pages/manager/TrackHandler.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00015 //$Id$
00016 
00017 import('pages.manager.ManagerHandler');
00018 
00019 class TrackHandler extends ManagerHandler {
00023    function TrackHandler() {
00024       parent::ManagerHandler();
00025    }
00029    function tracks() {
00030       $this->validate();
00031       $this->setupTemplate();
00032 
00033       $schedConf =& Request::getSchedConf();
00034       $rangeInfo =& Handler::getRangeInfo('tracks', array());
00035       $trackDao =& DAORegistry::getDAO('TrackDAO');
00036       while (true) {
00037          $tracks =& $trackDao->getSchedConfTracks($schedConf->getId(), $rangeInfo);
00038          if ($tracks->isInBounds()) break;
00039          unset($rangeInfo);
00040          $rangeInfo =& $tracks->getLastPageRangeInfo();
00041          unset($tracks);
00042       }
00043 
00044       $templateMgr =& TemplateManager::getManager();
00045       $templateMgr->assign('pageHierarchy', array(array(Request::url(null, null, 'manager'), 'manager.schedConfManagement')));
00046       $templateMgr->assign_by_ref('tracks', $tracks);
00047       $templateMgr->assign('helpTopicId','conference.currentConferences.tracks');
00048       $templateMgr->display('manager/tracks/tracks.tpl');
00049    }
00050 
00054    function createTrack() {
00055       $this->editTrack();
00056    }
00057 
00062    function editTrack($args = array()) {
00063       $this->validate();
00064       $this->setupTemplate(true);
00065 
00066       import('manager.form.TrackForm');
00067 
00068       $trackForm = new TrackForm(!isset($args) || empty($args) ? null : $args[0]);
00069       if ($trackForm->isLocaleResubmit()) {
00070          $trackForm->readInputData();
00071       } else {
00072          $trackForm->initData();
00073       }
00074       $trackForm->display();
00075    }
00076 
00080    function updateTrack() {
00081       parent::validate();
00082       $this->setupTemplate(true);
00083 
00084       import('manager.form.TrackForm');
00085 
00086       $trackForm = new TrackForm(Request::getUserVar('trackId'));
00087       $trackForm->readInputData();
00088 
00089       if ($trackForm->validate()) {
00090          $trackForm->execute();
00091          Request::redirect(null, null, null, 'tracks');
00092       } else {
00093          $trackForm->display();
00094       }
00095    }
00096 
00101    function deleteTrack($args) {
00102       $this->validate();
00103 
00104       $schedConf =& Request::getSchedConf();
00105       if (isset($args) && !empty($args)) {
00106          $trackDao =& DAORegistry::getDAO('TrackDAO');
00107          $trackDao->deleteTrackById($args[0], $schedConf->getId());
00108       }
00109 
00110       Request::redirect(null, null, null, 'tracks');
00111    }
00112 
00116    function moveTrack() {
00117       $this->validate();
00118 
00119       $schedConf =& Request::getSchedConf();
00120       $trackDao =& DAORegistry::getDAO('TrackDAO');
00121       $track =& $trackDao->getTrack(Request::getUserVar('trackId'), $schedConf->getId());
00122 
00123       if ($track != null) {
00124          $track->setSequence($track->getSequence() + (Request::getUserVar('d') == 'u' ? -1.5 : 1.5));
00125          $trackDao->updateTrack($track);
00126          $trackDao->resequenceTracks($schedConf->getId());
00127       }
00128 
00129       Request::redirect(null, null, null, 'tracks');
00130    }
00131 
00132    function setupTemplate($subclass = false){
00133       AppLocale::requireComponents(array(LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_PKP_READER));
00134       parent::setupTemplate(true);
00135       if ($subclass) {
00136          $templateMgr =& TemplateManager::getManager();
00137          $templateMgr->append('pageHierarchy', array(Request::url(null, null, 'manager', 'tracks'), 'track.tracks'));
00138       }
00139    }
00140 }
00141 
00142 ?>

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