예제 #1
1
 public function showResult($output_type, $limit = 0)
 {
     global $DB;
     $arrayRet = $this->execQuery($_POST);
     $result = $arrayRet['query_result'];
     $query = $arrayRet['query'];
     $nbtot = $result ? $DB->numrows($result) : 0;
     if ($limit) {
         $start = isset($_GET["start"]) ? $_GET["start"] : 0;
         if ($start >= $nbtot) {
             $start = 0;
         }
         if ($start > 0 || $start + $limit < $nbtot) {
             $result = $DB->query($query . " LIMIT {$start},{$limit}");
         }
     } else {
         $start = 0;
     }
     $nbCols = $DB->num_fields($result);
     $nbrows = $DB->numrows($result);
     $groupByRackName = true;
     if (isset($_POST['groupByRackName']) && $_POST['groupByRackName'] == "on") {
         $groupByRackName = false;
     }
     $title = date("d/m/Y H:i");
     if ($nbtot == 0) {
         echo "<div class='center'><font class='red b'>" . __("No item found") . "</font></div>";
         Html::footer();
     } else {
         if ($output_type == Search::PDF_OUTPUT_LANDSCAPE || $output_type == Search::PDF_OUTPUT_PORTRAIT) {
             include GLPI_ROOT . "/lib/ezpdf/class.ezpdf.php";
         } else {
             if ($output_type == Search::HTML_OUTPUT) {
                 echo "<div class='center'><table class='tab_cadre_fixe'>";
                 echo "<tr  class='tab_bg_1'><th>{$title}</th></tr>\n";
                 echo "<tr class='tab_bg_2 center'><td class='center'>";
                 echo "<form method='POST' action='" . $_SERVER["PHP_SELF"] . "?start={$start}' target='_blank'>\n";
                 $param = "";
                 foreach ($_POST as $key => $val) {
                     if (is_array($val)) {
                         foreach ($val as $k => $v) {
                             echo "<input type='hidden' name='" . $key . "[{$k}]' value='{$v}' >";
                             if (!empty($param)) {
                                 $param .= "&";
                             }
                             $param .= $key . "[" . $k . "]=" . urlencode($v);
                         }
                     } else {
                         echo "<input type='hidden' name='{$key}' value='{$val}' >";
                         if (!empty($param)) {
                             $param .= "&";
                         }
                         $param .= "{$key}=" . urlencode($val);
                     }
                 }
                 echo "<input type='hidden' name='result_search_reports' value='searchdone' >";
                 $param .= "&result_search_reports=searchdone&target=_blank";
                 Dropdown::showOutputFormat();
                 Html::closeForm();
                 echo "</td></tr>";
                 echo "</table></div>";
                 Html::printPager($start, $nbtot, $_SERVER['PHP_SELF'], $param);
             }
         }
     }
     if ($nbtot > 0) {
         if ($output_type == Search::HTML_OUTPUT) {
             echo "<form method='POST' action='" . $_SERVER["PHP_SELF"] . "?start={$start}'>\n";
         }
         echo Search::showHeader($output_type, $nbrows, $nbCols, true);
         $showAllFieds = true;
         $listFields = array();
         $cptField = 0;
         $showAllFieds = (!isset($_POST['cb_object_name']) || $_POST['cb_object_name'] != "on") && (!isset($_POST['cb_object_location']) || $_POST['cb_object_location'] != "on") && (!isset($_POST['cb_group']) || $_POST['cb_group'] != "on") && (!isset($_POST['cb_manufacturer']) || $_POST['cb_manufacturer'] != "on") && (!isset($_POST['cb_model']) || $_POST['cb_model'] != "on") && (!isset($_POST['cb_serial_number']) || $_POST['cb_serial_number'] != "on");
         $num = 1;
         $cptRow = 1;
         if (!$showAllFieds) {
             $this->showTitle($output_type, $num, __("Bay name", "racks"), 'name', false);
             $cptField++;
             $this->showTitle($output_type, $num, _n("Place", "Places", 1, "racks"), 'location', false);
             $cptField++;
             $this->showTitle($output_type, $num, _n("Location", "Locations", 1, "racks"), 'roomlocation', false);
             $cptField++;
             $this->showTitle($output_type, $num, __("U", "racks"), 'u', false);
             $cptField++;
             $this->showTitle($output_type, $num, __("Front", "racks") . " / " . __("Back", "racks"), 'front_rear', false);
             $cptField++;
             if (isset($_POST['cb_object_name']) && $_POST['cb_object_name'] == "on") {
                 $listFields['object_name'] = $_POST['cb_object_name'];
                 $this->showTitle($output_type, $num, __("Object name", "racks"), 'object_name', false);
                 $cptField++;
             }
             // Lieu
             if (isset($_POST['cb_object_location']) && $_POST['cb_object_location'] == "on") {
                 $listFields['object_location'] = $_POST['cb_object_location'];
                 $this->showTitle($output_type, $num, __("Object location", "racks"), 'object_location', false);
                 $cptField++;
             }
             // Groupe
             if (isset($_POST['cb_group']) && $_POST['cb_group'] == "on") {
                 $listFields['group'] = $_POST['cb_group'];
                 $this->showTitle($output_type, $num, __("Group"), 'roomlocation', false);
                 $cptField++;
             }
             // Fabricant
             if (isset($_POST['cb_manufacturer']) && $_POST['cb_manufacturer'] == "on") {
                 $listFields['manufacturer'] = $_POST['cb_manufacturer'];
                 $this->showTitle($output_type, $num, __("Manufacturer"), 'manufacturer', false);
                 $cptField++;
             }
             // Modèle
             if (isset($_POST['cb_model']) && $_POST['cb_model'] == "on") {
                 $listFields['model'] = $_POST['cb_model'];
                 $this->showTitle($output_type, $num, __("Model"), 'model', false);
                 $cptField++;
             }
             // Numéro de série
             if (isset($_POST['cb_serial_number']) && $_POST['cb_serial_number'] == "on") {
                 $listFields['serial_number'] = $_POST['cb_serial_number'];
                 $this->showTitle($output_type, $num, __("Serial number", "racks"), 'group', false);
                 $cptField++;
             }
         } else {
             $this->showTitle($output_type, $num, __("Bay name", "racks"), 'rack_name', false);
             $listFields['rack_name'] = true;
             $this->showTitle($output_type, $num, __("Place", "racks"), 'location', false);
             $listFields['location'] = true;
             $this->showTitle($output_type, $num, __("Location", "racks"), 'roomlocation', false);
             $listFields['roomlocation'] = true;
             $this->showTitle($output_type, $num, __("U", "racks"), 'u', false);
             $listFields['u'] = true;
             $this->showTitle($output_type, $num, __("Front", "racks") . " / " . __("Back", "racks"), 'front_rear', false);
             $listFields['front_rear'] = true;
             $this->showTitle($output_type, $num, __("Object name", "racks"), 'object_name', false);
             $listFields['object_name'] = true;
             $this->showTitle($output_type, $num, __("Object location", "racks"), 'object_location', false);
             $listFields['object_location'] = true;
             $this->showTitle($output_type, $num, __("Group"), false);
             $listFields['group'] = true;
             $this->showTitle($output_type, $num, __("Type"), 'type', false);
             $listFields['type'] = true;
             $this->showTitle($output_type, $num, __("Manufacturer"), 'manufacturer', false);
             $listFields['manufacturer'] = true;
             $this->showTitle($output_type, $num, __("Model"), 'model', false);
             $listFields['model'] = true;
             $this->showTitle($output_type, $num, __("Serial number", "racks"), 'serial_number', false);
             $listFields['serial_number'] = true;
             $this->showTitle($output_type, $num, __("Inventory number"), 'other_serial', false);
             $listFields['other_serial'] = true;
             $cptField = 13;
         }
         echo Search::showEndLine($output_type);
         $num = 1;
         $currentRack = -1;
         while ($row = $DB->fetch_array($result)) {
             // itemtype
             $itemtype = $row['itemtype'];
             $num = 1;
             $cptRow++;
             echo Search::showNewLine($output_type);
             if (isset($row['itemtype']) && $row['itemtype'] != "") {
                 $class = substr($itemtype, 0, -5);
                 $item = new $class();
                 $table = getTableForItemType($class);
                 $r = $DB->query("SELECT * FROM `" . $table . "` WHERE `id` = '" . $row["items_id"] . "' ");
                 $device = $DB->fetch_array($r);
             }
             // nom
             $link = Toolbox::getItemTypeFormURL("PluginRacksRack");
             if ($groupByRackName || $currentRack != $row['id']) {
                 if ($output_type == Search::HTML_OUTPUT) {
                     echo Search::showItem($output_type, "<a href=\"" . $link . "?id=" . $row["id"] . "\">" . $row["name"] . "</a>", $num, $cptRow);
                 } else {
                     echo Search::showItem($output_type, $row["name"], $num, $cptRow);
                 }
             } else {
                 echo Search::showItem($output_type, "&nbsp;", $num, $cptRow);
             }
             // lieu
             if ($groupByRackName || $currentRack != $row['id']) {
                 $tmpId = $row['locations_id'];
                 $tmpObj = new Location();
                 $tmpObj->getFromDB($tmpId);
                 if (isset($tmpObj->fields['name'])) {
                     echo Search::showItem($output_type, $tmpObj->fields['name'], $num, $cptRow);
                 } else {
                     echo Search::showItem($output_type, "&nbsp;", $num, $cptRow);
                 }
             } else {
                 echo Search::showItem($output_type, "&nbsp;", $num, $cptRow);
             }
             // Emplacement
             if ($groupByRackName || $currentRack != $row['id']) {
                 $tmpId = $row['plugin_racks_roomlocations_id'];
                 $tmpObj = new PluginRacksRoomLocation();
                 $tmpObj->getFromDB($tmpId);
                 if (isset($tmpObj->fields['name'])) {
                     echo Search::showItem($output_type, $tmpObj->fields['name'], $num, $cptRow);
                 } else {
                     echo Search::showItem($output_type, '&nbsp;', $num, $cptRow);
                 }
             } else {
                 echo Search::showItem($output_type, "&nbsp;", $num, $cptRow);
             }
             if (isset($row['itemtype']) && $row['itemtype'] != "") {
                 // U
                 if (isset($row['position']) && $row['position'] != "") {
                     echo Search::showItem($output_type, $row['position'], $num, $cptRow);
                 } else {
                     echo Search::showItem($output_type, "&nbsp;", $num, $cptRow);
                 }
                 // avant / arrière
                 if ($row['faces_id'] == 1) {
                     echo Search::showItem($output_type, __("Front", "racks"), $num, $cptRow);
                 } else {
                     echo Search::showItem($output_type, __("Back", "racks"), $num, $cptRow);
                 }
                 // Nom de l'objet
                 if (array_key_exists("object_name", $listFields)) {
                     $link = Toolbox::getItemTypeFormURL(substr($itemtype, 0, -5));
                     if ($itemtype != 'PluginRacksOtherModel') {
                         if ($output_type == Search::HTML_OUTPUT) {
                             echo Search::showItem($output_type, "<a href=\"" . $link . "?id=" . $row["items_id"] . "\">" . $device["name"] . "</a>", $num, $cptRow);
                         } else {
                             echo Search::showItem($output_type, $device["name"], $num, $cptRow);
                         }
                     } else {
                         echo Search::showItem($output_type, $device["name"], $num, $cptRow);
                     }
                 }
                 // Lieu de l'objet
                 if (array_key_exists("object_location", $listFields)) {
                     if ($itemtype != 'PluginRacksOtherModel') {
                         echo Search::showItem($output_type, Dropdown::getDropdownName("glpi_locations", $device["locations_id"]), $num, $cptRow);
                     } else {
                         echo Search::showItem($output_type, Dropdown::EMPTY_VALUE, $num, $cptRow);
                     }
                 }
                 // Groupe
                 if (array_key_exists("group", $listFields)) {
                     // Groupe
                     if ($itemtype != 'PluginRacksOtherModel') {
                         echo Search::showItem($output_type, Dropdown::getDropdownName("glpi_groups", $device["groups_id_tech"]), $num, $cptRow);
                     } else {
                         echo Search::showItem($output_type, Dropdown::EMPTY_VALUE, $num, $cptRow);
                     }
                 }
                 // type
                 if (array_key_exists("type", $listFields)) {
                     echo Search::showItem($output_type, $item->getTypeName(), $num, $cptRow);
                 }
                 // fabricant
                 if (array_key_exists("manufacturer", $listFields)) {
                     if ($itemtype != 'PluginRacksOtherModel') {
                         echo Search::showItem($output_type, Dropdown::getDropdownName("glpi_manufacturers", $device["manufacturers_id"]), $num, $cptRow);
                     } else {
                         echo Search::showItem($output_type, Dropdown::EMPTY_VALUE, $num, $cptRow);
                     }
                 }
                 // modèle //TODO = model du rack => model des objets
                 if (array_key_exists("model", $listFields)) {
                     if ($itemtype != 'PluginRacksOtherModel') {
                         $model_table = getTableForItemType($itemtype);
                         $modelfield = getForeignKeyFieldForTable(getTableForItemType($itemtype));
                         echo Search::showItem($output_type, Dropdown::getDropdownName($model_table, $device[$modelfield]), $num, $cptRow);
                     } else {
                         echo Search::showItem($output_type, Dropdown::EMPTY_VALUE, $num, $cptRow);
                     }
                 }
                 // numéro de série
                 if (array_key_exists("serial_number", $listFields)) {
                     if ($itemtype != 'PluginRacksOtherModel') {
                         echo Search::showItem($output_type, $device['serial'], $num, $cptRow);
                     } else {
                         echo Search::showItem($output_type, Dropdown::EMPTY_VALUE, $num, $cptRow);
                     }
                 }
                 // numéro d'inventaire
                 if (array_key_exists("other_serial", $listFields)) {
                     if ($itemtype != 'PluginRacksOtherModel') {
                         echo Search::showItem($output_type, $device['otherserial'], $num, $cptRow);
                     } else {
                         echo Search::showItem($output_type, Dropdown::EMPTY_VALUE, $num, $cptRow);
                     }
                 }
                 $currentRack = $row['id'];
             } else {
                 for ($k = 0; $k < $cptField - 3; $k++) {
                     echo Search::showItem($output_type, "&nbsp;", $num, $cptRow, "");
                 }
             }
             echo Search::showEndLine($output_type);
         }
         if ($output_type == Search::HTML_OUTPUT) {
             Html::closeForm();
         }
         echo Search::showFooter($output_type, $title);
     }
 }
 function showForm($ID, $options = array())
 {
     $PluginRacksConfig = new PluginRacksConfig();
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     //ligne 1
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td><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>" . __('Size') . "</td><td>";
     Dropdown::showInteger("rack_size", $this->fields["rack_size"], 1, 100, 1);
     echo " " . __('U', 'racks') . "</td>";
     echo "</tr>";
     //ligne 2
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Manufacturer') . "</td><td>";
     Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
     echo "</td>";
     echo "<td >" . __('Location') . "</td>";
     echo "<td>";
     Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "</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' => 'interface', 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Place', 'racks');
     echo "</td><td>";
     $PluginRacksRoomLocation = new PluginRacksRoomLocation();
     $PluginRacksRoomLocation->dropdownRoomLocations("plugin_racks_roomlocations_id", $this->fields["plugin_racks_roomlocations_id"], $this->fields["entities_id"]);
     echo "</td>";
     echo "</tr>";
     //ligne 4
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group in charge of the hardware') . "</td><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>" . __('Width', 'racks') . "</td><td>";
     echo "<input type='text' name='width' \n                              value=\"" . Html::formatNumber($this->fields["width"], true) . "\" size='10'> ";
     $PluginRacksConfig->getUnit("size");
     echo "</td>";
     echo "</tr>";
     //ligne 5
     echo "<tr class='tab_bg_1'>";
     echo "</td>";
     echo "<td>" . __('Serial number') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($this, 'serial');
     echo "</td>";
     echo "<td>" . __('Height', 'racks') . "</td><td>";
     echo "<input type='text' name='height' \n                              value=\"" . Html::formatNumber($this->fields["height"], true) . "\" size='10'> ";
     $PluginRacksConfig->getUnit("size");
     echo "</td>";
     echo "</tr>";
     //ligne 6
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Inventory number') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, 'otherserial');
     echo "</td>";
     echo "<td>" . __('Weight', 'racks') . "</td><td>";
     echo "<input type='text' name='weight' \n                              value=\"" . Html::formatNumber($this->fields["weight"], true) . "\" size='10'> ";
     $PluginRacksConfig->getUnit("weight");
     echo "</td>";
     echo "</tr>";
     //ligne 7
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Model') . "</td>";
     echo "<td>";
     Dropdown::show('PluginRacksRackModel', array('name' => "plugin_racks_rackmodels_id", 'value' => $this->fields["plugin_racks_rackmodels_id"]));
     echo "</td>";
     echo "<td>" . __('Depth', 'racks') . "</td><td>";
     echo "<input type='text' name='depth' \n                              value=\"" . Html::formatNumber($this->fields["depth"], true) . "\" size='10'> ";
     $PluginRacksConfig->getUnit("size");
     echo "</td>";
     echo "</tr>";
     //ligne 8
     echo "<tr class='tab_bg_1'>";
     echo "<td >" . __('Type') . "</td><td>";
     Dropdown::show('PluginRacksRackType', array('value' => $this->fields["plugin_racks_racktypes_id"]));
     echo "</td>";
     echo "<td >" . __('Status') . "</td><td>";
     Dropdown::show('PluginRacksRackState', array('value' => $this->fields["plugin_racks_rackstates_id"]));
     echo "</td>";
     echo "</tr>";
     //ligne 9
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='2'>";
     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 colspan='2'>";
     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";
     $this->showFormButtons($options);
     if (!$this->isNewID($this->getID())) {
         $this->showTotal();
     }
     return true;
 }
예제 #3
0
 public function showResult($output_type, $limit = 0, $params = array())
 {
     global $DB;
     $arrayRet = $this->execQuery($_REQUEST);
     $result = $arrayRet['query_result'];
     $query = $arrayRet['query'];
     $nbtot = $result ? $DB->numrows($result) : 0;
     if ($limit) {
         $start = isset($_REQUEST["start"]) ? $_REQUEST["start"] : 0;
         if ($start >= $nbtot) {
             $start = 0;
         }
         if ($start > 0 || $start + $limit < $nbtot) {
             $result = $DB->query($query . " LIMIT {$start},{$limit}");
         }
     } else {
         $start = 0;
     }
     $nbCols = $DB->num_fields($result);
     $nbrows = $DB->numrows($result);
     $groupByRackName = true;
     if (isset($_REQUEST['groupByRackName']) && $_REQUEST['groupByRackName'] == "on") {
         $groupByRackName = false;
     }
     $title = date("d/m/Y H:i");
     if ($nbtot == 0) {
         echo "<div class='center'><font class='red b'>" . __("No item found") . "</font></div>";
         Html::footer();
     } else {
         if ($output_type == Search::HTML_OUTPUT) {
             echo "<div class='center'><table class='tab_cadre_fixe'>";
             echo "<tr  class='tab_bg_1'><th>{$title}</th></tr>\n";
             echo "<tr class='tab_bg_2 center'><td class='center'>";
             $parameters = null;
             $parameters .= Toolbox::append_params($_REQUEST, '&amp;');
             $this->printPager($start, $nbtot, $_SERVER["PHP_SELF"], $parameters, 'PluginRacksRack');
         }
     }
     if ($nbtot > 0) {
         if ($output_type == Search::HTML_OUTPUT) {
             echo "<form method='POST' action='" . $_SERVER["PHP_SELF"] . "?start={$start}'>\n";
         }
         echo Search::showHeader($output_type, $nbrows, $nbCols, true);
         echo Search::showNewLine($output_type);
         $showAllFieds = true;
         $listFields = array();
         $cptField = 0;
         $showAllFieds = (!isset($_REQUEST['cb_object_name']) || $_REQUEST['cb_object_name'] != "on") && (!isset($_REQUEST['cb_object_location']) || $_REQUEST['cb_object_location'] != "on") && (!isset($_REQUEST['cb_group']) || $_REQUEST['cb_group'] != "on") && (!isset($_REQUEST['cb_manufacturer']) || $_REQUEST['cb_manufacturer'] != "on") && (!isset($_REQUEST['cb_model']) || $_REQUEST['cb_model'] != "on") && (!isset($_REQUEST['cb_serial_number']) || $_REQUEST['cb_serial_number'] != "on");
         $num = 1;
         $cptRow = 1;
         if (!$showAllFieds) {
             $this->showTitle($output_type, $num, __("Bay name", "racks"), 'name', false, $params);
             $cptField++;
             $this->showTitle($output_type, $num, __("Location"), 'location', false, $params);
             $cptField++;
             $this->showTitle($output_type, $num, _n("Place", "Places", 1, "racks"), 'roomlocation', false, $params);
             $cptField++;
             $this->showTitle($output_type, $num, __("U", "racks"), 'u', false, $params);
             $cptField++;
             $this->showTitle($output_type, $num, __("Front", "racks") . " / " . _x('Rack enclosure', 'Back', 'racks'), 'front_rear', false, $params);
             $cptField++;
             if (isset($_REQUEST['cb_object_name']) && $_REQUEST['cb_object_name'] == "on") {
                 $listFields['object_name'] = $_REQUEST['cb_object_name'];
                 $this->showTitle($output_type, $num, __("Object name", "racks"), 'object_name', false, $params);
                 $cptField++;
             }
             // Lieu
             if (isset($_REQUEST['cb_object_location']) && $_REQUEST['cb_object_location'] == "on") {
                 $listFields['object_location'] = $_REQUEST['cb_object_location'];
                 $this->showTitle($output_type, $num, __("Object location", "racks"), 'object_location', false, $params);
                 $cptField++;
             }
             // Groupe
             if (isset($_REQUEST['cb_group']) && $_REQUEST['cb_group'] == "on") {
                 $listFields['group'] = $_REQUEST['cb_group'];
                 $this->showTitle($output_type, $num, __("Group"), 'group', false, $params);
                 $cptField++;
             }
             // Fabricant
             if (isset($_REQUEST['cb_manufacturer']) && $_REQUEST['cb_manufacturer'] == "on") {
                 $listFields['manufacturer'] = $_REQUEST['cb_manufacturer'];
                 $this->showTitle($output_type, $num, __("Manufacturer"), 'manufacturer', false, $params);
                 $cptField++;
             }
             // Modèle
             if (isset($_REQUEST['cb_model']) && $_REQUEST['cb_model'] == "on") {
                 $listFields['model'] = $_REQUEST['cb_model'];
                 $this->showTitle($output_type, $num, __("Model"), 'model', false, $params);
                 $cptField++;
             }
             // Numéro de série
             if (isset($_REQUEST['cb_serial_number']) && $_REQUEST['cb_serial_number'] == "on") {
                 $listFields['serial_number'] = $_REQUEST['cb_serial_number'];
                 $this->showTitle($output_type, $num, __("Serial number"), 'group', false, $params);
                 $cptField++;
             }
         } else {
             $this->showTitle($output_type, $num, __("Bay name", "racks"), 'rack_name', false, $params);
             $listFields['rack_name'] = true;
             $this->showTitle($output_type, $num, __("Location"), 'location', false, $params);
             $listFields['location'] = true;
             $this->showTitle($output_type, $num, _n("Place", "Places", 1, "racks"), 'roomlocation', false, $params);
             $listFields['roomlocation'] = true;
             $this->showTitle($output_type, $num, __("U", "racks"), 'u', false, $params);
             $listFields['u'] = true;
             $this->showTitle($output_type, $num, __("Front", "racks") . " / " . _x('Rack enclosure', 'Back', 'racks'), 'front_rear', false, $params);
             $listFields['front_rear'] = true;
             $this->showTitle($output_type, $num, __("Object name", "racks"), 'object_name', false, $params);
             $listFields['object_name'] = true;
             $this->showTitle($output_type, $num, __("Object location", "racks"), 'object_location', false, $params);
             $listFields['object_location'] = true;
             $this->showTitle($output_type, $num, __("Group"), 'group', false, $params);
             $listFields['group'] = true;
             $this->showTitle($output_type, $num, __("Type"), 'type', false, $params);
             $listFields['type'] = true;
             $this->showTitle($output_type, $num, __("Manufacturer"), 'manufacturer', false, $params);
             $listFields['manufacturer'] = true;
             $this->showTitle($output_type, $num, __("Model"), 'model', false, $params);
             $listFields['model'] = true;
             $this->showTitle($output_type, $num, __("Serial number"), 'serial_number', false, $params);
             $listFields['serial_number'] = true;
             $this->showTitle($output_type, $num, __("Inventory number"), 'other_serial', false, $params);
             $listFields['other_serial'] = true;
             $cptField = 13;
         }
         echo self::showEndLine($output_type, $params);
         $num = 1;
         $cptRow = 1;
         $currentRack = -1;
         while ($row = $DB->fetch_array($result)) {
             // itemtype
             $itemtype = $row['itemtype'];
             $num = 1;
             $cptRow++;
             echo Search::showNewLine($output_type);
             if (isset($row['itemtype']) && $row['itemtype'] != "") {
                 $class = substr($itemtype, 0, -5);
                 $item = new $class();
                 $table = getTableForItemType($class);
                 $r = $DB->query("SELECT * FROM `" . $table . "` WHERE `id` = '" . $row["items_id"] . "' ");
                 $device = $DB->fetch_array($r);
             }
             // nom
             $link = Toolbox::getItemTypeFormURL("PluginRacksRack");
             if ($groupByRackName || $currentRack != $row['id']) {
                 if ($output_type == Search::HTML_OUTPUT) {
                     echo self::showItem($output_type, "<a href=\"" . $link . "?id=" . $row["id"] . "\">" . $row["name"] . "</a>", $num, $cptRow, null, $params);
                 } else {
                     echo self::showItem($output_type, $row["name"], $num, $cptRow, null, $params);
                 }
             } else {
                 echo self::showItem($output_type, "&nbsp;", $num, $cptRow, null, $params);
             }
             // lieu
             if ($groupByRackName || $currentRack != $row['id']) {
                 if (isset($row['locations_id'])) {
                     echo self::showItem($output_type, Dropdown::getDropdownName("glpi_locations", $row['locations_id']), $num, $cptRow, null, $params);
                 } else {
                     echo self::showItem($output_type, "&nbsp;", $num, $cptRow, null, $params);
                 }
             } else {
                 echo self::showItem($output_type, "&nbsp;", $num, $cptRow, null, $params);
             }
             // Emplacement
             if ($groupByRackName || $currentRack != $row['id']) {
                 $tmpId = $row['plugin_racks_roomlocations_id'];
                 $tmpId = $row['plugin_racks_roomlocations_id'];
                 $tmpObj = new PluginRacksRoomLocation();
                 $trans_name = "";
                 if ($tmpObj->getFromDB($tmpId)) {
                     $trans_name = $tmpObj->fields['name'];
                 }
                 $trans = DropdownTranslation::getTranslatedValue($tmpId, "PluginRacksRoomLocation", 'name', $_SESSION['glpilanguage']);
                 if (!empty($trans)) {
                     $trans_name = $trans;
                 }
                 if (isset($tmpId)) {
                     echo self::showItem($output_type, $trans_name, $num, $cptRow, null, $params);
                 } else {
                     echo self::showItem($output_type, '&nbsp;', $num, $cptRow, null, $params);
                 }
             } else {
                 echo self::showItem($output_type, "&nbsp;", $num, $cptRow, null, $params);
             }
             if (isset($row['itemtype']) && $row['itemtype'] != "") {
                 // U
                 if (isset($row['position']) && $row['position'] != "") {
                     echo self::showItem($output_type, $row['position'], $num, $cptRow, null, $params);
                 } else {
                     echo self::showItem($output_type, "&nbsp;", $num, $cptRow, null, $params);
                 }
                 // avant / arrière
                 if ($row['faces_id'] == 1) {
                     echo self::showItem($output_type, __("Front", "racks"), $num, $cptRow, null, $params);
                 } else {
                     echo self::showItem($output_type, _x('Rack enclosure', 'Back', 'racks'), $num, $cptRow, null, $params);
                 }
                 // Nom de l'objet
                 if (array_key_exists("object_name", $listFields)) {
                     $link = Toolbox::getItemTypeFormURL(substr($itemtype, 0, -5));
                     if ($itemtype != 'PluginRacksOtherModel') {
                         if ($output_type == Search::HTML_OUTPUT) {
                             echo self::showItem($output_type, "<a href=\"" . $link . "?id=" . $row["items_id"] . "\">" . $device["name"] . "</a>", $num, $cptRow, null, $params);
                         } else {
                             echo self::showItem($output_type, $device["name"], $num, $cptRow, null, $params);
                         }
                     } else {
                         echo self::showItem($output_type, $device["name"], $num, $cptRow, null, $params);
                     }
                 }
                 // Lieu de l'objet
                 if (array_key_exists("object_location", $listFields)) {
                     if ($itemtype != 'PluginRacksOtherModel') {
                         echo self::showItem($output_type, Dropdown::getDropdownName("glpi_locations", $device["locations_id"]), $num, $cptRow, null, $params);
                     } else {
                         echo self::showItem($output_type, Dropdown::EMPTY_VALUE, $num, $cptRow, null, $params);
                     }
                 }
                 // Groupe
                 if (array_key_exists("group", $listFields)) {
                     // Groupe
                     if ($itemtype != 'PluginRacksOtherModel') {
                         echo self::showItem($output_type, Dropdown::getDropdownName("glpi_groups", $device["groups_id_tech"]), $num, $cptRow, null, $params);
                     } else {
                         echo self::showItem($output_type, Dropdown::EMPTY_VALUE, $num, $cptRow, null, $params);
                     }
                 }
                 // type
                 if (array_key_exists("type", $listFields)) {
                     echo self::showItem($output_type, $item->getTypeName(), $num, $cptRow, null, $params);
                 }
                 // fabricant
                 if (array_key_exists("manufacturer", $listFields)) {
                     if ($itemtype != 'PluginRacksOtherModel') {
                         echo self::showItem($output_type, Dropdown::getDropdownName("glpi_manufacturers", $device["manufacturers_id"]), $num, $cptRow, null, $params);
                     } else {
                         echo self::showItem($output_type, Dropdown::EMPTY_VALUE, $num, $cptRow, null, $params);
                     }
                 }
                 // modèle
                 if (array_key_exists("model", $listFields)) {
                     $model_table = getTableForItemType($itemtype);
                     $modelfield = getForeignKeyFieldForTable(getTableForItemType($itemtype));
                     echo self::showItem($output_type, Dropdown::getDropdownName($model_table, $device[$modelfield]), $num, $cptRow, null, $params);
                 }
                 // numéro de série
                 if (array_key_exists("serial_number", $listFields)) {
                     if ($itemtype != 'PluginRacksOtherModel') {
                         echo self::showItem($output_type, $device['serial'], $num, $cptRow, null, $params);
                     } else {
                         echo self::showItem($output_type, Dropdown::EMPTY_VALUE, $num, $cptRow, null, $params);
                     }
                 }
                 // numéro d'inventaire
                 if (array_key_exists("other_serial", $listFields)) {
                     if ($itemtype != 'PluginRacksOtherModel') {
                         echo self::showItem($output_type, $device['otherserial'], $num, $cptRow, null, $params);
                     } else {
                         echo self::showItem($output_type, Dropdown::EMPTY_VALUE, $num, $cptRow, null, $params);
                     }
                 }
                 $currentRack = $row['id'];
             } else {
                 for ($k = 0; $k < $cptField - 3; $k++) {
                     echo self::showItem($output_type, "&nbsp;", $num, $cptRow, null, $params);
                 }
             }
             echo self::showEndLine($output_type, $params);
         }
         echo self::showFooter($output_type, $title, $params);
         if ($output_type == Search::HTML_OUTPUT) {
             Html::closeForm();
         }
     }
 }