Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
AssignedSubmissionsListGridHandler.inc.php
1 <?php
2 
16 // Import grid base classes.
17 import('lib.pkp.controllers.grid.submissions.SubmissionsListGridHandler');
18 import('lib.pkp.controllers.grid.submissions.SubmissionsListGridRow');
19 
20 // Filter editor
21 define('FILTER_EDITOR_ALL', 0);
22 define('FILTER_EDITOR_ME', 1);
23 
29  parent::SubmissionsListGridHandler();
30  $this->addRoleAssignment(
31  array(ROLE_ID_SITE_ADMIN, ROLE_ID_MANAGER, ROLE_ID_SUB_EDITOR, ROLE_ID_REVIEWER, ROLE_ID_ASSISTANT),
32  array('fetchGrid', 'fetchRow', 'deleteSubmission')
33  );
34  }
35 
36 
37  //
38  // Implement template methods from PKPHandler
39  //
43  function initialize($request) {
44  parent::initialize($request);
45 
46  // Set title.
47  $this->setTitle('common.queue.long.myAssigned');
48  }
49 
50 
51  //
52  // Implement template methods from SubmissionListGridHandler
53  //
57  function getSubmissions($request, $userId) {
58  $submissionDao = Application::getSubmissionDAO();
59  $userGroupDao = DAORegistry::getDAO('UserGroupDAO');
60  $signoffDao = DAORegistry::getDAO('SignoffDAO');
61  $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
62  $authorDao = DAORegistry::getDAO('AuthorDAO');
63 
64  // Get submissions the user is a stage participant for
65  $signoffs = $signoffDao->getByUserId($userId);
66 
67  $authorUserGroupIds = $userGroupDao->getUserGroupIdsByRoleId(ROLE_ID_AUTHOR);
68 
69  $data = array();
70 
71  // get signoffs and stage assignments
72  $stageAssignments = $stageAssignmentDao->getByUserId($userId);
73  while($stageAssignment = $stageAssignments->next()) {
74  $submission = $submissionDao->getAssignedById($stageAssignment->getSubmissionId(), $userId);
75  if (!$submission) continue;
76 
77  $submissionId = $submission->getId();
78  $data[$submissionId] = $submission;
79  }
80 
81  while($signoff = $signoffs->next()) {
82  // If it is a submission signoff (and not, say, a file signoff) and
83  // If this is an author signoff, do not include (it will be in the 'my submissions' grid)
84  if( $signoff->getAssocType() == ASSOC_TYPE_SUBMISSION &&
85  !in_array($signoff->getUserGroupId(), $authorUserGroupIds)) {
86  $submission = $submissionDao->getById($signoff->getAssocId());
87  $submissionId = $submission->getId();
88  if ($submission->getStatus() != STATUS_DECLINED) {
89  $data[$submissionId] = $submission;
90  }
91  }
92  }
93 
94  // Get submissions the user is reviewing
95  $reviewerSubmissionDao = DAORegistry::getDAO('ReviewerSubmissionDAO'); /* @var $reviewerSubmissionDao ReviewerSubmissionDAO */
96  $reviewerSubmissions = $reviewerSubmissionDao->getReviewerSubmissionsByReviewerId($userId);
97  while($reviewerSubmission = $reviewerSubmissions->next()) {
98  $submissionId = $reviewerSubmission->getId();
99  if (!isset($data[$submissionId])) {
100  // Only add if not already provided above --
101  // otherwise reviewer workflow link may
102  // clobber editorial workflow link
103  $data[$submissionId] = $reviewerSubmission;
104  }
105  }
106 
107  return $data;
108  }
109 }
110 
111 ?>
static & getDAO($name, $dbconn=null)
Handle submission list grid requests.
Handle submissions list grid requests (submissions the user is assigned to).
addRoleAssignment($roleIds, $operations)
static getSubmissionDAO()