classes/rt/ocs/form/VersionForm.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00015 //$Id$
00016 
00017 import('form.Form');
00018 
00019 class VersionForm extends Form {
00020 
00022    var $versionId;
00023 
00025    var $conferenceId;
00026 
00028    var $version;
00029 
00033    function VersionForm($versionId, $conferenceId) {
00034       parent::Form('rtadmin/version.tpl');
00035 
00036       $this->addCheck(new FormValidatorPost($this));
00037 
00038       $this->conferenceId = $conferenceId;
00039 
00040       $rtDao =& DAORegistry::getDAO('RTDAO');
00041       $this->version =& $rtDao->getVersion($versionId, $conferenceId);
00042 
00043       if (isset($this->version)) {
00044          $this->versionId = $versionId;
00045       }
00046    }
00047 
00051    function initData() {
00052       if (isset($this->version)) {
00053          $version =& $this->version;
00054          $this->_data = array(
00055             'key' => $version->getKey(),
00056             'title' => $version->getTitle(),
00057             'locale' => $version->getLocale(),
00058             'description' => $version->getDescription()
00059          );
00060       } else {
00061          $this->_data = array();
00062       }
00063    }
00064 
00068    function display() {
00069       $templateMgr =& TemplateManager::getManager();
00070 
00071       if (isset($this->version)) {
00072          $templateMgr->assign_by_ref('version', $this->version);
00073          $templateMgr->assign('versionId', $this->versionId);
00074       }
00075 
00076       $templateMgr->assign('helpTopicId', 'conference.generalManagement.readingTools.versions');
00077       parent::display();
00078    }
00079 
00080 
00084    function readInputData() {
00085       $this->readUserVars(
00086          array(
00087             'key',
00088             'title',
00089             'locale',
00090             'description'
00091          )
00092       );
00093    }
00094 
00099    function execute() {
00100       $rtDao =& DAORegistry::getDAO('RTDAO');
00101 
00102       $version = $this->version;
00103       if (!isset($version)) {
00104          $version = new RTVersion();
00105       }
00106 
00107       $version->setTitle($this->getData('title'));
00108       $version->setKey($this->getData('key'));
00109       $version->setLocale($this->getData('locale'));
00110       $version->setDescription($this->getData('description'));
00111 
00112       if (isset($this->version)) {
00113          $rtDao->updateVersion($this->conferenceId, $version);
00114       } else {
00115          $rtDao->insertVersion($this->conferenceId, $version);
00116          $this->versionId = $version->getVersionId();
00117       }
00118 
00119       return $this->versionId;
00120    }
00121 
00122 }
00123 
00124 ?>

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