classes/manager/form/setup/ConferenceSetupStep4Form.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00015 //$Id$
00016 
00017 import("manager.form.setup.ConferenceSetupForm");
00018 
00019 class ConferenceSetupStep4Form extends ConferenceSetupForm {
00023    function ConferenceSetupStep4Form() {
00024       parent::ConferenceSetupForm(4, array(
00025          'conferenceTheme' => 'string'
00026       ));
00027    }
00028 
00032    function display() {
00033       $conference =& Request::getConference();
00034 
00035       $allThemes =& PluginRegistry::loadCategory('themes', true);
00036       $conferenceThemes = array();
00037       foreach ($allThemes as $key => $junk) {
00038          $plugin =& $allThemes[$key]; // by ref
00039          $conferenceThemes[basename($plugin->getPluginPath())] =& $plugin;
00040          unset($plugin);
00041       }
00042 
00043       // Ensure upload file settings are reloaded when the form is displayed.
00044       $templateMgr =& TemplateManager::getManager();
00045       $templateMgr->assign(array(
00046          'conferenceStyleSheet' => $conference->getSetting('conferenceStyleSheet'),
00047          'conferenceThemes' => $conferenceThemes
00048       ));
00049 
00050       // Make lists of the sidebar blocks available.
00051       $templateMgr->initialize();
00052       $leftBlockPlugins = $disabledBlockPlugins = $rightBlockPlugins = array();
00053       $plugins =& PluginRegistry::getPlugins('blocks');
00054       foreach ($plugins as $key => $junk) {
00055          if (!$plugins[$key]->getEnabled() || $plugins[$key]->getBlockContext() == '') {
00056             if (count(array_intersect($plugins[$key]->getSupportedContexts(), array(BLOCK_CONTEXT_LEFT_SIDEBAR, BLOCK_CONTEXT_RIGHT_SIDEBAR))) > 0) $disabledBlockPlugins[] =& $plugins[$key];
00057          } else switch ($plugins[$key]->getBlockContext()) {
00058             case BLOCK_CONTEXT_LEFT_SIDEBAR:
00059                $leftBlockPlugins[] =& $plugins[$key];
00060                break;
00061             case BLOCK_CONTEXT_RIGHT_SIDEBAR:
00062                $rightBlockPlugins[] =& $plugins[$key];
00063                break;
00064          }
00065       }
00066       $templateMgr->assign(array(
00067          'disabledBlockPlugins' => &$disabledBlockPlugins,
00068          'leftBlockPlugins' => &$leftBlockPlugins,
00069          'rightBlockPlugins' => &$rightBlockPlugins
00070       ));
00071 
00072       parent::display();
00073    }
00074 
00079    function uploadStyleSheet($settingName) {
00080       $conference =& Request::getConference();
00081       $settingsDao =& DAORegistry::getDAO('ConferenceSettingsDAO');
00082 
00083       import('file.PublicFileManager');
00084       $fileManager = new PublicFileManager();
00085       if ($fileManager->uploadError($settingName)) return false;
00086       if ($fileManager->uploadedFileExists($settingName)) {
00087          $type = $fileManager->getUploadedFileType($settingName);
00088          if ($type != 'text/plain' && $type != 'text/css') {
00089             return false;
00090          }
00091          $uploadName = $settingName . '.css';
00092          if($fileManager->uploadConferenceFile($conference->getId(), $settingName, $uploadName)) {
00093             $value = array(
00094                'name' => $fileManager->getUploadedFileName($settingName),
00095                'uploadName' => $uploadName,
00096                'dateUploaded' => date("Y-m-d g:i:s")
00097             );
00098 
00099             $settingsDao->updateSetting($conference->getId(), $settingName, $value, 'object');
00100             return true;
00101          }
00102       }
00103       return false;
00104    }
00105 
00109    function execute() {
00110       // Save the block plugin layout settings.
00111       $blockVars = array('blockSelectLeft', 'blockUnselected', 'blockSelectRight');
00112       foreach ($blockVars as $varName) {
00113          $$varName = array_map('urldecode', split(' ', Request::getUserVar($varName)));
00114       }
00115 
00116       $plugins =& PluginRegistry::loadCategory('blocks');
00117       foreach ($plugins as $key => $junk) {
00118          $plugin =& $plugins[$key]; // Ref hack
00119          $plugin->setEnabled(!in_array($plugin->getName(), $blockUnselected));
00120          if (in_array($plugin->getName(), $blockSelectLeft)) {
00121             $plugin->setBlockContext(BLOCK_CONTEXT_LEFT_SIDEBAR);
00122             $plugin->setSeq(array_search($key, $blockSelectLeft));
00123          }
00124          else if (in_array($plugin->getName(), $blockSelectRight)) {
00125             $plugin->setBlockContext(BLOCK_CONTEXT_RIGHT_SIDEBAR);
00126             $plugin->setSeq(array_search($key, $blockSelectRight));
00127          }
00128          unset($plugin);
00129       }
00130 
00131       return parent::execute();
00132    }
00133 }
00134 
00135 ?>

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