pages/rtadmin/RTVersionHandler.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 RTVersionHandler extends RTAdminHandler {
00024    function RTVersionHandler() {
00025       parent::RTAdminHandler();
00026    }
00027    
00028    function createVersion($args) {
00029       $this->validate();
00030 
00031       $rtDao =& DAORegistry::getDAO('RTDAO');
00032 
00033       $conference = Request::getConference();
00034 
00035       import('rt.ocs.form.VersionForm');
00036       $versionForm = new VersionForm(null, $conference->getId());
00037 
00038       if (isset($args[0]) && $args[0]=='save') {
00039          $versionForm->readInputData();
00040          $versionForm->execute();
00041          Request::redirect(null, null, null, 'versions');
00042       } else {
00043          $this->setupTemplate(true);
00044          $versionForm->display();
00045       }
00046    }
00047 
00048    function exportVersion($args) {
00049       $this->validate();
00050 
00051       $rtDao =& DAORegistry::getDAO('RTDAO');
00052 
00053       $conference = Request::getConference();
00054       $versionId = isset($args[0])?$args[0]:0;
00055       $version =& $rtDao->getVersion($versionId, $conference->getId());
00056 
00057       if ($version) {
00058          $templateMgr =& TemplateManager::getManager();
00059          $templateMgr->assign_by_ref('version', $version);
00060 
00061          $templateMgr->display('rtadmin/exportXml.tpl', 'application/xml');
00062       }
00063       else Request::redirect(null, null, null, 'versions');
00064    }
00065 
00066    function importVersion() {
00067       $this->validate();
00068       $conference =& Request::getConference();
00069 
00070       $fileField = 'versionFile';
00071       if (isset($_FILES[$fileField]['tmp_name']) && is_uploaded_file($_FILES[$fileField]['tmp_name'])) {
00072          $rtAdmin = new ConferenceRTAdmin($conference->getId());
00073          $rtAdmin->importVersion($_FILES[$fileField]['tmp_name']);
00074       }
00075       Request::redirect(null, null, null, 'versions');
00076    }
00077 
00078    function restoreVersions() {
00079       $this->validate();
00080 
00081       $conference =& Request::getConference();
00082       $rtAdmin = new ConferenceRTAdmin($conference->getId());
00083       $rtAdmin->restoreVersions();
00084 
00085       // If the conference RT was configured, change its state to
00086       // "disabled" because the RT version it was configured for
00087       // has now been deleted.
00088       $rtDao =& DAORegistry::getDAO('RTDAO');
00089       $conferenceRt = $rtDao->getConferenceRTByConference($conference);
00090       if ($conferenceRt) {
00091          $conferenceRt->setVersion(null);
00092          $rtDao->updateConferenceRT($conferenceRt);
00093       }
00094 
00095       Request::redirect(null, null, null, 'versions');
00096    }
00097 
00098    function versions() {
00099       $this->validate();
00100       $this->setupTemplate(true);
00101 
00102       $conference = Request::getConference();
00103 
00104       $rtDao =& DAORegistry::getDAO('RTDAO');
00105       $rangeInfo = Handler::getRangeInfo('versions');
00106 
00107       $templateMgr =& TemplateManager::getManager();
00108       $templateMgr->assign_by_ref('versions', $rtDao->getVersions($conference->getId(), $rangeInfo));
00109       $templateMgr->assign('helpTopicId', 'conference.generalManagement.readingTools.versions');
00110       $templateMgr->display('rtadmin/versions.tpl');
00111    }
00112 
00113    function editVersion($args) {
00114       $this->validate();
00115 
00116       $rtDao =& DAORegistry::getDAO('RTDAO');
00117 
00118       $conference = Request::getConference();
00119       $versionId = isset($args[0])?$args[0]:0;
00120       $version =& $rtDao->getVersion($versionId, $conference->getId());
00121 
00122       if (isset($version)) {
00123          import('rt.ocs.form.VersionForm');
00124          $this->setupTemplate(true, $version);
00125          $versionForm = new VersionForm($versionId, $conference->getId());
00126          $versionForm->initData();
00127          $versionForm->display();
00128       }
00129       else Request::redirect(null, null, null, 'versions');
00130    }
00131 
00132    function deleteVersion($args) {
00133       $this->validate();
00134 
00135       $rtDao =& DAORegistry::getDAO('RTDAO');
00136 
00137       $conference = Request::getConference();
00138       $versionId = isset($args[0])?$args[0]:0;
00139 
00140       $rtDao->deleteVersion($versionId, $conference->getId());
00141 
00142       Request::redirect(null, null, null, 'versions');
00143    }
00144 
00145    function saveVersion($args) {
00146       $this->validate();
00147 
00148       $rtDao =& DAORegistry::getDAO('RTDAO');
00149 
00150       $conference = Request::getConference();
00151       $versionId = isset($args[0])?$args[0]:0;
00152       $version =& $rtDao->getVersion($versionId, $conference->getId());
00153 
00154       if (isset($version)) {
00155          import('rt.ocs.form.VersionForm');
00156          $versionForm = new VersionForm($versionId, $conference->getId());
00157          $versionForm->readInputData();
00158          $versionForm->execute();
00159       }
00160 
00161       Request::redirect(null, null, null, 'versions');
00162    }
00163 }
00164 
00165 ?>

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