00001 <?php 00002 00015 // $Id$ 00016 00017 00018 import('plugins.BlockPlugin'); 00019 00020 class NotificationBlockPlugin extends BlockPlugin { 00021 function register($category, $path) { 00022 $success = parent::register($category, $path); 00023 if ($success) { 00024 $this->addLocaleData(); 00025 } 00026 return $success; 00027 } 00028 00033 function getEnabled() { 00034 if (!Config::getVar('general', 'installed')) return true; 00035 return parent::getEnabled(); 00036 } 00037 00042 function getInstallSitePluginSettingsFile() { 00043 return $this->getPluginPath() . '/settings.xml'; 00044 } 00045 00050 function getNewConferencePluginSettingsFile() { 00051 return $this->getPluginPath() . '/settings.xml'; 00052 } 00053 00058 function getSupportedContexts() { 00059 return array(BLOCK_CONTEXT_LEFT_SIDEBAR, BLOCK_CONTEXT_RIGHT_SIDEBAR); 00060 } 00061 00067 function getName() { 00068 return 'NotificationBlockPlugin'; 00069 } 00070 00075 function getDisplayName() { 00076 return __('plugins.block.notification.displayName'); 00077 } 00078 00082 function getDescription() { 00083 return __('plugins.block.notification.description'); 00084 } 00085 00086 00087 function getContents(&$templateMgr) { 00088 $user =& Request::getUser(); 00089 $conference =& Request::getConference(); 00090 00091 if ($user && $conference) { 00092 $userId = $user->getId(); 00093 $notificationDao =& DAORegistry::getDAO('NotificationDAO'); 00094 $templateMgr->assign('unreadNotifications', $notificationDao->getUnreadNotificationCount($userId)); 00095 } 00096 00097 return parent::getContents($templateMgr); 00098 } 00099 } 00100 00101 ?>
1.4.7