本文整理汇总了PHP中NotificationEvent::dropdownEvents方法的典型用法代码示例。如果您正苦于以下问题:PHP NotificationEvent::dropdownEvents方法的具体用法?PHP NotificationEvent::dropdownEvents怎么用?PHP NotificationEvent::dropdownEvents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NotificationEvent
的用法示例。
在下文中一共展示了NotificationEvent::dropdownEvents方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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>";
}
示例2: getSpecificValueToSelect
/**
* @since version 0.84
*
* @param $field
* @param $name (default '')
* @param $values (default '')
* @param $options array
**/
static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
{
if (!is_array($values)) {
$values = array($field => $values);
}
$options['display'] = false;
switch ($field) {
case 'event':
if (isset($values['itemtype']) && !empty($values['itemtype'])) {
$options['value'] = $values[$field];
$options['name'] = $name;
return NotificationEvent::dropdownEvents($values['itemtype'], $options);
}
break;
case 'mode':
$options['value'] = $values[$field];
$options['name'] = $name;
return self::dropdownMode($options);
}
return parent::getSpecificValueToSelect($field, $name, $values, $options);
}
示例3: showForm
function showForm($ID, $options = array())
{
global $LANG, $CFG_GLPI;
if (!haveRight("notification", "r")) {
return false;
}
if ($ID > 0) {
$this->check($ID, 'r');
} else {
// Create item
$this->check(-1, 'w');
}
$this->showTabs($options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'><td>" . $LANG['common'][16] . " :</td>";
echo "<td>";
autocompletionTextField($this, "name");
echo "</td>";
echo "<td rowspan='6' class='middle right'>" . $LANG['common'][25] . " :</td>";
echo "<td class='center middle' rowspan='6'><textarea cols='45' rows='9' name='comment' >" . $this->fields["comment"] . "</textarea></td></tr>";
echo "<tr class='tab_bg_1'><td>" . $LANG['common'][60] . " :</td>";
echo "<td>";
Dropdown::showYesNo('is_active', $this->fields['is_active']);
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . $LANG['common'][17] . " :</td>";
echo "<td>";
if (haveRight('config', 'w') && $this->getEntityID() == 0) {
$rand = Dropdown::dropdownTypes("itemtype", $this->fields['itemtype'], $CFG_GLPI["notificationtemplates_types"]);
} else {
$rand = Dropdown::dropdownTypes("itemtype", $this->fields['itemtype'], array_diff($CFG_GLPI["notificationtemplates_types"], array('Crontask', 'DBConnection')));
}
$params = array('itemtype' => '__VALUE__');
ajaxUpdateItemOnSelectEvent("dropdown_itemtype{$rand}", "show_events", $CFG_GLPI["root_doc"] . "/ajax/dropdownNotificationEvent.php", $params);
ajaxUpdateItemOnSelectEvent("dropdown_itemtype{$rand}", "show_templates", $CFG_GLPI["root_doc"] . "/ajax/dropdownNotificationTemplate.php", $params);
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . $LANG['mailing'][120] . " :</td>";
echo "<td>";
self::dropdownMode($this->fields['mode']);
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . $LANG['mailing'][119] . " :</td>";
echo "<td><span id='show_events'>";
NotificationEvent::dropdownEvents($this->fields['itemtype'], $this->fields['event']);
echo "</span></td></tr>";
echo "<tr class='tab_bg_1'><td>" . $LANG['mailing'][113] . " :</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);
$this->addDivForTabs();
return true;
}
示例4: header
-------------------------------------------------------------------------
LICENSE
This file is part of GLPI.
GLPI is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
if (strpos($_SERVER['PHP_SELF'], "dropdownNotificationEvent.php")) {
include '../inc/includes.php';
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
}
Session::checkRight("notification", UPDATE);
NotificationEvent::dropdownEvents($_POST['itemtype']);