0

私の仕事に必要なこのYIIフレームワークは初めてで、ビュー/ユーザー/管理者、ユーザーコントローラー、およびユーザー(モデル)がありますが、このエラーが引き続き発生します。何が問題なのかわかりません。完全に混乱しています..私はホッピングしています誰かがここで私を助けることができます..

 PHP notice
Undefined variable: users

C:\xampp\htdocs\winegmobile\protected\controllers\UserController.php(147)

135      */
136     public function actionAdmin()
  137     {
138         $model=new User('search');
 139         $model->unsetAttributes();  // clear any default values
 140         if(isset($_GET['User']))
141             $model->attributes=$_GET['User'];
 142 
143         $this->render('admin',array(
 144             'model'=>$model,
145                     
146                         'User'=>$User
147         ));
148     }
149 
150     /**
151      * Returns the data model based on the primary key given in the GET variable.
152      * If the data model is not found, an HTTP exception will be raised.
153      * @param integer $id the ID of the model to be loaded
154      * @return User the loaded model
155      * @throws CHttpException
156      */
157     public function loadModel($id)
158     {
159         $model=User::model()->findByPk($id);


      This is the view/User/admin
   <?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')),
   );

   Yii::app()->clientScript->registerScript('search', "
   $('.search-button').click(function(){
$('.search-form').toggle();
return false;
    });
    $('.search-form form').submit(function(){
$('#user-grid').yiiGridView('update', {
    data: $(this).serialize()
});
return false;
   });
   ");
   ?>

    <h1>Manage Users</h1>
     <?php $this->widget('bootstrap.widgets.TbBreadcrumbs', array(
   'links'=>array('Admin'=>'index.php?r=site/admin', 'User'))); ?>
    <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,

   'User'=>$User,

   )); ?>
  </div><!-- search-form -->

  <?php 
  //change starts here

  $this->widget('bootstrap.widgets.TbGridView', array(
'type'=>'striped bordered condensed',
'dataProvider'=>$model->search(),
 'filter'=>$model,
'template'=>"{items}\n{pager}",
'columns'=>array(
    array('name'=>'username', 'header'=>'Username'),
     array('name'=>'FirstName', 'header'=>'First Name'),
     array('name'=>'LastName', 'header'=>'Last Name'),
     array('name'=>'Email', 'header'=>'Email'),
     array('name'=>'password', 'header'=>'Password'),
    array(
        'class'=>'bootstrap.widgets.TbButtonColumn',
        'htmlOptions'=>array('style'=>'width: 50px'),
    ),      
   ),
    )); 






    //end







  //$this->widget('zii.widgets.grid.CGridView', array(
//'id'=>'user-grid',
//'dataProvider'=>$model->search(),
//'filter'=>$model,
//'columns'=>array(
    //'id',
//  'FirstName',
//  'LastName',
//  'Email',
//  'Password',
//  'address_id',
//  array(
    //  'class'=>'CButtonColumn',
    //),
//),
//)); 

ユーザーコントローラー

  <?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')),
  );

  Yii::app()->clientScript->registerScript('search', "
  $('.search-button').click(function(){
$('.search-form').toggle();
return false;
  });
  $('.search-form form').submit(function(){
$('#user-grid').yiiGridView('update', {
    data: $(this).serialize()
});
return false;
    });
     ");
      ?>

      <h1>Manage Users</h1>
     <?php $this->widget('bootstrap.widgets.TbBreadcrumbs', array(
     'links'=>array('Admin'=>'index.php?r=site/admin', 'User'))); ?>
     <p>




      <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 
     //change starts here

      $this->widget('bootstrap.widgets.TbGridView', array(
      'type'=>'striped bordered condensed',
     'dataProvider'=>$model->search(),
     'filter'=>$model,
     'template'=>"{items}\n{pager}",
     'columns'=>array(
       array('name'=>'username', 'header'=>'Username'),
       array('name'=>'FirstName', 'header'=>'First Name'),
       array('name'=>'LastName', 'header'=>'Last Name'),
       array('name'=>'Email', 'header'=>'Email'),
       array('name'=>'password', 'header'=>'Password'),
      array(
        'class'=>'bootstrap.widgets.TbButtonColumn',
        'htmlOptions'=>array('style'=>'width: 50px'),
       ),      
     ),
    )); 






   //end







 //$this->widget('zii.widgets.grid.CGridView', array(
//'id'=>'user-grid',
//'dataProvider'=>$model->search(),
//'filter'=>$model,
//'columns'=>array(
    //'id',
//  'FirstName',
//  'LastName',
//  'Email',
//  'Password',
//  'address_id',
//  array(
    //  'class'=>'CButtonColumn',
    //),
//),
//)); 







?>
4

1 に答える 1