/**
  * 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 = UserType::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemplo n.º 2
0
<?php

/* @var $this UserController */
/* @var $model User */
$this->breadcrumbs = array('Users' => array('index'), 'Manage');
$this->menu = array(array('label' => 'Create User', 'url' => array('create')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('user-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Manage Users</h1>

<p>
    You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
    or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>

<?php 
echo CHtml::link('Advanced Search', '#', array('class' => 'search-button'));
?>
<div class="search-form" style="display:none">
    <?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'user-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', array('name' => 'country_id', 'value' => '!empty($data->country->name)?$data->country->name:"N/A"', 'filter' => CHtml::listData(Country::model()->findAll(array('order' => 'name')), 'id', 'name')), 'username', 'email', array('name' => 'type', 'value' => '!empty($data->userType->name)?$data->userType->name:"N/A"', 'filter' => CHtml::listData(UserType::model()->findAll(array('order' => 'name')), 'id', 'name')), array('name' => 'nofMessages', 'filter' => ''), array('name' => 'numberOfComments', 'filter' => ''), array('name' => 'nofMessagesRead', 'filter' => ''), array('name' => 'messageDetails', 'filter' => '', 'type' => 'raw'), array('class' => 'CButtonColumn', 'template' => '{update}{delete}', 'htmlOptions' => array('style' => 'min-width:50px'), 'header' => 'Actions', 'buttons' => array()))));
Exemplo n.º 3
0
echo $form->textField($model, 'email', array("class" => "span3"));
?>
</td>
        <td style='width:300px;'><?php 
echo $form->error($model, 'email');
?>
</td>
    </div></tr>

    <tr><div class="row">
        <td style='width:150px;'><?php 
echo $form->labelEx($model, 'user_type');
?>
</td>
        <td><?php 
echo $form->dropdownList($model, 'user_type', CHtml::listData(UserType::model()->findAll(), 'id', 'type'), array('prompt' => 'Select Type', 'class' => 'span3', 'ajax' => array('type' => 'POST')));
?>
</td>
        <td style='width:300px;'><?php 
echo $form->error($model, 'user_type');
?>
</td>
    </div></tr>
     


    <tr><div class="row buttons">
        <td style="padding-left: 109px;"> 
           
        </td>
        <td>
Exemplo n.º 4
0
echo $form->labelEx($model, 'password');
?>
               <?php 
echo $form->passwordField($model, 'password', array('size' => 30, 'maxlength' => 30));
?>
               <?php 
echo $form->error($model, 'password');
?>
          </div>

                    <div class="row">
               <?php 
echo $form->labelEx($model, 'type');
?>
               <?php 
echo $form->dropDownList($model, 'type', CHtml::listData(UserType::model()->findAll(), 'id', 'name'), array('prompt' => 'Select a UserType'));
?>
               <?php 
echo $form->error($model, 'type');
?>
          </div>

                    <div class="row">
               <?php 
echo $form->labelEx($model, 'created');
?>
               <?php 
echo $form->textField($model, 'created');
?>
               <?php 
echo $form->error($model, 'created');