echo $form->labelEx($user->profile, 'countryID'); ?> <?php echo $form->dropDownList($user->profile, 'countryID', CHtml::listData(Country::model()->active()->findAll(), 'id', 'name')); ?> <?php echo $form->error($user->profile, 'countryID'); ?> </div> <div class="row"> <?php echo $form->labelEx($user->profile, 'timeZoneID'); ?> <?php echo $form->dropDownList($user->profile, 'timeZoneID', CHtml::listData(TimeZone::model()->active()->findAll(), 'id', 'name')); ?> <?php echo $form->error($user->profile, 'timeZoneID'); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton($user->isNewRecord ? 'Create' : 'Save'); ?> </div> <?php $this->endWidget(); ?>
/** * 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 TimeZone the loaded model * @throws CHttpException */ public function loadModel($id) { $model = TimeZone::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php /* @var $this UserController */ /* @var $model User */ $this->breadcrumbs = array('Users' => array('index'), 'Manage'); $this->menu = array(array('label' => 'List User', 'url' => array('index')), array('label' => 'Create User', 'url' => array('create'))); ?> <h1>Manage Users</h1> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'user-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('fullName', 'user.email', array('name' => 'countryID', 'value' => '$data->country->name', 'filter' => CHtml::ListData(Country::model()->active()->findAll(), 'id', 'name')), array('name' => 'timeZoneID', 'value' => '$data->timeZone->name', 'filter' => CHtml::ListData(TimeZone::model()->active()->findAll(), 'id', 'name')), array('name' => 'user.status', 'value' => '$data->user->statusText', 'filter' => User::$statuses), 'user.createdAt', array('class' => 'CButtonColumn'))));
<?php /* @var $this CountryController */ /* @var $model Country */ $this->breadcrumbs = array('Countries' => array('index'), 'Manage'); $this->menu = array(array('label' => 'List Country', 'url' => array('index')), array('label' => 'Create Country', 'url' => array('create'))); ?> <h1>Manage Countries</h1> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'country-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('name', array('name' => 'userCount', 'filter' => false), array('name' => 'timeZoneID', 'value' => '$data->timeZone->name', 'filter' => CHtml::listData(TimeZone::model()->active()->findAll(), 'id', 'name')), array('name' => 'status', 'value' => '$data->statusText', 'filter' => Country::$statuses), array('class' => 'CButtonColumn'))));