/**
  * Display data from serialized inventory field
  */
 static function displaySerializedValues($array)
 {
     //      TODO: to fix in 0.85
     //      if ($_POST['glpi_tab'] == -1) { // tab all
     //         return;
     //      }
     foreach ($array as $key => $value) {
         echo "<tr class='tab_bg_1'>";
         echo "<th>";
         echo $key;
         echo "</th>";
         echo "<td>";
         if (is_array($value)) {
             echo "<table class='tab_cadre' width='100%'>";
             PluginFusioninventoryToolbox::displaySerializedValues($value);
             echo "</table>";
         } else {
             echo $value;
         }
         echo "</td>";
         echo "</tr>";
     }
 }
 function displaySerializedInventory($items_id)
 {
     global $CFG_GLPI;
     $a_printerextend = current($this->find("`printers_id`='" . $items_id . "'", "", 1));
     $this->getFromDB($a_printerextend['id']);
     if (empty($this->fields['serialized_inventory'])) {
         return;
     }
     $data = unserialize(gzuncompress($this->fields['serialized_inventory']));
     echo "<br/>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr class='tab_bg_1'>";
     echo "<th colspan='2'>";
     echo __('Last inventory', 'fusioninventory');
     echo " (" . Html::convDateTime($this->fields['last_fusioninventory_update']) . ")";
     echo "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<th>";
     echo __('Download', 'fusioninventory');
     echo "</th>";
     echo "<td>";
     echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/front/send_inventory.php" . "?itemtype=PluginFusioninventoryPrinter" . "&function=sendSerializedInventory&items_id=" . $a_printerextend['id'] . "&filename=Printer-" . $items_id . ".json'" . "target='_blank'>PHP Array</a> / <a href=''>XML</a>";
     echo "</td>";
     echo "</tr>";
     PluginFusioninventoryToolbox::displaySerializedValues($data);
     echo "</table>";
 }
 function displaySerializedInventory($items_id)
 {
     global $CFG_GLPI;
     $a_computerextend = current($this->find("`computers_id`='" . $items_id . "'", "", 1));
     $this->getFromDB($a_computerextend['id']);
     $folder = substr($items_id, 0, -1);
     if (empty($folder)) {
         $folder = '0';
     }
     if (empty($this->fields['serialized_inventory']) && !file_exists(GLPI_PLUGIN_DOC_DIR . "/fusioninventory/xml/computer/" . $folder . "/" . $items_id)) {
         return;
     }
     $data = array();
     if (!empty($this->fields['serialized_inventory'])) {
         $data = unserialize(gzuncompress($this->fields['serialized_inventory']));
     }
     echo "<br/>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr class='tab_bg_1'>";
     echo "<th colspan='2'>";
     echo __('Last inventory', 'fusioninventory');
     echo " (" . Html::convDateTime($this->fields['last_fusioninventory_update']) . ")";
     echo "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<th>";
     echo __('Download', 'fusioninventory');
     echo "</th>";
     echo "<td>";
     if (!empty($this->fields['serialized_inventory'])) {
         echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/front/send_inventory.php" . "?itemtype=PluginFusioninventoryInventoryComputerComputer" . "&function=sendSerializedInventory&items_id=" . $a_computerextend['id'] . "&filename=Computer-" . $items_id . ".json'" . "target='_blank'>" . __('PHP Array', 'fusioninventory') . "</a> ";
     }
     if (file_exists(GLPI_PLUGIN_DOC_DIR . "/fusioninventory/xml/computer/" . $folder . "/" . $items_id)) {
         if (!empty($this->fields['serialized_inventory'])) {
             echo "/ ";
         }
         echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/front/send_inventory.php" . "?itemtype=PluginFusioninventoryInventoryComputerComputer" . "&function=sendXML&items_id=computer/" . $folder . "/" . $items_id . "&filename=Computer-" . $items_id . ".xml'" . "target='_blank'>XML</a>";
     }
     echo "</td>";
     echo "</tr>";
     PluginFusioninventoryToolbox::displaySerializedValues($data);
     echo "</table>";
 }