Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
ArchivedSubmissionsListGridHandler.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_REVIEWER, ROLE_ID_ASSISTANT, ROLE_ID_MANAGER, ROLE_ID_SUB_EDITOR),
32  array('fetchGrid', 'fetchRow', 'deleteSubmission')
33  );
34  $this->addRoleAssignment(
35  array(ROLE_ID_MANAGER, ROLE_ID_SUB_EDITOR),
36  array('deleteSubmission')
37  );
38  }
39 
40 
41  //
42  // Implement template methods from PKPHandler
43  //
47  function initialize($request) {
48  parent::initialize($request);
49 
50  // Set title.
51  $this->setTitle('common.queue.long.submissionsArchived');
52 
53  // Add editor specific locale component.
54  AppLocale::requireComponents(LOCALE_COMPONENT_APP_EDITOR);
55  }
56 
57 
58  //
59  // Implement template methods from SubmissionListGridHandler
60  //
64  function getSubmissions($request) {
65  // Get all contexts that user is enrolled in as manager, series editor
66  // reviewer or assistant
67  $user = $request->getUser();
68  $roleDao = DAORegistry::getDAO('RoleDAO');
69  $contextDao = Application::getContextDAO();
70  $contexts = $contextDao->getAll()->toArray();
71  $accessibleRoles = array(
72  ROLE_ID_MANAGER,
73  ROLE_ID_SUB_EDITOR,
74  ROLE_ID_REVIEWER,
75  ROLE_ID_ASSISTANT
76  );
77 
78  $accessibleContexts = array();
79  $stageUserId = null;
80  $reviewUserId = null;
81  foreach ($accessibleRoles as $role) {
82  foreach ($contexts as $context) {
83  if ($roleDao->userHasRole($context->getId(), $user->getId(), $role)) {
84  $accessibleContexts[] = $context->getId();
85 
86  if ($role == ROLE_ID_ASSISTANT) {
87  $stageUserId = $user->getId();
88  } elseif ($role == ROLE_ID_REVIEWER) {
89  $reviewUserId = $user->getId();
90  }
91  }
92  }
93  }
94  $accessibleContexts = array_unique($accessibleContexts);
95  if (count($accessibleContexts) == 1) {
96  $accessibleContexts = array_pop($accessibleContexts);
97  }
98 
99  // Fetch all submissions for contexts the user can access. If the user
100  // is a reviewer or assistant only show submissions that have been
101  // assigned to the user
102  $submissionDao = Application::getSubmissionDAO();
103  return $submissionDao->getByStatus(
104  array(STATUS_DECLINED, STATUS_PUBLISHED),
105  $stageUserId,
106  $reviewUserId,
107  $accessibleContexts,
108  $this->getGridRangeInfo($request, $this->getId())
109  );
110  }
111 }
112 
113 ?>
static & getDAO($name, $dbconn=null)
Handle submission list grid requests.
static requireComponents()
addRoleAssignment($roleIds, $operations)
Handle archived submissions list grid requests.
static getSubmissionDAO()
getGridRangeInfo($request, $rangeName, $contextData=null)
static getContextDAO()