Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
PKPSubmissionMetadataViewForm.inc.php
1 <?php
2 
16 import('lib.pkp.classes.form.Form');
17 
18 // Use this class to handle the submission metadata.
19 import('classes.submission.SubmissionMetadataFormImplementation');
20 
22 
25 
27  var $_stageId;
28 
33 
35  var $_metadataFormImplem;
36 
43  function PKPSubmissionMetadataViewForm($submissionId, $stageId = null, $formParams = null, $templateName = 'controllers/modals/submissionMetadata/form/submissionMetadataViewForm.tpl') {
44  parent::Form($templateName);
45 
46  $submissionDao = Application::getSubmissionDAO();
47  $submission = $submissionDao->getById((int) $submissionId);
48  if ($submission) {
49  $this->_submission = $submission;
50  }
51 
52  $this->_stageId = $stageId;
53 
54  $this->_formParams = $formParams;
55 
56  $this->_metadataFormImplem = new SubmissionMetadataFormImplementation($this);
57 
58  // Validation checks for this form
59  $this->_metadataFormImplem->addChecks($submission);
60  $this->addCheck(new FormValidatorPost($this));
61  }
62 
63  //
64  // Getters and Setters
65  //
70  function &getSubmission() {
71  return $this->_submission;
72  }
73 
78  function getStageId() {
79  return $this->_stageId;
80  }
81 
85  function getFormParams() {
86  return $this->_formParams;
87  }
88 
89 
90  //
91  // Overridden template methods
92  //
97  function getLocaleFieldNames() {
98  $this->_metadataFormImplem->getLocaleFieldNames();
99  }
106  function initData($args, $request) {
108  LOCALE_COMPONENT_APP_COMMON,
109  LOCALE_COMPONENT_PKP_SUBMISSION,
110  LOCALE_COMPONENT_APP_SUBMISSION
111  );
112 
113  $this->_metadataFormImplem->initData($this->getSubmission());
114  }
115 
121  function fetch($request) {
122  $submission = $this->getSubmission();
123  $templateMgr = TemplateManager::getManager($request);
124  $templateMgr->assign('submissionId', $submission->getId());
125  $templateMgr->assign('stageId', $this->getStageId());
126  $templateMgr->assign('formParams', $this->getFormParams());
127  $templateMgr->assign('isPublished', $submission->getDatePublished() != null ? true : false);
128 
129  return parent::fetch($request);
130  }
131 
135  function readInputData() {
136  $this->_metadataFormImplem->readInputData();
137  }
143  function execute($request) {
144  $submission = $this->getSubmission();
145  // Execute submission metadata related operations.
146  $this->_metadataFormImplem->execute($submission, $request);
147  }
148 
149 }
150 
151 ?>
addCheck($formValidator)
Definition: Form.inc.php:396
Form validation check to make sure the form is POSTed.
static requireComponents()
Class defining basic operations for handling HTML forms.
Definition: Form.inc.php:47
initData()
Definition: Form.inc.php:227
PKPSubmissionMetadataViewForm($submissionId, $stageId=null, $formParams=null, $templateName= 'controllers/modals/submissionMetadata/form/submissionMetadataViewForm.tpl')
static getSubmissionDAO()
Displays a submission&#39;s metadata view.
This can be used by other forms that want to implement submission metadata data and form operations...