Exemplo n.º 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 the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Responsabil::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemplo n.º 2
0
<table>
    <tbody>
    <tr>
        <td> <?php 
echo $form->label($model, 'subdiv');
?>
            <?php 
echo $form->dropDownList($model, 'subdiv', CHtml::listData(Subdiv::model()->findAll(), 'id', 'name'), array('prompt' => 'Alegeți', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('tDb/Dynamicresp'), 'update' => '#' . CHtml::activeId($model, 'responsabil'))));
?>
</td>
        <td>
            <?php 
echo $form->label($model, 'responsabil');
?>
            <?php 
echo $form->DropDownList($model, 'responsabil', CHtml::listData(Responsabil::model()->findAllByAttributes(array('subdiv' => $model->subdiv)), 'id', 'fullname'), array('prompt' => 'Alegeți'));
?>
        </td>
    </tr>

    <tr>
        <td> <?php 
echo $form->label($model, 'date_reg');
?>
            <?php 
echo $form->textField($model, 'date_reg');
?>
</td>
        <td><?php 
echo $form->label($model, 'date_doc');
?>
Exemplo n.º 3
0
 public function actionDynamicresp()
 {
     $data = Responsabil::model()->findAll('subdiv=:parent_id', array(':parent_id' => (int) $_POST['TDb']['subdiv']));
     $data = CHtml::listData($data, 'id', 'fullname');
     echo CHtml::tag('option', array('value' => ""), 'Alegeți', true);
     foreach ($data as $id => $value) {
         echo CHtml::tag('option', array('value' => $id), CHtml::encode($value), true);
     }
 }