public function actionDinamis() { $data = DetailKegiatanPersonil::model()->getNamaKegiatanByBidang($_POST['bidang']); $data_new = array(); $ii = 0; foreach ($data as $value) { $data_new[$ii] = array('id' => $value['id'], 'nama' => $value['nk'] . " - " . $value['nama']); $ii++; } $dataBaru = CHtml::listData($data_new, 'id', 'nama'); echo CHtml::tag('option', array('value' => ''), 'Pilih Detail Kegiatan', true); foreach ($dataBaru as $value => $name) { echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true); } }
public function getAllYears() { $criteria = new CDbCriteria(); $criteria->select = 'tahun'; $criteria->distinct = true; $criteria->order = 'tahun ASC'; $tahun = DetailKegiatanPersonil::model()->findAll($criteria); return $tahun; }