00001 <?php
00002
00015
00016
00017 import('plugins.BlockPlugin');
00018
00019 class UserBlockPlugin extends BlockPlugin {
00020 function register($category, $path) {
00021 $success = parent::register($category, $path);
00022 if ($success) {
00023 $this->addLocaleData();
00024 AppLocale::requireComponents(array(LOCALE_COMPONENT_PKP_USER));
00025 }
00026 return $success;
00027 }
00028
00033 function getSupportedContexts() {
00034 return array(BLOCK_CONTEXT_LEFT_SIDEBAR, BLOCK_CONTEXT_RIGHT_SIDEBAR);
00035 }
00036
00042 function getName() {
00043 return 'UserBlockPlugin';
00044 }
00045
00050 function getInstallSitePluginSettingsFile() {
00051 return $this->getPluginPath() . '/settings.xml';
00052 }
00053
00058 function getNewConferencePluginSettingsFile() {
00059 return $this->getPluginPath() . '/settings.xml';
00060 }
00061
00066 function getDisplayName() {
00067 return __('plugins.block.user.displayName');
00068 }
00069
00073 function getDescription() {
00074 return __('plugins.block.user.description');
00075 }
00076
00077 function getContents(&$templateMgr) {
00078 if (!defined('SESSION_DISABLE_INIT')) {
00079 $session =& Request::getSession();
00080 $templateMgr->assign_by_ref('userSession', $session);
00081 $templateMgr->assign('loggedInUsername', $session->getSessionVar('username'));
00082 $loginUrl = Request::url(null, null, 'login', 'signIn');
00083 if (Config::getVar('security', 'force_login_ssl')) {
00084 $loginUrl = String::regexp_replace('/^http:/', 'https:', $loginUrl);
00085 }
00086 $templateMgr->assign('userBlockLoginUrl', $loginUrl);
00087 }
00088 return parent::getContents($templateMgr);
00089 }
00090 }
00091
00092 ?>