ryxeo-glpi-git / front / report.location.list.php @ b67d8923
Historique | Voir | Annoter | Télécharger (4,47 ko)
1 |
<?php
|
---|---|
2 |
/*
|
3 |
* @version $Id: report.location.list.php 7763 2009-01-06 18:44:50Z moyo $
|
4 |
-------------------------------------------------------------------------
|
5 |
GLPI - Gestionnaire Libre de Parc Informatique
|
6 |
Copyright (C) 2003-2009 by the INDEPNET Development Team.
|
7 |
|
8 |
http://indepnet.net/ http://glpi-project.org
|
9 |
-------------------------------------------------------------------------
|
10 |
|
11 |
LICENSE
|
12 |
|
13 |
This file is part of GLPI.
|
14 |
|
15 |
GLPI is free software; you can redistribute it and/or modify
|
16 |
it under the terms of the GNU General Public License as published by
|
17 |
the Free Software Foundation; either version 2 of the License, or
|
18 |
(at your option) any later version.
|
19 |
|
20 |
GLPI is distributed in the hope that it will be useful,
|
21 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
GNU General Public License for more details.
|
24 |
|
25 |
You should have received a copy of the GNU General Public License
|
26 |
along with GLPI; if not, write to the Free Software
|
27 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
28 |
--------------------------------------------------------------------------
|
29 |
*/
|
30 |
|
31 |
|
32 |
$NEEDED_ITEMS=array("networking"); |
33 |
|
34 |
define('GLPI_ROOT', '..'); |
35 |
include (GLPI_ROOT . "/inc/includes.php"); |
36 |
|
37 |
checkRight("reports","r"); |
38 |
|
39 |
if (isset($_POST["location"])&&$_POST["location"]){ |
40 |
commonHeader($LANG["Menu"][6],$_SERVER['PHP_SELF'],"utils","report"); |
41 |
|
42 |
// Titre
|
43 |
$name=getDropdownName("glpi_dropdown_locations",$_POST["location"]); |
44 |
echo "<div align='center'><h2>".$LANG["reports"][54]." $name </h2></div>"; |
45 |
|
46 |
$query="SELECT glpi_dropdown_netpoint.name AS prise, glpi_networking_ports.name AS port, glpi_networking_ports.ifaddr |
47 |
AS ip, glpi_networking_ports.ifmac AS mac,glpi_networking_ports.ID AS IDport, glpi_dropdown_locations.ID as location,glpi_dropdown_locations.completename
|
48 |
FROM glpi_dropdown_locations
|
49 |
LEFT JOIN glpi_dropdown_netpoint ON glpi_dropdown_netpoint.location =
|
50 |
glpi_dropdown_locations.ID
|
51 |
LEFT JOIN glpi_networking_ports ON glpi_networking_ports.netpoint=glpi_dropdown_netpoint.id
|
52 |
WHERE ".getRealQueryForTreeItem("glpi_dropdown_locations",$_POST["location"])." AND glpi_networking_ports.device_type=".NETWORKING_TYPE." |
53 |
ORDER BY glpi_dropdown_locations.completename, glpi_networking_ports.name;";
|
54 |
|
55 |
$result = $DB->query($query); |
56 |
if ($result&&$DB->numrows($result)){ |
57 |
|
58 |
echo "<div align='center'><table class='tab_cadre_report'>"; |
59 |
echo "<tr> "; |
60 |
echo "<th>".$LANG["common"][15]."</th>"; |
61 |
echo "<th>".$LANG["reports"][37]."</th>"; |
62 |
echo "<th>".$LANG["reports"][52]."</th>"; |
63 |
echo "<th>".$LANG["reports"][38]."</th>"; |
64 |
echo "<th>".$LANG["reports"][46]."</th>"; |
65 |
echo "<th>".$LANG["device_iface"][2]."</th>"; |
66 |
echo "<th>".$LANG["reports"][47]."</th>"; |
67 |
echo "<th>".$LANG["reports"][38]."</th>"; |
68 |
echo "<th>".$LANG["device_iface"][2]."</th>"; |
69 |
echo "<th>".$LANG["reports"][36]."</th>"; |
70 |
echo "</tr>"; |
71 |
while( $ligne = $DB->fetch_array($result)){ |
72 |
$lieu=$ligne["completename"]; |
73 |
$prise=$ligne['prise']; |
74 |
$port=$ligne['port']; |
75 |
$nw=new NetWire(); |
76 |
$end1=$nw->getOppositeContact($ligne['IDport']); |
77 |
$np=new Netport(); |
78 |
|
79 |
$ordi=""; |
80 |
$ip2=""; |
81 |
$mac2=""; |
82 |
$portordi=""; |
83 |
|
84 |
if ($end1){ |
85 |
$np->getFromDB($end1); |
86 |
$np->getDeviceData($np->fields["on_device"],$np->fields["device_type"]); |
87 |
$ordi=$np->device_name; |
88 |
$ip2=$np->fields['ifaddr']; |
89 |
$mac2=$np->fields['ifmac']; |
90 |
$portordi=$np->fields['name']; |
91 |
} |
92 |
|
93 |
$ip=$ligne['ip']; |
94 |
$mac=$ligne['mac']; |
95 |
|
96 |
$np=new Netport(); |
97 |
$np->getFromDB($ligne['IDport']); |
98 |
|
99 |
$nd=new Netdevice(); |
100 |
$nd->getFromDB($np->fields["on_device"]); |
101 |
$switch=$nd->fields["name"]; |
102 |
|
103 |
|
104 |
//inserer ces valeures dans un tableau
|
105 |
|
106 |
echo "<tr class='tab_bg_1'>"; |
107 |
if($lieu) echo "<td>$lieu</td>"; else echo "<td> N/A </td>"; |
108 |
if($prise) echo "<td>$prise</td>"; else echo "<td> N/A </td>"; |
109 |
if($switch) echo "<td>$switch</td>"; else echo "<td> N/A </td>"; |
110 |
if($ip) echo "<td>$ip</td>"; else echo "<td> N/A </td>"; |
111 |
if($port) echo "<td>$port</td>"; else echo "<td> N/A </td>"; |
112 |
if($mac) echo "<td>$mac</td>"; else echo "<td> N/A </td>"; |
113 |
if($portordi) echo "<td>$portordi</td>"; else echo "<td> N/A </td>"; |
114 |
if($ip2) echo "<td>$ip2</td>"; else echo "<td> N/A </td>"; |
115 |
if($mac2) echo "<td>$mac2</td>"; else echo "<td> N/A </td>"; |
116 |
if($ordi) echo "<td>$ordi</td>"; else echo "<td> N/A </td>"; |
117 |
echo "</tr>\n"; |
118 |
} |
119 |
echo "</table></div><br><hr><br>"; |
120 |
|
121 |
} |
122 |
|
123 |
echo "</div>"; |
124 |
commonFooter(); |
125 |
|
126 |
} else {
|
127 |
glpi_header($CFG_GLPI['root_doc']."/front/report.networking.php"); |
128 |
} |
129 |
|
130 |
?>
|