ryxeo-glpi-git / front / report.switch.list.php @ b67d8923
Historique | Voir | Annoter | Télécharger (3,73 ko)
1 | b67d8923 | Eric Seigne | <?php
|
---|---|---|---|
2 | /*
|
||
3 | * @version $Id: report.switch.list.php 7875 2009-01-23 15:16:47Z 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 | \brief affiche le rapport r�eau par switch
|
||
32 | |||
33 | */
|
||
34 | |||
35 | |||
36 | |||
37 | |||
38 | |||
39 | $NEEDED_ITEMS=array("networking"); |
||
40 | |||
41 | define('GLPI_ROOT', '..'); |
||
42 | include (GLPI_ROOT . "/inc/includes.php"); |
||
43 | |||
44 | checkRight("reports","r"); |
||
45 | |||
46 | // Titre
|
||
47 | if (isset($_POST["switch"])&&$_POST["switch"]){ |
||
48 | commonHeader($LANG["Menu"][6],$_SERVER['PHP_SELF'],"utils","report"); |
||
49 | |||
50 | $name=getDropdownName("glpi_networking",$_POST["switch"]); |
||
51 | echo "<div align='center'><h2>".$LANG["reports"][49]." $name </h2></div><br><br>"; |
||
52 | |||
53 | $query="SELECT c.name as port,c.ifaddr as ip,c.ifmac as mac, c.ID AS IDport, glpi_networking.name as switch |
||
54 | FROM glpi_networking
|
||
55 | LEFT JOIN glpi_networking_ports c ON c.device_type=".NETWORKING_TYPE." AND c.on_device=glpi_networking.ID |
||
56 | WHERE glpi_networking.id='".$_POST["switch"]."'"; |
||
57 | |||
58 | |||
59 | $result = $DB->query($query); |
||
60 | if ($result&&$DB->numrows($result)){ |
||
61 | echo "<div align='center'><table class='tab_cadre_report'>"; |
||
62 | echo "<tr> "; |
||
63 | echo "<th> </th>"; |
||
64 | echo "<th>".$LANG["reports"][46]."</th>"; |
||
65 | echo "<th>".$LANG["reports"][38]."</th>"; |
||
66 | echo "<th>".$LANG["device_iface"][2]."</th>"; |
||
67 | echo "<th>".$LANG["reports"][47]."</th>"; |
||
68 | echo "<th>".$LANG["reports"][38]."</th>"; |
||
69 | echo "<th>".$LANG["device_iface"][2]."</th>"; |
||
70 | echo "<th>".$LANG["reports"][36]."</th>"; |
||
71 | echo "</tr>\n"; |
||
72 | |||
73 | while( $ligne = $DB->fetch_array($result)){ |
||
74 | $switch = $ligne['switch']; |
||
75 | //echo $ligne['location'];
|
||
76 | //$prise=$ligne['prise'];
|
||
77 | $port = $ligne['port']; |
||
78 | $nw=new NetWire(); |
||
79 | $end1=$nw->getOppositeContact($ligne['IDport']); |
||
80 | $np=new Netport(); |
||
81 | $ip2=""; |
||
82 | $mac2=""; |
||
83 | $portordi=""; |
||
84 | $ordi=""; |
||
85 | |||
86 | if ($end1){ |
||
87 | $np->getFromDB($end1); |
||
88 | $np->getDeviceData($np->fields["on_device"],$np->fields["device_type"]); |
||
89 | $ordi=$np->device_name; |
||
90 | $ip2=$np->fields['ifaddr']; |
||
91 | $mac2=$np->fields['ifmac']; |
||
92 | $portordi=$np->fields['name']; |
||
93 | } |
||
94 | $ip=$ligne['ip']; |
||
95 | $mac=$ligne['mac']; |
||
96 | //inserer ces valeures dans un tableau
|
||
97 | echo "<tr class='tab_bg_1'>"; |
||
98 | if($switch) echo "<td>$switch</td>"; else echo "<td> N/A </td>"; |
||
99 | if($port) echo "<td>$port</td>"; else echo "<td> N/A </td>"; |
||
100 | if($ip) echo "<td>$ip</td>"; else echo "<td> N/A </td>"; |
||
101 | if($mac) echo "<td>$mac</td>"; else echo "<td> N/A </td>"; |
||
102 | if($portordi) echo "<td>$portordi</td>"; else echo "<td> N/A </td>"; |
||
103 | if($ip2) echo "<td>$ip2</td>"; else echo "<td> N/A </td>"; |
||
104 | if($mac2) echo "<td>$mac2</td>"; else echo "<td> N/A </td>"; |
||
105 | if($ordi) echo "<td>$ordi</td>"; else echo "<td> N/A </td>"; |
||
106 | echo "</tr>\n"; |
||
107 | } |
||
108 | echo "</table></div><br><hr><br>"; |
||
109 | } |
||
110 | |||
111 | commonFooter(); |
||
112 | |||
113 | } else {
|
||
114 | glpi_header($CFG_GLPI['root_doc']."/front/report.networking.php"); |
||
115 | } |
||
116 | |||
117 | ?> |