/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = $this->loadModel($id); $djadwal = DJadwal::model()->findAllByAttributes(array('ID_JADWAL' => $id)); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['MJadwal'])) { $model->attributes = $_POST['MJadwal']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->ID)); } } $this->render('update', array('model' => $model, 'djadwal' => $djadwal)); }
<TD ALIGN="CENTER"> <CENTER> <?php $ta = CHtml::listData(MJadwal::model()->findAll(), 'TA', 'TA'); echo $form->dropDownListGroup($mjadwal, 'TA', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => $ta, 'htmlOptions' => array()))); ?> </CENTER> </TD> <TD ALIGN="CENTER"><CENTER> <?php //echo $form->textFieldGroup($model,'ID_KUR',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5')))); ?> <?php $kodemk = CHtml::listData(DJadwal::model()->findAll(), 'KODE_MK', 'KODE_MK'); echo $form->dropDownListGroup($djadwal, 'KODE_MK', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => $kodemk, 'htmlOptions' => array()))); ?> </CENTER> </TD> <TD ALIGN="CENTER"><CENTER> <?php $kelas = CHtml::listData(MJadwal::model()->findAll(), 'KELAS', 'KELAS'); echo $form->dropDownListGroup($mjadwal, 'KELAS', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => $kelas, 'htmlOptions' => array()))); ?> <CENTER> </TD> </TR> <TR > <TD ALIGN="CENTER" COLSPAN="4" ><CENTER>
/** * 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 = DJadwal::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }