pages/rtadmin/RTSearchHandler.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00015 //$Id$
00016 
00017 import('rt.ocs.ConferenceRTAdmin');
00018 import('pages.rtadmin.RTAdminHandler');
00019 
00020 class RTSearchHandler extends RTAdminHandler {
00024    function RTSearchHandler() {
00025       parent::RTAdminHandler();
00026    }
00027    
00028    function createSearch($args) {
00029       $this->validate();
00030 
00031       $conference = Request::getConference();
00032 
00033       $rtDao =& DAORegistry::getDAO('RTDAO');
00034 
00035       $versionId = isset($args[0])?$args[0]:0;
00036       $version =& $rtDao->getVersion($versionId, $conference->getId());
00037       $contextId = isset($args[1])?$args[1]:0;
00038       $context =& $rtDao->getContext($contextId);
00039 
00040       import('rt.ocs.form.SearchForm');
00041       $searchForm = new SearchForm(null, $contextId, $versionId);
00042 
00043       if (isset($args[2]) && $args[2]=='save') {
00044          $searchForm->readInputData();
00045          $searchForm->execute();
00046          Request::redirect(null, null, null, 'searches', array($versionId, $contextId));
00047       } else {
00048          $this->setupTemplate(true, $version, $context);
00049          $searchForm->display();
00050       }
00051    }
00052 
00053    function searches($args) {
00054       $this->validate();
00055 
00056       $conference = Request::getConference();
00057 
00058       $rtDao =& DAORegistry::getDAO('RTDAO');
00059       $rangeInfo = Handler::getRangeInfo('searches');
00060 
00061       $versionId = isset($args[0])?$args[0]:0;
00062       $version =& $rtDao->getVersion($versionId, $conference->getId());
00063 
00064       $contextId = isset($args[1])?$args[1]:0;
00065       $context =& $rtDao->getContext($contextId);
00066 
00067       if ($context && $version && $context->getVersionId() == $version->getVersionId()) {
00068          $this->setupTemplate(true, $version, $context);
00069 
00070          $templateMgr =& TemplateManager::getManager();
00071 
00072          $templateMgr->assign_by_ref('version', $version);
00073          $templateMgr->assign_by_ref('context', $context);
00074          import('core.ArrayItemIterator');
00075          $templateMgr->assign_by_ref('searches', new ArrayItemIterator($context->getSearches(), $rangeInfo->getPage(), $rangeInfo->getCount()));
00076 
00077          $templateMgr->assign('helpTopicId', 'conference.generalManagement.readingTools.contexts');
00078          $templateMgr->display('rtadmin/searches.tpl');
00079       }
00080       else Request::redirect(null, null, null, 'versions');
00081    }
00082 
00083    function editSearch($args) {
00084       $this->validate();
00085 
00086       $rtDao =& DAORegistry::getDAO('RTDAO');
00087 
00088       $conference = Request::getConference();
00089       $versionId = isset($args[0])?$args[0]:0;
00090       $version =& $rtDao->getVersion($versionId, $conference->getId());
00091       $contextId = isset($args[1])?$args[1]:0;
00092       $context =& $rtDao->getContext($contextId);
00093       $searchId = isset($args[2])?$args[2]:0;
00094       $search =& $rtDao->getSearch($searchId);
00095 
00096       if (isset($version) && isset($context) && isset($search) && $context->getVersionId() == $version->getVersionId() && $search->getContextId() == $context->getContextId()) {
00097          import('rt.ocs.form.SearchForm');
00098          $this->setupTemplate(true, $version, $context, $search);
00099          $searchForm = new SearchForm($searchId, $contextId, $versionId);
00100          $searchForm->initData();
00101          $searchForm->display();
00102       }
00103       else Request::redirect(null, null, null, 'searches', array($versionId, $contextId));
00104 
00105 
00106    }
00107 
00108    function deleteSearch($args) {
00109       $this->validate();
00110 
00111       $rtDao =& DAORegistry::getDAO('RTDAO');
00112 
00113       $conference = Request::getConference();
00114       $versionId = isset($args[0])?$args[0]:0;
00115       $version =& $rtDao->getVersion($versionId, $conference->getId());
00116       $contextId = isset($args[1])?$args[1]:0;
00117       $context =& $rtDao->getContext($contextId);
00118       $searchId = isset($args[2])?$args[2]:0;
00119       $search =& $rtDao->getSearch($searchId);
00120 
00121       if (isset($version) && isset($context) && isset($search) && $context->getVersionId() == $version->getVersionId() && $search->getContextId() == $context->getContextId()) {
00122          $rtDao->deleteSearch($searchId, $contextId);
00123       }
00124 
00125       Request::redirect(null, null, null, 'searches', array($versionId, $contextId));
00126    }
00127 
00128    function saveSearch($args) {
00129       $this->validate();
00130 
00131       $rtDao =& DAORegistry::getDAO('RTDAO');
00132 
00133       $conference = Request::getConference();
00134       $versionId = isset($args[0])?$args[0]:0;
00135       $version =& $rtDao->getVersion($versionId, $conference->getId());
00136       $contextId = isset($args[1])?$args[1]:0;
00137       $context =& $rtDao->getContext($contextId);
00138       $searchId = isset($args[2])?$args[2]:0;
00139       $search =& $rtDao->getSearch($searchId);
00140 
00141       if (isset($version) && isset($context) && isset($search) && $context->getVersionId() == $version->getVersionId() && $search->getContextId() == $context->getContextId()) {
00142          import('rt.ocs.form.SearchForm');
00143          $searchForm = new SearchForm($searchId, $contextId, $versionId);
00144          $searchForm->readInputData();
00145          $searchForm->execute();
00146       }
00147 
00148       Request::redirect(null, null, null, 'searches', array($versionId, $contextId));
00149    }
00150 
00151    function moveSearch($args) {
00152       $this->validate();
00153 
00154       $rtDao =& DAORegistry::getDAO('RTDAO');
00155 
00156       $conference = Request::getConference();
00157       $versionId = isset($args[0])?$args[0]:0;
00158       $version =& $rtDao->getVersion($versionId, $conference->getId());
00159       $contextId = isset($args[1])?$args[1]:0;
00160       $context =& $rtDao->getContext($contextId);
00161       $searchId = isset($args[2])?$args[2]:0;
00162       $search =& $rtDao->getSearch($searchId);
00163 
00164       if (isset($version) && isset($context) && isset($search) && $context->getVersionId() == $version->getVersionId() && $search->getContextId() == $context->getContextId()) {
00165          $isDown = Request::getUserVar('dir')=='d';
00166          $search->setOrder($search->getOrder()+($isDown?1.5:-1.5));
00167          $rtDao->updateSearch($search);
00168          $rtDao->resequenceSearches($context->getContextId());
00169       }
00170 
00171       Request::redirect(null, null, null, 'searches', array($versionId, $contextId));
00172    }
00173 }
00174 
00175 ?>

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