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


PHP Notifications::Create方法代码示例

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


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

示例1: create

function create($info, $data)
{
    $notifications = new Notifications();
    $notifications->info = $info;
    $notifications->data = $data;
    return $notifications->Create();
}
开发者ID:vinigomescunha,项目名称:Sistema-Baseado-em-Partes-com-MySQL,代码行数:7,代码来源:index.php

示例2: create_task


//.........这里部分代码省略.........
     #array_unshift($sql_values, $task_id);
     $sql_keys_string = join(', ', $sql_keys);
     $sql_placeholder = $db->fill_placeholders($sql_values);
     $result = $db->Query("INSERT INTO {tasks}\n                                ({$sql_keys_string})\n                         VALUES ({$sql_placeholder})", $sql_values);
     $task_id = $db->Insert_ID();
     Backend::upload_links($task_id);
     // create tags
     if (isset($args['tags'])) {
         $tagList = explode(';', $args['tags']);
         $tagList = array_map('strip_tags', $tagList);
         $tagList = array_map('trim', $tagList);
         $tagList = array_unique($tagList);
         # avoid duplicates for inputs like: "tag1;tag1" or "tag1; tag1<p></p>"
         foreach ($tagList as $tag) {
             if ($tag == '') {
                 continue;
             }
             # old tag feature
             #$result2 = $db->Query("INSERT INTO {tags} (task_id, tag) VALUES (?,?)",array($task_id,$tag));
             # new tag feature. let's do it in 2 steps, it is getting too complicated to make it cross database compatible, drawback is possible (rare) race condition (use transaction?)
             $res = $db->Query("SELECT tag_id FROM {list_tag} WHERE (project_id=0 OR project_id=?) AND tag_name LIKE ? ORDER BY project_id", array($proj->id, $tag));
             if ($t = $db->FetchRow($res)) {
                 $tag_id = $t['tag_id'];
             } else {
                 if ($proj->prefs['freetagging'] == 1) {
                     # add to taglist of the project
                     $db->Query("INSERT INTO {list_tag} (project_id,tag_name) VALUES (?,?)", array($proj->id, $tag));
                     $tag_id = $db->Insert_ID();
                 } else {
                     continue;
                 }
             }
             $db->Query("INSERT INTO {task_tag}(task_id,tag_id) VALUES(?,?)", array($task_id, $tag_id));
         }
     }
     // Log the assignments and send notifications to the assignees
     if (isset($args['rassigned_to']) && is_array($args['rassigned_to'])) {
         // Convert assigned_to and store them in the 'assigned' table
         foreach ($args['rassigned_to'] as $val) {
             $db->Replace('{assigned}', array('user_id' => $val, 'task_id' => $task_id), array('user_id', 'task_id'));
         }
         // Log to task history
         Flyspray::logEvent($task_id, 14, implode(' ', $args['rassigned_to']));
         // Notify the new assignees what happened.  This obviously won't happen if the task is now assigned to no-one.
         $notify->Create(NOTIFY_NEW_ASSIGNEE, $task_id, null, $notify->SpecificAddresses($args['rassigned_to']), NOTIFY_BOTH, $proj->prefs['lang_code']);
     }
     // Log that the task was opened
     Flyspray::logEvent($task_id, 1);
     $result = $db->Query('SELECT  *
                             FROM  {list_category}
                            WHERE  category_id = ?', array($args['product_category']));
     $cat_details = $db->FetchRow($result);
     // We need to figure out who is the category owner for this task
     if (!empty($cat_details['category_owner'])) {
         $owner = $cat_details['category_owner'];
     } else {
         // check parent categories
         $result = $db->Query('SELECT  *
                                 FROM  {list_category}
                                WHERE  lft < ? AND rgt > ? AND project_id  = ?
                             ORDER BY  lft DESC', array($cat_details['lft'], $cat_details['rgt'], $cat_details['project_id']));
         while ($row = $db->FetchRow($result)) {
             // If there's a parent category owner, send to them
             if (!empty($row['category_owner'])) {
                 $owner = $row['category_owner'];
                 break;
             }
         }
     }
     if (!isset($owner)) {
         $owner = $proj->prefs['default_cat_owner'];
     }
     if ($owner) {
         if ($proj->prefs['auto_assign'] && ($args['item_status'] == STATUS_UNCONFIRMED || $args['item_status'] == STATUS_NEW)) {
             Backend::add_to_assignees($owner, $task_id, true);
         }
         Backend::add_notification($owner, $task_id, true);
     }
     // Reminder for due_date field
     if (!empty($sql_args['due_date'])) {
         Backend::add_reminder($task_id, L('defaultreminder') . "\n\n" . CreateURL('details', $task_id), 2 * 24 * 60 * 60, time());
     }
     // Create the Notification
     if (Backend::upload_files($task_id)) {
         $notify->Create(NOTIFY_TASK_OPENED, $task_id, 'files', null, NOTIFY_BOTH, $proj->prefs['lang_code']);
     } else {
         $notify->Create(NOTIFY_TASK_OPENED, $task_id, null, null, NOTIFY_BOTH, $proj->prefs['lang_code']);
     }
     // If the reporter wanted to be added to the notification list
     if (isset($args['notifyme']) && $args['notifyme'] == '1' && $user->id != $owner) {
         Backend::add_notification($user->id, $task_id, true);
     }
     if ($user->isAnon()) {
         $anonuser = array();
         $anonuser[$email] = array('recipient' => $args['anon_email'], 'lang' => $fs->prefs['lang_code']);
         $recipients = array($anonuser);
         $notify->Create(NOTIFY_ANON_TASK, $task_id, $token, $recipients, NOTIFY_EMAIL, $proj->prefs['lang_code']);
     }
     return array($task_id, $token);
 }
开发者ID:canneverbe,项目名称:flyspray,代码行数:101,代码来源:class.backend.php

示例3: array

 $new_details_full = Flyspray::GetTaskDetails($task['task_id']);
 // Not very nice...maybe combine compare_tasks() and logEvent() ?
 $result = $db->Query("SELECT * FROM {tasks} WHERE task_id = ?", array($task['task_id']));
 $new_details = $db->FetchRow($result);
 foreach ($new_details as $key => $val) {
     if (strstr($key, 'last_edited_') || $key == 'assigned_to' || is_numeric($key)) {
         continue;
     }
     if ($val != $task[$key]) {
         // Log the changed fields in the task history
         Flyspray::logEvent($task['task_id'], 3, $val, $task[$key], $key, $time);
     }
 }
 $changes = Flyspray::compare_tasks($task, $new_details_full);
 if (count($changes) > 0) {
     $notify->Create(NOTIFY_TASK_CHANGED, $task['task_id'], $changes, null, NOTIFY_BOTH, $proj->prefs['lang_code']);
 }
 if ($assignees_changed) {
     // Log to task history
     Flyspray::logEvent($task['task_id'], 14, implode(' ', $assignees), implode(' ', $task['assigned_to']), '', $time);
     // Notify the new assignees what happened.  This obviously won't happen if the task is now assigned to no-one.
     if (count($assignees)) {
         $new_assignees = array_diff($task['assigned_to'], $assignees);
         // Remove current user from notification list
         if (!$user->infos['notify_own']) {
             $new_assignees = array_filter($new_assignees, create_function('$u', 'global $user; return $user->id != $u;'));
         }
         if (count($new_assignees)) {
             $notify->Create(NOTIFY_NEW_ASSIGNEE, $task['task_id'], null, $notify->SpecificAddresses($new_assignees), NOTIFY_BOTH, $proj->prefs['lang_code']);
         }
     }
开发者ID:kandran,项目名称:flyspray,代码行数:31,代码来源:modify.inc.php

示例4: header

        if ($db->countRows($res) < 1) {
            header(':', true, 403);
            die(L('invalidvalue'));
        }
        break;
    case 'closedby_version':
        $res = $db->Query('SELECT * FROM {list_version} WHERE (project_id=0 OR project_id=?) AND show_in_list=1 AND version_id=? AND version_tense=3', array($task['project_id'], $value));
        if ($db->countRows($res) < 1) {
            header(':', true, 403);
            die(L('invalidvalue'));
        }
        break;
    default:
        header(':', true, 403);
        die(L('invalidField'));
        break;
}
$oldvalue = $task[Post::val('name')];
$time = time();
$sql = $db->Query("UPDATE {tasks} SET " . Post::val('name') . " = ?,last_edited_time = ? WHERE task_id = ?", array($value, $time, Post::val('task_id')));
# load $proj again of task with correct project_id for getting active notification types in notification class
$proj = new Project($task['project_id']);
// Log the changed field in task history
Flyspray::logEvent($task['task_id'], 3, $value, $oldvalue, Post::val('name'), $time);
// Get the details of the task we just updated to generate the changed-task message
$new_details_full = Flyspray::GetTaskDetails($task['task_id']);
$changes = Flyspray::compare_tasks($task, $new_details_full);
if (count($changes) > 0) {
    $notify = new Notifications();
    $notify->Create(NOTIFY_TASK_CHANGED, $task['task_id'], $changes, null, NOTIFY_BOTH, $proj->prefs['lang_code']);
}
开发者ID:canneverbe,项目名称:flyspray,代码行数:31,代码来源:quickedit.php

示例5: create_task

 /**
  * Adds a new task
  * @param array $args array containing all task properties. unknown properties will be ignored
  * @access public
  * @return integer the task ID on success
  * @version 1.0
  * @notes $args is POST data, bad..bad user..
  */
 public static function create_task($args)
 {
     global $db, $user, $proj;
     $notify = new Notifications();
     if ($proj->id != $args['project_id']) {
         $proj = new Project($args['project_id']);
     }
     if (!$user->can_open_task($proj) || count($args) < 3) {
         return 0;
     }
     if (!(($item_summary = $args['item_summary']) && ($detailed_desc = $args['detailed_desc']))) {
         return 0;
     }
     // Some fields can have default values set
     if (!$user->perms('modify_all_tasks')) {
         $args['closedby_version'] = 0;
         $args['task_priority'] = 2;
         $args['due_date'] = 0;
         $args['item_status'] = STATUS_UNCONFIRMED;
     }
     $param_names = array('task_type', 'item_status', 'product_category', 'product_version', 'closedby_version', 'operating_system', 'task_severity', 'task_priority');
     $sql_values = array(time(), time(), $args['project_id'], $item_summary, $detailed_desc, intval($user->id), 0);
     $sql_params = array();
     foreach ($param_names as $param_name) {
         if (isset($args[$param_name])) {
             $sql_params[] = $param_name;
             $sql_values[] = $args[$param_name];
         }
     }
     // Process the due_date
     if (isset($args['due_date']) && ($due_date = $args['due_date']) || ($due_date = 0)) {
         $due_date = Flyspray::strtotime($due_date);
     }
     $sql_params[] = 'mark_private';
     $sql_values[] = intval($user->perms('manage_project') && isset($args['mark_private']) && $args['mark_private'] == '1');
     $sql_params[] = 'due_date';
     $sql_values[] = $due_date;
     $sql_params[] = 'closure_comment';
     $sql_values[] = '';
     // Token for anonymous users
     $token = '';
     if ($user->isAnon()) {
         $token = md5(function_exists('openssl_random_pseudo_bytes') ? openssl_random_pseudo_bytes(32) : uniqid(mt_rand(), true));
         $sql_params[] = 'task_token';
         $sql_values[] = $token;
         $sql_params[] = 'anon_email';
         $sql_values[] = $args['anon_email'];
     } else {
         $sql_params[] = 'anon_email';
         $sql_values[] = '';
     }
     $sql_params = join(', ', $sql_params);
     // +1 for the task_id column;
     $sql_placeholder = $db->fill_placeholders($sql_values, 1);
     $result = $db->Query('SELECT  MAX(task_id)+1
                             FROM  {tasks}');
     $task_id = $db->FetchOne($result);
     $task_id = $task_id ? $task_id : 1;
     //now, $task_id is always the first element of $sql_values
     array_unshift($sql_values, $task_id);
     $result = $db->Query("INSERT INTO  {tasks}\n                                 ( task_id, date_opened, last_edited_time,\n                                   project_id, item_summary,\n                                   detailed_desc, opened_by,\n                                   percent_complete, {$sql_params} )\n                         VALUES  ({$sql_placeholder})", $sql_values);
     // Log the assignments and send notifications to the assignees
     if (isset($args['rassigned_to']) && is_array($args['rassigned_to'])) {
         // Convert assigned_to and store them in the 'assigned' table
         foreach ($args['rassigned_to'] as $val) {
             $db->Replace('{assigned}', array('user_id' => $val, 'task_id' => $task_id), array('user_id', 'task_id'));
         }
         // Log to task history
         Flyspray::logEvent($task_id, 14, implode(' ', $args['rassigned_to']));
         // Notify the new assignees what happened.  This obviously won't happen if the task is now assigned to no-one.
         $notify->Create(NOTIFY_NEW_ASSIGNEE, $task_id, null, $notify->SpecificAddresses($args['rassigned_to']));
     }
     // Log that the task was opened
     Flyspray::logEvent($task_id, 1);
     $result = $db->Query('SELECT  *
                             FROM  {list_category}
                            WHERE  category_id = ?', array($args['product_category']));
     $cat_details = $db->FetchRow($result);
     // We need to figure out who is the category owner for this task
     if (!empty($cat_details['category_owner'])) {
         $owner = $cat_details['category_owner'];
     } else {
         // check parent categories
         $result = $db->Query('SELECT  *
                                 FROM  {list_category}
                                WHERE  lft < ? AND rgt > ? AND project_id  = ?
                             ORDER BY  lft DESC', array($cat_details['lft'], $cat_details['rgt'], $cat_details['project_id']));
         while ($row = $db->FetchRow($result)) {
             // If there's a parent category owner, send to them
             if (!empty($row['category_owner'])) {
                 $owner = $row['category_owner'];
                 break;
//.........这里部分代码省略.........
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:101,代码来源:class.backend.php

示例6: CheckNotificationActions

 /**
  * @return Array of messages to be printed.
  */
 static function CheckNotificationActions()
 {
     $messages = array();
     if (isset($_POST['calnot']) && isset($_POST['calnot']['type']) && isset($_POST['calnot']['keys'])) {
         // Something relating to notifications
         $type = $_POST['calnot']['type'];
         $keys = $_POST['calnot']['keys'];
         if (isset($_POST['calnot']['action'])) {
             // An action has been taken on a notification.
             $action = $_POST['calnot']['action'];
             $notification = Notifications::Create($type, $keys);
             if (NULL !== $notification) {
                 if ($notification->ValidAction($action)) {
                     $messages = $notification->PerformAction($action);
                 } else {
                     $messages['error'][] = 'Unrecognised notification action: ' . xml_escape($action);
                 }
             } else {
                 $messages['error'][] = 'Unrecognised notification type: ' . xml_escape($type);
             }
         }
     }
     return $messages;
 }
开发者ID:TheYorkerArchive,项目名称:codebase-2006-2012,代码行数:27,代码来源:Notifications.php

示例7: User

    $user = new User(Cookie::val('flyspray_userid'));
    $user->check_account_ok();
    $user->save_search();
} else {
    $user = new User(0, $proj);
}
// don't allow anonymous users to access this page at all
if ($user->isAnon()) {
    die;
}
$task = Flyspray::GetTaskDetails(Post::val('task_id'));
if (!$user->can_edit_task($task)) {
    Flyspray::show_error(L('nopermission'));
    die;
}
if (Post::val('name') == "due_date") {
    $value = Flyspray::strtotime(Post::val('value'));
    $value = intval($value);
} elseif (Post::val('name') == "estimated_effort") {
    $value = effort::EditStringToSeconds(Post::val('value'), $proj->prefs['hours_per_manday'], $proj->prefs['estimated_effort_format']);
    $value = intval($value);
} else {
    $value = Post::val('value');
}
$oldvalue = $task[Post::val('name')];
$sql = $db->Query("UPDATE {tasks} SET " . Post::val('name') . " = ?,last_edited_time = ? WHERE task_id = ?", array($value, time(), Post::val('task_id')));
// Log the changed field in task history
Flyspray::logEvent($task['task_id'], 3, $value, $oldvalue, Post::val('name'), $time);
$notify = new Notifications();
$notify->Create(NOTIFY_TASK_CHANGED, $task['task_id']);
开发者ID:nathanburgess,项目名称:flyspray,代码行数:30,代码来源:quickedit.php

示例8: Notifications

require "Notifications.class.php";
header('Content-Type: application/json');
$notifications = new Notifications();
//verifico se é requisição ajax
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
    $action = $_GET['a'];
} else {
    echo json_encode(['deny' => true]);
    exit;
}
//ação de criar aluno/cliente
if ($action == 'create') {
    $notifications->info = $_GET['info'];
    $notifications->data = $_GET['data'];
    $creation = $notifications->Create();
    if (isset($creation) && !empty($creation)) {
        echo json_encode($creation);
    } else {
        echo json_encode(['error' => 'true']);
    }
}
//ação de retrieve/busca de informação unica
if ($action == 'retrieve') {
    $notifications->id = $_GET['id'];
    $notifications->Find();
    echo json_encode($notifications->variables);
}
//ação de lista de dados
if ($action == 'list') {
    $page = isset($_GET['page']) && !empty($_GET['page']) && $_GET['page'] >= 1 ? intval($_GET['page']) - 1 : 0;
开发者ID:vinigomescunha,项目名称:Sistema-Baseado-em-Partes-com-MySQL,代码行数:30,代码来源:index.php

示例9: GetNotifications

 static function GetNotifications($paths)
 {
     $CI =& get_instance();
     $notifications = array();
     $occurrence_alerts = $CI->events_model->GetOccurrenceAlerts();
     foreach ($occurrence_alerts as $occurrence) {
         $occurrence['link'] = $paths->OccurrenceRawInfo(0, $occurrence['event_id'], $occurrence['occurrence_id']);
         $notifications[] = Notifications::Create('NotificationCancelledEvent', array('userid' => $CI->events_model->GetActiveEntityId(), 'occid' => $occurrence['occurrence_id']), $occurrence);
     }
     $event_submissions = $CI->events_model->GetEventSubmissions();
     foreach ($event_submissions as $event_submission) {
         $event_submission['link'] = $paths->EventRawInfo(0, $event_submission['event_id']);
         $notifications[] = Notifications::Create('NotificationEventSubmission', array('userid' => $CI->events_model->GetActiveEntityId(), 'eventid' => $event_submission['event_id']), $event_submission);
     }
     return $notifications;
 }
开发者ID:TheYorkerArchive,项目名称:codebase-2006-2012,代码行数:16,代码来源:Calendar_notifications.php


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