/** * 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"); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Power supply') . "</td>"; echo "<td>"; PhonePowerSupply::dropdown(array('value' => $this->fields["phonepowersupplies_id"])); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . _n('Firmware', 'Firmwares', 1) . "</td>"; echo "<td>"; Html::autocompletionTextField($this, "firmware"); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . _x('quantity', 'Number of lines') . "</td><td>"; Html::autocompletionTextField($this, "number_line"); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Flags') . "</td>"; echo "<td>"; // micro? echo "\n<table><tr><td>" . __('Headset') . "</td>"; echo "<td> "; Dropdown::showYesNo("have_headset", $this->fields["have_headset"]); echo "</td></tr>"; // hp? echo "<tr><td>" . __('Speaker') . "</td>"; echo "<td> "; Dropdown::showYesNo("have_hp", $this->fields["have_hp"]); echo "</td></tr></table>\n"; echo "</td>"; if ($inventory_show) { echo "<td rowspan='2'>" . __('Automatic inventory') . "</td>"; echo "<td rowspan='2'>"; Plugin::doHook("autoinventory_information", $this); echo "</td>"; } echo "</tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>"; if ((!isset($options['withtemplate']) || $options['withtemplate'] == 0) && !empty($this->fields['template_name'])) { echo "<span class='small_space'>"; printf(__('Created from the template %s'), $this->fields['template_name']); echo "</span>"; } else { echo " "; } echo "</td><td>"; if (isset($options['withtemplate']) && $options['withtemplate']) { //TRANS: %s is the datetime of insertion printf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"])); } else { //TRANS: %s is the datetime of insertion printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"])); } echo "</td></tr>\n"; $this->showFormButtons($options); return true; }
/** * 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; $inventory_show = false; if (!empty($ID) && $this->fields["is_dynamic"]) { $inventory_show = true; $rowspan -= 2; } echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Domain') . "</td>\n"; echo "<td>"; Domain::dropdown(array('value' => $this->fields["domains_id"], 'entity' => $this->fields["entities_id"])); echo "</td>"; echo "<td rowspan='{$rowspan}'>" . __('Comments') . "</td>\n"; echo "<td rowspan='{$rowspan}'>"; echo "<textarea cols='45' rows='" . ($rowspan + 3) . "' name='comment' >" . $this->fields["comment"]; echo "</textarea></td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Memory') . "</td>\n"; echo "<td>"; Html::autocompletionTextField($this, "memory_size"); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Initial page counter') . "</td>\n"; echo "<td>"; Html::autocompletionTextField($this, "init_pages_counter", array('size' => 10)); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Current counter of pages') . "</td>\n"; echo "<td>"; Html::autocompletionTextField($this, "last_pages_counter", array('size' => 10)); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . _n('Port', 'Ports', Session::getPluralNumber()) . "</td>"; echo "<td>\n<table>"; // serial interface echo "<tr><td>" . __('Serial') . "</td><td width='80'>"; Dropdown::showYesNo("have_serial", $this->fields["have_serial"]); echo "</td>"; // parallel interface? echo "<td>" . __('Parallel') . "</td><td width='80'>"; Dropdown::showYesNo("have_parallel", $this->fields["have_parallel"]); echo "</td></tr>"; // USB interface? echo "<tr><td>" . __('USB') . "</td><td>"; Dropdown::showYesNo("have_usb", $this->fields["have_usb"]); echo "</td>"; // ethernet interface? echo "<td>" . __('Ethernet') . "</td><td>"; Dropdown::showYesNo("have_ethernet", $this->fields["have_ethernet"]); echo "</td></tr>"; // wifi ? echo "<tr><td>" . __('Wifi') . "</td><td colspan='3'>"; Dropdown::showYesNo("have_wifi", $this->fields["have_wifi"]); echo "</td></tr></table>\n"; echo "</td>"; if ($inventory_show) { echo "<td rowspan='2'>" . __('Automatic inventory') . "</td>"; echo "<td rowspan='2'>"; Plugin::doHook("autoinventory_information", $this); echo "</td>"; } echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>"; if ((!isset($options['withtemplate']) || $options['withtemplate'] == 0) && !empty($this->fields['template_name'])) { echo "<span class='small_space'>"; printf(__('Created from the template %s'), $this->fields['template_name']); echo "</span>"; } else { echo " "; } echo "</td><td>"; if (isset($options['withtemplate']) && $options['withtemplate']) { //TRANS: %s is the datetime of insertion printf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"])); } else { //TRANS: %s is the datetime of insertion printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"])); } echo "</td></tr>\n"; $this->showFormButtons($options); return true; }
/** * 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>"; // micro? echo "<tr><td width='20%'>" . __('Microphone') . "</td><td width='30%'>"; Dropdown::showYesNo("have_micro", $this->fields["have_micro"]); // speakers? echo "</td><td width='20%'>" . __('Speakers') . "</td><td width='30%'>"; Dropdown::showYesNo("have_speaker", $this->fields["have_speaker"]); echo "</td></tr>"; // sub-d? echo "<tr><td width='20%'>" . __('Sub-D') . "</td><td width='30%'>"; Dropdown::showYesNo("have_subd", $this->fields["have_subd"]); // bnc? echo "</td><td width='20%'>" . __('BNC') . "</td><td width='30%'>"; Dropdown::showYesNo("have_bnc", $this->fields["have_bnc"]); echo "</td></tr>"; // dvi? echo "<tr><td>" . __('DVI') . "</td><td>"; Dropdown::showYesNo("have_dvi", $this->fields["have_dvi"]); // pivot ? echo "</td><td>" . __('Pivot') . "</td><td>"; Dropdown::showYesNo("have_pivot", $this->fields["have_pivot"]); echo "</td></tr>"; // hdmi? echo "<tr><td>" . __('HDMI') . "</td><td>"; Dropdown::showYesNo("have_hdmi", $this->fields["have_hdmi"]); //Displayport echo "</td><td>" . __('DisplayPort') . "</td><td>"; Dropdown::showYesNo("have_displayport", $this->fields["have_displayport"]); echo "</td></tr>"; echo "</table></td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>"; if ((!isset($options['withtemplate']) || $options['withtemplate'] == 0) && !empty($this->fields['template_name'])) { echo "<span class='small_space'>"; printf(__('Created from the template %s'), $this->fields['template_name']); echo "</span>"; } else { echo " "; } echo "</td><td>"; if (isset($options['withtemplate']) && $options['withtemplate']) { //TRANS: %s is the datetime of insertion printf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"])); } else { //TRANS: %s is the datetime of insertion printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"])); } echo "</td></tr>\n"; $this->showFormButtons($options); return true; }
/** * @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; break; case "dropdown_groups_validate": $used = array(); if ($item = getItemForItemtype($options["sub_type"])) { $rule_data = getAllDatasFromTable('glpi_ruleactions', "`action_type` = 'add_validation'\n AND `field` = 'groups_id_validate'\n AND `" . $item->getRuleIdField() . "`\n = '" . $options[$item->getRuleIdField()] . "'"); foreach ($rule_data as $data) { $used[] = $data['value']; } } $condition = "(SELECT count(`users_id`)\n FROM `glpi_groups_users`\n WHERE `groups_id` = `glpi_groups`.`id`)"; $param['name'] = 'value'; $param['condition'] = $condition; $param['right'] = array('validate_incident', 'validate_request'); $param['used'] = $used; Group::dropdown($param); $display = true; break; case "dropdown_validation_percent": $ticket = new Ticket(); echo $ticket->getValueToSelect('validation_percent', 'value', $param['value']); $display = true; break; default: if ($rule = getItemForItemtype($options["sub_type"])) { $display = $rule->displayAdditionalRuleAction($actions[$options["field"]], $param['value']); } break; } } if (!$display) { Html::autocompletionTextField($this, "value", $param); } } }
/** * 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, $LANG; $target = $this->getFormURL(); $withtemplate = ''; if (isset($options['target'])) { $target = $options['target']; } if (isset($options['withtemplate'])) { $withtemplate = $options['withtemplate']; } if (!haveRight("phone", "r")) { return false; } if ($ID > 0) { $this->check($ID, 'r'); } else { // Create item $this->check(-1, 'w'); } $this->showTabs($options); $this->showFormHeader($options); if (isset($options['withtemplate']) && $options['withtemplate'] == 2) { $template = "newcomp"; $datestring = $LANG['computers'][14] . " : "; $date = convDateTime($_SESSION["glpi_currenttime"]); } else { if (isset($options['withtemplate']) && $options['withtemplate'] == 1) { $template = "newtemplate"; $datestring = $LANG['computers'][14] . " : "; $date = convDateTime($_SESSION["glpi_currenttime"]); } else { $datestring = $LANG['common'][26] . " : "; $date = convDateTime($this->fields["date_mod"]); $template = false; } } echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['common'][16] . ($template ? "*" : "") . " :</td>"; echo "<td>"; $objectName = autoName($this->fields["name"], "name", $template === "newcomp", $this->getType(), $this->fields["entities_id"]); autocompletionTextField($this, 'name', array('value' => $objectName)); echo "</td>"; echo "<td>" . $LANG['state'][0] . " :</td>"; echo "<td>"; Dropdown::show('State', array('value' => $this->fields["states_id"])); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['common'][15] . " :</td>"; 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; }
/** * 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"; echo "<td>"; Html::autocompletionTextField($this, "brand"); echo "</td></tr>\n"; if ($inventory_show) { echo "<tr class='tab_bg_1'>"; echo "<td rowspan='1'>" . __('Automatic inventory') . "</td>"; echo "<td rowspan='1'>"; Plugin::doHook("autoinventory_information", $this); echo "</td>"; echo "</tr>\n"; } $this->showFormButtons($options); return true; }
/** * @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"); } } }
/** * Print the printer 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, $LANG; $target = $this->getFormURL(); $withtemplate = ''; if (isset($options['target'])) { $target = $options['target']; } if (isset($options['withtemplate'])) { $withtemplate = $options['withtemplate']; } if (!haveRight("printer", "r")) { return false; } if ($ID > 0) { $this->check($ID, 'r'); } else { // Create item $this->check(-1, 'w'); } if (isset($options['withtemplate']) && $options['withtemplate'] == 2) { $template = "newcomp"; $datestring = $LANG['computers'][14] . " : "; $date = convDateTime($_SESSION["glpi_currenttime"]); } else { if (isset($options['withtemplate']) && $options['withtemplate'] == 1) { $template = "newtemplate"; $datestring = $LANG['computers'][14] . " : "; $date = convDateTime($_SESSION["glpi_currenttime"]); } else { $datestring = $LANG['common'][26] . " : "; $date = convDateTime($this->fields["date_mod"]); $template = false; } } $this->showTabs($options); $this->showFormHeader($options); echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['common'][16] . ($template ? "*" : "") . " :</td>\n"; echo "<td>"; $objectName = autoName($this->fields["name"], "name", $template === "newcomp", $this->getType(), $this->fields["entities_id"]); autocompletionTextField($this, 'name', array('value' => $objectName)); echo "</td>\n"; echo "<td>" . $LANG['state'][0] . " :</td>\n"; echo "<td>"; Dropdown::show('State', array('value' => $this->fields["states_id"])); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['common'][15] . " : </td>\n"; echo "<td>"; Dropdown::show('Location', array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"])); echo "</td>\n"; echo "<td>" . $LANG['common'][17] . " :</td>\n"; echo "<td>"; Dropdown::show('PrinterType', array('value' => $this->fields["printertypes_id"])); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['common'][10] . " :</td>\n"; echo "<td>"; User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'interface', 'entity' => $this->fields["entities_id"])); echo "</td>\n"; echo "<td>" . $LANG['common'][5] . " :</td>\n"; 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>\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; }