public static function findPuskajiByBidang($id_personil) { $id_bidang = Personil::model()->findAllByPk($id_personil); $data = self::model()->findAllByPk($id_bidang[0]['bidang']); $nama_puskaji = Puskaji::model()->findByPk($data[0]['id_puskaji']); return $nama_puskaji; }
<div class="form"> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'rangkuman-form', 'method' => 'get', 'enableAjaxValidation' => false)); ?> <div class="form-row large-2 column left"> <div> <?php $role = Yii::app()->user->getState('role'); if ($role == Akun::ADMIN || $role == Akun::DEPUTI) { echo CHtml::dropDownList('puskaji', $puskaji, Puskaji::model()->getPuskajiList(), array('empty' => 'Pilih Puskaji', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('personil/dinamis'), 'data' => array('puskaji' => 'js:this.value'), 'update' => '#kode_bidang'))); } else { $puskaji = Yii::app()->user->getState('puskaji'); $nama_puskaji = Puskaji::model()->findAllByPk($puskaji); echo CHtml::textField('puskaji', $nama_puskaji[0]['nama'], array('disabled' => 'disabled')); } ?> <?php if (Yii::app()->user->getState('role') == Akun::STAF) { // get berdasarkan bidangnya si staf!!! $bidang = Yii::app()->user->getState('bidang'); $nama_bidang = Bidang::model()->findAllByPk($bidang); echo CHtml::textField('kode_bidang', $nama_bidang[0]['nama'], array('disabled' => 'disabled')); } else { if ($puskaji != '') { echo CHtml::dropDownList('kode_bidang', $bidang, Bidang::getListBidangByPuskaji($puskaji), array('empty' => 'Pilih Bidang')); } else { echo CHtml::dropDownList('kode_bidang', $bidang, array(), array('empty' => 'Pilih Bidang'));
$form = $this->beginWidget('CActiveForm', array('id' => 'akun-form', 'enableAjaxValidation' => false)); ?> <p class="note">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <div class="row"> <?php echo $form->labelEx($model, 'Puskaji'); $puskaji = 0; ?> <?php echo CHtml::dropDownList('puskaji', $puskaji, Puskaji::model()->getPuskajiList(), array('empty' => 'Pilih Puskaji', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('personil/dinamis'), 'data' => array('puskaji' => 'js:this.value'), 'update' => '#bidang'))); ?> <?php echo $form->error($model, 'kode_bidang'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'Bidang'); $bidang = 0; ?> <?php if ($puskaji != '') { echo var_dump("hhh"); echo CHtml::dropDownList('bidang', $bidang, Bidang::model()->getBidangByPuskaji($puskaji), array('empty' => 'Pilih Bidang', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('detailKegiatanPersonil/dinamis'), 'data' => array('bidang' => 'js:this.value'), 'update' => '#id_detail_kegiatan')));
echo $form->labelEx($model, 'nama'); ?> <?php echo $form->textField($model, 'nama', array('size' => 60, 'maxlength' => 100)); ?> <?php echo $form->error($model, 'nama'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'puskaji'); ?> <?php echo $form->dropDownList($model, 'puskaji', Puskaji::model()->getPuskajiList(), array('empty' => 'Pilih Puskaji', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('personil/dinamisForm'), 'data' => array('puskaji' => 'js:this.value'), 'update' => '#' . CHtml::activeId($model, 'id_bidang')))); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'id_bidang'); ?> <?php if ($model->puskaji != '') { echo $form->dropDownList($model, 'id_bidang', Bidang::getListBidangByPuskaji($model->puskaji), array('empty' => 'Pilih Bidang')); } else { echo $form->dropDownList($model, 'id_bidang', array(), array('empty' => 'Pilih Bidang')); } ?> <?php
<th>Puskaji</th> <th>Bidang</th> <th>Nama File</th> <th>Aksi</th> </thead> <tfoot> <tr> </tr> </tfoot> <tbody> <?php $ii = 1; foreach ($dataProvider as $data) { echo "<tr id=\"\">"; echo "<td>" . $ii++ . "</td>"; $puskaji = Puskaji::model()->findByPk($data->puskaji); echo "<td>" . $puskaji->nama . "</td>"; $bidang = Bidang::model()->findByPk($data->bidang); echo "<td>" . $bidang->nama . "</td>"; echo "<td>" . $data->nama . "</td>"; echo "<td class=\"text-left\">" . CHtml::link('Unduh', array('Site/download', 'id' => $data->id)); $role = Yii::app()->user->getState('role'); if ($role == 1) { echo " |" . CHtml::link('Hapus', array('Referensi/delete', 'id' => $data->id), array('submit' => array('Referensi/delete', 'id' => $data->id), 'class' => 'delete', 'confirm' => 'Anda yakin untuk menghapus layanan?')) . "</td>"; } echo "</tr>"; } ?> </tbody> </table> </div>