/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Guru::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php $ruang = CHtml::listData(Ruangan::model()->findAll(array('order' => 'namaruang ASC', 'distinct' => true)), 'idruang', 'namaruang'); ?> <?php echo $form->dropDownListRow($model, 'idruang', $ruang, array('empty' => '- PILIH RUANG -', 'id' => 'idruang')); ?> <?php echo $form->textFieldRow($model, 'idwaktu', array('hint' => 'Silahkan klik tombol <a href="#" onclick=$("#twaktu").dialog("open"); return false; class="btn submit">+</a> untuk melihat daftar waktu.')); ?> <?php echo $form->dropDownListRow($model, 'kode_guru', CHtml::listData(Guru::model()->findAll(), 'kode_guru', 'nama_guru'), array('empty' => '- PILIH GURU -')); ?> <?php echo $form->textFieldRow($model, 'kode_mapel', array('hint' => 'Silahkan klik tombol <a href="#" onclick=$("#tmapel").dialog("open"); return false; class="btn submit">+</a> untuk melihat daftar mapel.')); ?> <?php echo $form->hiddenField($model, 'kode_mapel', array()); ?> <?php echo $form->textFieldRow($model, 'kelas', array()); ?>