classes/manager/form/ReviewFormForm.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00016 import('form.Form');
00017 
00018 class ReviewFormForm extends Form {
00019 
00021    var $reviewFormId;
00022 
00027    function ReviewFormForm($reviewFormId = null) {
00028       parent::Form('manager/reviewForms/reviewFormForm.tpl');
00029 
00030       $this->reviewFormId = $reviewFormId;
00031 
00032       // Validation checks for this form
00033       $this->addCheck(new FormValidatorLocale($this, 'title', 'required', 'manager.reviewForms.form.titleRequired'));
00034       $this->addCheck(new FormValidatorPost($this));
00035 
00036    }
00037 
00042    function getLocaleFieldNames() {
00043       $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
00044       return $reviewFormDao->getLocaleFieldNames();
00045    }
00046 
00050    function display() {
00051       $templateMgr =& TemplateManager::getManager();
00052       $templateMgr->assign('reviewFormId', $this->reviewFormId);
00053       $templateMgr->assign('helpTopicId','conference.managementPages.reviewForms');
00054       parent::display();
00055    }
00056 
00060    function initData() {
00061       if ($this->reviewFormId != null) {
00062          $conference =& Request::getConference();
00063          $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
00064          $reviewForm =& $reviewFormDao->getReviewForm($this->reviewFormId, ASSOC_TYPE_CONFERENCE, $conference->getId());
00065 
00066          if ($reviewForm == null) {
00067             $this->reviewFormId = null;
00068          } else {
00069             $this->_data = array(
00070                'title' => $reviewForm->getTitle(null), // Localized
00071                'description' => $reviewForm->getDescription(null) // Localized
00072             );
00073          }
00074       }
00075    }
00076 
00080    function readInputData() {
00081       $this->readUserVars(array('title', 'description'));
00082    }
00083 
00087    function execute() {
00088       $conference =& Request::getConference();
00089       $conferenceId = $conference->getId();
00090 
00091       $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
00092 
00093       if ($this->reviewFormId != null) {
00094          $reviewForm =& $reviewFormDao->getReviewForm($this->reviewFormId, ASSOC_TYPE_CONFERENCE, $conferenceId);
00095       }
00096 
00097       if (!isset($reviewForm)) {
00098          $reviewForm = $reviewFormDao->newDataObject();
00099 
00100          $reviewForm->setAssocType(ASSOC_TYPE_CONFERENCE);
00101          $reviewForm->setAssocId($conferenceId);
00102          $reviewForm->setActive(0);
00103          $reviewForm->setSequence(REALLY_BIG_NUMBER);
00104       }
00105 
00106       $reviewForm->setTitle($this->getData('title'), null); // Localized
00107       $reviewForm->setDescription($this->getData('description'), null); // Localized
00108 
00109       if ($reviewForm->getId() != null) {
00110          $reviewFormDao->updateObject($reviewForm);
00111          $reviewFormId = $reviewForm->getId();
00112       } else {
00113          $reviewFormId = $reviewFormDao->insertObject($reviewForm);
00114          $reviewFormDao->resequenceReviewForms(ASSOC_TYPE_CONFERENCE, $conferenceId);
00115       }
00116    }
00117 }
00118 
00119 ?>

Generated on 25 Jul 2013 for Open Conference Systems by  doxygen 1.4.7