本文整理汇总了PHP中Notifications::StoreJabber方法的典型用法代码示例。如果您正苦于以下问题:PHP Notifications::StoreJabber方法的具体用法?PHP Notifications::StoreJabber怎么用?PHP Notifications::StoreJabber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notifications
的用法示例。
在下文中一共展示了Notifications::StoreJabber方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send_reminders
function send_reminders()
{
global $db, $fs, $proj;
$notify = new Notifications();
$user = new User(0);
$now = time();
$get_reminders = $db->Query("SELECT r.*, t.*, u.*\n FROM {reminders} r\n INNER JOIN {users} u ON u.user_id = r.to_user_id\n INNER JOIN {tasks} t ON r.task_id = t.task_id\n INNER JOIN {projects} p ON t.project_id = p.project_id\n WHERE t.is_closed = '0'\n AND r.start_time < ?\n AND r.last_sent + r.how_often < ?\n ORDER BY r.reminder_id", array($now, $now));
while ($row = $db->FetchRow($get_reminders)) {
// So that the sender in emails will is the right project, not 'Default project'
// and also to get the projects default language, if needed.
$proj = new Project($row['project_id']);
$jabber_users = array();
$email_users = array();
if (($fs->prefs['user_notify'] == 1 || $fs->prefs['user_notify'] == 2) && ($row['notify_type'] == 1 || $row['notify_type'] == 3)) {
$email_users[] = $row['email_address'];
}
if (($fs->prefs['user_notify'] == 1 || $fs->prefs['user_notify'] == 3) && ($row['notify_type'] == 2 || $row['notify_type'] == 3)) {
$jabber_users[] = $row['jabber_id'];
}
if (!empty($row['lang_code'])) {
$lang = $row['lang_code'];
} else {
if (!empty($proj->prefs['lang_code'])) {
$lang = $proj->prefs['lang_code'];
} else {
$lang = $fs->prefs['lang_code'];
}
}
$subject = tL('notifyfromfs', $lang);
$message = $row['reminder_message'];
// Pass the recipients and message onto the notification function
$notify->SendEmail($email_users, $subject, $message);
$notify->StoreJabber($jabber_users, $subject, $message);
// Update the database with the time sent
$update_db = $db->Query("UPDATE {reminders}\n SET last_sent = ?\n WHERE reminder_id = ?", array(time(), $row['reminder_id']));
}
// send those stored notifications
$notify->SendJabber();
unset($notify, $user);
}