<p> <?php $form->widget('yiiwheels.widgets.select2.WhSelect2', array('model' => $model, 'attribute' => 'state_id_state', 'asDropDownList' => true, 'data' => CHtml::listData(State::model()->findAll(array('order' => 'name ASC')), 'id_state', 'name'), 'pluginOptions' => array('allowClear' => true, 'width' => '40%'), 'htmlOptions' => array())); ?> </p> <br /> <p>Majors <span class="required">*</span></p> <p> <?php $Options = array(); foreach ($model->collegesHasMajors as $collegesHasMajor) { $Options[$collegesHasMajor->majors_id] = array('selected' => 'selected'); } $form->widget('yiiwheels.widgets.multiselect.WhMultiSelect', array('name' => 'majors', 'data' => CHtml::listData(Majors::model()->findAll(array('order' => 'name ASC')), 'id', 'name'), 'pluginOptions' => array('nonSelectedText' => 'Seleccionar Majors', 'filterPlaceholder' => 'Buscar Majors', 'enableFiltering' => true, 'enableCaseInsensitiveFiltering' => true, 'maxHeight' => '300', 'buttonWidth' => '350'), 'htmlOptions' => array('options' => $Options))); ?> </p> <?php /* $state = State::model()->findAll(array('order'=>'name ASC')); echo "<PRE>"; print_r($state); echo "</PRE>"; Yii::app()->end(); */ /* $this->widget('yiiwheels.widgets.select2.WhSelect2', array( //'data' => CHtml::listData(State::model()->findAll(array('order'=>'name ASC')), 'id_state','name'), 'asDropDownList' => false, 'name' => 'select2test', 'pluginOptions' => array(
/** * Retorna una lista de todos los majors que tienen un essay asignado */ public function getListMajorEssay() { $criteria = new CDbCriteria(); $criteria->condition = "EXISTS (SELECT * FROM essays WHERE colleges_has_majors_majors_id = id) ORDER BY name ASC"; return Majors::model()->findAll($criteria); }
/** * 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 = Majors::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }