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

controllers/grid/submissions/unassignedSubmissions/UnassignedSubmissionsListGridHandler.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 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    // Implement template methods from PKPHandler
00035    //
00039    function initialize(&$request) {
00040       parent::initialize($request);
00041 
00042       // Set title.
00043       $this->setTitle('common.queue.long.submissionsUnassigned');
00044 
00045       // Add editor specific locale component.
00046       AppLocale::requireComponents(LOCALE_COMPONENT_OMP_EDITOR);
00047    }
00048 
00049 
00050    //
00051    // Implement template methods from SubmissionListGridHandler
00052    //
00056    function getSubmissions(&$request, $userId) {
00057       $monographDao =& DAORegistry::getDAO('MonographDAO'); /* @var $monographDao MonographDAO */
00058 
00059       // Determine whether this is a Series Editor or Press Manager.
00060       // Press Managers can access all submissions, Series Editors
00061       // only assigned submissions.
00062       $user =& $request->getUser();
00063 
00064       // Get all monographs for all presses that user is
00065       // enrolled in as manager or series editor.
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    // Overridden methods from GridHandler
00105    //
00110    function &getRowInstance() {
00111       $row = new SubmissionsListGridRow();
00112       return $row;
00113    }
00114 }
00115 
00116 ?>

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