本文整理汇总了PHP中NotificationManager::trigger方法的典型用法代码示例。如果您正苦于以下问题:PHP NotificationManager::trigger方法的具体用法?PHP NotificationManager::trigger怎么用?PHP NotificationManager::trigger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NotificationManager
的用法示例。
在下文中一共展示了NotificationManager::trigger方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
include '../EventManager.php';
include '../NotificationManager.php';
$eventManager = new EventManager();
$notify = new NotificationManager();
$notify->setEventManager($eventManager);
$notifications = array('user.new', 'transcript.save', 'item.new');
$notify->registerNotifications($notifications, array('NotificationController', 'send'));
class NotificationController
{
public static function send($params)
{
switch ($params['notification']) {
case 'user.new':
$username = $params['username'];
$adminemail = $params['adminemail'];
$useremail = $params['useremail'];
echo "New user {$username}, sending to {$adminemail} and {$useremail}\n";
break;
case 'transcript.save':
$username = $params['username'];
$item_id = $params['item_id'];
echo "Saving user {$username}'s transcript for item {$item_id}\n";
break;
}
}
}
$username = 'userbob';
$adminemail = 'test@gmail.com';
$useremail = 'user@gmail.com';
$notify->trigger('user.new', array('username' => $username, 'adminemail' => $adminemail, 'useremail' => $useremail));
$notify->trigger('transcript.save', array('username' => $username, 'item_id' => 523));