. * * ------------------------------------------------------------------------ * * This file is used to manage the extended information of a computer. * * ------------------------------------------------------------------------ * * @package FusionInventory * @author David Durieux * @copyright Copyright (c) 2010-2016 FusionInventory team * @license AGPL License 3.0 or (at your option) any later version * http://www.gnu.org/licenses/agpl-3.0-standalone.html * @link http://www.fusioninventory.org/ * @link https://github.com/fusioninventory/fusioninventory-for-glpi * */ if (!defined('GLPI_ROOT')) { die("Sorry. You can't access directly to this file"); } /** * Common class to manage informations FI display on an asset */ class PluginFusioninventoryItem extends CommonDBTM { /** * The right name for this class * * @var string */ static $rightname = ''; /** * The itemtype we are processing */ public $itemtype = ''; /** * Get automatic inventory info for a computer * @since 9.1+1.2 * @param integer $items_id the item ID to look for * @return inventory computer infos or an empty array */ function hasAutomaticInventory($items_id) { $fk = getForeignKeyFieldForItemType($this->itemtype); $params = [$fk => $items_id]; if ($this->getFromDBByCrit($params)) { return $this->fields; } else { return []; } } /** * Form to download the XML inventory file * * @param integer $items_id the item ID to look for */ function showDownloadInventoryFile($items_id) { global $CFG_GLPI; $folder = substr($items_id, 0, -1); if (empty($folder)) { $folder = '0'; } $file_found = false; //Check if the file exists with the .xml extension (new format) $file = PLUGIN_FUSIONINVENTORY_XML_DIR; $filename = $items_id.'.xml'; $file_shortname = strtolower($this->itemtype)."/".$folder."/".$filename; $file .= $file_shortname; if (!file_exists($file)) { //The file doesn't exists, check without the extension (old format) $file = PLUGIN_FUSIONINVENTORY_XML_DIR; $filename = $items_id; $file_shortname = strtolower($this->itemtype)."/".$folder."/".$filename; $file .= $file_shortname; if (file_exists($file)) { $file_found = true; } } else { $file_found = true; } if ($file_found) { echo "
";
$url = Plugin::getWebDir('fusioninventory')."/front/send_inventory.php";
$url.= "?itemtype=".get_class($this)
."&function=sendXML&items_id=".$file_shortname."&filename=".$filename;
echo "";
$message = __('Download inventory file', 'fusioninventory');
echo " |
---|