/**
  * @return array Возвращает данные для отчета
  */
 protected function getReportData()
 {
     $model = new Platforms('search');
     $model->unsetAttributes();
     $provider = $model->search(array(), null);
     return $provider->getData();
 }
Exemplo n.º 2
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $modelC = new Campaigns('search');
     $modelC->unsetAttributes();
     // clear any default values
     if (isset($_GET[get_class($modelC)])) {
         $modelC->attributes = $_GET[get_class($modelC)];
     }
     $this->userData = Users::model()->findByPk($id);
     $list = null;
     switch ($this->userData->role) {
         case Users::ROLE_USER:
             $only_active = false;
             if (isset($_GET[get_class($modelC)])) {
                 $modelC->attributes = $_GET[get_class($modelC)];
                 if (isset($_GET[get_class($modelC)]['is_active']) && $_GET[get_class($modelC)]['is_active'] == 1) {
                     $only_active = true;
                 }
             }
             $list = $modelC->searchForUser($this->userData->id, $only_active);
             break;
         case Users::ROLE_PLATFORM:
             $model = new Platforms('search');
             $model->user_id = $this->userData->id;
             $list = $model->search();
             break;
         case Users::ROLE_WEBMASTER:
             Offers::disableDefaultScope();
             $status = Yii::app()->request->getParam('status', -1);
             $list = OffersUsers::model()->findByUserId($this->userData->id, true, $status === '' ? -1 : $status);
             break;
     }
     $this->render('view', array('model' => $this->loadModel($id), 'modelC' => $modelC, 'list' => $list));
 }