Advertisement
fernandezekiel

Untitled

Dec 30th, 2012
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.66 KB | None | 0 0
  1. public function actionAdmin()
  2.     {
  3.         $model=new Contact('search');
  4.         $model->unsetAttributes();  // clear any default values
  5.        
  6.         //this should display customers that are accessible
  7.         $viewConfig = array();
  8.        
  9.         $viewConfig['showOwner'] = true;
  10.        
  11.         if(!Yii::app()->user->checkAccess('Admin'))
  12.         {
  13.             //if it is not an admin
  14.             $model->owner_id = Yii::app()->user->id; //display results that he only owns
  15.             $viewConfig['showOwner'] = false;
  16.            
  17.         }
  18.        
  19.          // for filtering only owned records
  20.         if(isset($_GET['Customer']))
  21.             $model->attributes=$_GET['Customer'];
  22.  
  23.         $this->render('admin',array(
  24.             'model'=>$model,
  25.             'viewConfig'=>$viewConfig,
  26.         ));
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement