Inheritance: extends CommonDropdown
Example #1
0
 /**
  * Print the computer's operating system form
  *
  * @param $comp Computer object
  *
  * @since version 9.1
  *
  * @return Nothing (call to classes members)
  **/
 static function showOperatingSystem(Computer $comp)
 {
     global $DB;
     $ID = $comp->fields['id'];
     $colspan = 4;
     echo "<div class='center'>";
     $comp->initForm($ID);
     $comp->showFormHeader(['formtitle' => false]);
     echo "<tr class='headerRow'><th colspan='" . $colspan . "'>";
     echo __('Operating system');
     echo "</th></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     OperatingSystem::dropdown(array('value' => $comp->fields["operatingsystems_id"]));
     echo "</td>";
     echo "<td>" . __('Version') . "</td>";
     echo "<td >";
     OperatingSystemVersion::dropdown(array('value' => $comp->fields["operatingsystemversions_id"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Architecture') . "</td>";
     echo "<td >";
     OperatingSystemArchitecture::dropdown(array('value' => $comp->fields["operatingsystemarchitectures_id"]));
     echo "</td>";
     echo "<td>" . __('Service pack') . "</td>";
     echo "<td >";
     OperatingSystemServicePack::dropdown(array('value' => $comp->fields["operatingsystemservicepacks_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Kernel version') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($comp, 'os_kernel_version');
     echo "</td>";
     echo "<td>" . __('Product ID') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($comp, 'os_licenseid');
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Serial number') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($comp, 'os_license_number');
     echo "</td><td colspan='2'></td></tr>";
     $comp->showFormButtons(array('candel' => false, 'formfooter' => false));
 }
Example #2
0
 /**
  * Print the computer form
  *
  * @param $ID        integer ID of the item
  * @param $options   array
  *     - target for the Form
  *     - withtemplate template or basic computer
  *
  *@return Nothing (display)
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI, $DB;
     $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_computer`"));
     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>";
     ComputerType::dropdown(array('value' => $this->fields["computertypes_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>";
     ComputerModel::dropdown(array('value' => $this->fields["computermodels_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     //TRANS: Number of the alternate username
     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>";
     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>\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>" . __('Network') . "</td>";
     echo "<td>";
     Network::dropdown(array('value' => $this->fields["networks_id"]));
     echo "</td></tr>\n";
     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>";
     // Display auto inventory informations
     $rowspan = 10;
     $inventory_show = false;
     if (!empty($ID) && Plugin::haveImport() && $this->fields["is_dynamic"]) {
         $inventory_show = true;
         $rowspan -= 4;
     }
     echo "<td rowspan='{$rowspan}'>" . __('Comments') . "</td>";
     echo "<td rowspan='{$rowspan}' class='middle'>";
     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>" . __('Domain') . "</td>";
     echo "<td >";
     Domain::dropdown(array('value' => $this->fields["domains_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Operating system') . "</td>";
     echo "<td>";
     OperatingSystem::dropdown(array('value' => $this->fields["operatingsystems_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Service pack') . "</td>";
     echo "<td >";
     OperatingSystemServicePack::dropdown(array('value' => $this->fields["operatingsystemservicepacks_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Version of the operating system') . "</td>";
     echo "<td >";
     OperatingSystemVersion::dropdown(array('value' => $this->fields["operatingsystemversions_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Product ID of the operating system') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($this, 'os_licenseid');
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Serial of the operating system') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($this, 'os_license_number');
     echo "</td>";
     if ($inventory_show) {
         echo "<td rowspan='4' colspan='2'>";
         Plugin::doHook("autoinventory_information", $this);
         echo "</td>";
     }
     echo "</tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('UUID') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($this, 'uuid');
     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 "&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 update
         printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
     }
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Update Source') . "</td>";
     echo "<td >";
     AutoUpdateSystem::dropdown(array('value' => $this->fields["autoupdatesystems_id"]));
     echo "</td></tr>";
     $this->showFormButtons($options);
     return true;
 }
Example #3
0
 /**
  * Print the computer form
  *
  * @param $ID        integer ID of the item
  * @param $options   array
  *     - target for the Form
  *     - withtemplate template or basic computer
  *
  *@return Nothing (display)
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI, $DB;
     $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_computer`"));
     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>";
     ComputerType::dropdown(array('value' => $this->fields["computertypes_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>";
     ComputerModel::dropdown(array('value' => $this->fields["computermodels_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     //TRANS: Number of the alternate username
     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>";
     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>\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>" . __('Network') . "</td>";
     echo "<td>";
     Network::dropdown(array('value' => $this->fields["networks_id"]));
     echo "</td></tr>\n";
     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>";
     // Display auto inventory informations
     $rowspan = 7;
     $inventory_show = false;
     if (!empty($ID) && Plugin::haveImport() && $this->fields["is_dynamic"]) {
         $inventory_show = true;
         $rowspan -= 5;
     }
     echo "<td rowspan='{$rowspan}'>" . __('Comments') . "</td>";
     echo "<td rowspan='{$rowspan}' class='middle'>";
     echo "<textarea cols='45' rows='" . ($rowspan + 3) . "' name='comment' >" . $this->fields["comment"];
     echo "</textarea></td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Domain') . "</td>";
     echo "<td >";
     Domain::dropdown(array('value' => $this->fields["domains_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Operating system') . "</td>";
     echo "<td>";
     OperatingSystem::dropdown(array('value' => $this->fields["operatingsystems_id"]));
     echo "<br /><a href='#' id='toggle_os_information'>" . __("More information") . "</a>";
     echo "</td>";
     if ($inventory_show) {
         echo "<td rowspan='4' colspan='2'>";
         Plugin::doHook("autoinventory_information", $this);
         echo "</td>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Version of the operating system') . "</td>";
     echo "<td >";
     OperatingSystemVersion::dropdown(array('value' => $this->fields["operatingsystemversions_id"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'><td colspan='2'>";
     echo Html::scriptBlock("\n      \$(document).ready(function(){\n         \$('#os_information').hide();\n\n         \$('#toggle_os_information').on('click',function() {\n            \$('#os_information').dialog({\n               width:'auto',\n               resizable: false,\n               appendTo: '#os_information_parent',\n               position: {\n                  my : 'left top',\n                  at : 'left bottom',\n                  of: \$('#toggle_os_information')\n               }\n            })\n         })\n      });");
     // group os advanced information in a single bloc (who can be toggled)
     echo "<div id='os_information_parent'>";
     echo "<div id='os_information' title=\"" . __('Operating system') . "\">";
     echo "<table>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Service pack') . "</td>";
     echo "<td >";
     OperatingSystemServicePack::dropdown(array('value' => $this->fields["operatingsystemservicepacks_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Operating system architecture') . "</td>";
     echo "<td >";
     OperatingSystemArchitecture::dropdown(array('value' => $this->fields["operatingsystemarchitectures_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Kernel version of the operating system') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($this, 'os_kernel_version');
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Product ID of the operating system') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($this, 'os_licenseid');
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Serial of the operating system') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($this, 'os_license_number');
     echo "</td>";
     echo "</table>";
     echo "</div>";
     echo "</div>";
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('UUID') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($this, 'uuid');
     echo "</td>";
     echo "</tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Update Source') . "</td>";
     echo "<td >";
     AutoUpdateSystem::dropdown(array('value' => $this->fields["autoupdatesystems_id"]));
     echo "</td></tr>";
     $this->showFormButtons($options);
     return true;
 }