_pubObject = $pubObject; $this->_approval = $approval; $this->_confirmationText = $confirmationText; $request = Application::get()->getRequest(); $context = $request->getContext(); $this->_contextId = $context->getId(); $this->addCheck(new \PKP\form\validation\FormValidatorPost($this)); $this->addCheck(new \PKP\form\validation\FormValidatorCSRF($this)); } /** * @copydoc Form::fetch() * * @param null|mixed $template */ public function fetch($request, $template = null, $display = false) { $templateMgr = TemplateManager::getManager($request); $pubIdPlugins = PluginRegistry::loadCategory('pubIds', true, $this->getContextId()); $templateMgr->assign([ 'pubIdPlugins' => $pubIdPlugins, 'pubObject' => $this->getPubObject(), 'approval' => $this->getApproval(), 'confirmationText' => $this->getConfirmationText(), ]); if ($request->getUserVar('submissionId')) { $templateMgr->assign('submissionId', $request->getUserVar('submissionId')); } if ($request->getUserVar('publicationId')) { $templateMgr->assign('publicationId', $request->getUserVar('publicationId')); } return parent::fetch($request, $template, $display); } // // Getters and Setters // /** * Get the pub object * * @return object */ public function getPubObject() { return $this->_pubObject; } /** * Get weather it is an approval * * @return bool */ public function getApproval() { return $this->_approval; } /** * Get the context id * * @return int */ public function getContextId() { return $this->_contextId; } /** * Get the confirmation text. * * @return string */ public function getConfirmationText() { return $this->_confirmationText; } /** * @copydoc Form::readInputData() */ public function readInputData() { $pubIdPluginHelper = new PKPPubIdPluginHelper(); $pubIdPluginHelper->readAssignInputData($this); } /** * Assign pub ids. * * @param bool $save * true if the pub id shall be saved here * false if this form is integrated somewhere else, where the pub object will be updated. */ public function execute($save = false, ...$functionArgs) { parent::execute($save, ...$functionArgs); $pubObject = $this->getPubObject(); $pubIdPluginHelper = new PKPPubIdPluginHelper(); $pubIdPluginHelper->assignPubId($this->getContextId(), $this, $pubObject, $save); } }