validate() public method

Validate the form
public validate ( $request )
Ejemplo n.º 1
0
 /**
  * Edit the current issue form
  */
 function editIssue($args, $request)
 {
     $issueId = (int) array_shift($args);
     $this->validate($issueId, true);
     $issue =& $this->issue;
     $this->setupTemplate(EDITOR_SECTION_ISSUES);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('issueId', $issueId);
     $journal =& $request->getJournal();
     $journalId = $journal->getId();
     import('classes.issue.IssueAction');
     $templateMgr->assign('issueOptions', IssueAction::getIssueOptions());
     import('classes.issue.form.IssueForm');
     if (checkPhpVersion('5.0.0')) {
         // WARNING: This form needs $this in constructor
         $issueForm = new IssueForm('editor/issues/issueData.tpl');
     } else {
         $issueForm =& new IssueForm('editor/issues/issueData.tpl');
     }
     $issueForm->readInputData();
     if ($issueForm->validate($issue)) {
         $issueForm->execute($issueId);
         $issueForm->initData($issueId);
     }
     $templateMgr->assign_by_ref('issue', $issue);
     $templateMgr->assign('unpublished', !$issue->getPublished());
     $issueForm->display();
 }
Ejemplo n.º 2
0
 /**
  * Update a issue
  * @param $args array
  * @param $request PKPRequest
  * @return string Serialized JSON object
  */
 function updateIssue($args, $request)
 {
     $issue = $this->getAuthorizedContextObject(ASSOC_TYPE_ISSUE);
     import('controllers.grid.issues.form.IssueForm');
     $issueForm = new IssueForm($issue);
     $issueForm->readInputData();
     if ($issueForm->validate($request)) {
         $issueId = $issueForm->execute($request);
         return DAO::getDataChangedEvent($issueId);
     } else {
         $json = new JSONMessage(true, $issueForm->fetch($request));
         return $json->getString();
     }
 }
 /**
  * Edit the current issue form
  */
 function editIssue($args)
 {
     $issueId = isset($args[0]) ? (int) $args[0] : 0;
     $this->validate($issueId, true);
     $issue =& $this->issue;
     $this->setupTemplate(EDITOR_SECTION_ISSUES);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('issueId', $issueId);
     $journal =& Request::getJournal();
     $journalId = $journal->getId();
     import('classes.issue.IssueAction');
     $templateMgr->assign('issueOptions', IssueAction::getIssueOptions());
     import('classes.issue.form.IssueForm');
     if (checkPhpVersion('5.0.0')) {
         // WARNING: This form needs $this in constructor
         $issueForm = new IssueForm('editor/issues/issueData.tpl');
     } else {
         $issueForm =& new IssueForm('editor/issues/issueData.tpl');
     }
     $issueForm->readInputData();
     if ($issueForm->validate($issueId)) {
         $issueForm->execute($issueId);
         $issueForm->initData($issueId);
         //%CBP% add Issue ISBN to table
         $CBPPlatformDao =& DAORegistry::getDAO('CBPPlatformDAO');
         $CBPPlatformDao->setIssueISBN($issueId, Request::getUserVar('isbn'));
     }
     $templateMgr->assign_by_ref('issue', $issue);
     $templateMgr->assign('unpublished', !$issue->getPublished());
     $issueForm->display();
 }