Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
CatalogEntryHandler.inc.php
1 <?php
2 
16 // Import the base Handler.
17 import('lib.pkp.controllers.modals.submissionMetadata.PublicationEntryHandler');
18 
20 
23 
27  function CatalogEntryHandler() {
28  parent::PublicationEntryHandler();
29  }
30 
31 
32  //
33  // Overridden methods from Handler
34  //
38  function initialize($request, $args = null) {
39  $this->_selectedFormatId = (int) $request->getUserVar('selectedFormatId');
40  parent::initialize($request, $args);
41  }
42 
43  // Getters and Setters
48  function getSelectedFormatId() {
50  }
51 
52  //
53  // Public handler methods
54  //
60  function fetch($args, $request) {
61  parent::fetch($args, $request);
62 
63  $templateMgr = TemplateManager::getManager($request);
64 
65  $templateMgr->assign('selectedFormatId', $this->getSelectedFormatId());
66 
67  $submission = $this->getSubmission();
68 
69  // load in any publication formats assigned to this published monograph
70  $publicationFormatDao = DAORegistry::getDAO('PublicationFormatDAO');
71  $formats = $publicationFormatDao->getBySubmissionId($submission->getId());
72  $publicationFormats = array();
73  while ($publicationFormat = $formats->next()) {
74  $publicationFormats[] = $publicationFormat;
75  }
76 
77  $templateMgr->assign_by_ref('publicationFormats', $publicationFormats);
78 
79  $application = Application::getApplication();
80  $request = $application->getRequest();
81  $router = $request->getRouter();
82  $dispatcher = $router->getDispatcher();
83 
84  // These two URLs are catalog/monograph specific.
85  $tabsUrl = $dispatcher->url($request, ROUTE_COMPONENT, null, 'modals.submissionMetadata.CatalogEntryHandler', 'fetchFormatInfo', null, array('submissionId' => $submission->getId(), 'stageId' => $this->getStageId()));
86  $templateMgr->assign('tabsUrl', $tabsUrl);
87 
88  $tabContentUrl = $dispatcher->url($request, ROUTE_COMPONENT, null, 'tab.catalogEntry.CatalogEntryTabHandler', 'publicationMetadata', null, array('submissionId' => $submission->getId(), 'stageId' => $this->getStageId()));
89  $templateMgr->assign('tabContentUrl', $tabContentUrl);
90 
91  return $templateMgr->fetchJson('controllers/modals/submissionMetadata/catalogEntryTabs.tpl');
92  }
93 
100  function fetchFormatInfo($args, $request) {
101  $submission = $this->getSubmission();
102  // check to see if this submission has been published yet
103  $publishedMonographDao = DAORegistry::getDAO('PublishedMonographDAO');
104  $json = new JSONMessage();
105 
106  $publicationFormatDao = DAORegistry::getDAO('PublicationFormatDAO');
107  $formats = $publicationFormatDao->getBySubmissionId($submission->getId());
108  $publicationFormats = array();
109  while ($format = $formats->next()) {
110  $publicationFormats[$format->getId()] = $format->getLocalizedName();
111  }
112  $json->setStatus(true);
113  $json->setContent(true);
114  $json->setAdditionalAttributes(array('formats' => $publicationFormats));
115  return $json->getString();
116  }
117 }
118 
119 ?>
static & getDAO($name, $dbconn=null)
initialize($request, $args=null)
Class to represent a JSON (Javascript Object Notation) message.
Base handler to generate the tab structure for a submission&#39;s publication metadata.
Handle the request to generate the tab structure on the New Catalog Entry page.
fetchFormatInfo($args, $request)