Example #1
0
 /**
  * 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 "&nbsp;";
     }
     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;
 }