addCheck(new FormValidatorPost($this)); $this->addCheck(new FormValidatorCSRF($this)); $this->_issue = $issue; } /** * Fetch the form. */ function fetch($request) { $templateMgr = TemplateManager::getManager($request); $templateMgr->assign(array( 'accessOptions' => array( ISSUE_ACCESS_OPEN => 'editor.issues.openAccess', ISSUE_ACCESS_SUBSCRIPTION => 'editor.issues.subscription', ), 'issueId' => $this->_issue->getId(), )); return parent::fetch($request); } /** * Initialize form data from current issue. * @param $request PKPRequest */ function initData($request) { $this->_data = array( 'accessStatus' => $this->_issue->getAccessStatus(), 'openAccessDate' => $this->_issue->getOpenAccessDate(), ); parent::initData(); } /** * Assign form data to user-submitted data. */ function readInputData() { $this->readUserVars(array( 'accessStatus', 'openAccessDate', )); } /** * Save issue settings. * @param $request PKPRequest * @return int Issue ID for created/updated issue */ function execute($request) { $journal = $request->getJournal(); $issueDao = DAORegistry::getDAO('IssueDAO'); $this->_issue->setAccessStatus($this->getData('accessStatus') ? $this->getData('accessStatus') : ISSUE_ACCESS_OPEN); if ($openAccessDate = $this->getData('openAccessDate')) $this->_issue->setOpenAccessDate($openAccessDate); else $this->_issue->setOpenAccessDate(null); HookRegistry::call('IssueAccessForm::execute', array($this, $this->_issue)); $issueDao->updateObject($this->_issue); } } ?>