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


PHP Notifications::send_now方法代码示例

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


在下文中一共展示了Notifications::send_now方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: send_stored

 /**
  * Sends notifications already stored in the DB by send_later()
  * @access public
  * @return bool
  */
 function send_stored()
 {
     global $db;
     // First we get the messages in chronological order...
     $sql = $db->x->getAll('SELECT message_id, message_data FROM {notification_messages} ORDER BY time_created DESC');
     if (!count($sql)) {
         return true;
     }
     $stmt_rec = $db->prepare('SELECT nr.user_id, u.notify_type, u.notify_own, u.email_address,
                               u.jabber_id, u.notify_blacklist
                          FROM {notification_recipients} nr
                     LEFT JOIN {users} u ON nr.user_id = u.user_id
                         WHERE message_id = ?', array('integer'), MDB2_PREPARE_RESULT);
     $stmt_del_rec = $db->x->autoPrepare('{notification_recipients}', null, MDB2_AUTOQUERY_DELETE, 'message_id = ?');
     $stmt_del_messages = $db->x->autoPrepare('{notification_messages}', null, MDB2_AUTOQUERY_DELETE, 'message_id = ?');
     foreach ($sql as $row) {
         $data = unserialize($row['message_data']);
         $result_rec = $stmt_rec->execute($row['message_id']);
         $emails = array();
         $jids = array();
         foreach ($result_rec->fetchAll() as $msg) {
             Notifications::add_to_list($emails, $jids, $msg, $data['notify_type']);
         }
         if (Notifications::send_now(array($emails, $jids), ADDRESS_DONE, 0, $row)) {
             $stmt_del_rec->execute($row['message_id']);
             $stmt_del_messages->execute($row['message_id']);
         }
     }
     foreach (array('stmt_rec', 'stmt_del_rec', 'stmt_del_messages') as $stmt) {
         ${$stmt}->free();
     }
 }
开发者ID:negram,项目名称:flyspray,代码行数:37,代码来源:class.notify.php

示例2: sprintf

                 $closed[] = sprintf("%s#%d: %s (%s)\n-> %s %s (%s)", $project['project_prefix'], $row['prefix_id'], $row['item_summary'], $row['resolution_name'], L('openedby'), $row['real_name'], $row['user_name']);
                 break;
             case '13':
                 $reopened[] = sprintf("%s#%d: %s\n-> %s %s (%s)", $project['project_prefix'], $row['prefix_id'], $row['item_summary'], L('reopenedby'), $row['real_name'], $row['user_name']);
                 break;
             case '19':
                 $assigned[] = sprintf("%s#%d: %s\n-> %s %s (%s)", $project['project_prefix'], $row['prefix_id'], $row['item_summary'], L('assignedto'), $row['real_name'], $row['user_name']);
                 break;
         }
     }
     foreach (array('opened', 'closed', 'reopened', 'assigned') as $type) {
         if (count(${$type})) {
             $message .= L($type . 'tasks') . ':' . "\n" . implode("\n", ${$type}) . "\n\n";
         }
     }
     if (Notifications::send_now($pms, ADDRESS_USER, NOTIFY_DIGEST, array('message' => $message))) {
         $db->x->execParam('UPDATE {projects} SET last_digest = ? WHERE project_id = ?', array(time(), $project['project_id']));
     }
 }
 ############ Task four: Close tasks ############
 $tasks = $db->query('SELECT t.*, c.date_added, max(c.date_added) FROM {tasks} t
                 LEFT JOIN {comments} c ON t.task_id = c.task_id
                     WHERE is_closed = 0 AND close_after > 0
                  GROUP BY t.task_id');
 while ($row = $tasks->FetchRow()) {
     if (max($row['date_added'], $row['last_edited_time']) + $row['close_after'] < time()) {
         Backend::close_task($row['task_id'], $row['resolution_reason'], $row['closure_comment'], false);
         $db->x->execParam('UPDATE {tasks} SET close_after = 0 WHERE task_id = ?', $row['task_id']);
     }
 }
 //wait 10 minutes for the next loop.
开发者ID:negram,项目名称:flyspray,代码行数:31,代码来源:schedule.php


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