本文整理汇总了PHP中NotificationEvent::getEventName方法的典型用法代码示例。如果您正苦于以下问题:PHP NotificationEvent::getEventName方法的具体用法?PHP NotificationEvent::getEventName怎么用?PHP NotificationEvent::getEventName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NotificationEvent
的用法示例。
在下文中一共展示了NotificationEvent::getEventName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getSpecificValueToDisplay
/**
* @since version 0.84
*
* @param $field
* @param $values
* @param $options array
**/
static function getSpecificValueToDisplay($field, $values, array $options = array())
{
if (!is_array($values)) {
$values = array($field => $values);
}
switch ($field) {
case 'event':
if (isset($values['itemtype']) && !empty($values['itemtype'])) {
return NotificationEvent::getEventName($values['itemtype'], $values[$field]);
}
break;
case 'mode':
return self::getMode($values[$field]);
}
return parent::getSpecificValueToDisplay($field, $values, $options);
}