Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function actionAdmin()
- {
- $model=new Customer('search');
- $model->unsetAttributes(); // clear any default values
- //this should display customers that are accessible
- $viewConfig;
- $viewConfig['showOwner'] = true;
- if(!Yii::app()->user->checkAccess('Admin'))
- {
- //if it is not an admin
- $model->owner_id = Yii::app()->user->id; //display results that he only owns
- $viewConfig['showOwner'] = false;
- }
- // for filtering only owned records
- if(isset($_GET['Customer']))
- $model->attributes=$_GET['Customer'];
- $this->render('admin',array(
- 'model'=>$model,
- 'viewConfig'=>$viewConfig,
- ));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement