• Main Page
  • Modules
  • Classes
  • Files
  • File List

plugins/blocks/languageToggle/LanguageToggleBlockPlugin.inc.php

00001 <?php
00002 
00017 import('lib.pkp.classes.plugins.BlockPlugin');
00018 
00019 class LanguageToggleBlockPlugin extends BlockPlugin {
00024    function getEnabled() {
00025       if (!Config::getVar('general', 'installed')) return true;
00026       return parent::getEnabled();
00027    }
00028 
00033    function getInstallSitePluginSettingsFile() {
00034       return $this->getPluginPath() . '/settings.xml';
00035    }
00036 
00041    function getContextSpecificPluginSettingsFile() {
00042       return $this->getPluginPath() . '/settings.xml';
00043    }
00044 
00050    function getBlockContext() {
00051       if (!Config::getVar('general', 'installed')) return BLOCK_CONTEXT_LEFT_SIDEBAR;
00052       return parent::getBlockContext();
00053    }
00054 
00059    function getSeq() {
00060       if (!Config::getVar('general', 'installed')) return 2;
00061       return parent::getSeq();
00062    }
00063 
00068    function getDisplayName() {
00069       return __('plugins.block.languageToggle.displayName');
00070    }
00071 
00075    function getDescription() {
00076       return __('plugins.block.languageToggle.description');
00077    }
00078 
00082    function getContents(&$templateMgr) {
00083       if (!defined('SESSION_DISABLE_INIT')) {
00084          $press =& Request::getPress();
00085          if (isset($press)) {
00086             $locales =& $press->getSupportedLocaleNames();
00087 
00088          } else {
00089             $site =& Request::getSite();
00090             $locales =& $site->getSupportedLocaleNames();
00091          }
00092       } else {
00093          $locales =& AppLocale::getAllLocales();
00094          $templateMgr->assign('languageToggleNoUser', true);
00095       }
00096 
00097       if (isset($locales) && count($locales) > 1) {
00098          $templateMgr->assign('enableLanguageToggle', true);
00099          $templateMgr->assign('languageToggleLocales', $locales);
00100       }
00101 
00102       return parent::getContents($templateMgr);
00103    }
00104 }
00105 
00106 ?>

Generated on Mon Sep 17 2012 13:58:56 for Open Monograph Press by  doxygen 1.7.1