コード例 #1
0
 public function init()
 {
     // --- Организации
     $c_id = Campaign::getId();
     if ($c_id) {
         Payment::$table_prefix = $c_id . '_';
         //Profile::$table_prefix = $c_id.'_';
         //ProfileField::$table_prefix = $c_id.'_';
         ProjectChanges::$table_prefix = $c_id . '_';
         ProjectChanges::$file_path = 'uploads/c' . $c_id . '/changes_documents';
         //ProjectMessages::$table_prefix = $c_id.'_';
         ProjectPayments::$table_prefix = $c_id . '_';
         Zakaz::$table_prefix = $c_id . '_';
         Zakaz::$files_folder = '/uploads/c' . $c_id . '/';
         Events::$table_prefix = $c_id . '_';
         ZakazParts::$table_prefix = $c_id . '_';
         UpdateProfile::$table_prefix = $c_id . '_';
         ZakazPartsFiles::$table_prefix = $c_id . '_';
         PaymentImage::$table_prefix = $c_id . '_';
         Emails::$table_prefix = $c_id . '_';
         Yii::app()->language = Campaign::getLanguage();
     } else {
         ProjectChanges::$file_path = 'uploads/changes_documents';
     }
     // ---
     if (!Yii::app()->user->isGuest) {
         switch (User::model()->getUserRole()) {
             case 'Manager':
             case 'Admin':
                 Yii::app()->theme = 'admin';
                 break;
             case 'Author':
                 $this->menu = array(array('label' => Yii::t('site', 'My orders'), 'url' => array('/project/zakaz/ownList')), array('label' => Yii::t('site', 'New projects'), 'url' => array('/project/zakaz/list')), array('label' => Yii::t('site', 'Profile'), 'url' => array('/user/profile/edit')), array('label' => Yii::t('site', 'Logout'), 'url' => array('/user/logout')));
                 $this->authMenu = array(array('label' => Yii::t('site', 'Logout'), 'url' => array('/user/logout')));
                 Yii::app()->theme = 'client';
                 break;
             case 'Customer':
                 $this->menu = array(array('label' => Yii::t('site', 'My orders'), 'url' => array('/project/zakaz/customerOrderList')), array('label' => Yii::t('site', 'Create order'), 'url' => array('/project/zakaz/create')), array('label' => Yii::t('site', 'Profile'), 'url' => array('/user/profile/edit')), array('label' => Yii::t('site', 'Logout'), 'url' => array('/user/logout')));
                 $this->authMenu = array(array('label' => Yii::t('site', 'Logout'), 'url' => array('/user/logout')));
                 Yii::app()->theme = 'client';
                 break;
         }
     }
     //		var_dump(Yii::app()->controller->module->id ,Yii::app()->controller->id, Yii::app()->controller->action->id);
     //		die();
 }