本文整理汇总了PHP中Dropdown::showGlobalSwitch方法的典型用法代码示例。如果您正苦于以下问题:PHP Dropdown::showGlobalSwitch方法的具体用法?PHP Dropdown::showGlobalSwitch怎么用?PHP Dropdown::showGlobalSwitch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dropdown
的用法示例。
在下文中一共展示了Dropdown::showGlobalSwitch方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showForm
/**
* Print the phone form
*
* @param $ID integer ID of the item
* @param $options array
* - target filename : where to go when done.
* - withtemplate boolean : template or basic item
*
* @return boolean item found
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI;
$target = $this->getFormURL();
$withtemplate = $this->initForm($ID, $options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
//TRANS: %1$s is a string, %2$s a second one without spaces between them : to change for RTL
echo "<td>" . sprintf(__('%1$s%2$s'), __('Name'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
echo "<td>";
$objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, 'name', array('value' => $objectName));
echo "</td>";
echo "<td>" . __('Status') . "</td>";
echo "<td>";
State::dropdown(array('value' => $this->fields["states_id"], 'entity' => $this->fields["entities_id"], 'condition' => "`is_visible_phone`='1'"));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Location') . "</td>";
echo "<td>";
Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __('Type') . "</td>";
echo "<td>";
PhoneType::dropdown(array('value' => $this->fields["phonetypes_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Technician in charge of the hardware') . "</td>";
echo "<td>";
User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __('Manufacturer') . "</td>";
echo "<td>";
Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group in charge of the hardware') . "</td>";
echo "<td>";
Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
echo "</td>";
echo "<td>" . __('Model') . "</td>";
echo "<td>";
PhoneModel::dropdown(array('value' => $this->fields["phonemodels_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Alternate username number') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "contact_num");
echo "</td>";
echo "<td>" . __('Serial number') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "serial");
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Alternate username') . "</td><td>";
Html::autocompletionTextField($this, "contact");
echo "</td>";
echo "<td>" . sprintf(__('%1$s%2$s'), __('Inventory number'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
echo "<td>";
$objectName = autoName($this->fields["otherserial"], "otherserial", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, 'otherserial', array('value' => $objectName));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('User') . "</td>";
echo "<td>";
User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
echo "</td>";
echo "<td>" . __('Management type') . "</td>";
echo "<td>";
Dropdown::showGlobalSwitch($this->fields["id"], array('withtemplate' => $withtemplate, 'value' => $this->fields["is_global"], 'management_restrict' => $CFG_GLPI["phones_management_restrict"], 'target' => $target));
echo "</td></tr>\n";
// Display auto inventory informations
$rowspan = 7;
$inventory_show = false;
if (!empty($ID) && $this->fields["is_dynamic"]) {
$inventory_show = true;
$rowspan -= 2;
}
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group') . "</td>";
echo "<td>";
Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
echo "</td>";
echo "<td rowspan='{$rowspan}'>" . __('Comments') . "</td>";
echo "<td rowspan='{$rowspan}'>\n <textarea cols='45' rows='" . ($rowspan + 3) . "' name='comment' class='form-control' >" . $this->fields["comment"];
echo "</textarea></td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Brand') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "brand");
//.........这里部分代码省略.........
示例2: showForm
/**
* Print the printer form
*
* @param $ID integer ID of the item
* @param $options array of possible options:
* - target filename : where to go when done.
* - withtemplate boolean : template or basic item
*
*@return boolean item found
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI;
$target = $this->getFormURL();
$withtemplate = $this->initForm($ID, $options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
//TRANS: %1$s is a string, %2$s a second one without spaces between them : to change for RTL
echo "<td>" . sprintf(__('%1$s%2$s'), __('Name'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>\n";
echo "<td>";
$objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, 'name', array('value' => $objectName));
echo "</td>\n";
echo "<td>" . __('Status') . "</td>\n";
echo "<td>";
State::dropdown(array('value' => $this->fields["states_id"], 'entity' => $this->fields["entities_id"], 'condition' => "`is_visible_printer`"));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Location') . "</td>\n";
echo "<td>";
Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>\n";
echo "<td>" . __('Type') . "</td>\n";
echo "<td>";
PrinterType::dropdown(array('value' => $this->fields["printertypes_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Technician in charge of the hardware') . "</td>\n";
echo "<td>";
User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
echo "</td>\n";
echo "<td>" . __('Manufacturer') . "</td>\n";
echo "<td>";
Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group in charge of the hardware') . "</td>";
echo "<td>";
Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
echo "</td>";
echo "<td>" . __('Model') . "</td>\n";
echo "<td>";
PrinterModel::dropdown(array('value' => $this->fields["printermodels_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Alternate username number') . "</td>\n";
echo "<td>";
Html::autocompletionTextField($this, "contact_num");
echo "</td>\n";
echo "<td>" . __('Serial number') . "</td>\n";
echo "<td>";
Html::autocompletionTextField($this, "serial");
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Alternate username') . "</td>\n";
echo "<td>";
Html::autocompletionTextField($this, "contact");
echo "</td>\n";
echo "<td>" . sprintf(__('%1$s%2$s'), __('Inventory number'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>\n";
echo "<td>";
$objectName = autoName($this->fields["otherserial"], "otherserial", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, 'otherserial', array('value' => $objectName));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('User') . "</td>\n";
echo "<td>";
User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
echo "</td>\n";
echo "<td>" . __('Management type') . "</td>";
echo "<td>";
$globalitem = array();
$globalitem['withtemplate'] = $withtemplate;
$globalitem['value'] = $this->fields["is_global"];
$globalitem['target'] = $target;
if ($this->can($ID, UPDATE)) {
$globalitem['management_restrict'] = $CFG_GLPI["printers_management_restrict"];
}
Dropdown::showGlobalSwitch($this->fields["id"], $globalitem);
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group') . "</td>\n";
echo "<td>";
Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
echo "</td>\n";
echo "<td>" . __('Network') . "</td>\n";
echo "<td>";
Network::dropdown(array('value' => $this->fields["networks_id"]));
echo "</td></tr>\n";
// Display auto inventory informations
$rowspan = 6;
//.........这里部分代码省略.........
示例3: showForm
/**
* Print the monitor form
*
* @param $ID integer ID of the item
* @param $options array
* - target filename : where to go when done.
* - withtemplate boolean : template or basic item
*
* @return boolean item found
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI;
$target = $this->getFormURL();
$withtemplate = $this->initForm($ID, $options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
//TRANS: %1$s is a string, %2$s a second one without spaces between them : to change for RTL
echo "<td>" . sprintf(__('%1$s%2$s'), __('Name'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "");
echo "</td>";
echo "<td>";
$objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, "name", array('value' => $objectName));
echo "</td>";
echo "<td>" . __('Status') . "</td>";
echo "<td>";
State::dropdown(array('value' => $this->fields["states_id"], 'entity' => $this->fields["entities_id"], 'condition' => "`is_visible_monitor`"));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Location') . "</td>";
echo "<td>";
Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __('Type') . "</td>";
echo "<td>";
MonitorType::dropdown(array('value' => $this->fields["monitortypes_id"]));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Technician in charge of the hardware') . "</td>";
echo "<td>";
User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __('Manufacturer') . "</td>";
echo "<td>";
Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group in charge of the hardware') . "</td>";
echo "<td>";
Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
echo "</td>";
echo "<td>" . __('Model') . "</td>";
echo "<td>";
MonitorModel::dropdown(array('value' => $this->fields["monitormodels_id"]));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Alternate username number') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "contact_num");
echo "</td>";
echo "<td>" . __('Serial number') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "serial");
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Alternate username') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "contact");
echo "</td>";
echo "<td>" . sprintf(__('%1$s%2$s'), __('Inventory number'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
echo "<td>";
$objectName = autoName($this->fields["otherserial"], "otherserial", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, "otherserial", array('value' => $objectName));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('User') . "</td>";
echo "<td>";
User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
echo "</td>";
echo "<td>" . __('Management type') . "</td>";
echo "<td>";
Dropdown::showGlobalSwitch($this->fields["id"], array('withtemplate' => $withtemplate, 'value' => $this->fields["is_global"], 'management_restrict' => $CFG_GLPI["monitors_management_restrict"], 'target' => $target));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group') . "</td>";
echo "<td>";
Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
echo "</td>";
echo "<td rowspan='4'>" . __('Comments') . "</td>";
echo "<td rowspan='4'>\n <textarea cols='45' rows='10' name='comment' >" . $this->fields["comment"] . "</textarea>";
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Size') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "size");
echo "\"</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . 'Flags' . "</td>";
echo "<td><table>";
//.........这里部分代码省略.........
示例4: displayActionSelectPattern
/**
* @param $options array
**/
function displayActionSelectPattern($options = array())
{
$display = false;
$param['value'] = '';
if (isset($options['value'])) {
$param['value'] = $options['value'];
}
switch ($options["action_type"]) {
//If a regex value is used, then always display an autocompletiontextfield
case "regex_result":
case "append_regex_result":
Html::autocompletionTextField($this, "value", $param);
break;
case 'fromuser':
case 'fromitem':
Dropdown::showYesNo("value", $param['value'], 0);
$display = true;
break;
default:
$actions = Rule::getActionsByType($options["sub_type"]);
if (isset($actions[$options["field"]]['type'])) {
switch ($actions[$options["field"]]['type']) {
case "dropdown":
$table = $actions[$options["field"]]['table'];
$param['name'] = "value";
if (isset($actions[$options["field"]]['condition'])) {
$param['condition'] = $actions[$options["field"]]['condition'];
}
Dropdown::show(getItemTypeForTable($table), $param);
$display = true;
break;
case "dropdown_tickettype":
Ticket::dropdownType('value', $param);
$display = true;
break;
case "dropdown_assign":
$param['name'] = 'value';
$param['right'] = 'own_ticket';
User::dropdown($param);
$display = true;
break;
case "dropdown_users":
$param['name'] = 'value';
$param['right'] = 'all';
User::dropdown($param);
$display = true;
break;
case "dropdown_urgency":
$param['name'] = 'value';
Ticket::dropdownUrgency($param);
$display = true;
break;
case "dropdown_impact":
$param['name'] = 'value';
Ticket::dropdownImpact($param);
$display = true;
break;
case "dropdown_priority":
if ($_POST["action_type"] != 'compute') {
$param['name'] = 'value';
Ticket::dropdownPriority($param);
}
$display = true;
break;
case "dropdown_status":
$param['name'] = 'value';
Ticket::dropdownStatus($param);
$display = true;
break;
case "yesonly":
Dropdown::showYesNo("value", $param['value'], 0);
$display = true;
break;
case "yesno":
Dropdown::showYesNo("value", $param['value']);
$display = true;
break;
case "dropdown_management":
$param['name'] = 'value';
$param['management_restrict'] = 2;
$param['withtemplate'] = false;
Dropdown::showGlobalSwitch(0, $param);
$display = true;
break;
case "dropdown_users_validate":
$used = array();
if ($item = getItemForItemtype($options["sub_type"])) {
$rule_data = getAllDatasFromTable('glpi_ruleactions', "`action_type` = 'add_validation'\n AND `field` = 'users_id_validate'\n AND `" . $item->getRuleIdField() . "`\n = '" . $options[$item->getRuleIdField()] . "'");
foreach ($rule_data as $data) {
$used[] = $data['value'];
}
}
$param['name'] = 'value';
$param['right'] = array('validate_incident', 'validate_request');
$param['used'] = $used;
User::dropdown($param);
$display = true;
//.........这里部分代码省略.........
示例5: showForm
//.........这里部分代码省略.........
echo "<td>";
Dropdown::show('Location', array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . $LANG['common'][17] . " :</td>";
echo "<td>";
Dropdown::show('PhoneType', array('value' => $this->fields["phonetypes_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][10] . " :</td>";
echo "<td>";
User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'interface', 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . $LANG['common'][5] . " :</td>";
echo "<td>";
Dropdown::show('Manufacturer', array('value' => $this->fields["manufacturers_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][21] . " :</td>";
echo "<td>";
autocompletionTextField($this, "contact_num");
echo "</td>";
echo "<td>" . $LANG['common'][22] . " :</td>";
echo "<td>";
Dropdown::show('PhoneModel', array('value' => $this->fields["phonemodels_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][18] . " :</td><td>";
autocompletionTextField($this, "contact");
echo "</td>";
echo "<td>" . $LANG['common'][19] . " :</td>";
echo "<td>";
autocompletionTextField($this, "serial");
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][34] . " :</td>";
echo "<td>";
User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
echo "</td>";
echo "<td>" . $LANG['common'][20] . ($template ? "*" : "") . " :</td>";
echo "<td>";
$objectName = autoName($this->fields["otherserial"], "otherserial", $template === "newcomp", $this->getType(), $this->fields["entities_id"]);
autocompletionTextField($this, 'otherserial', array('value' => $objectName));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][35] . " :</td>";
echo "<td>";
Dropdown::show('Group', array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . $LANG['peripherals'][33] . " :</td>";
echo "<td>";
Dropdown::showGlobalSwitch($this->fields["id"], array('withtemplate' => $withtemplate, 'value' => $this->fields["is_global"], 'management_restrict' => $CFG_GLPI["phones_management_restrict"], 'target' => $target));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['peripherals'][18] . " :</td>";
echo "<td>";
autocompletionTextField($this, "brand");
echo "</td>";
echo "<td rowspan='6'>";
echo $LANG['common'][25] . " :</td>";
echo "<td rowspan='6'>\n <textarea cols='45' rows='9' name='comment' >" . $this->fields["comment"] . "</textarea>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['phones'][36] . " :</td>";
echo "<td>";
Dropdown::show('PhonePowerSupply', array('value' => $this->fields["phonepowersupplies_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['setup'][71] . " :</td>";
echo "<td>";
autocompletionTextField($this, "firmware");
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['phones'][40] . " :</td><td>";
autocompletionTextField($this, "number_line");
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['monitors'][18] . " :</td>";
echo "<td>";
// micro?
echo "\n<table><tr><td>" . $LANG['phones'][38] . "</td>";
echo "<td> ";
Dropdown::showYesNo("have_headset", $this->fields["have_headset"]);
echo "</td></tr>";
// hp?
echo "<tr><td>" . $LANG['phones'][39] . "</td>";
echo "<td> ";
Dropdown::showYesNo("have_hp", $this->fields["have_hp"]);
echo "</td></tr></table>\n";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td colspan='2' class='center' height='30'>" . $datestring . " " . $date;
if (!$template && !empty($this->fields['template_name'])) {
echo "<span class='small_space'>";
echo "(" . $LANG['common'][13] . " : " . $this->fields['template_name'] . ")</span>";
}
echo "</td></tr>\n";
$this->showFormButtons($options);
$this->addDivForTabs();
return true;
}
示例6: showForm
/**
* Print the peripheral form
*
* @param $ID integer ID of the item
* @param $options array
* - target filename : where to go when done.
* - withtemplate boolean : template or basic item
*
* @return boolean item found
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI;
$target = $this->getFormURL();
$withtemplate = $this->initForm($ID, $options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
//TRANS: %1$s is a string, %2$s a second one without spaces between them : to change for RTL
echo "<td>" . sprintf(__('%1$s%2$s'), __('Name'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "");
echo "</td>";
echo "<td>";
$objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, "name", array('value' => $objectName));
echo "</td>\n";
echo "<td>" . __('Status') . "</td>\n";
echo "<td>";
State::dropdown(array('value' => $this->fields["states_id"], 'entity' => $this->fields["entities_id"], 'condition' => "`is_visible_peripheral`"));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Location') . "</td>\n";
echo "<td>";
Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>\n";
echo "<td>" . __('Type') . "</td>\n";
echo "<td>";
PeripheralType::dropdown(array('value' => $this->fields["peripheraltypes_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Technician in charge of the hardware') . "</td>\n";
echo "<td>";
User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __('Manufacturer') . "</td>\n";
echo "<td>";
Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group in charge of the hardware') . "</td>";
echo "<td>";
Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
echo "</td>";
echo "<td>" . __('Model') . "</td>\n";
echo "<td>";
PeripheralModel::dropdown(array('value' => $this->fields["peripheralmodels_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Alternate username number') . "</td>\n";
echo "<td>";
Html::autocompletionTextField($this, "contact_num");
echo "</td>";
echo "<td>" . __('Serial number') . "</td>\n";
echo "<td>";
Html::autocompletionTextField($this, "serial");
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Alternate username') . "</td>\n";
echo "<td>";
Html::autocompletionTextField($this, "contact");
echo "</td>\n";
echo "<td>" . sprintf(__('%1$s%2$s'), __('Inventory number'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>\n";
echo "<td>";
$objectName = autoName($this->fields["otherserial"], "otherserial", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, "otherserial", array('value' => $objectName));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('User') . "</td>\n";
echo "<td>";
User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
echo "</td>\n";
echo "<td>" . __('Management type') . "</td>\n";
echo "<td>";
Dropdown::showGlobalSwitch($this->fields["id"], array('withtemplate' => $withtemplate, 'value' => $this->fields["is_global"], 'management_restrict' => $CFG_GLPI["peripherals_management_restrict"], 'target' => $target));
echo "</td></tr>\n";
// Display auto inventory informations
$rowspan = 2;
$inventory_show = false;
if (!empty($ID) && $this->fields["is_dynamic"]) {
$inventory_show = true;
$rowspan -= 1;
}
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group') . "</td>\n";
echo "<td>";
Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
echo "</td>\n";
echo "<td rowspan='{$rowspan}'>" . __('Comments') . "</td>\n";
echo "<td rowspan='{$rowspan}'>\n <textarea cols='45' rows='" . ($rowspan + 3) . "' name='comment' >" . $this->fields["comment"];
echo "</textarea></td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Brand') . "</td>\n";
//.........这里部分代码省略.........
示例7: displayActionSelectPattern
/**
* @param $options array
**/
function displayActionSelectPattern($options = array())
{
$display = false;
switch ($_POST["action_type"]) {
//If a regex value is used, then always display an autocompletiontextfield
case "regex_result":
case "append_regex_result":
Html::autocompletionTextField($this, "value");
break;
case 'fromuser':
case 'fromitem':
Dropdown::showYesNo("value", 0, 0);
$display = true;
break;
default:
$actions = Rule::getActionsByType($options["sub_type"]);
if (isset($actions[$options["field"]]['type'])) {
switch ($actions[$options["field"]]['type']) {
case "dropdown":
$table = $actions[$options["field"]]['table'];
$param = array('name' => "value");
if (isset($actions[$options["field"]]['condition'])) {
$param['condition'] = $actions[$options["field"]]['condition'];
}
Dropdown::show(getItemTypeForTable($table), $param);
$display = true;
break;
case "dropdown_tickettype":
Ticket::dropdownType('value');
$display = true;
break;
case "dropdown_assign":
User::dropdown(array('name' => 'value', 'right' => 'own_ticket'));
$display = true;
break;
case "dropdown_users":
User::dropdown(array('name' => 'value', 'right' => 'all'));
$display = true;
break;
case "dropdown_urgency":
Ticket::dropdownUrgency(array('name' => 'value'));
$display = true;
break;
case "dropdown_impact":
Ticket::dropdownImpact(array('name' => 'value'));
$display = true;
break;
case "dropdown_priority":
if ($_POST["action_type"] != 'compute') {
Ticket::dropdownPriority(array('name' => 'value'));
}
$display = true;
break;
case "dropdown_status":
Ticket::dropdownStatus(array('name' => "value"));
$display = true;
break;
case "yesonly":
Dropdown::showYesNo("value", 0, 0);
$display = true;
break;
case "yesno":
Dropdown::showYesNo("value");
$display = true;
break;
case "dropdown_management":
Dropdown::showGlobalSwitch(0, array('name' => 'value', 'management_restrict' => 2, 'withtemplate' => false));
$display = true;
break;
case "dropdown_users_validate":
User::dropdown(array('name' => "value", 'right' => array('validate_incident', 'validate_request')));
$display = true;
break;
default:
if ($rule = getItemForItemtype($options["sub_type"])) {
$display = $rule->displayAdditionalRuleAction($actions[$options["field"]]);
}
break;
}
}
if (!$display) {
Html::autocompletionTextField($this, "value");
}
}
}
示例8: showForm
//.........这里部分代码省略.........
Dropdown::show('Manufacturer', array('value' => $this->fields["manufacturers_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][21] . " :</td>\n";
echo "<td>";
autocompletionTextField($this, "contact_num");
echo "</td>\n";
echo "<td>" . $LANG['common'][22] . " :</td>\n";
echo "<td>";
Dropdown::show('PrinterModel', array('value' => $this->fields["printermodels_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][18] . " :</td>\n";
echo "<td>";
autocompletionTextField($this, "contact");
echo "</td>\n";
echo "<td>" . $LANG['common'][19] . " :</td>\n";
echo "<td>";
autocompletionTextField($this, "serial");
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][34] . " :</td>\n";
echo "<td>";
User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
echo "</td>\n";
echo "<td>" . $LANG['common'][20] . ($template ? "*" : "") . " :</td>\n";
echo "<td>";
$objectName = autoName($this->fields["otherserial"], "otherserial", $template === "newcomp", $this->getType(), $this->fields["entities_id"]);
autocompletionTextField($this, 'otherserial', array('value' => $objectName));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][35] . " :</td>\n";
echo "<td>";
Dropdown::show('Group', array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>\n";
echo "<td>" . $LANG['peripherals'][33] . " :</td>";
echo "<td>";
if ($this->can($ID, 'w')) {
Dropdown::showGlobalSwitch($this->fields["id"], array('withtemplate' => $withtemplate, 'value' => $this->fields["is_global"], 'management_restrict' => $CFG_GLPI["printers_management_restrict"], 'target' => $target));
} else {
Dropdown::showGlobalSwitch($this->fields["id"], array('withtemplate' => $withtemplate, 'value' => $this->fields["is_global"], 'target' => $target));
}
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['setup'][89] . " :</td>\n";
echo "<td>";
Dropdown::show('Domain', array('value' => $this->fields["domains_id"]));
echo "</td>";
echo "<td>" . $LANG['setup'][88] . " :</td>\n";
echo "<td>";
Dropdown::show('Network', array('value' => $this->fields["networks_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['devices'][6] . " :</td>\n";
echo "<td>";
autocompletionTextField($this, "memory_size");
echo "</td>";
echo "<td rowspan='4'>";
echo $LANG['common'][25] . " :</td>\n";
echo "<td rowspan='4'><textarea cols='45' rows='8' name='comment' >" . $this->fields["comment"] . "</textarea>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['printers'][30] . " :</td>\n";
echo "<td>";
autocompletionTextField($this, "init_pages_counter");
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['printers'][18] . " : </td>";
echo "<td>\n<table>";
// serial interface
echo "<tr><td>" . $LANG['printers'][14] . "</td><td>";
Dropdown::showYesNo("have_serial", $this->fields["have_serial"]);
echo "</td></tr>";
// parallel interface?
echo "<tr><td>" . $LANG['printers'][15] . "</td><td>";
Dropdown::showYesNo("have_parallel", $this->fields["have_parallel"]);
echo "</td></tr>";
// USB interface?
echo "<tr><td>" . $LANG['printers'][27] . "</td><td>";
Dropdown::showYesNo("have_usb", $this->fields["have_usb"]);
echo "</td></tr>";
// ethernet interface?
echo "<tr><td>" . $LANG['printers'][28] . "</td><td>";
Dropdown::showYesNo("have_ethernet", $this->fields["have_ethernet"]);
echo "</td></tr>";
// wifi ?
echo "<tr><td>" . $LANG['printers'][29] . "</td><td>";
Dropdown::showYesNo("have_wifi", $this->fields["have_wifi"]);
echo "</td></tr></table>\n";
echo "<tr class='tab_bg_1'>";
echo "<td colspan='2' class='center' height='30'>" . $datestring . " " . $date;
if (!$template && !empty($this->fields['template_name'])) {
echo "<span class='small_space'>";
echo "(" . $LANG['common'][13] . " : " . $this->fields['template_name'] . ")</span>";
}
echo "</td></tr>\n";
$this->showFormButtons($options);
$this->addDivForTabs();
return true;
}