Beispiel #1
0
 /**
  * Edit project info
  *
  * @return  void
  */
 public function editTask()
 {
     if (!User::authorise('core.edit', $this->_option) && !User::authorise('core.create', $this->_option)) {
         App::abort(403, Lang::txt('JERROR_ALERTNOAUTHOR'));
     }
     Request::setVar('hidemainmenu', 1);
     // Incoming project ID
     $id = Request::getVar('id', array(0));
     if (is_array($id)) {
         $id = !empty($id) ? intval($id[0]) : 0;
     }
     $model = new Models\Project($id);
     $objAC = $model->table('Activity');
     if ($id) {
         if (!$model->exists()) {
             Notify::error(Lang::txt('COM_PROJECTS_NOTICE_ID_NOT_FOUND'));
             return $this->cancelTask();
         }
     }
     if (!$id) {
         Notify::error(Lang::txt('COM_PROJECTS_NOTICE_NEW_PROJECT_FRONT_END'));
         return $this->cancelTask();
     }
     $this->view = $this->view;
     $this->view->config = $this->config;
     // Get project types
     $objT = $model->table('Type');
     $this->view->types = $objT->getTypes();
     // Get activity counts
     $counts = Event::trigger('projects.onProjectCount', array($model, 1));
     $counts = Helpers\Html::getCountArray($counts);
     $counts['activity'] = $objAC->getActivityCount($model->get('id'), User::get('id'));
     $this->view->counts = $counts;
     // Get team
     $objO = $model->table('Owner');
     // Sync with system group
     $objO->sysGroup($model->get('alias'), $this->config->get('group_prefix', 'pr-'));
     // Get members and managers
     $this->view->managers = $objO->getOwnerNames($id, 0, '1', 1);
     $this->view->members = $objO->getOwnerNames($id, 0, '0', 1);
     $this->view->authors = $objO->getOwnerNames($id, 0, '2', 1);
     $this->view->reviewers = $objO->getOwnerNames($id, 0, '5', 1);
     // Get last activity
     $afilters = array('limit' => 1);
     $last_activity = $objAC->getActivities($id, $afilters);
     $this->view->last_activity = count($last_activity) > 0 ? $last_activity[0] : '';
     // Was project suspended?
     $this->view->suspended = false;
     $setup_complete = $this->config->get('confirm_step', 0) ? 3 : 2;
     if ($model->isInactive()) {
         $this->view->suspended = $objAC->checkActivity($id, Lang::txt('COM_PROJECTS_ACTIVITY_PROJECT_SUSPENDED'));
     }
     // Get project params
     $this->view->params = $model->params;
     $content = Event::trigger('projects.diskspace', array($model, 'local', 'admin'));
     $this->view->diskusage = isset($content[0]) ? $content[0] : '';
     // Set any errors
     if ($this->getError()) {
         $this->view->setError($this->getError());
     }
     // Get tags on this item
     $cloud = new Models\Tags($id);
     $this->view->tags = $cloud->render('string');
     // Output the HTML
     $this->view->model = $model;
     $this->view->publishing = $this->_publishing;
     $this->view->display();
 }
Beispiel #2
0
 /**
  * Edit project info
  *
  * @return     void
  */
 public function editTask()
 {
     // Incoming project ID
     $id = Request::getVar('id', array(0));
     if (is_array($id)) {
         $id = $id[0];
     }
     // Push some styles to the template
     \Hubzero\Document\Assets::addPluginStylesheet('projects', 'files', 'diskspace.css');
     \Hubzero\Document\Assets::addPluginScript('projects', 'files', 'diskspace.js');
     \Hubzero\Document\Assets::addPluginScript('projects', 'files');
     $this->view = $this->view;
     $this->view->config = $this->config;
     $model = new Models\Project($id);
     $objAC = $model->table('Activity');
     if ($id) {
         if (!$model->exists()) {
             App::redirect(Route::url('index.php?option=' . $this->_option, false), Lang::txt('COM_PROJECTS_NOTICE_ID_NOT_FOUND'), 'error');
             return;
         }
     }
     if (!$id) {
         App::redirect(Route::url('index.php?option=' . $this->_option, false), Lang::txt('COM_PROJECTS_NOTICE_NEW_PROJECT_FRONT_END'), 'error');
         return;
     }
     // Get project types
     $objT = $model->table('Type');
     $this->view->types = $objT->getTypes();
     // Get activity counts
     $counts = Event::trigger('projects.onProjectCount', array($model, 1));
     $counts = Helpers\Html::getCountArray($counts);
     $counts['activity'] = $objAC->getActivityCount($model->get('id'), User::get('id'));
     $this->view->counts = $counts;
     // Get team
     $objO = $model->table('Owner');
     // Sync with system group
     $objO->sysGroup($model->get('alias'), $this->config->get('group_prefix', 'pr-'));
     // Get members and managers
     $this->view->managers = $objO->getOwnerNames($id, 0, '1', 1);
     $this->view->members = $objO->getOwnerNames($id, 0, '0', 1);
     $this->view->authors = $objO->getOwnerNames($id, 0, '2', 1);
     $this->view->reviewers = $objO->getOwnerNames($id, 0, '5', 1);
     // Get last activity
     $afilters = array('limit' => 1);
     $last_activity = $objAC->getActivities($id, $afilters);
     $this->view->last_activity = count($last_activity) > 0 ? $last_activity[0] : '';
     // Was project suspended?
     $this->view->suspended = false;
     $setup_complete = $this->config->get('confirm_step', 0) ? 3 : 2;
     if ($model->isInactive()) {
         $this->view->suspended = $objAC->checkActivity($id, Lang::txt('COM_PROJECTS_ACTIVITY_PROJECT_SUSPENDED'));
     }
     // Get project params
     $this->view->params = $model->params;
     $content = Event::trigger('projects.diskspace', array($model, 'local', 'admin'));
     $this->view->diskusage = isset($content[0]) ? $content[0] : '';
     // Set any errors
     if ($this->getError()) {
         $this->view->setError($this->getError());
     }
     // Get tags on this item
     $cloud = new Models\Tags($id);
     $this->view->tags = $cloud->render('string');
     // Output the HTML
     $this->view->model = $model;
     $this->view->publishing = $this->_publishing;
     $this->view->display();
 }