Пример #1
0
 /**
  * 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 Varietals the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Varietals::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Пример #2
0
echo $form->labelEx($model, 'wine_year');
?>
        <?php 
echo $form->textField($model, 'wine_year', array('size' => 4, 'maxlength' => 4));
?>
        <?php 
echo $form->error($model, 'wine_year');
?>
    </div>

    <div class="row">
        <?php 
echo $form->labelEx($model, 'wine_varietal_id');
?>
        <?php 
$varietal_list = CHtml::listData(Varietals::model()->findAll(array('order' => 'common_flg DESC, name ASC')), 'id', 'name');
?>
        <?php 
echo $form->dropDownList($model, 'wine_varietal_id', $varietal_list, array('empty' => '(Select an Varietal)'));
?>
        <?php 
echo $form->error($model, 'wine_varietal_id');
?>
    </div>

    <div class="row">
        <?php 
echo $form->labelEx($model, 'bottle_size');
?>
        <?php 
echo $form->dropDownList($model, 'bottle_size', Yii::app()->params['bottle_sizes']);