Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- /**
- * Description of Admin
- *
- * @author Web Developer
- */
- class Admin extends CAction{
- //put your code here
- public $showSoftDeleted = false;
- public $defaultViewConfig = array(
- 'showOwner'=>false,
- 'showSoftDeleted'=>false,
- );
- public $modelClass = "Customer";
- //public $
- public function run($showSoftDeleted = false) {
- $controller = $this->getController();
- $modelClass = $this->modelClass;
- $viewConfig = $this->defaultViewConfig;
- $model = new $this->modelClass('search');
- $model->unsetAttributes(); // clear any default values
- //
- //$model->enableFiltering = false;
- if($showSoftDeleted == true){
- $model->hideSoftDeleted = !$showSoftDeleted;
- $viewConfig['showSoftDeleted'] = true;
- }
- //$model->owner_id = Yii::app()->user->id;
- //this should display customers that are accessible
- //var_dump($viewConfig['showSoftDeleted']);
- if (RestrictedActiveRecord::mayGenerally($model, $model->accessTerms['readAccessTerm']))
- $viewConfig['showOwner'] = true;
- // for filtering only owned records
- if (isset($_GET[$modelClass]))
- $model->attributes = $_GET[$modelClass];
- $controller->render('admin', array(
- 'model' => $model,
- 'viewConfig' => $viewConfig,
- ));
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement