title: How can I add new admin pages to YII?
body: <p>I have a completed YII and I have tried to copy an admin page to make another one.
  The admin.php inclue this:</p>
  
  <pre><code>&lt;?php
  /* @var $this UsersController */
  /* @var $model banned */
  //$model = 'Users';
  $this-&gt;breadcrumbs=array(
      'Banned users'=&gt;array('index'),
      'Manage',
  );
  
  /*
  Yii::app()-&gt;clientScript-&gt;registerScript('search', "
  $('.search-button').click(function(){
      $('.search-form').toggle();
      return false;
  });
  $('.search-form form').submit(function(){
      $('#banned-grid').yiiGridView('update', {
          data: $(this).serialize()
      });
      return false;
  });
  ");*/
  ?&gt;
  
  &lt;h1&gt;Manage Banned Users&lt;/h1&gt;
  
  &lt;p&gt;
  You may optionally enter a comparison operator (&lt;b&gt;&amp;lt;&lt;/b&gt;, &lt;b&gt;&amp;lt;=&lt;/b&gt;, &lt;b&gt;&amp;gt;&lt;/b&gt;, &lt;b&gt;&amp;gt;=&lt;/b&gt;, &lt;b&gt;&amp;lt;&amp;gt;&lt;/b&gt;
  or &lt;b&gt;=&lt;/b&gt;) at the beginning of each of your search values to specify how the comparison should be done.
  &lt;/p&gt;
  
  &lt;?php //echo CHtml::link('Advanced Search','#',array('class'=&gt;'search-button')); ?&gt;
  &lt;div class="search-form" style="display:none"&gt;
  
  &lt;?php $this-&gt;renderPartial('_search1',array(
      'model'=&gt;$model,
  )); ?&gt;
  &lt;/div&gt;&lt;!-- search-form --&gt;
  
  &lt;?php $this-&gt;widget('zii.widgets.grid.CGridView', array(
      'id'=&gt;'banned-grid',
      'dataProvider'=&gt;$model-&gt;search(),
      'filter'=&gt;$model,
      'columns'=&gt;array(
          'uid',
          //'name',
          //'email',
          //'password',
          'datejoined',
          //'picture',
          /*
          'interestingquestionnotify',
          'myquestionnotify',
          'myanswernotify',*/
          'role',
          'status',
          //'newsletternotify',
          array(
              'class'=&gt;'CButtonColumn',
          ),
      ),
  )); ?&gt;
  
    &lt;?php
   // print_r($model);
    ?&gt;
  </code></pre>
  
  <p>My problem is: When I open that menu point what show me this admin php, than I can see the other menu point's zii.widgets.grid.CGridView . I <code>need to be used the Banned.php</code>  from models folder, <code>but this one use Users.php</code>. Any idea how could I debugg it?</p>
  
  <p>I have Banned.php in models. And I have Class Banned. I have banned in views.</p>
  
  <p>This is my protected/controllers/BannedController.php</p>
  
  <pre><code>&lt;?php
  
  class BannedController extends Controller
  {
      /**
       * @var string the default layout for the views. Defaults to '//layouts/column2', meaning
       * using two-column layout. See 'protected/views/layouts/column2.php'.
       */
      public $layout='//layouts/column1';
  
      /**
       * @return array action filters
       */
      public function filters()
      {
          return array(
              'accessControl', // perform access control for CRUD operations
              'postOnly + delete', // we only allow deletion via POST request
          );
      }
  
      /**
       * Specifies the access control rules.
       * This method is used by the 'accessControl' filter.
       * @return array access control rules
       */
      public function accessRules()
      {
          return array(
              array('allow', // allow admin user to perform 'admin' and 'delete' actions
                  'actions'=&gt;array('index','view','admin','delete','create','update'),
                  'users'=&gt;array('admin'),
              ),
              array('deny',  // deny all users
                  'users'=&gt;array('*'),
              ),
          );
      }
  
      /**
       * Displays a particular model.
       * @param integer $id the ID of the model to be displayed
       */
  /*  public function actionView($id)
      {
          $model = $this-&gt;loadModel($id);
          $questions = new Questions('search');
          $ans = new Answers('search');
  
          // válaszok
          if(isset($_GET['Answers'])){
              $ans-&gt;attributes = $_GET['Answers'];
              $ans-&gt;uid = $model-&gt;uid;
              $answersDataProvider = $ans-&gt;searchOnUser();
          } else {
              $answersDataProvider = new CActiveDataProvider('Answers', array(
                  'criteria'=&gt;array('condition'=&gt;'uid='.$model-&gt;uid),
                  'pagination'=&gt;array('pageSize'=&gt;10),
              ));
          }
  
          //kérdések
          if(isset($_GET['Questions'])){
              $questions-&gt;attributes = $_GET['Questions'];
              $questions-&gt;uid = $model-&gt;uid;
              $questionsDataProvider = $questions-&gt;searchOnUser();
          } else {
              $questionsDataProvider = new CActiveDataProvider('Questions', array(
                  'criteria'=&gt;array('condition'=&gt;'uid='.$model-&gt;uid),
                  'pagination'=&gt;array('pageSize'=&gt;10),
              ));
          }
  
          $this-&gt;render('view',array(
              'model'=&gt;$model,
              'answersDataProvider'=&gt;$answersDataProvider,
              'questionsDataProvider'=&gt;$questionsDataProvider,
              'ans'=&gt;$ans,
              'questions'=&gt;$questions
          ));
      } */
      public function actionView($id)
      {
          $this-&gt;render('view',array(
              'model'=&gt;$this-&gt;loadModel($id),
          ));
      }       
  
      /**
       * Creates a new model.
       * If creation is successful, the browser will be redirected to the 'view' page.
       */
      public function actionCreate()
      {
          $model=new Banned;
  
          // Uncomment the following line if AJAX validation is needed
          // $this-&gt;performAjaxValidation($model);
  
          if(isset($_POST['Users']))
          {
              $model-&gt;attributes=$_POST['Users'];
              if($model-&gt;save())
                  $this-&gt;redirect(array('view','id'=&gt;$model-&gt;uid));
          }
  
          $this-&gt;render('create',array(
              'model'=&gt;$model,
          ));
      }
  
      /**
       * Updates a particular model.
       * If update is successful, the browser will be redirected to the 'view' page.
       * @param integer $id the ID of the model to be updated
       */
      public function actionUpdate($id)
      {
          $model=$this-&gt;loadModel($id);
  
          // Uncomment the following line if AJAX validation is needed
          // $this-&gt;performAjaxValidation($model);
  
          if(isset($_POST['Users']))
          {
              $model-&gt;attributes=$_POST['Users'];
              if($model-&gt;save())
                  $this-&gt;redirect(array('view','id'=&gt;$model-&gt;uid));
          }
  
          $this-&gt;render('update',array(
              'model'=&gt;$model,
          ));
      }
  
      /**
       * Deletes a particular model.
       * If deletion is successful, the browser will be redirected to the 'admin' page.
       * @param integer $id the ID of the model to be deleted
       */
      public function actionDelete($id)
      {
          DMongo::get()-&gt;selectCollection('users')-&gt;remove(array('_id' =&gt; intval($id)));
          $this-&gt;loadModel($id)-&gt;delete();
  
          // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
          if(!isset($_GET['ajax']))
              $this-&gt;redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
      }
  
      /**
       * Lists all models.
       */
      public function actionIndex()
      {
          $dataProvider=new CActiveDataProvider('Users');
          $this-&gt;render('index',array(
              'dataProvider'=&gt;$dataProvider,
          ));
      }
  
      /**
       * Manages all models.
       */
      public function actionAdmin()
      {
          $model=new Users('search');
          $model-&gt;unsetAttributes();  // clear any default values
          if(isset($_GET['Users']))
              $model-&gt;attributes=$_GET['Banned'];
                                                      // Users
          $this-&gt;render('admin',array(
              'model'=&gt;$model,
          ));
      }
  
      /**
       * 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 Users the loaded model
       * @throws CHttpException
       */ 
      public function loadModel($id)
      {
          $model=Banned::model()-&gt;findByPk($id);
          if($model===null)
              throw new CHttpException(404,'The requested page does not exist1.');
          return $model;
      }
  
      /**
       * Performs the AJAX validation.
       * @param Users $model the model to be validated
       */
      protected function performAjaxValidation($model)
      {
          if(isset($_POST['ajax']) &amp;&amp; $_POST['ajax']==='users-form')
          {
              echo CActiveForm::validate($model);
              Yii::app()-&gt;end();
          }
      }
  }
  </code></pre>
  
  <p>And this is: protected/models/Banned.php</p>
  
  <pre><code>&lt;?php
  
  /**
   * This is the model class for table "tbl_users".
   *
   * The followings are the available columns in table 'tbl_users':
   * @property integer $uid
   * @property string $name
   * @property string $email
   * @property string $password
   * @property string $datejoined
   * @property string $picture
   * @property integer $interestingquestionnotify
   * @property integer $myquestionnotify
   * @property integer $myanswernotify
   * @property string $role
   * @property integer $status
   * @property integer $newsletternotify
   */
  class Banned extends CActiveRecord
  {
      /**
       * Returns the static model of the specified AR class.
       * @param string $className active record class name.
       * @return Banned the static model class
       */
      public static function model($className=__CLASS__)
      {
          return parent::model($className);
      }
  
      /**
       * @return string the associated database table name
       */
      public function tableName()
      {
          return 'tbl_banned_users';
      }
  
      /**
       * @return array validation rules for model attributes.
       */
      public function rules()
      {
          // NOTE: you should only define rules for those attributes that
          // will receive user inputs.
          return array(
              array('user_id, user_mail, user_name'),
              array('interestingquestionnotify, myquestionnotify, myanswernotify, status, newsletternotify', 'numerical', 'integerOnly'=&gt;true),
              array('name, email, password, picture', 'length', 'max'=&gt;50),
              array('role', 'length', 'max'=&gt;10),
              // The following rule is used by search().
              // Please remove those attributes that should not be searched.
              array('uid, name, email, password, datejoined, picture, interestingquestionnotify, myquestionnotify, myanswernotify, role, status, newsletternotify', 'safe', 'on'=&gt;'search'),
          );
      }
  
      /**
       * @return array relational rules.
       */
      public function relations()
      {
          // NOTE: you may need to adjust the relation name and the related
          // class name for the relations automatically generated below.
          return array(
          );
      }
  
      /**
       * @return array customized attribute labels (name=&gt;label)
       */
      public function attributeLabels()
      {
          return array(
              'uid' =&gt; 'Azonosító1',
              'name' =&gt; 'Név',
              'email' =&gt; 'E-mail',
              'password' =&gt; 'Jelszó',
              'datejoined' =&gt; 'Dátum',
              'picture' =&gt; 'Profilkép',
              'interestingquestionnotify' =&gt; 'Megfigyelt kérdésekről értesítés',
              'myquestionnotify' =&gt; 'Kérdésekről értesítés',
              'myanswernotify' =&gt; 'Válaszokról értesítés',
              'role' =&gt; 'Jog',
              'status' =&gt; 'Állapot',
              'newsletternotify' =&gt; 'Hírekről értesítés',
          );
      }
  
      /**
       * Retrieves a list of models based on the current search/filter conditions.
       * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
       */
      public function search()
      {
          // Warning: Please modify the following code to remove attributes that
          // should not be searched.
  
          $criteria=new CDbCriteria;
  
          $criteria-&gt;compare('uid',$this-&gt;uid);
          $criteria-&gt;compare('name',$this-&gt;name,true);
          $criteria-&gt;compare('email',$this-&gt;email,true);
          $criteria-&gt;compare('password',$this-&gt;password,true);
          $criteria-&gt;compare('datejoined',$this-&gt;datejoined,true);
          $criteria-&gt;compare('picture',$this-&gt;picture,true);
          $criteria-&gt;compare('interestingquestionnotify',$this-&gt;interestingquestionnotify);
          $criteria-&gt;compare('myquestionnotify',$this-&gt;myquestionnotify);
          $criteria-&gt;compare('myanswernotify',$this-&gt;myanswernotify);
          $criteria-&gt;compare('role',$this-&gt;role,true);
          $criteria-&gt;compare('status',$this-&gt;status);
          $criteria-&gt;compare('newsletternotify',$this-&gt;newsletternotify);
  
          return new CActiveDataProvider($this, array(
              'criteria'=&gt;$criteria,
          ));
      }
  
      public function beforeSave() {
          if ($this-&gt;isNewRecord)
              $this-&gt;password = md5($this-&gt;password);
  
          return parent::beforeSave();
      }
  }
  </code></pre>
  
  <p>And my BannedController dont get datas from Banned.php, it gets from Users.php
  Now I replaced all Users to Banned, but it writes: <code>Banned has an invalid validation rule. The rule must specify attributes to be validated and the validator name.</code></p>