?> <?php echo $form->dropDownList($model, 'accesory_id', Chtml::listData(Accesory::model()->findAll(array('condition' => 'active=1', 'order' => 'name')), 'id', 'name'), array('prompt' => 'Seleccionar')); ?> <?php echo CHtml::button('+', array('id' => 'addAccesory')); ?> <?php echo CHtml::button('-', array('id' => 'removeAccesory')); ?> <div> <?php echo $form->dropDownList($model, 'accesory', CHtml::listData(Accesory::model()->findAllByPk($model->accesory), 'id', 'name'), array('multiple' => 'multiple', 'size' => '5', 'style' => 'min-width:200px;')); ?> </div> <?php echo $form->error($model, 'accesory'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, '_failureDescription'); ?> <?php //echo $form->dropDownList($model,'dependences', CHtml::listData($model->getDependencias(), 'id','name')); ?>
/** * Datos para llenar las tablas de productos */ public function getServicios() { return $ModelDependencias = Accesory::model()->findAll('active = 1'); }
/** * 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 Accesory the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Accesory::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php /* @var $this AccesoryController */ /* @var $model Accesory */ $this->breadcrumbs = array('Accesorios' => array('index'), $model->name); $this->menu = array(array('label' => 'Listar accesorios', 'url' => array('index')), array('label' => 'Crear accesorio', 'url' => array('create')), array('label' => 'Actualizar accesorio', 'url' => array('update', 'id' => $model->id)), array('label' => 'Desactivar accesorio', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => '¿Esta seguro que desea eliminar este Accesorio?'), 'visible' => $model->active == 1), array('label' => 'Activar accesorio', 'url' => '#', 'linkOptions' => array('submit' => array('activate', 'id' => $model->id), 'confirm' => '¿Esta seguro que desea activar este Accesorio?'), 'visible' => $model->active == 0), array('label' => 'Administrar accesorio', 'url' => array('admin'))); ?> <h1>Accesorio: <?php echo $model->name; ?> </h1> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', 'name', array('name' => 'Activo', 'type' => 'raw', 'value' => Accesory::getActive($model->active)))));