Example #1
0
 /**
  * Display task
  *
  * @return  void
  */
 public function displayTask()
 {
     // Must be logged in to be a curator
     if (User::isGuest()) {
         $this->_msg = Lang::txt('COM_PUBLICATIONS_CURATION_LOGIN');
         $this->_login();
         return;
     }
     // Get all user groups
     $usergroups = \Hubzero\User\Helper::getGroups(User::get('id'));
     // Check authorization
     $mt = new Tables\MasterType($this->database);
     $authorized = $this->_authorize($mt->getCuratorGroups());
     // Incoming
     $assigned = Request::getInt('assigned', 0);
     // Build query
     $filters = array();
     $filters['limit'] = Request::getInt('limit', 25);
     $filters['start'] = Request::getInt('limitstart', 0);
     $filters['sortby'] = Request::getVar('t_sortby', 'submitted');
     $filters['sortdir'] = Request::getVar('t_sortdir', 'DESC');
     $filters['ignore_access'] = 1;
     // Only get types for which authorized
     if ($authorized == 'limited') {
         $filters['master_type'] = $mt->getAuthTypes($usergroups, $authorized);
     }
     $filters['dev'] = 1;
     // get dev versions
     $filters['status'] = array(5, 7);
     // submitted/pending
     $filters['curator'] = $assigned || $authorized == false ? 'owner' : NULL;
     $this->view->filters = $filters;
     // Instantiate project publication
     $objP = new Tables\Publication($this->database);
     // Get all publications
     $this->view->rows = $objP->getRecords($filters);
     // Get total count
     $this->view->total = $objP->getCount($filters);
     // Initiate paging
     $this->view->pageNav = new \Hubzero\Pagination\Paginator($this->view->total, $this->view->filters['start'], $this->view->filters['limit']);
     // Set page title
     $this->_buildTitle();
     // Set the pathway
     $this->_buildPathway();
     //push the stylesheet to the view
     \Hubzero\Document\Assets::addPluginStylesheet('projects', 'publications');
     foreach ($this->getErrors() as $error) {
         $this->view->setError($error);
     }
     $this->view->option = $this->_option;
     $this->view->database = $this->database;
     $this->view->config = $this->config;
     $this->view->title = $this->_title;
     $this->view->authorized = $authorized;
     $this->view->display();
 }
Example #2
0
 /**
  * Checks-in one or more resources
  * Redirects to the main listing
  *
  * @return  void
  */
 public function checkinTask()
 {
     // Check for request forgeries
     Request::checkToken();
     // Incoming
     $id = Request::getInt('id', 0);
     if ($id) {
         // Load the object and checkin
         $row = new Tables\Publication($this->database);
         $row->load($id);
         $row->checkin();
     }
     // Redirect
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false));
 }