plugins/generic/customBlockManager/CustomBlockEditForm.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00016 import('form.Form');
00017 
00018 class CustomBlockEditForm extends Form {
00020    var $conferenceId;
00021 
00023    var $plugin;
00024    
00026    var $errors;
00027 
00032    function CustomBlockEditForm(&$plugin, $conferenceId) {
00033 
00034       parent::Form($plugin->getTemplatePath() . 'editCustomBlockForm.tpl');
00035 
00036       $this->conferenceId = $conferenceId;
00037       $this->plugin =& $plugin;
00038 
00039       $this->addCheck(new FormValidatorPost($this));
00040       $this->addCheck(new FormValidator($this, 'blockContent', 'required', 'plugins.generic.customBlock.contentRequired'));
00041 
00042    }
00043 
00047    function initData() {
00048       $conferenceId = $this->conferenceId;
00049       $plugin =& $this->plugin;
00050 
00051       // add the tiny MCE script 
00052       $this->addTinyMCE();
00053       $this->setData('blockContent', $plugin->getSetting($conferenceId, 0, 'blockContent'));
00054    }
00055 
00059    function addTinyMCE() {
00060       $conferenceId = $this->conferenceId;
00061       $plugin =& $this->plugin;
00062       $templateMgr =& TemplateManager::getManager();
00063 
00064       // Enable TinyMCE with specific params
00065       $additionalHeadData = $templateMgr->get_template_vars('additionalHeadData');
00066 
00067       import('file.ConferenceFileManager');
00068       $publicFileManager = new PublicFileManager();
00069       $tinyMCE_script = '
00070       <script language="javascript" type="text/javascript" src="'.Request::getBaseUrl().'/'.TINYMCE_JS_PATH.'/tiny_mce.js"></script>
00071       <script language="javascript" type="text/javascript">
00072          tinyMCE.init({
00073          mode : "textareas",
00074          plugins : "style,paste",
00075          theme : "advanced",
00076          theme_advanced_buttons1 : "formatselect,fontselect,fontsizeselect",
00077          theme_advanced_buttons2 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,undo,redo,link,unlink",
00078          theme_advanced_buttons3 : "cut,copy,paste,pastetext,pasteword,|,cleanup,help,code,",
00079          theme_advanced_toolbar_location : "bottom",
00080          theme_advanced_toolbar_align : "left",
00081          content_css : "' . Request::getBaseUrl() . '/styles/common.css", 
00082          relative_urls : false,     
00083          document_base_url : "'. Request::getBaseUrl() .'/'.$publicFileManager->getConferenceFilesPath($conferenceId) .'/", 
00084          extended_valid_elements : "span[*], div[*]"
00085          });
00086       </script>';
00087 
00088       $templateMgr->assign('additionalHeadData', $additionalHeadData."\n".$tinyMCE_script);
00089 
00090    }
00091 
00095    function readInputData() {
00096       $this->readUserVars(array('blockContent'));
00097    }
00098 
00102    function save() {
00103       $plugin =& $this->plugin;
00104       $conferenceId = $this->conferenceId;
00105       $plugin->updateSetting($conferenceId, 0, 'blockContent', $this->getData('blockContent'));    
00106    }
00107 
00108 }
00109 ?>

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