|
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
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of KelasTanah
*
* @author rio
*/
class RefGis extends CBhumieRecord {
public $thn_awal_kls_tanah;
public $thn_awal_kls_bng;
public static function model($className=__CLASS__)
{
return parent::model($className);
}
public function tableName()
{
return 'pbb.kelas_tanah';
}
/**
* @return array customized attribute labels (name=>label)
*/
public function getCombo()
{
$criteria = new CDbCriteria();
$criteria->select = "distinct thn_awal_kls_tanah, thn_awal_kls_tanah ||' - '|| thn_akhir_kls_tanah as thn_kelas_tanah";
$criteria->order = "thn_kelas_tanah desc";
$result = KelasTanah::model()->findAll($criteria);
return $result;
}
public function getKelasTanah($tahun)
{
$result = KelasTanah::model()->findAll(array('condition'=>'thn_awal_kls_tanah = \''.$tahun.'\'', 'order' => 'nilai_per_m2_tanah asc'));
return $result;
}
public function updateKelasTanah($warna, $kd_kls_tanah, $thn_awal, $thn_akhir)
{
$transaction = Yii::app()->db->beginTransaction();
try {
$attributes = array('warna'=>$warna);
$update = KelasTanah::model()->updateAll($attributes, array('condition'=>'kd_kls_tanah= \''.$kd_kls_tanah.'\' and thn_awal_kls_tanah = \''.$thn_awal.'\' and thn_akhir_kls_tanah = \''.$thn_akhir.'\' '));
$transaction->commit();
return $update;
} catch (Exception $e){
$transaction->rollback();
return $e;
}
}
public function getComboBangunan()
{
$criteria = new CDbCriteria();
$criteria->select = "distinct thn_awal_kls_bng, thn_awal_kls_bng ||' - '|| thn_akhir_kls_bng as thn_kelas_bng";
$criteria->order = "thn_kelas_bng desc";
$result = KelasBangunan::model()->findAll($criteria);
return $result;
}
public function getKelasBangunan($tahun)
{
$result = KelasBangunan::model()->findAll(array('condition'=>'thn_awal_kls_bng = \''.$tahun.'\'', 'order' => 'nilai_per_m2_bng asc'));
return $result;
}
public function updateKelasBangunan($warna, $kd_kls_bng, $thn_awal, $thn_akhir)
{
$transaction = Yii::app()->db->beginTransaction();
try {
$attributes = array('warna'=>$warna);
$update = KelasBangunan::model()->updateAll($attributes, array('condition'=>'kd_kls_bng= \''.$kd_kls_bng.'\' and thn_awal_kls_bng = \''.$thn_awal.'\' and thn_akhir_kls_bng = \''.$thn_akhir.'\' '));
$transaction->commit();
return $update;
} catch (Exception $e){
$transaction->rollback();
return $e;
}
}
public function updateKelasZnt($warna, $kd_znt, $nop)
{
$transaction = Yii::app()->db->beginTransaction();
try {
$update = DatPetaZnt::model()->updateAll(array('warna' => $warna), array('condition'=>'kd_znt = \''.$kd_znt.'\' and KD_PROPINSI || KD_DATI2 || KD_KECAMATAN || KD_KELURAHAN = \''.$nop.'\' '));
$transaction->commit();
return $update;
} catch (Exception $e){
$transaction->rollback();
return $e;
}
}
}