pages/manager/ManagerSchedConfHandler.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00015 //$Id$
00016 
00017 import('pages.manager.ManagerHandler');
00018 
00019 class ManagerSchedConfHandler extends ManagerHandler {
00023    function ManagerSchedConfHandler() {
00024       parent::ManagerHandler();
00025    }
00026 
00030    function schedConfs() {
00031       $this->validate();
00032       $this->setupTemplate(true);
00033 
00034       $conference =& Request::getConference();
00035 
00036       $rangeInfo = Handler::getRangeInfo('schedConfs', array());
00037 
00038       $schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
00039       while (true) {
00040          $schedConfs =& $schedConfDao->getSchedConfsByConferenceId($conference->getId(), $rangeInfo);
00041          if ($schedConfs->isInBounds()) break;
00042          unset($rangeInfo);
00043          $rangeInfo =& $schedConfs->getLastPageRangeInfo();
00044          unset($schedConfs);
00045       }
00046 
00047       $templateMgr =& TemplateManager::getManager();
00048       $templateMgr->assign_by_ref('schedConfs', $schedConfs);
00049       $templateMgr->assign_by_ref('conference', $conference);
00050       $templateMgr->assign('helpTopicId', 'conference.generalManagement.scheduledConferences');
00051       $templateMgr->display('manager/schedConfs.tpl');
00052    }
00053 
00057    function createSchedConf() {
00058       import('schedConf.SchedConf');
00059       $schedConf = Request::getSchedConf();
00060       $conference = Request::getConference();
00061 
00062       if($schedConf) {
00063          $schedConfId = $schedConf->getId();
00064       } else {
00065          $schedConfId = null;
00066       }
00067 
00068       if($conference) {
00069          $conferenceId = $conference->getId();
00070       } else {
00071          $conferenceId = null;
00072       }
00073 
00074       ManagerSchedConfHandler::editSchedConf(array($conferenceId, $schedConfId));
00075    }
00076 
00081    function editSchedConf($args = array()) {
00082       $this->validate();
00083       $this->setupTemplate(true);
00084 
00085       import('manager.form.SchedConfSettingsForm');
00086 
00087       if (checkPhpVersion('5.0.0')) { // WARNING: This form needs $this in constructor
00088          $settingsForm = new SchedConfSettingsForm($args);
00089       } else {
00090          $settingsForm =& new SchedConfSettingsForm($args);
00091       }
00092       if ($settingsForm->isLocaleResubmit()) {
00093          $settingsForm->readInputData();
00094       } else {
00095          $settingsForm->initData();
00096       }
00097       $settingsForm->display();
00098    }
00099 
00103    function updateSchedConf() {
00104       $this->validate();
00105       $this->setupTemplate(true);
00106 
00107       import('manager.form.SchedConfSettingsForm');
00108 
00109       if (checkPhpVersion('5.0.0')) { // WARNING: This form needs $this in constructor
00110          $settingsForm = new SchedConfSettingsForm(
00111             array(Request::getUserVar('conferenceId'), Request::getUserVar('schedConfId'))
00112          );
00113       } else {
00114          $settingsForm =& new SchedConfSettingsForm(
00115             array(Request::getUserVar('conferenceId'), Request::getUserVar('schedConfId'))
00116          );
00117       }
00118       $settingsForm->readInputData();
00119 
00120       if ($settingsForm->validate()) {
00121          $settingsForm->execute();
00122          Request::redirect(null, null, null, 'schedConfs');
00123 
00124       } else {
00125          $settingsForm->display();
00126       }
00127    }
00128 
00133    function deleteSchedConf($args) {
00134       $this->validate();
00135 
00136       $schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
00137 
00138       if (isset($args) && !empty($args) && !empty($args[0])) {
00139          $schedConfId = $args[0];
00140          $schedConf =& $schedConfDao->getSchedConf($schedConfId);
00141 
00142          // Look up the scheduled conference path before we delete the scheduled conference.
00143          import('file.PublicFileManager');
00144          $publicFileManager = new PublicFileManager();
00145          $schedConfFilesPath = $publicFileManager->getSchedConfFilesPath($schedConfId);
00146 
00147          if ($schedConfDao->deleteSchedConfById($schedConfId)) {
00148             // Delete scheduled conference file tree
00149             // FIXME move this somewhere better.
00150             import('file.FileManager');
00151             $fileManager = new FileManager();
00152             $schedConfPath = Config::getVar('files', 'files_dir') . '/conferences/' . $schedConf->getConferenceId() . '/schedConfs/' . $schedConfId;
00153             $fileManager->rmtree($schedConfPath);
00154 
00155             $publicFileManager->rmtree($schedConfFilesPath);
00156          }
00157       }
00158 
00159       Request::redirect(null, null, null, 'schedConfs');
00160    }
00161 
00165    function moveSchedConf() {
00166       $this->validate();
00167 
00168       $conference =& Request::getConference();
00169 
00170       $schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
00171       $schedConf =& $schedConfDao->getSchedConf(Request::getUserVar('id'), $conference->getId());
00172       $direction = Request::getUserVar('d');
00173 
00174       if ($schedConf != null) {
00175          if ($direction != null) {
00176             // moving with up or down arrow
00177             $schedConf->setSequence($schedConf->getSequence() + ($direction == 'u' ? -1.5 : 1.5));
00178          } else {
00179             // Dragging and dropping onto another scheduled conference
00180             $prevId = Request::getUserVar('prevId');
00181             if ($prevId == null)
00182                $prevSeq = 0;
00183             else {
00184                $prevSchedConf = $schedConfDao->getConference($prevId, $conference->getId());
00185                $prevSeq = $prefSchedConf->getSequence();
00186             }
00187             $schedConf->setSequence($prevSeq + .5);
00188          }
00189          $schedConfDao->updateSchedConf($schedConf);
00190          $schedConfDao->resequenceSchedConfs($conference->getId());
00191       }
00192 
00193       // Moving up or down with the arrows requires a page reload.
00194       // In the case of a drag and drop move, the display has been
00195       // updated on the client side, so no reload is necessary.
00196       if ($direction != null) {
00197          Request::redirect(null, null, null, 'schedConfs');
00198       }
00199    }
00200 }
00201 
00202 ?>

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