本文整理汇总了PHP中Notification::getMode方法的典型用法代码示例。如果您正苦于以下问题:PHP Notification::getMode方法的具体用法?PHP Notification::getMode怎么用?PHP Notification::getMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notification
的用法示例。
在下文中一共展示了Notification::getMode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showForGroup
/**
* Display notification registered for a group
*
* @since version 0.83
*
* @param $group Group object
*
* @return nothing
**/
static function showForGroup(Group $group)
{
global $DB;
if (!Notification::canView()) {
return false;
}
$sql = "SELECT `glpi_notifications`.`id`\n FROM `glpi_notificationtargets`\n INNER JOIN `glpi_notifications`\n ON (`glpi_notifications`.`id` = `glpi_notificationtargets`.`notifications_id`)\n WHERE `items_id` = '" . $group->getID() . "'\n AND (`type` = '" . Notification::SUPERVISOR_GROUP_TYPE . "'\n OR `type` = '" . Notification::GROUP_TYPE . "') " . getEntitiesRestrictRequest('AND', 'glpi_notifications', '', '', true);
$req = $DB->request($sql);
echo "<table class='tab_cadre_fixe'>";
if ($req->numrows()) {
echo "<tr><th>" . __('Name') . "</th>";
echo "<th>" . Entity::getTypeName(1) . "</th>";
echo "<th>" . __('Active') . "</th>";
echo "<th>" . __('Type') . "</th>";
echo "<th>" . __('Notification method') . "</th>";
echo "<th>" . NotificationEvent::getTypeName(1) . "</th>";
echo "<th>" . NotificationTemplate::getTypeName(1) . "</th></tr>";
$notif = new Notification();
Session::initNavigateListItems('Notification', sprintf(__('%1$s = %2$s'), Group::getTypeName(1), $group->getName()));
foreach ($req as $data) {
Session::addToNavigateListItems('Notification', $data['id']);
if ($notif->getFromDB($data['id'])) {
echo "<tr class='tab_bg_2'><td>" . $notif->getLink();
echo "</td><td>" . Dropdown::getDropdownName('glpi_entities', $notif->getEntityID());
echo "</td><td>" . Dropdown::getYesNo($notif->getField('is_active')) . "</td><td>";
$itemtype = $notif->getField('itemtype');
if ($tmp = getItemForItemtype($itemtype)) {
echo $tmp->getTypeName(1);
} else {
echo " ";
}
echo "</td><td>" . Notification::getMode($notif->getField('mode'));
echo "</td><td>" . NotificationEvent::getEventName($itemtype, $notif->getField('event'));
echo "</td>" . "<td>" . Dropdown::getDropdownName('glpi_notificationtemplates', $notif->getField('notificationtemplates_id'));
echo "</td></tr>";
}
}
} else {
echo "<tr class='tab_bg_2'><td class='b center'>" . __('No item found') . "</td></tr>";
}
echo "</table>";
}
示例2: giveItem
//.........这里部分代码省略.........
$options['field'][0] = 12;
$options['searchtype'][0] = 'equals';
$options['contains'][0] = 'all';
$options['link'][0] = 'AND';
$options['itemtype2'][0] = $itemtype;
$options['field2'][0] = self::getOptionNumber($itemtype, 'name');
$options['searchtype2'][0] = 'equals';
$options['contains2'][0] = $data['id'];
$options['link2'][0] = 'AND';
$options['reset'] = 'reset';
$out = "<a href=\"" . $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($options) . "\" data-back='false'>";
$out .= $data[$NAME . $num];
$out .= "</a>";
} else {
$out = $data[$NAME . $num];
}
return $out;
case "glpi_softwarelicenses.number":
if ($data[$NAME . $num . "_2"] == -1) {
return $LANG['software'][4];
}
if (empty($data[$NAME . $num])) {
return 0;
}
return $data[$NAME . $num];
case "glpi_auth_tables.name":
return Auth::getMethodName($data[$NAME . $num], $data[$NAME . $num . "_2"], 1, $data[$NAME . $num . "_3"] . $data[$NAME . $num . "_4"]);
case "glpi_reservationitems.comment":
if (empty($data[$NAME . $num])) {
return "<a title='" . $LANG['reservation'][22] . "'\n href='" . $CFG_GLPI["root_doc"] . "/front/reservationitem.form.php?id=" . $data["refID"] . "' data-back='false'>" . $LANG['common'][49] . "</a>";
}
return "<a title='" . $LANG['reservation'][22] . "'\n href='" . $CFG_GLPI["root_doc"] . "/front/reservationitem.form.php?id=" . $data['refID'] . "' data-back='false'>" . resume_text($data[$NAME . $num]) . "</a>";
case 'glpi_notifications.mode':
return Notification::getMode($data[$NAME . $num]);
case 'glpi_notifications.event':
$item = NotificationTarget::getInstanceByType($data['itemtype']);
if ($item) {
$events = $item->getAllEvents();
return $events[$data[$NAME . $num]];
}
return '';
case 'glpi_crontasks.description':
$tmp = new CronTask();
return $tmp->getDescription($data['id']);
case 'glpi_crontasks.state':
return CronTask::getStateName($data[$NAME . $num]);
case 'glpi_crontasks.mode':
return CronTask::getModeName($data[$NAME . $num]);
case 'glpi_crontasks.itemtype':
if ($plug = isPluginItemType($data[$NAME . $num])) {
return $plug['plugin'];
}
return '';
case 'glpi_tickets.status':
$status = Ticket::getStatus($data[$NAME . $num]);
// status Stevenes Donato
if ($data[$NAME . $num] == "1") {
$data[$NAME . $num] = "new";
}
if ($data[$NAME . $num] == "2") {
$data[$NAME . $num] = "assign";
}
if ($data[$NAME . $num] == "3") {
$data[$NAME . $num] = "plan";
}
if ($data[$NAME . $num] == "4") {
示例3: giveItem
//.........这里部分代码省略.........
}
$color = $_SESSION['glpiduedateok_color'];
if ($less_crit < $less_crit_limit) {
$color = $_SESSION['glpiduedatecritical_color'];
} else {
if ($less_warn < $less_warn_limit) {
$color = $_SESSION['glpiduedatewarning_color'];
}
}
//Calculate bar progress
$out .= "<div class='center' style='background-color: #ffffff; width: 100%;\n border: 1px solid #9BA563;' >";
$out .= "<div style='position:absolute;'> " . $percentage_text . "%</div>";
$out .= "<div class='center' style='background-color: " . $color . ";\n width: " . $percentage . "%; height: 12px' ></div>";
$out .= "</div>";
return $out;
}
break;
case "glpi_softwarelicenses.number":
if ($data[$NAME . $num . "_2"] == -1) {
return __('Unlimited');
}
if (empty($data[$NAME . $num])) {
return 0;
}
return $data[$NAME . $num];
case "glpi_auth_tables.name":
return Auth::getMethodName($data[$NAME . $num], $data[$NAME . $num . "_2"], 1, $data[$NAME . $num . "_3"] . $data[$NAME . $num . "_4"]);
case "glpi_reservationitems.comment":
if (empty($data[$NAME . $num])) {
return "<a title=\"" . __s('Modify the comment') . "\"\n href='" . $CFG_GLPI["root_doc"] . "/front/reservationitem.form.php?id=" . $data["refID"] . "' >" . __('None') . "</a>";
}
return "<a title=\"" . __s('Modify the comment') . "\"\n href='" . $CFG_GLPI["root_doc"] . "/front/reservationitem.form.php?id=" . $data['refID'] . "' >" . Html::resume_text($data[$NAME . $num]) . "</a>";
case 'glpi_notifications.mode':
return Notification::getMode($data[$NAME . $num]);
case 'glpi_notifications.event':
$item = NotificationTarget::getInstanceByType($data['itemtype']);
if ($item) {
$events = $item->getAllEvents();
if (isset($events[$data[$NAME . $num]])) {
return $events[$data[$NAME . $num]];
}
}
return '';
case 'glpi_reminders.state':
return Planning::getState($data[$NAME . $num]);
case 'glpi_crontasks.description':
$tmp = new CronTask();
return $tmp->getDescription($data['id']);
case 'glpi_crontasks.state':
return CronTask::getStateName($data[$NAME . $num]);
case 'glpi_crontasks.mode':
return CronTask::getModeName($data[$NAME . $num]);
case 'glpi_crontasks.itemtype':
if ($plug = isPluginItemType($data[$NAME . $num])) {
return $plug['plugin'];
}
return '';
case 'glpi_changes.status':
$status = Change::getStatus($data[$NAME . $num]);
return "<img src=\"" . Change::getStatusIconURL($data[$NAME . $num]) . "\"\n alt=\"{$status}\" title=\"{$status}\"> {$status}";
case 'glpi_problems.status':
$status = Problem::getStatus($data[$NAME . $num]);
return "<img src=\"" . Problem::getStatusIconURL($data[$NAME . $num]) . "\"\n alt=\"{$status}\" title=\"{$status}\"> {$status}";
case 'glpi_tickets.status':
$status = Ticket::getStatus($data[$NAME . $num]);
return "<img src=\"" . Ticket::getStatusIconURL($data[$NAME . $num]) . "\"\n alt=\"{$status}\" title=\"{$status}\"> {$status}";
示例4: giveItem
//.........这里部分代码省略.........
$options['searchtype'][0] = 'equals';
$options['contains'][0] = 'all';
$options['link'][0] = 'AND';
$options['itemtype2'][0] = $itemtype;
$options['field2'][0] = self::getOptionNumber($itemtype, 'name');
$options['searchtype2'][0] = 'equals';
$options['contains2'][0] = $data['id'];
$options['link2'][0] = 'AND';
}
$options['reset'] = 'reset';
$out = "<a id='ticket{$itemtype}" . $data['id'] . "' ";
$out .= "href=\"" . $CFG_GLPI["root_doc"] . "/front/ticket.php?" . append_params($options, '&') . "\">";
$out .= $data[$NAME . $num] . "</a>";
} else {
$out = $data[$NAME . $num];
}
return $out;
case "glpi_softwarelicenses.number":
if ($data[$NAME . $num . "_2"] == -1) {
return $LANG['software'][4];
}
if (empty($data[$NAME . $num])) {
return 0;
}
return $data[$NAME . $num];
case "glpi_auth_tables.name":
return Auth::getMethodName($data[$NAME . $num], $data[$NAME . $num . "_2"], 1, $data[$NAME . $num . "_3"] . $data[$NAME . $num . "_4"]);
case "glpi_reservationitems.comment":
if (empty($data[$NAME . $num])) {
return "<a title=\"" . $LANG['reservation'][22] . "\"\n href='" . $CFG_GLPI["root_doc"] . "/front/reservationitem.form.php?id=" . $data["refID"] . "' >" . $LANG['common'][49] . "</a>";
}
return "<a title=\"" . $LANG['reservation'][22] . "\"\n href='" . $CFG_GLPI["root_doc"] . "/front/reservationitem.form.php?id=" . $data['refID'] . "' >" . resume_text($data[$NAME . $num]) . "</a>";
case 'glpi_notifications.mode':
return Notification::getMode($data[$NAME . $num]);
case 'glpi_notifications.event':
$item = NotificationTarget::getInstanceByType($data['itemtype']);
if ($item) {
$events = $item->getAllEvents();
return $events[$data[$NAME . $num]];
}
return '';
case 'glpi_crontasks.description':
$tmp = new CronTask();
return $tmp->getDescription($data['id']);
case 'glpi_crontasks.state':
return CronTask::getStateName($data[$NAME . $num]);
case 'glpi_crontasks.mode':
return CronTask::getModeName($data[$NAME . $num]);
case 'glpi_crontasks.itemtype':
if ($plug = isPluginItemType($data[$NAME . $num])) {
return $plug['plugin'];
}
return '';
case 'glpi_tickets.status':
$status = Ticket::getStatus($data[$NAME . $num]);
return "<img src=\"" . $CFG_GLPI["root_doc"] . "/pics/" . $data[$NAME . $num] . ".png\"\n alt=\"{$status}\" title=\"{$status}\"> {$status}";
case 'glpi_tickets.type':
return Ticket::getTicketTypeName($data[$NAME . $num]);
case 'glpi_tickets.priority':
return Ticket::getPriorityName($data[$NAME . $num]);
case 'glpi_tickets.urgency':
return Ticket::getUrgencyName($data[$NAME . $num]);
case 'glpi_tickets.impact':
return Ticket::getImpactName($data[$NAME . $num]);
case 'glpi_tickets.items_id':
if (!empty($data[$NAME . $num . "_2"]) && class_exists($data[$NAME . $num . "_2"])) {