/** * 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 = Kepribadian::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php echo $form->errorSummary($model); ?> <?php echo $form->textFieldRow($model, 'nis', array('class' => 'span5', 'value' => $nis, 'hint' => 'Silahkan tekan tombol <a href="#" onclick=$("#mydialog").dialog("open"); return false; class="btn submit">+</a> untuk melihat daftar siswa.')); ?> <?php if (isset($_GET['pribadi']) == 1) { $ekstra = $th_ajar = Yii::app()->db->createCommand("select id_pribadi from kepribadian where id_pribadi='" . $_GET['pribadi'] . "';")->queryScalar(); echo $form->hiddenfield($model, 'id_pribadi', array('value' => $ekstra)); echo $form->textAreaRow($model, 'catatan', array('class' => 'span5', 'rows' => 8)); } else { $ekstra = CHtml::listData(Kepribadian::model()->findAll(array('condition' => "id_pribadi not in (4,5)", 'order' => 'id_pribadi ASC')), 'id_pribadi', 'nama_pribadi'); echo $form->dropDownListRow($model, 'id_pribadi', $ekstra, array('class' => 'span5', 'empty' => '-- Pilih Kepribadian--')); echo $form->dropDownListRow($model, 'nilai_pribadi', array('A' => 'A', 'B' => 'B', 'C' => 'C', 'D' => 'D', 'E' => 'E'), array('class' => 'span5', 'empty' => '-- Pilih Nilai --')); } ?> <?php $bulan = date('m'); if ($bulan < 7) { $smt = 2; //jika th 2(1-6) maka tahun-1/tahun-2 2012/2013 $th_ajar = date('Y') - 1 . '/' . date('Y'); } elseif ($bulan < 13 && $bulan > 6) { $smt = 1; //jika th 1(7-12) maka tahun/tahun+1 2012/2013 $th_ajar = date('Y') . '/' . (date('Y') + 1);