00001 <?php
00002
00014 import('form.Form');
00015
00016 class SettingsForm extends Form {
00018 var $conferenceId;
00019
00021 var $plugin;
00022
00024 var $errors;
00025
00030 function SettingsForm(&$plugin, $conferenceId) {
00031
00032 parent::Form($plugin->getTemplatePath() . 'settingsForm.tpl');
00033
00034 $this->conferenceId = $conferenceId;
00035 $this->plugin =& $plugin;
00036
00037 }
00038
00042 function initData() {
00043 $conferenceId = $this->conferenceId;
00044 $plugin =& $this->plugin;
00045
00046 $templateMgr =& TemplateManager::getManager();
00047
00048 $blocks = $plugin->getSetting($conferenceId, 0, 'blocks');
00049
00050 if ( !is_array($blocks) ) {
00051 $this->setData('blocks', array());
00052 } else {
00053 $this->setData('blocks', $blocks);
00054 }
00055 }
00056
00060 function readInputData() {
00061 $this->readUserVars(
00062 array(
00063 'blocks',
00064 'deletedBlocks'
00065 )
00066 );
00067 }
00068
00072 function execute() {
00073 $plugin =& $this->plugin;
00074 $conferenceId = $this->conferenceId;
00075
00076 $pluginSettingsDAO =& DAORegistry::getDAO('PluginSettingsDAO');
00077
00078 $deletedBlocks = explode(':',$this->getData('deletedBlocks'));
00079 foreach ($deletedBlocks as $deletedBlock) {
00080 $pluginSettingsDAO->deleteSetting($conferenceId, 0, $deletedBlock.'CustomBlockPlugin', 'enabled');
00081 $pluginSettingsDAO->deleteSetting($conferenceId, 0, $deletedBlock.'CustomBlockPlugin', 'seq');
00082 $pluginSettingsDAO->deleteSetting($conferenceId, 0, $deletedBlock.'CustomBlockPlugin', 'context');
00083 $pluginSettingsDAO->deleteSetting($conferenceId, 0, $deletedBlock.'CustomBlockPlugin', 'blockContent');
00084 }
00085
00086
00087 $blocks = $this->getData('blocks');
00088 ksort($blocks);
00089
00090
00091 foreach ($blocks as $key => $value) {
00092 if (is_null($value) || trim($value)=="") {
00093 unset($blocks[$key]);
00094 }
00095 }
00096
00097
00098 $plugin->updateSetting($conferenceId, 0, 'blocks', $blocks);
00099 $this->setData('blocks',$blocks);
00100 }
00101 }
00102
00103 ?>