|
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.dat_peta_znt".
*
* The followings are the available columns in table 'pbb.dat_peta_znt':
* @property string $kd_propinsi
* @property string $kd_dati2
* @property string $kd_kecamatan
* @property string $kd_kelurahan
* @property string $kd_blok
* @property string $kd_znt
* @property integer $createdby
* @property string $createdtime
* @property integer $updatedby
* @property string $updatedtime
*/
class DatPetaZnt extends CBhumieRecord
{
/**
* Returns the static model of the specified AR class.
* @param string $className active record class name.
* @return DatPetaZnt the static model class
*/
public $nm_kecamatan;
public $nm_kelurahan;
public static function model($className=__CLASS__)
{
return parent::model($className);
}
/**
* @return string the associated database table name
*/
public function tableName()
{
return 'pbb.dat_peta_znt';
}
/**
* @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, kd_blok', 'required'),
//array('createdby, updatedby', 'numerical', 'integerOnly'=>true),
array('kd_propinsi, kd_dati2, kd_znt', 'length', 'max'=>2),
array('kd_kecamatan, kd_kelurahan, kd_blok', 'length', 'max'=>3),
// 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_blok, kd_znt, createdby, createdtime, updatedby, updatedtime', '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' => 'Kd Propinsi',
'kd_dati2' => 'Kd Dati2',
'kd_kecamatan' => 'Kd Kecamatan',
'kd_kelurahan' => 'Kd Kelurahan',
'kd_blok' => 'Kd Blok',
'kd_znt' => 'Kd Znt',
'createdby' => 'Createdby',
'createdtime' => 'Createdtime',
'updatedby' => 'Updatedby',
'updatedtime' => 'Updatedtime',
);
}
/**
* 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()
{
$kd_propinsi = Yii::app()->globalvar->getKodePropinsi();
$kd_dati2 = Yii::app()->globalvar->getKodeDati2();
// Warning: Please modify the following code to remove attributes that
// should not be searched.
/*$sql = "SELECT * FROM pbb.dat_peta_znt as a
JOIN pbb.ref_kecamatan AS b ON b.kd_kecamatan = a.kd_kecamatan
JOIN pbb.ref_kelurahan AS c ON c.kd_kelurahan = a.kd_kelurahan
WHERE a.kd_propinsi=\''.$kd_propinsi.'\' AND a.kd_dati2=\''.$kd_dati2.'\'";
$command = $connection->createCommand($sql);
$dataReader = $command->query();
$criteria = $dataReader->readAll();*/
$criteria=new CDbCriteria;
$criteria->alias = 't';
$criteria->select= 't.kd_propinsi, t.kd_dati2, t.kd_kecamatan, t.kd_kelurahan, t.kd_blok, t.kd_znt, k.nm_kecamatan, l.nm_kelurahan';
$criteria->join= 'INNER JOIN pbb.ref_kecamatan AS k ON (t.kd_kecamatan = k.kd_kecamatan)
INNER JOIN pbb.ref_kelurahan AS l ON (t.kd_kelurahan = l.kd_kelurahan)';
$criteria->condition='t.kd_propinsi=\''.$kd_propinsi.'\' AND t.kd_dati2=\''.$kd_dati2.'\'';
$criteria->order='t.kd_blok';
// $criteria->compare('nm_kecamatan',$this->nm_kecamatan,true);
$criteria->compare('t.kd_propinsi',$this->kd_propinsi,true);
$criteria->compare('t.kd_dati2',$this->kd_dati2,true);
$criteria->compare('t.kd_kecamatan',$this->kd_kecamatan,true);
$criteria->compare('t.kd_kelurahan',$this->kd_kelurahan,true);
$criteria->compare('t.kd_blok',$this->kd_blok,true);
$criteria->compare('t.kd_znt',$this->kd_znt,true);
$criteria->compare('t.createdby',$this->createdby);
$criteria->compare('t.createdtime',$this->createdtime,true);
$criteria->compare('t.updatedby',$this->updatedby);
$criteria->compare('t.updatedtime',$this->updatedtime,true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
'sort'=>array(
'attributes'=>array(
'kd_kecamatan'=>array(
'asc'=>'t.kd_kecamatan',
'desc'=>'t.kd_kecamatan DESC',
),
'nm_kecamatan'=>array(
'asc'=>'k.nm_kecamatan',
'desc'=>'k.nm_kecamatan DESC',
),
'kd_kelurahan'=>array(
'asc'=>'t.kd_kelurahan',
'desc'=>'t.kd_kelurahan DESC',
),
'nm_kelurahan'=>array(
'asc'=>'l.kd_kelurahan',
'desc'=>'l.kd_kelurahan DESC',
),
'kd_blok'=>array(
'asc'=>'t.kd_blok',
'desc'=>'t.kd_blok DESC',
),
'kd_znt'=>array(
'asc'=>'t.kd_znt',
'desc'=>'t.kd_znt DESC',
),
),
),
));
}
}