Projet

Général

Profil

Paste
Statistiques
| Branche: | Révision:

ryxeo-glpi-git / front / report.netpoint.list.php @ b67d8923

Historique | Voir | Annoter | Télécharger (4,44 ko)

1
<?php
2
/*
3
 * @version $Id: report.netpoint.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
$NEEDED_ITEMS=array("networking");
39

    
40
define('GLPI_ROOT', '..');
41
include (GLPI_ROOT . "/inc/includes.php");
42

    
43
checkRight("reports","r");
44

    
45

    
46
        if (isset($_POST["prise"])&&$_POST["prise"]){
47
                commonHeader($LANG["Menu"][6],$_SERVER['PHP_SELF'],"utils","report");
48

    
49
                $name=getDropdownName("glpi_dropdown_netpoint",$_POST["prise"]);
50

    
51
                // Titre
52
                echo "<div align='center'><h2>".$LANG["reports"][51]." $name</h2></div><br><br>";
53
                $query="SELECT a.name as bureau,a.ID as ID,glpi_dropdown_netpoint.name as prise,c.name as port,c.ifaddr as ip,c.ifmac as mac,c.ID AS IDport
54
                        FROM glpi_dropdown_netpoint
55
                        LEFT JOIN glpi_dropdown_locations a ON a.id=glpi_dropdown_netpoint.location
56
                        LEFT JOIN glpi_networking_ports c ON c.netpoint=glpi_dropdown_netpoint.id
57
                        WHERE glpi_dropdown_netpoint.id='".$_POST["prise"]."' AND c.device_type='".NETWORKING_TYPE."';";
58

    
59
                /*!
60
                  on envoie la requ�e de selection qui varie selon le choix fait dans la dropdown �la fonction report perso qui
61
                  affiche un rapport en fonction de la prise choisie
62
                 */
63

    
64
                $result = $DB->query($query);
65
                if ($result&&$DB->numrows($result)){
66

    
67
                        echo "<div align='center'><table class='tab_cadre_report'>";
68
                        echo "<tr> ";
69
                        echo "<th>".$LANG["common"][15]."</th>";
70
                        echo "<th>".$LANG["reports"][52]."</th>";
71
                        echo "<th>".$LANG["reports"][38]."</th>";
72
                        echo "<th>".$LANG["reports"][46]."</th>";
73
                        echo "<th>".$LANG["device_iface"][2]."</th>";
74
                        echo "<th>".$LANG["reports"][47]."</th>";
75
                        echo "<th>".$LANG["reports"][38]."</th>";
76
                        echo "<th>".$LANG["device_iface"][2]."</th>";
77
                        echo "<th>".$LANG["reports"][36]."</th>";
78
                        echo "</tr>";
79

    
80
                        while( $ligne = $DB->fetch_array($result))
81
                        {
82
                                $prise=$ligne['prise'];
83
                                $ID=$ligne['ID'];
84
                                $lieu=getDropdownName("glpi_dropdown_locations",$ID);
85
                                //$etage=$ligne['etage'];
86
                                $nw=new NetWire();
87
                                $end1=$nw->getOppositeContact($ligne['IDport']);
88
                                $np=new Netport();
89

    
90
                                $ordi="";
91
                                $ip2="";
92
                                $mac2="";
93
                                $portordi="";
94

    
95
                                if ($end1){
96
                                        $np->getFromDB($end1);
97
                                        $np->getDeviceData($np->fields["on_device"],$np->fields["device_type"]);
98
                                        $ordi=$np->device_name;
99
                                        $ip2=$np->fields['ifaddr'];
100
                                        $mac2=$np->fields['ifmac'];
101
                                        $portordi=$np->fields['name'];
102
                                }
103

    
104
                                $ip=$ligne['ip'];
105
                                $mac=$ligne['mac'];
106
                                $port=$ligne['port'];
107
                                $np=new Netport();
108
                                $np->getFromDB($ligne['IDport']);
109

    
110
                                $nd=new Netdevice();
111
                                $nd->getFromDB($np->fields["on_device"]);
112
                                $switch=$nd->fields["name"];
113

    
114

    
115
                                //inserer ces valeures dans un tableau
116

    
117
                                echo "<tr class='tab_bg_1'>";
118
                                if($lieu) echo "<td>$lieu</td>"; else echo "<td> N/A </td>";        
119
                                if($switch) echo "<td>$switch</td>"; else echo "<td> N/A </td>";
120
                                if($ip) echo "<td>$ip</td>"; else echo "<td> N/A </td>";
121
                                if($port) echo "<td>$port</td>"; else echo "<td> N/A </td>";
122
                                if($mac) echo "<td>$mac</td>"; else echo "<td> N/A </td>";
123
                                if($portordi) echo "<td>$portordi</td>"; else echo "<td> N/A </td>";
124
                                if($ip2) echo "<td>$ip2</td>"; else echo "<td> N/A </td>";
125
                                if($mac2) echo "<td>$mac2</td>"; else echo "<td> N/A </td>";
126
                                if($ordi) echo "<td>$ordi</td>"; else echo "<td> N/A </td>";
127
                                echo "</tr>\n";
128
                        }        
129
                        echo "</table></div><br><hr><br>";
130
                }
131

    
132
                commonFooter();
133

    
134
        } else  {
135
                glpi_header($CFG_GLPI['root_doc']."/front/report.networking.php"); 
136
        }
137
?>
Redmine Appliance - Powered by TurnKey Linux