protected function loadOModel($id) { $model = Origins::model()->findByPk($id); if (!$model) { $this->thrown; } return $model; }
/** * 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 = Origins::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
</div> <div class="row"><?php echo $form->dropDownList($model, 'companyService', CHtml::listData(RateCompanyService::model()->findAll(), 'id', 'name', 'company.name'), array('prompt' => '-- Choose Service --')); ?> <div class="row"><?php echo $form->error($model, 'companyService'); ?> </div> </div> <div class="row"><?php echo $form->label($model, 'origin'); ?> </div> <div class="row"><?php echo $form->dropDownList($model, 'origin', CHtml::listData(Origins::model()->findAll(), 'id', 'name'), array('prompt' => '-- Choose Origin --')); ?> </div> <div class="row"><?php echo $form->error($model, 'origin'); ?> </div> <div class="row"> <?php echo $form->label($model, 'to'); ?> <?php $this->widget('zii.widgets.jui.CJuiAutoComplete', array('model' => $model, 'name' => 'to', 'sourceUrl' => array('ratePrice/ratePriceAutoComplete'), 'options' => array('select' => 'js:function(event,ui){ $("#FRatePrice_to").val(ui.item.did); $("#FRatePrice_zone_id").val(ui.item.zid);