本文整理汇总了PHP中NotificationEvent类的典型用法代码示例。如果您正苦于以下问题:PHP NotificationEvent类的具体用法?PHP NotificationEvent怎么用?PHP NotificationEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NotificationEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: afterAdd
static function afterAdd(Group_Ticket $item)
{
global $DB;
//Toolbox::logDebug(__METHOD__, $item);
$config = PluginBehaviorsConfig::getInstance();
if ($config->getField('add_notif')) {
if ($item->getField('type') == CommonITILActor::ASSIGN) {
$ticket = new Ticket();
if ($ticket->getFromDB($item->getField('tickets_id'))) {
NotificationEvent::raiseEvent('plugin_behaviors_ticketnewgrp', $ticket);
}
}
}
// Check is the connected user is a tech
if (!is_numeric(Session::getLoginUserID(false)) || !Session::haveRight('own_ticket', 1)) {
return false;
// No check
}
$config = PluginBehaviorsConfig::getInstance();
if ($config->getField('single_tech_mode') != 0 && $item->input['type'] == CommonITILActor::ASSIGN) {
$crit = array('tickets_id' => $item->input['tickets_id'], 'type' => CommonITILActor::ASSIGN);
foreach ($DB->request('glpi_groups_tickets', $crit) as $data) {
if ($data['id'] != $item->getID()) {
$gu = new Group_Ticket();
$gu->delete($data);
}
}
if ($config->getField('single_tech_mode') == 2) {
foreach ($DB->request('glpi_tickets_users', $crit) as $data) {
$gu = new Ticket_User();
$gu->delete($data);
}
}
}
}
开发者ID:geldarr,项目名称:hack-space,代码行数:35,代码来源:group_ticket.class.php
示例2: afterUpdate
static function afterUpdate(TicketSatisfaction $ticketsatisfaction)
{
$config = PluginBehaviorsConfig::getInstance();
$ticket = new Ticket();
if ($config->getField('add_notif') && $ticket->getFromDB($ticketsatisfaction->getField('tickets_id')) && $ticketsatisfaction->input["date_answered"]) {
NotificationEvent::raiseEvent('plugin_behaviors_replysurvey', $ticket);
}
}
开发者ID:geldarr,项目名称:hack-space,代码行数:8,代码来源:ticketsatisfaction.class.php
示例3: afterPurge
static function afterPurge(Document_Item $document_item)
{
$config = PluginBehaviorsConfig::getInstance();
if ($config->getField('add_notif') && $document_item->fields['itemtype'] == 'Ticket' && isset($_POST['item'])) {
// prevent not use in case of purge ticket
$ticket = new Ticket();
$ticket->getFromDB($document_item->fields['items_id']);
NotificationEvent::raiseEvent('plugin_behaviors_document_itemdel', $ticket);
}
}
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:10,代码来源:document_item.class.php
示例4: post_deleteFromDB
function post_deleteFromDB()
{
global $CFG_GLPI;
$donotif = $CFG_GLPI["use_mailing"];
if (isset($this->input["_no_notif"]) && $this->input["_no_notif"]) {
$donotif = false;
}
$t = new Ticket();
if ($t->getFromDB($this->fields['tickets_id'])) {
if ($t->fields["suppliers_id_assign"] == 0 && $t->countUsers(Ticket::ASSIGN) == 0 && $t->countGroups(Ticket::ASSIGN) == 0) {
$t->update(array('id' => $this->fields['tickets_id'], 'status' => 'new'));
} else {
$t->updateDateMod($this->fields['tickets_id']);
if ($donotif) {
NotificationEvent::raiseEvent("update", $t);
}
}
}
parent::post_deleteFromDB();
}
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:20,代码来源:group_ticket.class.php
示例5: executeActions
/**
* @param $output
* @param $params
**/
function executeActions($output, $params)
{
if (count($this->actions)) {
foreach ($this->actions as $action) {
switch ($action->fields["action_type"]) {
case "send":
$ticket = new Ticket();
if ($ticket->getFromDB($output['id'])) {
NotificationEvent::raiseEvent('recall', $ticket);
}
break;
case "add_validation":
if (isset($output['_add_validation']) && !is_array($output['_add_validation'])) {
$output['_add_validation'] = array($output['_add_validation']);
}
switch ($action->fields['field']) {
case 'users_id_validate_requester_supervisor':
$output['_add_validation'][] = 'requester_supervisor';
break;
case 'users_id_validate_assign_supervisor':
$output['_add_validation'][] = 'assign_supervisor';
break;
case 'groups_id_validate':
$output['_add_validation']['group'][] = $action->fields["value"];
break;
case 'users_id_validate':
$output['_add_validation'][] = $action->fields["value"];
break;
case 'validation_percent':
$output[$action->fields["field"]] = $action->fields["value"];
break;
default:
$output['_add_validation'][] = $action->fields["value"];
break;
}
break;
case "assign":
$output[$action->fields["field"]] = $action->fields["value"];
// Special case of users_id_requester
if ($action->fields["field"] === '_users_id_requester') {
// Add groups of requester
if (!isset($output['_groups_id_of_requester'])) {
$output['_groups_id_of_requester'] = array();
}
foreach (Group_User::getUserGroups($action->fields["value"]) as $g) {
$output['_groups_id_of_requester'][$g['id']] = $g['id'];
}
}
break;
case "append":
$actions = $this->getActions();
$value = $action->fields["value"];
if (isset($actions[$action->fields["field"]]["appendtoarray"]) && isset($actions[$action->fields["field"]]["appendtoarrayfield"])) {
$value = $actions[$action->fields["field"]]["appendtoarray"];
$value[$actions[$action->fields["field"]]["appendtoarrayfield"]] = $action->fields["value"];
}
$output[$actions[$action->fields["field"]]["appendto"]][] = $value;
// Special case of users_id_requester
if ($action->fields["field"] === '_users_id_requester') {
// Add groups of requester
if (!isset($output['_groups_id_of_requester'])) {
$output['_groups_id_of_requester'] = array();
}
foreach (Group_User::getUserGroups($action->fields["value"]) as $g) {
$output['_groups_id_of_requester'][$g['id']] = $g['id'];
}
}
break;
case 'fromuser':
if ($action->fields['field'] == 'locations_id' && isset($output['users_locations'])) {
$output['locations_id'] = $output['users_locations'];
}
break;
case 'fromitem':
if ($action->fields['field'] == 'locations_id' && isset($output['items_locations'])) {
$output['locations_id'] = $output['items_locations'];
}
if ($action->fields['field'] == 'groups_id' && isset($output['items_groups'])) {
$output['groups_id'] = $output['items_groups'];
}
break;
case 'compute':
// Value could be not set (from test)
$urgency = isset($output['urgency']) ? $output['urgency'] : 3;
$impact = isset($output['impact']) ? $output['impact'] : 3;
// Apply priority_matrix from config
$output['priority'] = Ticket::computePriority($urgency, $impact);
break;
case "affectbyip":
case "affectbyfqdn":
case "affectbymac":
if (!isset($output["entities_id"])) {
$output["entities_id"] = $params["entities_id"];
}
if (isset($this->regex_results[0])) {
$regexvalue = RuleAction::getRegexResultById($action->fields["value"], $this->regex_results[0]);
//.........这里部分代码省略.........
开发者ID:korial29,项目名称:glpi,代码行数:101,代码来源:ruleticket.class.php
示例6: post_addItem
function post_addItem()
{
global $CFG_GLPI;
parent::post_addItem();
if (isset($this->input['_tickets_id'])) {
$ticket = new Ticket();
if ($ticket->getFromDB($this->input['_tickets_id'])) {
$pt = new Change_Ticket();
$pt->add(array('tickets_id' => $this->input['_tickets_id'], 'changes_id' => $this->fields['id']));
if (!empty($ticket->fields['itemtype']) && $ticket->fields['items_id'] > 0) {
$it = new Change_Item();
$it->add(array('changes_id' => $this->fields['id'], 'itemtype' => $ticket->fields['itemtype'], 'items_id' => $ticket->fields['items_id']));
}
}
}
if (isset($this->input['_problems_id'])) {
$problem = new Problem();
if ($problem->getFromDB($this->input['_problems_id'])) {
$cp = new Change_Problem();
$cp->add(array('problems_id' => $this->input['_problems_id'], 'changes_id' => $this->fields['id']));
}
}
// Processing Email
if ($CFG_GLPI["use_mailing"]) {
// Clean reload of the change
$this->getFromDB($this->fields['id']);
$type = "new";
if (isset($this->fields["status"]) && in_array($this->input["status"], $this->getSolvedStatusArray())) {
$type = "solved";
}
NotificationEvent::raiseEvent($type, $this);
}
}
开发者ID:jose-martins,项目名称:glpi,代码行数:33,代码来源:change.class.php
示例7: showDebug
/**
* Display debug information for current object
**/
function showDebug()
{
$license = array('softname' => '', 'name' => '', 'serial' => '', 'expire' => '');
$options['entities_id'] = $this->getEntityID();
$options['licenses'] = array($license);
NotificationEvent::debugEvent($this, $options);
}
开发者ID:glpi-project,项目名称:glpi,代码行数:10,代码来源:softwarelicense.class.php
示例8: post_updateItem
function post_updateItem($history = 1)
{
global $CFG_GLPI;
$job = new Ticket();
$donotif = $CFG_GLPI["use_mailing"];
if (isset($this->input['_disablenotif'])) {
$donotif = false;
}
if ($job->getFromDB($this->fields["tickets_id"])) {
if (count($this->updates) && $donotif) {
$options = array('validation_id' => $this->fields["id"], 'validation_status' => $this->fields["status"]);
NotificationEvent::raiseEvent('validation_answer', $job, $options);
}
// Set global validation to accepted to define one
if ($job->fields['global_validation'] == 'waiting' || self::getNumberValidationForTicket($this->fields["tickets_id"]) == 1 || self::isAllValidationsHaveSameStatusForTicket($this->fields["tickets_id"])) {
$input['id'] = $this->fields["tickets_id"];
$input['global_validation'] = $this->fields["status"];
$job->update($input);
}
}
parent::post_updateItem($history);
}
开发者ID:gaforeror,项目名称:glpi,代码行数:22,代码来源:ticketvalidation.class.php
示例9: cronCheckDBreplicate
/**
* Cron process to check DB replicate state
*
* @param $task to log and get param
**/
static function cronCheckDBreplicate($task)
{
global $DB;
//Lauch cron only is :
// 1 the master database is avalaible
// 2 the slave database is configurated
if (!$DB->isSlave() && self::isDBSlaveActive()) {
$DBslave = self::getDBSlaveConf();
if (is_array($DBslave->dbhost)) {
$hosts = $DBslave->dbhost;
} else {
$hosts = array($DBslave->dbhost);
}
foreach ($hosts as $num => $name) {
$diff = self::getReplicateDelay($num);
// Quite strange, but allow simple stat
$task->addVolume($diff);
if ($diff > 1000000000) {
// very large means slave is disconnect
$task->log(sprintf(__s("Mysql server: %s can't connect to the database"), $name));
} else {
//TRANS: %1$s is the server name, %2$s is the time
$task->log(sprintf(__('Mysql server: %1$s, difference between master and slave: %2$s'), $name, Html::timestampToString($diff, true)));
}
if ($diff > $task->fields['param'] * 60) {
//Raise event if replicate is not synchronized
$options = array('diff' => $diff, 'name' => $name, 'entities_id' => 0);
// entity to avoid warning in getReplyTo
NotificationEvent::raiseEvent('desynchronization', new self(), $options);
}
}
return 1;
}
return 0;
}
开发者ID:pvasener,项目名称:glpi,代码行数:40,代码来源:dbconnection.class.php
示例10: showDebug
/**
* Display debug information for current object
**/
function showDebug()
{
$options['entities_id'] = $this->getEntityID();
$options['contracts'] = array();
NotificationEvent::debugEvent($this, $options);
}
开发者ID:gaforeror,项目名称:glpi,代码行数:9,代码来源:contract.class.php
示例11: cronAdditionalalertsNewOcs
static function cronAdditionalalertsNewOcs($task = NULL)
{
global $DB, $CFG_GLPI;
if (!$CFG_GLPI["use_mailing"]) {
return 0;
}
$CronTask = new CronTask();
if ($CronTask->getFromDBbyName("PluginAdditionalalertsOcsAlert", "AdditionalalertsNewOcs")) {
if ($CronTask->fields["state"] == CronTask::STATE_DISABLE) {
return 0;
}
} else {
return 0;
}
$message = array();
$cron_status = 0;
foreach (self::getEntitiesToNotify('use_newocs_alert') as $entity => $repeat) {
foreach ($DB->request("glpi_plugin_ocsinventoryng_ocsservers", "`is_active` = 1") as $config) {
$query_newocsmachine = self::queryNew($config, $entity);
$newocsmachine_infos = array();
$newocsmachine_messages = array();
$type = Alert::END;
$newocsmachine_infos[$type] = array();
foreach ($DB->request($query_newocsmachine) as $data) {
$entity = $data['entities_id'];
$message = $data["name"];
$newocsmachine_infos[$type][$entity][] = $data;
if (!isset($newocsmachines_infos[$type][$entity])) {
$newocsmachine_messages[$type][$entity] = __('New imported computers from OCS-NG', 'additionalalerts') . "<br />";
}
$newocsmachine_messages[$type][$entity] .= $message;
}
$delay_ocs = 0;
foreach ($newocsmachine_infos[$type] as $entity => $newocsmachines) {
Plugin::loadLang('additionalalerts');
if (NotificationEvent::raiseEvent("newocs", new PluginAdditionalalertsOcsAlert(), array('entities_id' => $entity, 'ocsmachines' => $newocsmachines, 'delay_ocs' => $delay_ocs))) {
$message = $newocsmachine_messages[$type][$entity];
$cron_status = 1;
if ($task) {
$task->log(Dropdown::getDropdownName("glpi_entities", $entity) . ": {$message}\n");
$task->addVolume(1);
} else {
Session::addMessageAfterRedirect(Dropdown::getDropdownName("glpi_entities", $entity) . ": {$message}");
}
} else {
if ($task) {
$task->log(Dropdown::getDropdownName("glpi_entities", $entity) . ": Send newocsmachines alert failed\n");
} else {
Session::addMessageAfterRedirect(Dropdown::getDropdownName("glpi_entities", $entity) . ": Send newocsmachines alert failed", false, ERROR);
}
}
}
}
}
return $cron_status;
}
开发者ID:geldarr,项目名称:hack-space,代码行数:56,代码来源:ocsalert.class.php
示例12: post_addItem
function post_addItem()
{
global $CFG_GLPI;
parent::post_addItem();
if (isset($this->input['_tickets_id'])) {
$ticket = new Ticket();
if ($ticket->getFromDB($this->input['_tickets_id'])) {
$pt = new Problem_Ticket();
$pt->add(array('tickets_id' => $this->input['_tickets_id'], 'problems_id' => $this->fields['id'], '_no_notif' => true));
if (!empty($ticket->fields['itemtype']) && $ticket->fields['items_id'] > 0) {
$it = new Item_Problem();
$it->add(array('problems_id' => $this->fields['id'], 'itemtype' => $ticket->fields['itemtype'], 'items_id' => $ticket->fields['items_id'], '_no_notif' => true));
}
}
}
// Processing Email
if ($CFG_GLPI["use_mailing"]) {
// Clean reload of the problem
$this->getFromDB($this->fields['id']);
$type = "new";
if (isset($this->fields["status"]) && $this->fields["status"] == self::SOLVED) {
$type = "solved";
}
NotificationEvent::raiseEvent($type, $this);
}
}
开发者ID:gaforeror,项目名称:glpi,代码行数:26,代码来源:problem.class.php
示例13: post_addItem
function post_addItem()
{
global $CFG_GLPI;
if ($CFG_GLPI["use_mailing"]) {
NotificationEvent::raiseEvent("new", $this);
}
parent::post_addItem();
}
开发者ID:btry,项目名称:glpi,代码行数:8,代码来源:reservation.class.php
示例14: showDebug
/**
* Display debug information for current object
**/
function showDebug()
{
$params = array('message' => '', 'action_type' => true, 'action_user' => getUserName(Session::getLoginUserID()), 'entities_id' => $_SESSION['glpiactive_entity'], 'itemtype' => get_class($this), 'date' => $_SESSION['glpi_currenttime'], 'refuse' => true);
NotificationEvent::debugEvent($this, $params);
}
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:8,代码来源:fieldunicity.class.php
示例15: post_addItem
function post_addItem()
{
global $CFG_GLPI;
if (isset($this->input['_planningrecall'])) {
$this->input['_planningrecall']['items_id'] = $this->fields['id'];
PlanningRecall::manageDatas($this->input['_planningrecall']);
}
$donotif = $CFG_GLPI["use_mailing"];
if (isset($this->fields["begin"]) && !empty($this->fields["begin"])) {
Planning::checkAlreadyPlanned($this->fields["users_id_tech"], $this->fields["begin"], $this->fields["end"], array($this->getType() => array($this->fields["id"])));
$calendars_id = Entity::getUsedConfig('calendars_id', $this->input["_job"]->fields['entities_id']);
$calendar = new Calendar();
// Using calendar
if ($calendars_id > 0 && $calendar->getFromDB($calendars_id)) {
if (!$calendar->isAWorkingHour(strtotime($this->fields["begin"]))) {
Session::addMessageAfterRedirect(__('Start of the selected timeframe is not a working hour.'), false, ERROR);
}
if (!$calendar->isAWorkingHour(strtotime($this->fields["end"]))) {
Session::addMessageAfterRedirect(__('End of the selected timeframe is not a working hour.'), false, ERROR);
}
}
}
$this->input["_job"]->updateDateMod($this->input[$this->input["_job"]->getForeignKeyField()]);
if (isset($this->input["actiontime"]) && $this->input["actiontime"] > 0) {
$this->input["_job"]->updateActionTime($this->input[$this->input["_job"]->getForeignKeyField()]);
}
//change status only if input change
if (isset($this->input['_status']) && $this->input['_status'] != $this->input['_job']->fields['status']) {
$update['status'] = $this->input['_status'];
$update['id'] = $this->input['_job']->fields['id'];
$update['_disablenotif'] = true;
$this->input['_job']->update($update);
}
if (!empty($this->fields['begin']) && $this->input["_job"]->isStatusExists(CommonITILObject::PLANNED) && ($this->input["_job"]->fields["status"] == CommonITILObject::INCOMING || $this->input["_job"]->fields["status"] == CommonITILObject::ASSIGNED)) {
$input2['id'] = $this->input["_job"]->getID();
$input2['status'] = CommonITILObject::PLANNED;
$input2['_disablenotif'] = true;
$this->input["_job"]->update($input2);
}
if ($donotif) {
$options = array('task_id' => $this->fields["id"], 'is_private' => $this->isPrivate());
NotificationEvent::raiseEvent('add_task', $this->input["_job"], $options);
}
// Add log entry in the ITIL object
$changes[0] = 0;
$changes[1] = '';
$changes[2] = $this->fields['id'];
Log::history($this->getField($this->input["_job"]->getForeignKeyField()), $this->input["_job"]->getTYpe(), $changes, $this->getType(), Log::HISTORY_ADD_SUBITEM);
}
开发者ID:glpi-project,项目名称:glpi,代码行数:49,代码来源:commonitiltask.class.php
示例16: cronWatcher
/**
* Check zombie crontask
*
* @param $task for log
**/
static function cronWatcher($task)
{
global $CFG_GLPI, $DB;
$cron_status = 0;
// Crontasks running for more than 1 hour or 2 frequency
$query = "SELECT *\n FROM `glpi_crontasks`\n WHERE `state` = '" . self::STATE_RUNNING . "'\n AND ((unix_timestamp(`lastrun`) + 2 * `frequency` < unix_timestamp(now()))\n OR (unix_timestamp(`lastrun`) + 2*" . HOUR_TIMESTAMP . " < unix_timestamp(now())))";
$crontasks = array();
foreach ($DB->request($query) as $data) {
$crontasks[$data['id']] = $data;
}
if (count($crontasks)) {
$task = new self();
$task->getFromDBByQuery("WHERE `itemtype` = 'Crontask' AND `name` = 'watcher'");
if (NotificationEvent::raiseEvent("alert", $task, array('items' => $crontasks))) {
$cron_status = 1;
$task->addVolume(1);
}
QueuedMail::forceSendFor($task->getType(), $task->fields['id']);
}
return 1;
}
开发者ID:glpi-project,项目名称:glpi,代码行数:26,代码来源:crontask.class.php
示例17: showDebug
/**
* Display debug information for current object
**/
function showDebug()
{
NotificationEvent::debugEvent($this);
}
开发者ID:glpi-project,项目名称:glpi,代码行数:7,代码来源:ticket.class.php
示例18: showDebug
/**
* Display debug information for current object
* NotificationTemplateTranslation => translation preview
*
* @since version 0.84
**/
function showDebug()
{
$template = new NotificationTemplate();
if (!$template->getFromDB($this->fields['notificationtemplates_id'])) {
return;
}
$itemtype = $template->getField('itemtype');
if (!($item = getItemForItemtype($itemtype))) {
return;
}
echo "<div class='spaced'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2'>" . __('Preview') . "</th></tr>";
$oktypes = array('CartridgeItem', 'Change', 'ConsumableItem', 'Contract', 'Crontask', 'Problem', 'Project', 'Ticket', 'User');
if (!in_array($itemtype, $oktypes)) {
// this itemtype doesn't work, need to be fixed
echo "<tr class='tab_bg_2 center'><td>" . NOT_AVAILABLE . "</td>";
echo "</table></div>";
return;
}
// Criteria Form
$key = getForeignKeyFieldForItemType($item->getType());
$id = Session::getSavedOption(__CLASS__, $key, 0);
$event = Session::getSavedOption(__CLASS__, $key . '_event', '');
echo "<tr class='tab_bg_2'><td>" . $item->getTypeName(1) . " ";
$item->dropdown(array('value' => $id, 'on_change' => 'reloadTab("' . $key . '="+this.value)'));
echo "</td><td>" . NotificationEvent::getTypeName(1) . " ";
NotificationEvent::dropdownEvents($item->getType(), array('value' => $event, 'on_change' => 'reloadTab("' . $key . '_event="+this.value)'));
echo "</td>";
// Preview
if ($event && $item->getFromDB($id)) {
$options = array('_debug' => true);
// TODO Awfull Hack waiting for https://forge.indepnet.net/issues/3439
$multi = array('alert', 'alertnotclosed', 'end', 'notice', 'periodicity', 'periodicitynotice');
if (in_array($event, $multi)) {
// Won't work for Cardridge and Consumable
$options['entities_id'] = $item->getEntityID();
$options['items'] = array($item->getID() => $item->fields);
}
$target = NotificationTarget::getInstance($item, $event, $options);
$infos = array('language' => $_SESSION['glpilanguage'], 'additionnaloption' => array('usertype' => NotificationTarget::GLPI_USER));
$template->resetComputedTemplates();
$template->setSignature(Notification::getMailingSignature($_SESSION['glpiactive_entity']));
if ($tid = $template->getTemplateByLanguage($target, $infos, $event, $options)) {
$data = $template->templates_by_languages[$tid];
echo "<tr><th colspan='2'>" . __('Subject') . "</th></tr>";
echo "<tr class='tab_bg_2 b'><td colspan='2'>" . $data['subject'] . "</td></tr>";
echo "<tr><th>" . __('Email text body') . "</th>";
echo "<th>" . __('Email HTML body') . "</th></tr>";
echo "<tr class='tab_bg_2'><td>" . nl2br($data['content_text']) . "</td>";
echo "<td>" . $data['content_html'] . "</td></tr>";
}
}
echo "</table></div>";
}
开发者ID:stweil,项目名称:glpi,代码行数:61,代码来源:notificationtemplatetranslation.class.php
示例19: cronMailgateError
/**
* Send Alarms on mailgate errors
*
* @since version 0.85
*
* @param $task for log
**/
static function cronMailgateError($task)
{
global $DB, $CFG_GLPI;
if (!$CFG_GLPI["use_mailing"]) {
return 0;
}
$cron_status = 0;
$query = "SELECT `glpi_mailcollectors`.*\n FROM `glpi_mailcollectors`\n WHERE `glpi_mailcollectors`.`errors` > 0\n AND `glpi_mailcollectors`.`is_active`";
$items = array();
foreach ($DB->request($query) as $data) {
$items[$data['id']] = $data;
}
if (count($items)) {
if (NotificationEvent::raiseEvent('error', new self(), array('items' => $items))) {
$cron_status = 1;
if ($task) {
$task->setVolume(count($items));
}
}
}
return $cron_status;
}
开发者ID:remicollet,项目名称:glpi,代码行数:29,代码来源:mailcollector.class.php
示例20: sendAlert
/**
* @return int
*/
static function sendAlert()
{
global $DB, $CFG_GLPI;
if (!$CFG_GLPI["use_mailing"]) {
return 0;
}
$items_infos = array();
$query = "SELECT `glpi_plugin_ocsinventoryng_notimportedcomputers`.*\n FROM `glpi_plugin_ocsinventoryng_notimportedcomputers`\n LEFT JOIN `glpi_alerts`\n ON (`glpi_plugin_ocsinventoryng_notimportedcomputers`.`id` = `glpi_alerts`.`items_id`\n AND `glpi_alerts`.`itemtype` = 'PluginOcsinventoryngNotimportedcomputer'\n AND `glpi_alerts`.`type` = '" . Alert::END . "')\n WHERE `glpi_alerts`.`date` IS NULL";
foreach ($DB->request($query) as $notimported) {
$items_infos[$notimported['entities_id']][$notimported['id']] = $notimported;
}
foreach ($items_infos as $entity => $items) {
if (NotificationEvent::raiseEvent('not_imported', new PluginOcsinventoryngNotimportedcomputer(), array('entities_id' => $entity, 'notimported' => $items))) {
$alert = new Alert();
$input["itemtype"] = 'PluginOcsinventoryngNotimportedcomputer';
$input["type"] = Alert::END;
foreach ($items as $id => $item) {
$input["items_id"] = $id;
$alert->add($input);
unset($alert->fields['id']);
}
} else {
Toolbox::logDebug(__('%1$s: %2$s') . "\n", Dropdown::getDropdownName("glpi_entities", $entity), __('Send OCSNG not imported computers alert failed', 'ocsinventoryng'));
}
}
}
开发者ID:pluginsGLPI,项目名称:ocsinventoryng,代码行数:29,代码来源:notimportedcomputer.class.php
注:本文中的NotificationEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论