/** * 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 Measurement the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Measurement::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'products-form', 'enableAjaxValidation' => false)); ?> <?php echo $form->errorSummary($model); ?> <?php echo $form->textFieldRow($model, 'name', array('class' => 'span5', 'maxlength' => 100)); ?> <br /> <div ><?php echo $form->dropDownListRow($model, 'measure_id', CHtml::listData(Measurement::model()->findAll(), 'measure_id', 'name'), array('class' => 'span2')); ?> </div> <div class="form-actions span9"> <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => $model->isNewRecord ? 'Сохранить' : 'Сохранить')); ?> </div> <script> var delay = (function(){ var timer = 0; return function(callback, ms){ clearTimeout (timer); timer = setTimeout(callback, ms);
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'halfstaff-form', 'enableAjaxValidation' => false)); ?> <p class="note">Поля с <span class="required">*</span> обязательны.</p> <?php echo $form->errorSummary($model); ?> <div class="form-group"> <?php echo $form->textFieldRow($model, 'name', array('class' => 'span5')); ?> <br /> <div class="span3"><?php echo $form->dropDownListRow($model, 'stuff_type', CHtml::listData(Measurement::model()->findAll(), 'measure_id', 'name')); ?> </div> <div class="span3"><?php echo $form->textFieldRow($model, 'count', array()); ?> </div> <div > <div class=""> <div class="span3"> <h3>Продукты</h3> <?php echo $form->dropDownList($model, 'stuffStruct', $prodList, array('class' => 'span2 left all_options listbox', 'style' => 'height:200px!important', 'id' => 'all_product', 'empty' => 'Выберите продукт')); ?> </div>