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

Go to the documentation of this file.
00001 <?php
00002 
00015 //$Id$
00016 
00017 import('form.Form');
00018 
00019 class SearchForm extends Form {
00020 
00022    var $searchId;
00023 
00025    var $search;
00026 
00028    var $contextId;
00029 
00031    var $versionId;
00032 
00036    function SearchForm($searchId, $contextId, $versionId) {
00037       parent::Form('rtadmin/search.tpl');
00038 
00039       $this->addCheck(new FormValidatorPost($this));
00040 
00041       $rtDao =& DAORegistry::getDAO('RTDAO');
00042       $this->search =& $rtDao->getSearch($searchId);
00043 
00044       $this->contextId = $contextId;
00045       $this->versionId = $versionId;
00046 
00047       if (isset($this->search)) {
00048          $this->searchId = $searchId;
00049       }
00050    }
00051 
00055    function initData() {
00056       if (isset($this->search)) {
00057          $search =& $this->search;
00058          $this->_data = array(
00059             'url' => $search->getUrl(),
00060             'title' => $search->getTitle(),
00061             'searchUrl' => $search->getSearchUrl(),
00062             'description' => $search->getDescription(),
00063             'searchPost' => $search->getSearchPost(),
00064             'order' => $search->getOrder()
00065          );
00066       } else {
00067          $this->_data = array();
00068       }
00069    }
00070 
00074    function display() {
00075       $conference =& Request::getConference();
00076       $templateMgr =& TemplateManager::getManager();
00077 
00078       $templateMgr->assign('contextId', $this->contextId);
00079       $templateMgr->assign('versionId', $this->versionId);
00080 
00081       if (isset($this->search)) {
00082          $templateMgr->assign_by_ref('search', $this->search);
00083          $templateMgr->assign('searchId', $this->searchId);
00084       }
00085 
00086       $templateMgr->assign('helpTopicId', 'conference.generalManagement.readingTools.contexts');
00087       parent::display();
00088    }
00089 
00090 
00094    function readInputData() {
00095       $this->readUserVars(
00096          array(
00097             'url',
00098             'title',
00099             'order',
00100             'description',
00101             'searchUrl',
00102             'searchPost'
00103          )
00104       );
00105    }
00106 
00111    function execute() {
00112       $rtDao =& DAORegistry::getDAO('RTDAO');
00113 
00114       $search = $this->search;
00115       if (!isset($search)) {
00116          $search = new RTSearch();
00117          $search->setContextId($this->contextId);
00118       }
00119 
00120       $search->setTitle($this->getData('title'));
00121       $search->setUrl($this->getData('url'));
00122       $search->setSearchUrl($this->getData('searchUrl'));
00123       $search->setSearchPost($this->getData('searchPost'));
00124       $search->setDescription($this->getData('description'));
00125       if (!isset($this->search)) $search->setOrder(0);
00126 
00127       if (isset($this->search)) {
00128          $rtDao->updateSearch($search);
00129       } else {
00130          $rtDao->insertSearch($search);
00131          $this->searchId = $search->getSearchId();
00132       }
00133 
00134       return $this->searchId;
00135    }
00136 
00137 }
00138 
00139 ?>

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