/** * 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 = Dependence::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
echo $form->labelEx($model, 'customer_type_id'); ?> <?php echo $form->DropDownList($model, 'customer_type_id', CHtml::listData(CustomerType::model()->findAll(array('condition' => 'active = 1', 'order' => 'type')), 'id', 'type'), array('empty' => 'Seleccionar')); ?> <?php echo $form->error($model, 'customer_type_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'dependence_id'); ?> <?php echo $form->DropDownList($model, 'dependence_id', CHtml::listData(Dependence::model()->findAll(array('condition' => 'active = 1', 'order' => 'name')), 'id', 'name'), array('empty' => 'Seleccionar')); ?> <?php echo $form->error($model, 'dependence_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'address'); ?> <?php echo $form->textArea($model, 'address', array('size' => 60, 'maxlength' => 200)); ?> <?php echo $form->error($model, 'address'); ?>
public static function getActiveDependencies() { $dependencies = array('' => "Seleccionar"); $dependencies += CHtml::ListData(Dependence::model()->findAll('t.active = 1'), 'id', 'name'); return $dependencies; }