/** * 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 $id the ID of the model to be loaded * @return TbaLogType the loaded model * @throws CHttpException */ public function loadModel($id) { $model = TbaLogType::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<td width="10%"> <?php echo $form->label($model, 'logtype'); ?> </td> <td width="20%"> <?php //echo $form->textField($model,'logtype',array('size'=>2,'maxlength'=>2)); ?> <?php // echo $form->dropDownList($model,'logtype',CHtml::listData(TbaLogtype::model()->findAll(array('order' => 'id ASC','condition'=>'opt1=1') // ), 'id', 'cname'), array('empty' => '選擇類別', 'options' => array(' ' => array('selected' => 'selected')))); ?> <?php echo $form->dropDownList($model, 'logtype', CHtml::listData(TbaLogType::model()->findAll(array('order' => 'id ASC', 'condition' => 'opt1=1')), 'id', 'cname'), array('prompt' => '選擇類別', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('tbsCom/dynamiclogitems', array('model' => 'TbaLog', 'column' => 'logtype')), 'update' => '#TbaLog_logitem'))); ?> <?php echo $form->dropDownList($model, 'logitem', CHtml::listData(TbaLogItem::model()->findAll(array('order' => 'seqno ASC', 'condition' => 'optshow=1')), 'id', 'logname'), array('empty' => '選擇項目')); ?> </td> <td width="25%"> 員編:<?php echo $form->textField($model, 'empno', array('size' => 8, 'maxlength' => 8)); ?> 姓名:<?php echo $form->textField($model, 'empname', array('size' => 8, 'maxlength' => 8)); ?>
echo $form->labelEx($model, 'ename'); ?> <?php echo $form->textField($model, 'ename', array('size' => 20, 'maxlength' => 20)); ?> <?php echo $form->error($model, 'ename'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'logtype'); ?> <?php echo $form->dropDownList($model, 'logtype', CHtml::listData(TbaLogType::model()->findAll(array('order' => 'id', 'condition' => "opt1='1'")), 'id', 'cname')); ?> <?php echo $form->error($model, 'logtype'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'seqno'); ?> <?php echo $form->textField($model, 'seqno', array('size' => 4, 'maxlength' => 4)); ?> <?php echo $form->error($model, 'seqno');