Пример #1
0
 public function init()
 {
     $this->parts = ZakazParts::model()->findAllByAttributes(['proj_id' => $this->project->id]);
     $this->payments = ProjectPayments::model()->findByAttributes(['order_id' => $this->project->id]);
     $this->changes = ProjectChanges::model()->findAllByAttributes(['project_id' => $this->project->id]);
     $this->messages = ProjectMessages::model()->findAllByAttributes(['order' => $this->project->id], ['order' => 'id DESC']);
 }
 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();
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  *
  * @param integer $id the ID of the model to be loaded
  *
  * @return ProjectChanges the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = ProjectChanges::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Пример #4
0
<div id="list-changes-block" class="list-changes-block">
    <div class="list-changes-filename">
        <a href="<?php 
echo $data['file'];
?>
"><?php 
echo $data['filename'];
?>
</a>
    </div>
    <div class="list-changes-comment">
        <?php 
echo $data['comment'];
?>
    </div>
<?php 
if (ProjectChanges::approveAllowed()) {
    ?>
    <div class="list-changes-moderate">
        Модерация
        <?php 
    echo CHtml::dropDownList('moderate', $data['moderate'], array('1' => ProjectModule::t('Approved'), '0' => ProjectModule::t('Not approved')), array('onchange' => 'changes_approve(' . $data['id'] . ', ' . $data['moderate'] . ')'));
    ?>
    </div>
<?php 
}
?>
</div>
Пример #5
0
 public function init()
 {
     // --- Организации
     $c_id = Company::getId();
     if ($c_id) {
         if (Company::getCompany()->frozen) {
             echo 'Where is my money, dude ?!?!?!';
             die;
         }
         ProjectChanges::$file_path = 'uploads/c' . $c_id . '/changes_documents';
         Zakaz::$files_folder = '/uploads/c' . $c_id . '/';
         Yii::app()->language = Company::getLanguage();
     } else {
         $tmp = explode('.', $_SERVER['SERVER_NAME']);
         if (array_shift($tmp) == 'www') {
             $this->redirect('http://' . implode('.', $tmp));
         } else {
             echo 'Requested company not found.';
         }
         Yii::app()->end();
     }
     // ---
     if (!Yii::app()->user->isGuest) {
         switch (User::model()->getUserRole()) {
             case 'Manager':
             case 'Admin':
             case 'root':
                 Yii::app()->theme = 'admin';
                 break;
             case 'Author':
                 $menu[] = array('label' => Yii::t('site', 'My orders'), 'url' => array('/project/zakaz/ownList'));
                 $menu[] = array('label' => Yii::t('site', 'New projects'), 'url' => array('/project/zakaz/list'));
                 if (User::model()->isCorrector()) {
                     $menu[] = array('label' => Yii::t('site', 'New projects for technical'), 'url' => array('/project/zakaz/listtech'));
                     //if (Company::getCompany()->module_tree) $menu[] = array('label'=>Yii::t('site','Tree structure'), 'url'=>array('/project/zakaz/tree'));
                 }
                 if (Company::getCompany()->agreement4executors && Company::getCompany()->agreement4executors != '') {
                     $menu[] = array('label' => Yii::t('site', 'User Agreement'), 'url' => array('/site/agreement'));
                 }
                 //$menu[] = array('label'=>Yii::t('site','Personal account'), 'url'=>array('/user/profile/account'));
                 $menu[] = array('label' => Yii::t('site', 'Logout'), 'url' => array('/user/logout'));
                 // Далее выводится в обратном порядке
                 $menu[] = array('label' => Yii::t('site', 'Profile'), 'url' => array('/user/profile/edit'));
                 $this->menu = $menu;
                 Yii::app()->theme = 'client';
                 break;
             case 'Customer':
                 $menu[] = array('label' => Yii::t('site', 'My orders'), 'url' => array('/project/zakaz/customerOrderList'));
                 if (Company::getCompany()->module_tree) {
                     $menu[] = array('label' => Yii::t('site', 'Tree structure'), 'url' => array('/project/zakaz/tree'));
                 }
                 $menu[] = array('label' => Yii::t('site', 'Create order'), 'url' => array('/project/zakaz/create'));
                 //$menu[] = array('label'=>Yii::t('site','Personal account'), 'url'=>array('/user/profile/account'));
                 if (Company::getCompany()->agreement4customers && Company::getCompany()->agreement4customers != '') {
                     $menu[] = array('label' => Yii::t('site', 'User Agreement'), 'url' => array('/site/agreement'));
                 }
                 $menu[] = array('label' => Yii::t('site', 'Logout'), 'url' => array('/user/logout'));
                 // Даллее выводится в обратном порядке
                 $menu[] = array('label' => Yii::t('site', 'Profile'), 'url' => array('/user/profile/edit'));
                 $this->menu = $menu;
                 /*$this->authMenu = array(
                 		    array('label'=>Yii::t('site','Logout'), 'url'=>array('/user/logout')),
                 		);*/
                 Yii::app()->theme = 'client';
                 break;
             case 'Webmaster':
                 $this->menu = array(array('label' => Yii::t('site', 'Stats'), 'url' => array('/partner/stats')), array('label' => Yii::t('site', 'Promo materials'), 'url' => array('/partner/materials')), array('label' => Yii::t('site', 'Logout'), 'url' => array('/user/logout')), array('label' => Yii::t('site', 'Profile'), 'url' => array('/user/profile/edit')));
                 $this->authMenu = array(array('label' => Yii::t('site', 'Logout'), 'url' => array('/user/logout')));
                 Yii::app()->theme = 'client';
                 if (Yii::app()->getRequest()->getRequestUri() == '/project/zakaz/list') {
                     $this->redirect('/');
                 }
                 break;
         }
     }
     //		var_dump(Yii::app()->controller->module->id ,Yii::app()->controller->id, Yii::app()->controller->action->id);
     //		die();
 }
 public function init()
 {
     //echo 'project_id =' . (int)$this->project->id .' '. ((User::model()->isManager() || User::model()->isAdmin()) ? '' : (' AND (user_id = '.((Yii::app()->user->id)?Yii::app()->user->id:(-1)).' OR moderate=1)' )).'!!!';
     $this->userObj = User::model();
     $this->changes = new CArrayDataProvider(Yii::app()->db->createCommand()->select('CONCAT("/' . ProjectChanges::$file_path . '/",file)  as `file`, file as `filename`, comment, id, moderate, date_create')->from(ProjectChanges::model()->tableName())->where('project_id =' . (int) $this->project->id . (User::model()->isManager() || User::model()->isAdmin() ? '' : ' AND (user_id = ' . (Yii::app()->user->id ? Yii::app()->user->id : -1) . ' OR moderate=1)'))->queryAll(), array('pagination' => false));
 }