00001 <?php
00002
00017 import('lib.pkp.classes.plugins.BlockPlugin');
00018
00019 class NotificationBlockPlugin 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
00049 function getDisplayName() {
00050 return __('plugins.block.notification.displayName');
00051 }
00052
00056 function getDescription() {
00057 return __('plugins.block.notification.description');
00058 }
00059
00060
00061 function getContents(&$templateMgr) {
00062 $user =& Request::getUser();
00063 $press =& Request::getPress();
00064
00065 if ($user && $press) {
00066 $userId = $user->getId();
00067 $notificationDao =& DAORegistry::getDAO('NotificationDAO');
00068 $templateMgr->assign('unreadNotifications', $notificationDao->getNotificationCount(false, $userId, $press->getId()));
00069 }
00070
00071 return parent::getContents($templateMgr);
00072 }
00073 }
00074
00075 ?>