Example #1
0
 public function actionUpdate($id)
 {
     $project = $this->loadModel('Project', User::getLastProjectId());
     $model = $this->loadModel('Issue', $id);
     $this->pageTitle = 'Редактирование ' . $model->subject . ' - ' . Yii::app()->name;
     $this->_saveModel($model, 'обновлена');
     $this->render('update', array('model' => $model, 'project' => $project));
 }
Example #2
0
 public function actionCreate()
 {
     $project = $this->loadModel('Project', User::getLastProjectId());
     $model = new File();
     $this->pageTitle = 'Добавить файл в ' . $project->title . ' - ' . Yii::app()->name;
     if (isset($_POST['File'])) {
         $model->attributes = $_POST['File'];
         if ($model->save()) {
             user()->setFlash('success', "Файл добавлен");
             $this->redirect(array('index'));
         }
     }
     $this->render('create', array('model' => $model, 'project' => $project));
 }
Example #3
0
 protected function beforeSave()
 {
     if (parent::beforeSave()) {
         if ($this->isNewRecord) {
             $this->user_id = Yii::app()->user->id;
             $this->project_id = User::getLastProjectId();
         }
         return true;
     } else {
         return false;
     }
 }
Example #4
0
 /**
  * This action lists all pages
  */
 public function actionPageIndex()
 {
     $project = Project::model()->findByPk(User::getLastProjectId());
     $pages = WikiPage::model()->findAll(array('order' => 'namespace, page_uid', 'condition' => 'project_id=' . (int) User::getLastProjectId()));
     $this->render('page_index', array('pages' => $pages, 'project' => $project));
 }