public function __construct()
 {
     parent::__construct();
     // если в сессии нет информации об авторизации, отравляем на страницу с оной
     if (!$this->authdata) {
         $this->redirect('/auth/');
         return;
     }
     // если текущий пользователь - руководитель, то добавим ссылку на создание новой заявки
     //if (get_param($this->authdata, 'role_id') === Configuration::$ROLE_USER) {
     if ($this->isGrantToMe('ACE_NEW')) {
         $this->data['usermenu'] .= $this->renderPartial('new-create');
         // и пункт меню для черновиков
         $this->menu = [STATUS_DRAFT => 'Черновики'] + $this->menu;
     }
     // получим количество заявок в разрезе статусов
     $udep = get_param($this->authdata, 'depid', 0);
     $states = array_column($this->model->getCounter($udep), 'cnt', 'id');
     // рендерим основное меню
     foreach ($this->menu as $index => $title) {
         $this->data['cnt'] = $states[$index] ?: '';
         //rand(1, 15);
         $this->data['title'] = $title;
         $this->data['type'] = $index;
         // статус заявок (для фильтрации)
         $this->data['usermenu'] .= $this->renderPartial('menu-item');
     }
     $this->scripts[] = 'contents';
 }
Пример #2
0
 /**
  *构造方法获取公共的变量参数
  *
  */
 public function __construct($id, $module = null)
 {
     parent::__construct($id, $module);
     /**
      * 该段代码用于获取后台的设置信息,
      * 并将获得的信息缓存&读取到公共的Settings变量中.
      */
     $this->Settings = Yii::app()->cache->get('Settings');
     if (!$this->Settings) {
         $Info = Settings::model()->findAllBySql("SELECT * FROM {{settings}}");
         $ArraySettings = array();
         foreach ($Info as $key) {
             $ArraySettings[$key->key] = $key->value;
         }
         $this->Settings = (object) $ArraySettings;
         Yii::app()->cache->set('Settings', $this->Settings, 10);
     }
     /**
      *  如果用户登录了
      *  该段代码调用了经过权限处理后的操作模块,
      *  否则跳转回登录页
      */
     if (Yii::app()->session->get('IsLogin') || $this->getId('login')) {
         $this->roleAction = $this->actionMeun();
     } else {
         $Url = $this->createUrl('admin/Login/Login');
         $this->redirect($Url);
     }
 }
Пример #3
0
 public function __construct($id = null, $module = null)
 {
     if (!Yii::app()->my->logged) {
         $this->redirect(array('auth/index'));
     }
     parent::__construct($id, $module = null);
 }
Пример #4
0
 public function __construct($id, $module = null)
 {
     parent::__construct($id, $module);
     // If there is a post-request, redirect the application to the provided url of the selected language
     if (isset($_POST['language'])) {
         $lang = $_POST['language'];
         $MultilangReturnUrl = $_POST[$lang];
         $this->redirect($MultilangReturnUrl);
     }
     // Set the application language if provided by GET, session or cookie
     if (isset($_GET['language'])) {
         Yii::app()->language = $_GET['language'];
         Yii::app()->user->setState('language', $_GET['language']);
         $cookie = new CHttpCookie('language', $_GET['language']);
         $cookie->expire = time() + 60 * 60 * 24 * 365;
         // (1 year)
         Yii::app()->request->cookies['language'] = $cookie;
     } else {
         if (Yii::app()->user->hasState('language')) {
             Yii::app()->language = Yii::app()->user->getState('language');
         } else {
             if (isset(Yii::app()->request->cookies['language'])) {
                 Yii::app()->language = Yii::app()->request->cookies['language']->value;
             }
         }
     }
 }
Пример #5
0
 public function __construct()
 {
     parent::__construct();
     $this->_user = new User();
     $this->_user->stateKeyPrefix = base64_encode('_microHR_adminKey');
     $this->_init();
 }
Пример #6
0
 public function __construct($id, $module)
 {
     parent::__construct($id, $module);
     // set current lang from cookie
     if (isset(Yii::app()->request->cookies['language'])) {
         Yii::app()->setLanguage(Yii::app()->request->cookies['language']->value);
     }
 }
Пример #7
0
 function __construct()
 {
     parent::__construct();
     $this->model(array("news_model", "rubrics_model", "photo_model"));
     $this->library(array('form', 'table'));
     $this->method = 'index';
     $this->ctrler = 'json';
 }
Пример #8
0
 function __construct()
 {
     parent::__construct();
     $this->library(array('form', 'table'));
     $this->upload = new Upload();
     $this->temp_imgDir = $this->config['klimg_dir'] . 'tmp/' . url_title($_SESSION['usr_fullname']) . '/';
     $this->target_imgDir = $this->config['klimg_dir'] . 'real/2013/09/';
 }
 public function __construct()
 {
     parent::__construct();
     if (!$this->authdata) {
         $this->redirect('/auth/');
         return;
     }
 }
Пример #10
0
 function __construct()
 {
     parent::__construct();
     $this->model(array("menu_model"));
     $this->library(array('form'));
     $this->method = 'index';
     $this->ctrler = 'menu-config';
 }
Пример #11
0
 function __construct()
 {
     parent::__construct();
     $this->model(array('rubrics_model'));
     $this->library(array('form', 'table'));
     $this->ctrler = 'column';
     //$this->method_by_url = $this->config['method_by_url');
 }
Пример #12
0
 function __construct()
 {
     parent::__construct();
     $this->model(array("news_model", "rubrics_model", "photo_model", "jsview_model", "user_model", "fbinfo_model"));
     $this->library(array('form', 'table'));
     $this->ctrler = 'page-view';
     $this->search = array('id' => $this->uri->get('id') ? $this->uri->get('id') : false, 'title' => $this->uri->get('title') ? $this->uri->get('title') : false, 'dateFrom' => $this->uri->get('dateFrom') ? $this->uri->get('dateFrom') : '', 'dateTo' => $this->uri->get('dateTo') ? $this->uri->get('dateTo') : '', 'category' => $this->uri->get('category') ? $this->uri->get('category') : '', 'type' => $this->uri->get('type') ? $this->uri->get('type') : 'all', 'rep' => $this->uri->get('rep') ? $this->uri->get('rep') : '');
     $this->page = $this->uri->get('page') ? $this->uri->get('page') : 1;
 }
Пример #13
0
 function __construct()
 {
     parent::__construct();
     $this->model(array('import_model'));
     $this->library(array('form', 'table'));
     $this->method = 'index';
     $this->ctrler = 'json';
     $this->date_columns = array('created_at' => 0, 'updated_at' => 0, 'news_entry' => 0, 'news_date_publish' => 0, 'phone_announced' => 0);
 }
Пример #14
0
 function __construct()
 {
     parent::__construct();
     $this->model(array("news_model", "rubrics_model", "img_conf_model", "photo_model", "news_rubric_model", "news_keywords_model", "tag_news_model", "photonews_model", "keywords_model", "quote_model", "tags_model", "domain_users_model", "user_model", "news_paging_model", "temp_img_model"));
     $old_cat = file_get_contents($this->config['json_dir'] . "old_categori.json");
     $arr_cat_old = json_decode($old_cat, true);
     //echoPre($arr_cat_old);
     $this->arr_Categori_old = $arr_cat_old;
 }
Пример #15
0
 public function __construct($id, $module = null)
 {
     parent::__construct($id, $module = null);
     if (Yii::app()->user->isGuest) {
         $this->redirect(array('site/login'));
     } else {
         $userInfo = UserModel::model()->find('username=:username', array(':username' => Yii::app()->user->name));
         Yii::app()->session['userInfo'] = array('uid' => $userInfo->uid, 'username' => $userInfo->username, 'nickname' => $userInfo->nickname, 'group_id' => $userInfo->group_id);
     }
 }
Пример #16
0
 function __construct()
 {
     parent::__construct();
     $this->model(array("dfp_order_model", "dfp_lineitem_model", "dfp_advertiser_model", "dfp_placement_model", "dfp_creative_model"));
     $this->library(array('form', 'table', 'url'));
     $this->method = 'infeed-ads';
     $this->ctrler = 'delivery/infeed-ads';
     $this->upload = new Upload();
     $this->page = $this->uri->get('page') ? $this->uri->get('page') : 1;
 }
Пример #17
0
 function __construct()
 {
     parent::__construct();
     $this->model(array('tags_model', 'tag_news_model', "photo_model", 'img_conf_model'));
     $this->library(array('form', 'table', 'upload'));
     $this->ctrler = 'tag-management';
     $this->sts = array("Success save tag", "Failed save tag", "Double tag name", "Failed upload image");
     //$this->msg_alert = false;
     //        $this->method_by_url = $this->config['method_by_url');
 }
Пример #18
0
 function __construct()
 {
     parent::__construct();
     $this->model(array("news_model", "rubrics_model", "photo_model", "popup_model", "img_conf_model"));
     $this->library(array('form', 'table'));
     $this->method = 'index';
     $this->ctrler = 'popup';
     $this->search = array('wording' => $this->uri->get('wording') ? $this->uri->get('wording') : false, 'idPupop' => $this->uri->get('idPupop') ? $this->uri->get('idPupop') : false);
     $this->page = $this->uri->get('page') ? $this->uri->get('page') : 1;
 }
Пример #19
0
 public function __construct($id, $module = null)
 {
     $language = Yii::app()->request->getParam('language', DEFAULT_LANGUAGE);
     DwHelper::SetLanguage($language);
     //set meta data
     $this->keywords = LuxSeo::getParam('keywords');
     $this->title = LuxSeo::getParam('title');
     $this->description = LuxSeo::getParam('description');
     parent::__construct($id, $module);
 }
Пример #20
0
 function __construct()
 {
     parent::__construct();
     $this->model(array("news_model", "rubrics_model", "photo_model", "quote_model", "img_conf_model"));
     $this->library(array('form', 'table'));
     $this->method = 'index';
     $this->ctrler = 'quote';
     $this->search = array('dStart' => $this->uri->get('dStart') ? $this->uri->get('dStart') : false, 'dEnd' => $this->uri->get('dEnd') ? $this->uri->get('dEnd') : false, 'idQuote' => $this->uri->get('idQuote') ? $this->uri->get('idQuote') : false);
     $this->page = $this->uri->get('page') ? $this->uri->get('page') : 1;
 }
Пример #21
0
 function __construct()
 {
     parent::__construct();
     $this->model(array('tags_model', 'tag_news_model', "photo_model", 'img_conf_model', 'today_tag_model', 'rubrics_model'));
     $this->library(array('form', 'table'));
     $this->method = 'index';
     $this->ctrler = 'today-tag';
     $this->search = array('tag' => $this->uri->get('tag') ? $this->uri->get('tag') : false, 'idTag' => $this->uri->get('idTag') ? $this->uri->get('idTag') : false, 'title' => $this->uri->get('title') ? $this->uri->get('title') : false);
     $this->page = $this->uri->get('page') ? $this->uri->get('page') : 1;
 }
Пример #22
0
 public function __construct()
 {
     parent::__construct();
     if (get_param($this->authdata, 'admin') !== true) {
         $this->preparePopup('Не достаточно прав доступа!');
         $this->redirect();
     }
     $this->scripts[] = 'administration';
     $this->data['extra'] = '';
     $this->data['btnList'] = '';
 }
Пример #23
0
 function __construct()
 {
     parent::__construct();
     $this->model("user_level_model");
     $this->model("menu_model");
     $this->library(array('form'));
     $this->row_level = $this->menu_model->getLevel();
     $this->method = 'index';
     $this->ctrler = 'access';
     //$this->method_by_url = $this->config['method_by_url');
 }
Пример #24
0
 public function __construct()
 {
     parent::__construct();
     try {
         $this->con = new PDO('odbc:Driver={SQL Server};Server=dgk90tch006;Database=DevNet; Uid=sa;Pwd=Asu31281080', '', '', [PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC]);
     } catch (Exception $ex) {
         $msg = $ex->getMessage();
         charsetChange($msg);
         throw new Exception($msg);
     }
 }
Пример #25
0
 /**
  * \brief При вызове класса, с помощью виджета и урл менеджера создаем перевод страниц и выбор языка
  */
 public function __construct($id, $module = null)
 {
     parent::__construct($id, $module);
     if (!Yii::app()->user->isGuest) {
         $this->layout = '//layouts/main';
     } else {
         $this->layout = '//layouts/registration';
     }
     /*elseif (!Yii::app()->user->isGuest && Yii::app()->user->checkAccess('admin')) {
     			$this->layout = '//layouts/admin';
     		}*/
 }
Пример #26
0
 function __construct()
 {
     parent::__construct();
     $this->model(array("news_model", "migrasi_model", "rubrics_model", "img_conf_model", "photo_model", "news_rubric_model", "news_keywords_model", "tag_news_model", "photonews_model", "keywords_model", "quote_model", "tags_model", "domain_users_model", "user_model", "news_paging_model", "temp_img_model", "video_model"));
     $this->library("upload");
     $old_cat = file_get_contents($this->config['json_dir'] . "old_categori.json");
     $arr_cat_old = json_decode($old_cat, true);
     $this->arr_Categori_old = $arr_cat_old;
     $this->file_log_migrasi = $this->config['json_dir'] . "log_migrasi_sooperboy.txt";
     $this->file_log_id = $this->config['json_dir'] . "log_migrasi_sooperboy_result.txt";
     $this->limit = 20;
 }
Пример #27
0
 /**
  * Basic initialiser to the base controller class
  *
  * @access public
  * @param string $id
  * @param CWebModule $module
  * @return void
  */
 public function __construct($id, $module = null)
 {
     parent::__construct($id, $module);
     $this->_checkInstallation();
     Yii::app()->session->init();
     $this->loadLibrary('LS.LS');
     $this->loadHelper('globalsettings');
     $this->loadHelper('common');
     $this->loadHelper('expressions.em_manager');
     $this->loadHelper('replacements');
     $this->_init();
 }
Пример #28
0
 function __construct()
 {
     parent::__construct();
     $this->search = array('dStart' => $this->uri->get('dStart') ? $this->uri->get('dStart') : false, 'dEnd' => $this->uri->get('dEnd') ? $this->uri->get('dEnd') : false, 'tTitle' => $this->uri->get('tTitle') ? $this->uri->get('tTitle') : false, 'cField' => $this->uri->get('cField') ? $this->uri->get('cField') : false, 'schedule' => $this->uri->get('schedule') ? $this->uri->get('schedule') : false);
     $this->model(array("user_model", "user_level_model", "menu_model"));
     $this->model(array("what_happen_model", "user_level_model", "news_model", "photo_model", "img_conf_model"));
     $this->library(array('form', 'table'));
     $this->row_level = $this->menu_model->getLevel();
     $this->page = $this->uri->get('page') ? $this->uri->get('page') : 1;
     $this->method = 'index';
     $this->ctrler = 'whats-hot';
 }
Пример #29
0
 /**
  * Detect resource class name before getModel function gets called.
  * @param string $id
  * @param string $module
  */
 public function __construct($id, $module = null)
 {
     parent::__construct($id, $module);
     if ($this->resourceClassName == null) {
         // default controller does not have model
         if ($this->id == 'frApi') {
             $this->resourceClassName = "FrApiResource";
         } else {
             $this->resourceClassName = ucfirst($id);
         }
     }
 }
Пример #30
0
 function __construct()
 {
     parent::__construct();
     //set local var for search and paging
     $this->search = array('bulan' => $this->uri->get('m') ? $this->uri->get('m') : false, 'tahun' => $this->uri->get('y') ? $this->uri->get('y') : false);
     //init local var for paging param value if exist
     $this->page = $this->uri->get('page') ? $this->uri->get('page') : 1;
     //initialize model
     $this->model(array("event_model"));
     $this->library(array('form', 'table', 'calendar'));
     $this->method = 'index';
     $this->ctrler = 'update_event';
 }