243 lines
4.6 KiB
PHP
243 lines
4.6 KiB
PHP
<?php
|
|
|
|
ob_Start();
|
|
|
|
|
|
|
|
use Glpi\Event;
|
|
|
|
include ('../inc/includes.php');
|
|
|
|
Session::checkLoginUser();
|
|
|
|
|
|
|
|
|
|
|
|
function get_Ordinateur($id){
|
|
|
|
|
|
|
|
global $DB;
|
|
|
|
|
|
|
|
$query = "SELECT DISTINCT glpi_computers.name, concat(glpi_users.realname,' ',glpi_users.firstname) as fullname,
|
|
|
|
glpi_computers.id AS Computer_id, glpi_manufacturers.name AS fabricant, glpi_computers.serial AS serial,
|
|
|
|
glpi_computertypes.name AS types, glpi_computermodels.name AS modele, glpi_users.id AS users_id,
|
|
|
|
glpi_computers.uuid , glpi_computers.comment AS comment , glpi_computers.serial as num_serie,
|
|
|
|
glpi_locations.name as location , glpi_states.name as statut,glpi_networks.name as reseau
|
|
|
|
FROM glpi_computers
|
|
|
|
LEFT JOIN glpi_states ON (glpi_computers.states_id = glpi_states.id )
|
|
|
|
LEFT JOIN glpi_manufacturers ON (glpi_computers.manufacturers_id = glpi_manufacturers.id )
|
|
|
|
LEFT JOIN glpi_computertypes ON (glpi_computers.computertypes_id = glpi_computertypes.id )
|
|
|
|
LEFT JOIN glpi_computermodels ON (glpi_computers.computermodels_id = glpi_computermodels.id )
|
|
|
|
LEFT JOIN glpi_items_operatingsystems ON (glpi_computers.id = glpi_items_operatingsystems.items_id AND glpi_items_operatingsystems.itemtype = 'Computer' )
|
|
|
|
LEFT JOIN glpi_operatingsystems AS glpi_operatingsystems_8 ON (glpi_items_operatingsystems.operatingsystems_id = glpi_operatingsystems_8.id )
|
|
|
|
LEFT JOIN glpi_locations ON (glpi_computers.locations_id = glpi_locations.id )
|
|
|
|
LEFT JOIN glpi_users ON (glpi_computers.users_id = glpi_users.id )
|
|
|
|
LEFT JOIN glpi_items_deviceprocessors ON (glpi_computers.id = glpi_items_deviceprocessors.items_id AND glpi_items_deviceprocessors.itemtype = 'Computer' )
|
|
|
|
LEFT JOIN glpi_deviceprocessors AS glpi_deviceprocessors_7 ON (glpi_items_deviceprocessors.deviceprocessors_id = glpi_deviceprocessors_7.id )
|
|
|
|
LEFT JOIN glpi_networks ON (glpi_computers.networks_id = glpi_networks.id )
|
|
|
|
WHERE glpi_computers.is_deleted = 0 AND glpi_computers.is_template = 0 and glpi_computers.id = ?";
|
|
|
|
$stmt = $DB->prepare($query);
|
|
|
|
$stmt->bind_param("i" , $id);
|
|
|
|
$stmt->execute();
|
|
$result = $stmt->get_result();
|
|
|
|
|
|
|
|
if ($result->num_rows > 0) {
|
|
|
|
|
|
|
|
while($row = $result->fetch_assoc()) {
|
|
|
|
$res[] = $row;
|
|
|
|
}
|
|
|
|
return $res[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_Ordinateur_logiciels($id_Ordinateur){
|
|
|
|
|
|
|
|
global $DB;
|
|
|
|
|
|
|
|
$query = "SELECT
|
|
|
|
`glpi_softwares`.`softwarecategories_id`,
|
|
|
|
`glpi_softwares`.`name` AS `softname`,
|
|
|
|
`glpi_items_softwareversions`.`id`,
|
|
|
|
`glpi_states`.`name` AS `state`,
|
|
|
|
`glpi_softwareversions`.`id` AS `verid`,
|
|
|
|
`glpi_softwareversions`.`softwares_id`,
|
|
|
|
`glpi_softwareversions`.`name` AS `version`,
|
|
|
|
`glpi_softwares`.`is_valid` AS `softvalid`,
|
|
|
|
`glpi_items_softwareversions`.`date_install` AS `dateinstall`
|
|
|
|
FROM
|
|
|
|
`glpi_items_softwareversions`
|
|
|
|
LEFT JOIN `glpi_softwareversions` ON(
|
|
|
|
`glpi_items_softwareversions`.`softwareversions_id` = `glpi_softwareversions`.`id`
|
|
|
|
)
|
|
|
|
LEFT JOIN `glpi_states` ON(
|
|
|
|
`glpi_softwareversions`.`states_id` = `glpi_states`.`id`
|
|
|
|
)
|
|
|
|
LEFT JOIN `glpi_softwares` ON(
|
|
|
|
`glpi_softwareversions`.`softwares_id` = `glpi_softwares`.`id`
|
|
|
|
)
|
|
|
|
WHERE
|
|
|
|
`glpi_items_softwareversions`.`items_id` = ? AND `glpi_items_softwareversions`.`itemtype` = 'Computer'
|
|
|
|
AND `glpi_items_softwareversions`.`is_deleted` = '0'
|
|
|
|
ORDER BY
|
|
|
|
`softname`,
|
|
|
|
`version`";
|
|
|
|
$stmt = $DB->prepare($query);
|
|
|
|
$stmt->bind_param("i" , $id_Ordinateur);
|
|
|
|
$stmt->execute();
|
|
$result = $stmt->get_result();
|
|
|
|
|
|
|
|
if ($result->num_rows > 0) {
|
|
|
|
|
|
|
|
while($row = $result->fetch_assoc()) {
|
|
|
|
$res[] = $row;
|
|
|
|
}
|
|
|
|
return $res;
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(filter_var($_GET['id'], FILTER_VALIDATE_INT) === FALSE) Html::redirect($CFG_GLPI["root_doc"]."/front/computer.php");
|
|
|
|
|
|
|
|
if(isset($_GET['id']) && !empty($_GET['id'])){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$ordinateur = get_Ordinateur($_GET['id']);
|
|
|
|
|
|
|
|
//supprimer UTF-8-BOM
|
|
|
|
for ($i = 0; $i <= 31; ++$i) {
|
|
|
|
$ordinateur = str_replace(chr($i), "", $ordinateur);
|
|
|
|
}
|
|
|
|
$ordinateur = str_replace(chr(127), "", $ordinateur);
|
|
|
|
|
|
|
|
|
|
|
|
$logiciels = get_Ordinateur_logiciels($_GET['id']);
|
|
|
|
|
|
|
|
//supprimer UTF-8-BOM
|
|
|
|
for ($i = 0; $i <= 31; ++$i) {
|
|
|
|
$logiciels = str_replace(chr($i), "", $logiciels);
|
|
|
|
}
|
|
|
|
$logiciels = str_replace(chr(127), "", $logiciels);
|
|
|
|
|
|
|
|
if($ordinateur != null){
|
|
|
|
include ('../lib/tcpdf/templates/fiche_ordinateur.php');
|
|
|
|
}
|
|
|
|
|
|
|
|
}else{
|
|
|
|
Html::redirect($CFG_GLPI["root_doc"]."/front/computer.php");
|
|
|
|
} |