plugins/generic/customBlockManager/CustomBlockPlugin.inc.php

Go to the documentation of this file.
00001 <?php
00015 import('plugins.BlockPlugin');
00016 
00017 class CustomBlockPlugin extends BlockPlugin {
00018    var $blockName; 
00019    
00020    function CustomBlockPlugin($blockName) {
00021       $this->blockName = $blockName;
00022       return parent::BlockPlugin();
00023    }
00024    
00029    function &getManagerPlugin() {
00030       $plugin =& PluginRegistry::getPlugin('generic', 'CustomBlockManagerPlugin');
00031       return $plugin;
00032    }  
00037    function getPluginPath() {
00038       $plugin =& $this->getManagerPlugin();
00039       return $plugin->getPluginPath();
00040    }
00041 
00046    function getTemplatePath() {
00047       $plugin =& $this->getManagerPlugin();
00048       return $plugin->getTemplatePath();
00049    }
00050 
00055    function getEnabled() {
00056       if (!Config::getVar('general', 'installed')) return true;
00057       return parent::getEnabled();
00058    }
00059    
00060    function getManagementVerbs() {
00061       $verbs = parent::getManagementVerbs();
00062       if ($this->getEnabled()) {
00063          $verbs[] = array(
00064             'disable',
00065             __('manager.plugins.disable')
00066          );
00067          $verbs[] = array(
00068             'edit',
00069             __('plugins.generic.customBlock.edit')
00070          );       
00071       } else {
00072          $verbs[] = array(
00073             'enable',
00074             __('manager.plugins.enable')
00075          );
00076       }
00077       return $verbs;
00078    }
00079 
00083    function manage($verb, $args) {
00084       $returner = true;
00085 
00086       $templateMgr =& TemplateManager::getManager();
00087       $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
00088 
00089       $pageCrumbs = array(
00090          array(
00091             Request::url(null, 'user'),
00092             'navigation.user'
00093          ),
00094          array(
00095             Request::url(null, 'manager'),
00096             'user.role.manager'
00097          )
00098       );
00099       
00100       $conference =& Request::getConference();
00101 
00102       $this->import('CustomBlockEditForm');
00103       $form = new CustomBlockEditForm($this, $conference->getId());
00104       
00105       switch ($verb) {
00106          case 'enable':
00107             $this->setEnabled(true);
00108             break;
00109          case 'disable':
00110             $this->setEnabled(false);
00111             break;
00112          case 'edit':
00113             $pageCrumbs[] = array(
00114                Request::url(null, null, 'manager', 'plugins'),
00115                __('manager.plugins'),
00116                true
00117             );
00118                         
00119             $templateMgr->assign('pageHierarchy', $pageCrumbs);
00120             $form->initData();
00121             $form->display();
00122             exit;
00123 
00124          case 'save':
00125             $form->readInputData();
00126             if ($form->validate()) {                  
00127                $form->save();
00128                $pageCrumbs[] = array(Request::url(null, 'manager', 'plugins'), 'manager.plugins');
00129                $templateMgr->assign(array(
00130                   'currentUrl' => Request::url(null, null, null, array($this->getCategory(), $this->getName(), 'edit')),
00131                   'pageTitleTranslated' => $this->getDisplayName(),
00132                   'pageHierarchy' => $pageCrumbs, 
00133                   'message' => 'plugins.generic.customBlock.saved',
00134                   'backLink' => Request::url(null, null, 'manager', 'plugins'),
00135                   'backLinkLabel' => 'common.continue'
00136                ));
00137                $templateMgr->display('common/message.tpl');
00138                exit;
00139             } else {
00140                $form->addTinyMCE();
00141                $form->readInputData();
00142                $form->display();
00143                exit;
00144             }
00145          }
00146          $returner = false;   
00147    }
00148 
00154    function getContents(&$templateMgr) {
00155       $conference =& Request::getConference();
00156       if (!$conference) return '';
00157 
00158       $templateMgr->assign('customBlockContent', $this->getSetting($conference->getId(), 0, 'blockContent'));
00159       return parent::getContents($templateMgr);
00160 
00161    }
00162 
00168    function getBlockContext() {
00169       if (!Config::getVar('general', 'installed')) return BLOCK_CONTEXT_RIGHT_SIDEBAR;
00170       return parent::getBlockContext();
00171    }
00172 
00177    function getSupportedContexts() {
00178       return array(BLOCK_CONTEXT_LEFT_SIDEBAR, BLOCK_CONTEXT_RIGHT_SIDEBAR);
00179    }
00180 
00185    function getSeq() {
00186       if (!Config::getVar('general', 'installed')) return 1;
00187       return parent::getSeq();
00188    }
00189 
00195    function getName() {
00196       return $this->blockName . 'CustomBlockPlugin';
00197    }
00198 
00203    function getDisplayName() {
00204       return $this->blockName . ' ' . __('plugins.generic.customBlock.nameSuffix');
00205    }
00206 
00210    function getDescription() {
00211       return __('plugins.generic.customBlock.description');
00212    }
00213 }
00214 
00215 ?>

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