/** * 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->showTabs($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"])); 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 = 3; $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"; 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>"; if ($inventory_show) { echo "<td rowspan='1'>"; _e('Automatic inventory'); echo "</td>"; echo "<td rowspan='1'>"; Plugin::doHook("autoinventory_information", $this); echo "</td>"; } echo "</tr>\n"; $this->showFormButtons($options); $this->addDivForTabs(); return true; }