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


PHP NotificationEvent::getTypeName方法代码示例

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


在下文中一共展示了NotificationEvent::getTypeName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 "&nbsp;";
                 }
                 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>";
 }
开发者ID:kipman,项目名称:glpi,代码行数:51,代码来源:notificationtarget.class.php

示例2: 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) . "&nbsp;";
     $item->dropdown(array('value' => $id, 'on_change' => 'reloadTab("' . $key . '="+this.value)'));
     echo "</td><td>" . NotificationEvent::getTypeName(1) . "&nbsp;";
     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

示例3: showForm

 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'><td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td rowspan='6' class='middle right'>" . __('Comments') . "</td>";
     echo "<td class='center middle' rowspan='6'><textarea cols='45' rows='9' class='form-control' name='comment' >" . $this->fields["comment"] . "</textarea></td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Active') . "</td>";
     echo "<td>";
     Dropdown::showYesNo('is_active', $this->fields['is_active']);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Type') . "</td>";
     echo "<td>";
     if (!Session::haveRight(static::$rightname, UPDATE)) {
         $itemtype = $this->fields['itemtype'];
         echo $itemtype::getTypeName(1);
         $rand = '';
     } else {
         if (Config::canUpdate() && $this->getEntityID() == 0) {
             $rand = Dropdown::showItemTypes('itemtype', $CFG_GLPI["notificationtemplates_types"], array('value' => $this->fields['itemtype']));
         } else {
             $rand = Dropdown::showItemTypes('itemtype', array_diff($CFG_GLPI["notificationtemplates_types"], array('Crontask', 'DBConnection', 'User')), array('value' => $this->fields['itemtype']));
         }
     }
     $params = array('itemtype' => '__VALUE__');
     Ajax::updateItemOnSelectEvent("dropdown_itemtype{$rand}", "show_events", $CFG_GLPI["root_doc"] . "/ajax/dropdownNotificationEvent.php", $params);
     Ajax::updateItemOnSelectEvent("dropdown_itemtype{$rand}", "show_templates", $CFG_GLPI["root_doc"] . "/ajax/dropdownNotificationTemplate.php", $params);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Notification method') . "</td>";
     echo "<td>";
     self::dropdownMode(array('value' => $this->fields['mode']));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . NotificationEvent::getTypeName(1) . "</td>";
     echo "<td><span id='show_events'>";
     NotificationEvent::dropdownEvents($this->fields['itemtype'], array('value' => $this->fields['event']));
     echo "</span></td></tr>";
     echo "<tr class='tab_bg_1'><td>" . NotificationTemplate::getTypeName(1) . "</td>";
     echo "<td><span id='show_templates'>";
     NotificationTemplate::dropdownTemplates('notificationtemplates_id', $this->fields['itemtype'], $this->fields['notificationtemplates_id']);
     echo "</span></td></tr>";
     $this->showFormButtons($options);
     return true;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:47,代码来源:notification.class.php


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