当前位置: 首页>>代码示例>>PHP>>正文


PHP Notifications::SendJabber方法代码示例

本文整理汇总了PHP中Notifications::SendJabber方法的典型用法代码示例。如果您正苦于以下问题:PHP Notifications::SendJabber方法的具体用法?PHP Notifications::SendJabber怎么用?PHP Notifications::SendJabber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Notifications的用法示例。


在下文中一共展示了Notifications::SendJabber方法的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);
}
开发者ID:krayon,项目名称:flyspray,代码行数:40,代码来源:schedule.php


注:本文中的Notifications::SendJabber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。