• Main Page
  • Modules
  • Classes
  • Files
  • File List

controllers/grid/submissions/assignedSubmissions/AssignedSubmissionsListGridHandler.inc.php

00001 <?php
00002 
00015 // Import grid base classes.
00016 import('controllers.grid.submissions.SubmissionsListGridHandler');
00017 import('controllers.grid.submissions.SubmissionsListGridRow');
00018 
00019 // Filter editor
00020 define('FILTER_EDITOR_ALL', 0);
00021 define('FILTER_EDITOR_ME', 1);
00022 
00023 class AssignedSubmissionsListGridHandler extends SubmissionsListGridHandler {
00027    function AssignedSubmissionsListGridHandler() {
00028       parent::GridHandler();
00029       $this->addRoleAssignment(
00030          array(ROLE_ID_SITE_ADMIN, ROLE_ID_PRESS_MANAGER, ROLE_ID_SERIES_EDITOR, ROLE_ID_REVIEWER, ROLE_ID_PRESS_ASSISTANT),
00031          array('fetchGrid')
00032       );
00033    }
00034 
00035 
00036    //
00037    // Implement template methods from PKPHandler
00038    //
00042    function initialize(&$request) {
00043       parent::initialize($request);
00044 
00045       // Set title.
00046       $this->setTitle('common.queue.long.myAssigned');
00047    }
00048 
00049 
00050    //
00051    // Implement template methods from SubmissionListGridHandler
00052    //
00056    function getSubmissions(&$request, $userId) {
00057       $monographDao =& DAORegistry::getDAO('MonographDAO');
00058       $userGroupDao =& DAORegistry::getDAO('UserGroupDAO');
00059       $signoffDao =& DAORegistry::getDAO('SignoffDAO');
00060       $stageAssignmentDao =& DAORegistry::getDAO('StageAssignmentDAO');
00061       $authorDao =& DAORegistry::getDAO('AuthorDAO');
00062 
00063       // Get submissions the user is a stage participant for
00064       $signoffs =& $signoffDao->getByUserId($userId);
00065 
00066       $authorUserGroupIds = $userGroupDao->getUserGroupIdsByRoleId(ROLE_ID_AUTHOR);
00067 
00068       $data = array();
00069 
00070       // get signoffs and stage assignments
00071       $stageAssignments =& $stageAssignmentDao->getByUserId($userId);
00072       while($stageAssignment =& $stageAssignments->next()) {
00073          $monograph =& $monographDao->getById($stageAssignment->getSubmissionId());
00074          if ($monograph->getDateSubmitted() == null) { continue; }; // Still incomplete, don't add to assigned submissions grid.
00075 
00076          if ($monograph->getDatePublished() != null) { continue; } // This is published, don't add to the submissions grid (it's in the catalog)
00077 
00078          // Check if user is a submitter of this monograph.
00079          if ($userId == $monograph->getUserId()) { continue; }; // It will be in the 'my submissions' grid.
00080 
00081          $monographId = $monograph->getId();
00082          $data[$monographId] = $monograph;
00083          unset($monograph, $stageAssignment, $authors);
00084       }
00085 
00086       while($signoff =& $signoffs->next()) {
00087          // If it is a monograph signoff (and not, say, a file signoff) and
00088          // If this is an author signoff, do not include (it will be in the 'my submissions' grid)
00089          if( $signoff->getAssocType() == ASSOC_TYPE_MONOGRAPH &&
00090             !in_array($signoff->getUserGroupId(), $authorUserGroupIds)) {
00091             $monograph =& $monographDao->getById($signoff->getAssocId());
00092             $monographId = $monograph->getId();
00093             $data[$monographId] = $monograph;
00094             unset($monograph);
00095          }
00096          unset($signoff);
00097       }
00098 
00099       // Get submissions the user is reviewing
00100       $reviewerSubmissionDao =& DAORegistry::getDAO('ReviewerSubmissionDAO'); /* @var $reviewerSubmissionDao ReviewerSubmissionDAO */
00101       $reviewerSubmissions = $reviewerSubmissionDao->getReviewerSubmissionsByReviewerId($userId);
00102       while($reviewerSubmission =& $reviewerSubmissions->next()) {
00103          $monographId = $reviewerSubmission->getId();
00104          if (!isset($data[$monographId])) {
00105             // Only add if not already provided above --
00106             // otherwise reviewer workflow link may
00107             // clobber editorial workflow link
00108             $data[$monographId] = $reviewerSubmission;
00109          }
00110          unset($reviewerSubmission);
00111       }
00112 
00113       return $data;
00114    }
00115 
00116 
00117    //
00118    // Overridden methods from GridHandler
00119    //
00124    function &getRowInstance() {
00125       $row = new SubmissionsListGridRow();
00126       return $row;
00127    }
00128 }
00129 
00130 ?>

Generated on Mon Sep 17 2012 13:58:56 for Open Monograph Press by  doxygen 1.7.1