Exemplo n.º 1
0
<div class="view">

    <b><?php 
echo CHtml::encode($data->getAttributeLabel('name'));
?>
:</b>
    <?php 
echo CHtml::link(CHtml::encode($data->name), array('view', 'id' => $data->id));
?>
    <br />

    <b><?php 
echo CHtml::encode($data->getAttributeLabel('param_type_id'));
?>
:</b>
    <?php 
echo CHtml::encode(ParamType::model()->findByPk($data->param_type_id)->name);
?>
    <br />

    <b><?php 
echo CHtml::encode($data->getAttributeLabel('form_id'));
?>
:</b>
    <?php 
echo CHtml::encode(Form::model()->findByPk($data->form_id)->name);
?>
    <br />

</div>
Exemplo n.º 2
0
?>
    </div>

    <div class="row">
        <?php 
echo $form->label($model, 'name');
?>
        <?php 
echo $form->textField($model, 'name', array('size' => 50, 'maxlength' => 50));
?>
    </div>

    <div class="row">
        <?php 
echo $form->label($model, 'param_type_id');
$param_types = ParamType::model()->findAll();
?>
        <?php 
echo $form->dropDownList($model, 'param_type_id', CHtml::listData($param_types, 'id', 'name'));
?>
    </div>

    <div class="row">
        <?php 
echo $form->label($model, 'form_id');
$forms = Form::model()->findAll();
?>
        <?php 
echo $form->dropDownList($model, 'form_id', CHtml::listData($forms, 'id', 'name'));
?>
    </div>
 /**
  * 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 ParamType the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = ParamType::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }