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