Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
SelectMonographHandler.inc.php
1 <?php
2 
17 import('classes.handler.Handler');
18 
19 // import JSON class for use with all AJAX requests
20 import('lib.pkp.classes.core.JSONMessage');
21 
27  parent::Handler();
28  $this->addRoleAssignment(
29  array(ROLE_ID_SUB_EDITOR, ROLE_ID_MANAGER),
30  array('fetch', 'getSubmissions')
31  );
32  }
33 
34  //
35  // Implement template methods from PKPHandler
36  //
43  function authorize($request, &$args, $roleAssignments) {
44  import('lib.pkp.classes.security.authorization.PKPSiteAccessPolicy');
45  $this->addPolicy(new PKPSiteAccessPolicy($request, null, $roleAssignments));
46  return parent::authorize($request, $args, $roleAssignments);
47  }
48 
54  function fetch($args, $request) {
55  $templateMgr = TemplateManager::getManager($request);
56  AppLocale::requireComponents(LOCALE_COMPONENT_APP_SUBMISSION); // submission.select
57  $json = new JSONMessage(true, $templateMgr->fetch('controllers/modals/submissionMetadata/selectMonograph.tpl'));
58  return $json->getString();
59  }
60 
66  function getSubmissions($args, $request) {
67  $press = $request->getPress();
68  $monographDao = DAORegistry::getDAO('MonographDAO');
69  $submissionsIterator = $monographDao->getUnpublishedMonographsByPressId($press->getId());
70  $submissions = array();
71  while ($monograph = $submissionsIterator->next()) {
72  $submissions[$monograph->getId()] = $monograph->getLocalizedTitle();
73  }
74 
75  $jsonMessage = new JSONMessage(true, $submissions);
76  return $jsonMessage->getString();
77  }
78 }
79 
80 ?>
static & getDAO($name, $dbconn=null)
addPolicy($authorizationPolicy, $addToTop=false)
static requireComponents()
Handle requests for a modal wrapper around the catalog entry form allowing monograph submission in a ...
addRoleAssignment($roleIds, $operations)
Class to represent a JSON (Javascript Object Notation) message.
Base request handler application class.
Definition: Handler.inc.php:20
Class to that makes sure that a user is logged in.
authorize($request, &$args, $roleAssignments)