本文整理汇总了PHP中NotificationManager::getFormattedNotificationsForUser方法的典型用法代码示例。如果您正苦于以下问题:PHP NotificationManager::getFormattedNotificationsForUser方法的具体用法?PHP NotificationManager::getFormattedNotificationsForUser怎么用?PHP NotificationManager::getFormattedNotificationsForUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NotificationManager
的用法示例。
在下文中一共展示了NotificationManager::getFormattedNotificationsForUser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: notificationFeed
/**
* Fetch the actual RSS feed
* @param $args array
* @param $request Request
*/
function notificationFeed($args, &$request)
{
if (isset($args[0]) && isset($args[1])) {
$type = $args[0];
$token = $args[1];
} else {
return false;
}
$this->setupTemplate(true);
$application = PKPApplication::getApplication();
$appName = $application->getNameKey();
$site =& $request->getSite();
$siteTitle = $site->getLocalizedTitle();
$notificationSubscriptionSettingsDao =& DAORegistry::getDAO('NotificationSubscriptionSettingsDAO');
$context =& $request->getContext();
$userId = $notificationSubscriptionSettingsDao->getUserIdByRSSToken($token, $context->getId());
// Make sure the feed type is specified and valid
$typeMap = array('rss' => 'rss.tpl', 'rss2' => 'rss2.tpl', 'atom' => 'atom.tpl');
$contentTypeMap = array('rss' => 'rssContent.tpl', 'rss2' => 'rss2Content.tpl', 'atom' => 'atomContent.tpl');
$mimeTypeMap = array('rss' => 'application/rdf+xml', 'rss2' => 'application/rss+xml', 'atom' => 'application/atom+xml');
if (!isset($typeMap[$type])) {
return false;
}
$notificationManager = new NotificationManager();
$notifications = $notificationManager->getFormattedNotificationsForUser($request, $userId, NOTIFICATION_LEVEL_NORMAL, $context->getId(), null, 'notification/' . $contentTypeMap[$type]);
$versionDao =& DAORegistry::getDAO('VersionDAO');
$version = $versionDao->getCurrentVersion();
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('version', $version->getVersionString());
$templateMgr->assign('selfUrl', $request->getCompleteUrl());
$templateMgr->assign('locale', AppLocale::getPrimaryLocale());
$templateMgr->assign('appName', $appName);
$templateMgr->assign('siteTitle', $siteTitle);
$templateMgr->assign_by_ref('formattedNotifications', $notifications);
$templateMgr->display('notification/' . $typeMap[$type], $mimeTypeMap[$type]);
return true;
}