pages/admin/AdminConferenceHandler.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00015 //$Id$
00016 
00017 import('pages.admin.AdminHandler');
00018 
00019 class AdminConferenceHandler extends AdminHandler {
00023    function AdminConferenceHandler() {
00024       parent::AdminHandler();
00025    }
00026 
00030    function conferences() {
00031       $this->validate();
00032       $this->setupTemplate(true);
00033 
00034       $rangeInfo = Handler::getRangeInfo('conferences');
00035 
00036       $conferenceDao =& DAORegistry::getDAO('ConferenceDAO');
00037       $conferences =& $conferenceDao->getConferences($rangeInfo);
00038 
00039       $templateMgr =& TemplateManager::getManager();
00040       $templateMgr->assign_by_ref('conferences', $conferences);
00041       $templateMgr->assign('helpTopicId', 'site.siteManagement');
00042       $templateMgr->display('admin/conferences.tpl');
00043    }
00044 
00048    function createConference() {
00049       AdminConferenceHandler::editConference();
00050    }
00051 
00056    function editConference($args = array()) {
00057       $this->validate();
00058       $this->setupTemplate(true);
00059 
00060       import('admin.form.ConferenceSiteSettingsForm');
00061 
00062       if (checkPhpVersion('5.0.0')) { // WARNING: This form needs $this in constructor
00063          $settingsForm = new ConferenceSiteSettingsForm(!isset($args) || empty($args) ? null : $args[0]);
00064       } else {
00065          $settingsForm =& new ConferenceSiteSettingsForm(!isset($args) || empty($args) ? null : $args[0]);
00066       }
00067       if ($settingsForm->isLocaleResubmit()) {
00068          $settingsForm->readInputData();
00069       } else {
00070          $settingsForm->initData();
00071       }
00072       $settingsForm->display();
00073    }
00074 
00080    function updateConference($args, &$request) {
00081       $this->validate();
00082       $this->setupTemplate(true);
00083 
00084       import('admin.form.ConferenceSiteSettingsForm');
00085 
00086       if (checkPhpVersion('5.0.0')) { // WARNING: This form needs $this in constructor
00087          $settingsForm = new ConferenceSiteSettingsForm($request->getUserVar('conferenceId'));
00088       } else {
00089          $settingsForm =& new ConferenceSiteSettingsForm($request->getUserVar('conferenceId'));
00090       }
00091       $settingsForm->readInputData();
00092 
00093       if ($settingsForm->validate()) {
00094          PluginRegistry::loadCategory('blocks');
00095          $settingsForm->execute();
00096          import('notification.NotificationManager');
00097          $notificationManager = new NotificationManager();
00098          $notificationManager->createTrivialNotification('notification.notification', 'common.changesSaved');
00099          $request->redirect(null, null, null, 'conferences');
00100       } else {
00101          $settingsForm->display();
00102       }
00103    }
00104 
00109    function deleteConference($args, &$request) {
00110       $this->validate();
00111 
00112       $conferenceDao =& DAORegistry::getDAO('ConferenceDAO');
00113 
00114       if (isset($args) && !empty($args) && !empty($args[0])) {
00115          $conferenceId = $args[0];
00116          if ($conferenceDao->deleteConferenceById($conferenceId)) {
00117             // Delete conference file tree
00118             // FIXME move this somewhere better.
00119             import('file.FileManager');
00120             $fileManager = new FileManager();
00121 
00122             $conferencePath = Config::getVar('files', 'files_dir') . '/conferences/' . $conferenceId;
00123             $fileManager->rmtree($conferencePath);
00124 
00125             import('file.PublicFileManager');
00126             $publicFileManager = new PublicFileManager();
00127             $publicFileManager->rmtree($publicFileManager->getConferenceFilesPath($conferenceId));
00128          }
00129       }
00130 
00131       $request->redirect(null, null, null, 'conferences');
00132    }
00133 
00139    function moveConference($args, &$request) {
00140       $this->validate();
00141 
00142       $conferenceDao =& DAORegistry::getDAO('ConferenceDAO');
00143       $conference =& $conferenceDao->getConference($request->getUserVar('id'));
00144 
00145       if ($conference != null) {
00146          $direction = $request->getUserVar('d');
00147          if ($direction != null) {
00148             // moving with up or down arrow
00149             $conference->setSequence($conference->getSequence() + ($direction == 'u' ? -1.5 : 1.5));
00150          } else {
00151             // Dragging and dropping onto another conference
00152             $prevId = $request->getUserVar('prevId');
00153             if ($prevId == null)
00154                $prevSeq = 0;
00155             else {
00156                $prevConference = $conferenceDao->getConference($prevId);
00157                $prevSeq = $prevConference->getSequence();
00158             }
00159             $conference->setSequence($prevSeq + .5);
00160          }
00161          $conferenceDao->updateConference($conference);
00162          $conferenceDao->resequenceConferences();
00163       }
00164 
00165       // Moving up or down with the arrows requires a page reload.
00166       // In the case of a drag and drop move, the display has been
00167       // updated on the client side, so no reload is necessary.
00168       if ($direction != null) {
00169          $request->redirect(null, null, null, 'conferences');
00170       }
00171    }
00172 
00176    function importOCS1() {
00177       $this->validate();
00178       $this->setupTemplate(true);
00179 
00180       import('admin.form.ImportOCS1Form');
00181 
00182       $importForm = new ImportOCS1Form();
00183       $importForm->initData();
00184       $importForm->display();
00185    }
00186 
00192    function doImportOCS1($args, &$request) {
00193       $this->validate();
00194       $this->setupTemplate(true);
00195 
00196       import('admin.form.ImportOCS1Form');
00197 
00198       $importForm = new ImportOCS1Form();
00199       $importForm->readInputData();
00200 
00201       if ($importForm->validate() && ($conferenceId = $importForm->execute()) !== false) {
00202          $conflicts = $importForm->getConflicts();
00203          $errors = $importForm->getErrors();
00204          if (!empty($conflicts) || !empty($errors)) {
00205             $templateMgr =& TemplateManager::getManager();
00206             $templateMgr->assign('conferenceId', $conferenceId);
00207             $templateMgr->assign('conflicts', $conflicts);
00208             $templateMgr->assign('errors', $errors);
00209             $templateMgr->display('admin/importConflicts.tpl');
00210          } else {
00211             $request->redirect(null, null, null, 'editConference', $conferenceId);
00212          }
00213       } else {
00214          $importForm->display();
00215       }
00216    }
00217 }
00218 
00219 ?>

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