00001 <?php
00002
00015
00016 import('controllers.grid.submissions.SubmissionsListGridHandler');
00017 import('controllers.grid.submissions.SubmissionsListGridRow');
00018
00019
00020 define('FILTER_EDITOR_ALL', 0);
00021 define('FILTER_EDITOR_ME', 1);
00022
00023 class UnassignedSubmissionsListGridHandler extends SubmissionsListGridHandler {
00027 function UnassignedSubmissionsListGridHandler() {
00028 parent::SubmissionsListGridHandler();
00029 $this->addRoleAssignment(array(ROLE_ID_PRESS_MANAGER, ROLE_ID_SERIES_EDITOR), array('fetchGrid'));
00030 }
00031
00032
00033
00034
00035
00039 function initialize(&$request) {
00040 parent::initialize($request);
00041
00042
00043 $this->setTitle('common.queue.long.submissionsUnassigned');
00044
00045
00046 AppLocale::requireComponents(LOCALE_COMPONENT_OMP_EDITOR);
00047 }
00048
00049
00050
00051
00052
00056 function getSubmissions(&$request, $userId) {
00057 $monographDao =& DAORegistry::getDAO('MonographDAO');
00058
00059
00060
00061
00062 $user =& $request->getUser();
00063
00064
00065
00066 $roleDao =& DAORegistry::getDAO('RoleDAO');
00067 $pressDao =& DAORegistry::getDAO('PressDAO');
00068 $presses =& $pressDao->getPresses();
00069
00070 $accessibleMonographs = array();
00071 while ($press =& $presses->next()) {
00072 $isPressManager = $roleDao->userHasRole($press->getId(), $userId, ROLE_ID_PRESS_MANAGER);
00073 $isSeriesEditor = $roleDao->userHasRole($press->getId(), $userId, ROLE_ID_SERIES_EDITOR);
00074
00075 if (!$isPressManager && !$isSeriesEditor) {
00076 continue;
00077 }
00078
00079 $monographFactory =& $monographDao->getMonographsBySeriesEditorId(
00080 $press->getId(),
00081 $isPressManager?null:$userId
00082 );
00083
00084 if (!$monographFactory->wasEmpty()) {
00085 $stageAssignmentDao =& DAORegistry::getDAO('StageAssignmentDAO');
00086 while ($monograph =& $monographFactory->next()) {
00087 if ($monograph->getDatePublished() == null && !$stageAssignmentDao->editorAssignedToStage($monograph->getId())) {
00088 $accessibleMonographs[$monograph->getId()] = $monograph;
00089 }
00090 unset($monograph);
00091 }
00092 }
00093
00094 unset($press);
00095 unset($monographs);
00096 unset($monographFactory);
00097 }
00098
00099 return $accessibleMonographs;
00100 }
00101
00102
00103
00104
00105
00110 function &getRowInstance() {
00111 $row = new SubmissionsListGridRow();
00112 return $row;
00113 }
00114 }
00115
00116 ?>