本文整理匯總了PHP中FrontendNavigation::getBackendURLForBlock方法的典型用法代碼示例。如果您正苦於以下問題:PHP FrontendNavigation::getBackendURLForBlock方法的具體用法?PHP FrontendNavigation::getBackendURLForBlock怎麽用?PHP FrontendNavigation::getBackendURLForBlock使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FrontendNavigation
的用法示例。
在下文中一共展示了FrontendNavigation::getBackendURLForBlock方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: notifyAdmin
/**
* Notify the admin
*
* @return void
* @param array $comment The comment that was submitted.
*/
public static function notifyAdmin(array $comment)
{
// don't notify admin in case of spam
if ($comment['status'] == 'spam') {
return;
}
// build data for pushnotification
if ($comment['status'] == 'moderation') {
$alert = array('loc-key' => 'NEW_COMMENT_TO_MODERATE');
} else {
$alert = array('loc-key' => 'NEW_COMMENT');
}
// get count of unmoderated items
$badge = (int) FrontendModel::getDB()->getVar('SELECT COUNT(i.id)
FROM blog_comments AS i
WHERE i.status = ? AND i.language = ?
GROUP BY i.status', array('moderation', FRONTEND_LANGUAGE));
// reset if needed
if ($badge == 0) {
$badge = null;
}
// build data
$data = array('data' => array('endpoint' => SITE_URL . '/api/1.0', 'comment_id' => $comment['id']));
// push it
FrontendModel::pushToAppleApp($alert, $badge, null, $data);
// get settings
$notifyByMailOnComment = FrontendModel::getModuleSetting('blog', 'notify_by_email_on_new_comment', false);
$notifyByMailOnCommentToModerate = FrontendModel::getModuleSetting('blog', 'notify_by_email_on_new_comment_to_moderate', false);
// create URLs
$URL = SITE_URL . FrontendNavigation::getURLForBlock('blog', 'detail') . '/' . $comment['post_url'] . '#comment-' . $comment['id'];
$backendURL = SITE_URL . FrontendNavigation::getBackendURLForBlock('comments', 'blog') . '#tabModeration';
// notify on all comments
if ($notifyByMailOnComment) {
// comment to moderate
if ($comment['status'] == 'moderation') {
// set variables
$variables['message'] = vsprintf(FL::msg('BlogEmailNotificationsNewCommentToModerate'), array($comment['author'], $URL, $comment['post_title'], $backendURL));
} elseif ($comment['status'] == 'published') {
// set variables
$variables['message'] = vsprintf(FL::msg('BlogEmailNotificationsNewComment'), array($comment['author'], $URL, $comment['post_title']));
}
// send the mail
FrontendMailer::addEmail(FL::msg('NotificationSubject'), FRONTEND_CORE_PATH . '/layout/templates/mails/notification.tpl', $variables);
} elseif ($notifyByMailOnCommentToModerate && $comment['status'] == 'moderation') {
// set variables
$variables['message'] = vsprintf(FL::msg('BlogEmailNotificationsNewCommentToModerate'), array($comment['author'], $URL, $comment['post_title'], $backendURL));
// send the mail
FrontendMailer::addEmail(FL::msg('NotificationSubject'), FRONTEND_CORE_PATH . '/layout/templates/mails/notification.tpl', $variables);
}
}