00001 <?php
00002
00016 import('classes.handler.Handler');
00017
00018
00019 import('lib.pkp.classes.core.JSONMessage');
00020
00021 class SelectMonographHandler extends Handler {
00025 function SelectMonographHandler() {
00026 parent::Handler();
00027 $this->addRoleAssignment(
00028 array(ROLE_ID_SERIES_EDITOR, ROLE_ID_PRESS_MANAGER),
00029 array('fetch', 'getSubmissions')
00030 );
00031 }
00032
00033
00034
00035
00042 function authorize(&$request, $args, $roleAssignments) {
00043 import('lib.pkp.classes.security.authorization.PKPSiteAccessPolicy');
00044 $this->addPolicy(new PKPSiteAccessPolicy($request, null, $roleAssignments));
00045 return parent::authorize($request, $args, $roleAssignments);
00046 }
00047
00053 function fetch($args, &$request) {
00054 $templateMgr =& TemplateManager::getManager();
00055 AppLocale::requireComponents(LOCALE_COMPONENT_OMP_SUBMISSION);
00056 $json = new JSONMessage(true, $templateMgr->fetch('controllers/modals/submissionMetadata/selectMonograph.tpl'));
00057 return $json->getString();
00058 }
00059
00065 function getSubmissions($args, &$request) {
00066 $press =& $request->getPress();
00067 $monographDao =& DAORegistry::getDAO('MonographDAO');
00068 $submissionsIterator = $monographDao->getUnpublishedMonographsByPressId($press->getId());
00069 $submissions = array();
00070 while ($monograph =& $submissionsIterator->next()) {
00071 $submissions[$monograph->getId()] = $monograph->getLocalizedTitle();
00072 unset($monograph);
00073 }
00074
00075 $jsonMessage = new JSONMessage(true, $submissions);
00076 return $jsonMessage->getString();
00077 }
00078 }
00079
00080 ?>