本文整理汇总了PHP中Dropdown::dropdownTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP Dropdown::dropdownTypes方法的具体用法?PHP Dropdown::dropdownTypes怎么用?PHP Dropdown::dropdownTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dropdown
的用法示例。
在下文中一共展示了Dropdown::dropdownTypes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showForItem
/**
* Print the HTML array for device on link
*
* Print the HTML array for device on link for link $instID
*
*@param $links_id array : Link identifier.
*
*@return Nothing (display)
*
**/
static function showForItem($links_id)
{
global $DB, $CFG_GLPI, $LANG;
$link = new Link();
if ($links_id > 0) {
$link->check($links_id, 'r');
} else {
// Create item
$link->check(-1, 'w');
$link->getEmpty();
}
$canedit = $link->can($links_id, 'w');
$canrecu = $link->can($links_id, 'recursive');
if (!haveRight("link", "r")) {
return false;
}
//$canedit= haveRight("link","w");
$query = "SELECT *\n FROM `glpi_links_itemtypes`\n WHERE `links_id`='{$links_id}'\n ORDER BY `itemtype`";
$result = $DB->query($query);
$number = $DB->numrows($result);
$i = 0;
$used = array();
echo "<form method='post' action=\"" . $CFG_GLPI["root_doc"] . "/front/link_itemtype.form.php\">";
echo "<div class='center'><table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2'>" . $LANG['links'][4] . " :</th></tr>";
echo "<tr><th>" . $LANG['common'][17] . "</th>";
echo "<th> </th></tr>";
while ($i < $number) {
$ID = $DB->result($result, $i, "id");
$itemtype = $DB->result($result, $i, "itemtype");
$typename = NOT_AVAILABLE;
if (class_exists($itemtype)) {
$item = new $itemtype();
$typename = $item->getTypeName();
}
echo "<tr class='tab_bg_1'>";
echo "<td class='center'>{$typename}</td>";
echo "<td class='center'>";
echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/link_itemtype.form.php?delete=deletedevice&id={$ID}&links_id={$links_id}'>\n <strong>" . $LANG['buttons'][6] . "</strong></a></td></tr>";
$used[$itemtype] = $itemtype;
$i++;
}
if ($canedit) {
echo "<tr class='tab_bg_1'><td> </td><td class='center'>";
echo "<input type='hidden' name='links_id' value='{$links_id}'>";
Dropdown::dropdownTypes("itemtype", '', $CFG_GLPI["link_types"], $used);
echo " <input type='submit' name='add' value=\"" . $LANG['buttons'][8] . "\" class='submit'>";
echo "</td></tr>";
}
echo "</table></div></form>";
}
示例2: 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;
}
示例3: preaddRule
function preaddRule($componentscatalogs_id)
{
global $LANG, $CFG_GLPI, $DB;
$networkport_types = $CFG_GLPI['networkport_types'];
$networkport_types[] = "PluginMonitoringNetworkport";
$a_usedItemtypes = array();
$query = "SELECT * FROM `" . $this->getTable() . "`\n WHERE `plugin_monitoring_componentscalalog_id`='" . $componentscatalogs_id . "'";
$result = $DB->query($query);
while ($data = $DB->fetch_array($result)) {
$a_usedItemtypes[$data['itemtype']] = $data['itemtype'];
}
if (count($a_usedItemtypes) == count($networkport_types)) {
return;
}
$this->getEmpty();
$this->showFormHeader();
echo "<tr class='tab_bg_1'>";
echo "<td>";
echo $LANG['common'][16] . " :";
echo "</td>";
echo "<td>";
echo "<input type='text' name='name' value=''/>";
echo "</td>";
echo "<td>";
echo $LANG['state'][6] . " :";
echo "</td>";
echo "<td>";
Dropdown::dropdownTypes("itemtypen", "", $networkport_types, $a_usedItemtypes);
echo "<input type='hidden' name='plugin_monitoring_componentscalalog_id' value='" . $componentscatalogs_id . "' >";
echo "</td>";
echo "</tr>";
$this->showFormButtons();
}
示例4: displayCriteriaSelectPattern
/**
* Display item used to select a pattern for a criteria
*
* @param $name criteria name
* @param $ID the given criteria
* @param $condition condition used
* @param $value the pattern
* @param $test Is to test rule ?
**/
function displayCriteriaSelectPattern($name, $ID, $condition, $value = "", $test = false)
{
$crit = $this->getCriteria($ID);
$display = false;
$tested = false;
if (isset($crit['type']) && ($test || $condition == self::PATTERN_IS || $condition == self::PATTERN_IS_NOT)) {
switch ($crit['type']) {
case "yesonly":
Dropdown::showYesNo($name, $crit['table'], 0);
$display = true;
break;
case "yesno":
Dropdown::showYesNo($name, $crit['table']);
$display = true;
break;
case "dropdown":
Dropdown::show(getItemTypeForTable($crit['table']), array('name' => $name, 'value' => $value));
$display = true;
break;
case "dropdown_users":
User::dropdown(array('value' => $value, 'name' => $name, 'right' => 'all'));
$display = true;
break;
case "dropdown_tracking_itemtype":
Dropdown::dropdownTypes($name, 0, array_keys(Ticket::getAllTypesForHelpdesk()));
$display = true;
break;
case "dropdown_urgency":
Ticket::dropdownUrgency($name, $value);
$display = true;
break;
case "dropdown_impact":
Ticket::dropdownImpact($name, $value);
$display = true;
break;
case "dropdown_priority":
Ticket::dropdownPriority($name, $value);
$display = true;
break;
case "dropdown_tickettype":
Ticket::dropdownType($name, $value);
$display = true;
break;
}
$tested = true;
}
//Not a standard condition
if (!$tested) {
$display = $this->displayAdditionalRuleCondition($condition, $crit, $name, $value, $test);
}
if ($condition == self::PATTERN_EXISTS || $condition == self::PATTERN_DOES_NOT_EXISTS) {
echo "<input type='hidden' name='{$name}' value='1'>";
$display = true;
}
if (!$display) {
$rc = new $this->rulecriteriaclass();
autocompletionTextField($rc, "pattern", array('name' => $name, 'value' => $value, 'size' => 70));
}
}
示例5: showForm
function showForm($ID, $options = array())
{
global $LANG, $CFG_GLPI;
if (!haveRight("config", "w")) {
return false;
}
$spotted = false;
if (empty($ID)) {
if ($this->getEmpty()) {
$spotted = true;
}
} else {
if ($this->getFromDB($ID)) {
$spotted = true;
}
}
$this->showTabs($options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'><td>" . $LANG['common'][16] . " :</td>";
echo "<td colspan='3'>";
autocompletionTextField($this, "name");
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . $LANG['common'][17] . " :</td><td colspan='3'>";
Dropdown::dropdownTypes("itemtype", $this->fields['itemtype'] ? $this->fields['itemtype'] : 'Ticket', $CFG_GLPI["notificationtemplates_types"]);
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . $LANG['common'][25] . " : </td>";
echo "<td colspan='3'>";
echo "<textarea cols='60' rows='5' name='comment' >" . $this->fields["comment"] . "</textarea>";
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . $LANG['mailing'][6] . " : </td>";
echo "<td colspan='3'>";
echo "<textarea cols='60' rows='5' name='css' >" . $this->fields["css"] . "</textarea></td></tr>";
$this->showFormButtons($options);
$this->addDivForTabs();
return true;
}