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

Go to the documentation of this file.
00001 <?php
00002 
00015 //$Id$
00016 
00017 import('form.Form');
00018 
00019 class ContextForm extends Form {
00020 
00022    var $contextId;
00023 
00025    var $context;
00026 
00028    var $versionId;
00029 
00033    function ContextForm($contextId, $versionId) {
00034       parent::Form('rtadmin/context.tpl');
00035 
00036       $this->addCheck(new FormValidatorPost($this));
00037 
00038       $rtDao =& DAORegistry::getDAO('RTDAO');
00039       $this->context =& $rtDao->getContext($contextId);
00040 
00041       $this->versionId = $versionId;
00042 
00043       if (isset($this->context)) {
00044          $this->contextId = $contextId;
00045       }
00046    }
00047 
00051    function initData() {
00052       if (isset($this->context)) {
00053          $context =& $this->context;
00054          $this->_data = array(
00055             'abbrev' => $context->getAbbrev(),
00056             'title' => $context->getTitle(),
00057             'order' => $context->getOrder(),
00058             'description' => $context->getDescription(),
00059             'authorTerms' => $context->getAuthorTerms(),
00060             'citedBy' => $context->getCitedBy(),
00061             'geoTerms' => $context->getGeoTerms(),
00062             'defineTerms' => $context->getDefineTerms()
00063          );
00064       } else {
00065          $this->_data = array();
00066       }
00067    }
00068 
00072    function display() {
00073       $conference =& Request::getConference();
00074       $templateMgr =& TemplateManager::getManager();
00075 
00076       $templateMgr->assign('versionId', $this->versionId);
00077 
00078       if (isset($this->context)) {
00079          $templateMgr->assign_by_ref('context', $this->context);
00080          $templateMgr->assign('contextId', $this->contextId);
00081       }
00082 
00083       $templateMgr->assign('helpTopicId', 'conference.generalManagement.readingTools.contexts');
00084       parent::display();
00085    }
00086 
00087 
00091    function readInputData() {
00092       $this->readUserVars(
00093          array(
00094             'abbrev',
00095             'title',
00096             'order',
00097             'description',
00098             'authorTerms',
00099             'citedBy',
00100             'defineTerms'
00101          )
00102       );
00103    }
00104 
00109    function execute() {
00110       $rtDao =& DAORegistry::getDAO('RTDAO');
00111 
00112       $context = $this->context;
00113       if (!isset($context)) {
00114          $context = new RTContext();
00115          $context->setVersionId($this->versionId);
00116       }
00117 
00118       $context->setTitle($this->getData('title'));
00119       $context->setAbbrev($this->getData('abbrev'));
00120       $context->setCitedBy($this->getData('citedBy')==true);
00121       $context->setAuthorTerms($this->getData('authorTerms')==true);
00122       $context->setGeoTerms($this->getData('geoTerms')==true);
00123       $context->setDefineTerms($this->getData('defineTerms')==true);
00124       $context->setDescription($this->getData('description'));
00125       if (!isset($this->context)) $context->setOrder(-1);
00126 
00127       if (isset($this->context)) {
00128          $rtDao->updateContext($context);
00129       } else {
00130          $rtDao->insertContext($context);
00131          $this->contextId = $context->getContextId();
00132       }
00133 
00134       return $this->contextId;
00135    }
00136 
00137 }
00138 
00139 ?>

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