ryxeo-glpi-git / front / report.default.php @ b67d8923
Historique | Voir | Annoter | Télécharger (9,3 ko)
1 |
<?php
|
---|---|
2 |
/*
|
3 |
* @version $Id: report.default.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 |
// Original Author of file:
|
33 |
// Purpose of file:
|
34 |
// ----------------------------------------------------------------------
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
$NEEDED_ITEMS=array("software"); |
40 |
|
41 |
define('GLPI_ROOT', '..'); |
42 |
include (GLPI_ROOT . "/inc/includes.php"); |
43 |
|
44 |
checkRight("reports","r"); |
45 |
|
46 |
commonHeader($LANG["Menu"][6],$_SERVER['PHP_SELF'],"utils","report"); |
47 |
|
48 |
# Title
|
49 |
|
50 |
echo "<div align='center'><big><b>GLPI ".$LANG["Menu"][6]."</b></big><br><br>"; |
51 |
|
52 |
# 1. Get some number data
|
53 |
|
54 |
$query = "SELECT count(*) |
55 |
FROM glpi_computers
|
56 |
WHERE deleted ='0' AND is_template = '0' ".getEntitiesRestrictRequest("AND","glpi_computers"); |
57 |
$result = $DB->query($query); |
58 |
$number_of_computers = $DB->result($result,0,0); |
59 |
|
60 |
$query = "SELECT count(*) |
61 |
FROM glpi_software
|
62 |
WHERE deleted ='0' AND is_template = '0' ".getEntitiesRestrictRequest("AND","glpi_software"); |
63 |
$result = $DB->query($query); |
64 |
$number_of_software = $DB->result($result,0,0); |
65 |
|
66 |
$query = "SELECT count(*) |
67 |
FROM glpi_printers
|
68 |
LEFT JOIN glpi_connect_wire ON (glpi_connect_wire.type='".PRINTER_TYPE."' AND glpi_connect_wire.end1=glpi_printers.ID) |
69 |
WHERE glpi_printers.deleted ='0' AND glpi_printers.is_template = '0' ".getEntitiesRestrictRequest("AND","glpi_printers"); |
70 |
$result = $DB->query($query); |
71 |
$number_of_printers = $DB->result($result,0,0); |
72 |
|
73 |
$query = "SELECT count(*) FROM glpi_networking where deleted ='0' AND is_template = '0' ".getEntitiesRestrictRequest("AND","glpi_networking"); |
74 |
$result = $DB->query($query); |
75 |
$number_of_networking = $DB->result($result,0,0); |
76 |
|
77 |
|
78 |
|
79 |
$query = "SELECT count(*) |
80 |
FROM glpi_monitors
|
81 |
LEFT JOIN glpi_connect_wire ON (glpi_connect_wire.type='".MONITOR_TYPE."' AND glpi_connect_wire.end1=glpi_monitors.ID) |
82 |
WHERE glpi_monitors.deleted ='0' AND glpi_monitors.is_template = '0' ".getEntitiesRestrictRequest("AND","glpi_monitors"); |
83 |
$result = $DB->query($query); |
84 |
$number_of_monitors = $DB->result($result,0,0); |
85 |
|
86 |
|
87 |
$query = "SELECT count(*) |
88 |
FROM glpi_peripherals
|
89 |
LEFT JOIN glpi_connect_wire ON (glpi_connect_wire.type='".PERIPHERAL_TYPE."' AND glpi_connect_wire.end1=glpi_peripherals.ID) |
90 |
WHERE glpi_peripherals.deleted ='0' AND glpi_peripherals.is_template = '0' ".getEntitiesRestrictRequest("AND","glpi_peripherals"); |
91 |
$result = $DB->query($query); |
92 |
$number_of_peripherals = $DB->result($result,0,0); |
93 |
|
94 |
|
95 |
$query = "SELECT count(*) |
96 |
FROM glpi_phones
|
97 |
LEFT JOIN glpi_connect_wire ON (glpi_connect_wire.type='".PHONE_TYPE."' AND glpi_connect_wire.end1=glpi_phones.ID) |
98 |
WHERE glpi_phones.deleted ='0' AND glpi_phones.is_template = '0' ".getEntitiesRestrictRequest("AND","glpi_phones"); |
99 |
$result = $DB->query($query); |
100 |
$number_of_phones = $DB->result($result,0,0); |
101 |
|
102 |
# 2. Spew out the data in a table
|
103 |
|
104 |
echo "<table class='tab_cadre' width='80%'>"; |
105 |
echo "<tr class='tab_bg_2'><td>".$LANG["Menu"][0].":</td><td>$number_of_computers</td></tr>"; |
106 |
echo "<tr class='tab_bg_2'><td>".$LANG["Menu"][2].":</td><td>$number_of_printers</td></tr>"; |
107 |
echo "<tr class='tab_bg_2'><td>".$LANG["Menu"][1].":</td><td>$number_of_networking</td></tr>"; |
108 |
echo "<tr class='tab_bg_2'><td>".$LANG["Menu"][4].":</td><td>$number_of_software</td></tr>"; |
109 |
echo "<tr class='tab_bg_2'><td>".$LANG["Menu"][3].":</td><td>$number_of_monitors</td></tr>"; |
110 |
echo "<tr class='tab_bg_2'><td>".$LANG["Menu"][16].":</td><td>$number_of_peripherals</td></tr>"; |
111 |
echo "<tr class='tab_bg_2'><td>".$LANG["Menu"][34].":</td><td>$number_of_phones</td></tr>"; |
112 |
|
113 |
echo "<tr><td colspan='2' height=10></td></tr>"; |
114 |
echo "<tr class='tab_bg_1'><td colspan='2'><b>".$LANG["setup"][5].":</b></td></tr>"; |
115 |
|
116 |
|
117 |
# 3. Get some more number data (operating systems per computer)
|
118 |
|
119 |
|
120 |
$query = "SELECT count(*) AS COUNT, glpi_dropdown_os.name as NAME |
121 |
FROM glpi_computers
|
122 |
LEFT JOIN glpi_dropdown_os ON (glpi_computers.os = glpi_dropdown_os.ID)
|
123 |
WHERE glpi_computers.deleted ='0' AND glpi_computers.is_template = '0' ".getEntitiesRestrictRequest("AND","glpi_computers")." |
124 |
GROUP BY glpi_dropdown_os.name";
|
125 |
$result = $DB->query($query); |
126 |
|
127 |
while ($data=$DB->fetch_assoc($result)){ |
128 |
if (empty($data['NAME'])) $data['NAME']="------"; |
129 |
echo "<tr class='tab_bg_2'><td>".$data['NAME']."</td><td>".$data['COUNT']."</td></tr>"; |
130 |
} |
131 |
|
132 |
|
133 |
echo "<tr><td colspan='2' height=10></td></tr>"; |
134 |
echo "<tr class='tab_bg_1'><td colspan='2'><b>".$LANG["Menu"][1].":</b></td></tr>"; |
135 |
|
136 |
# 4. Get some more number data (Networking)
|
137 |
|
138 |
|
139 |
$query = "SELECT count(*) AS COUNT, glpi_type_networking.name as NAME |
140 |
FROM glpi_networking
|
141 |
LEFT JOIN glpi_type_networking ON (glpi_networking.type = glpi_type_networking.ID)
|
142 |
WHERE glpi_networking.deleted ='0' AND glpi_networking.is_template = '0' ".getEntitiesRestrictRequest("AND","glpi_networking")." |
143 |
GROUP BY glpi_type_networking.name";
|
144 |
$result = $DB->query($query); |
145 |
|
146 |
while ($data=$DB->fetch_assoc($result)){ |
147 |
if (empty($data['NAME'])) $data['NAME']="------"; |
148 |
echo "<tr class='tab_bg_2'><td>".$data['NAME']."</td><td>".$data['COUNT']."</td></tr>"; |
149 |
} |
150 |
|
151 |
|
152 |
echo "<tr><td colspan='2' height=10></td></tr>"; |
153 |
echo "<tr class='tab_bg_1'><td colspan='2'><b>".$LANG["Menu"][3].":</b></td></tr>"; |
154 |
|
155 |
# 4. Get some more number data (Monitor)
|
156 |
|
157 |
$query = "SELECT count(*) AS COUNT, glpi_type_monitors.name as NAME |
158 |
FROM glpi_monitors
|
159 |
LEFT JOIN glpi_type_monitors ON (glpi_monitors.type = glpi_type_monitors.ID)
|
160 |
LEFT JOIN glpi_connect_wire ON (glpi_connect_wire.type='".MONITOR_TYPE."' AND glpi_connect_wire.end1=glpi_monitors.ID) |
161 |
WHERE glpi_monitors.deleted ='0' AND glpi_monitors.is_template = '0' ".getEntitiesRestrictRequest("AND","glpi_monitors")." |
162 |
GROUP BY glpi_type_monitors.name";
|
163 |
$result = $DB->query($query); |
164 |
|
165 |
while ($data=$DB->fetch_assoc($result)){ |
166 |
if (empty($data['NAME'])) $data['NAME']="------"; |
167 |
echo "<tr class='tab_bg_2'><td>".$data['NAME']."</td><td>".$data['COUNT']."</td></tr>"; |
168 |
} |
169 |
|
170 |
|
171 |
echo "<tr><td colspan='2' height=10></td></tr>"; |
172 |
echo "<tr class='tab_bg_1'><td colspan='2'><b>".$LANG["Menu"][2].":</b></td></tr>"; |
173 |
|
174 |
# 4. Get some more number data (Printers)
|
175 |
|
176 |
$query = "SELECT count(*) AS COUNT, glpi_type_printers.name as NAME |
177 |
FROM glpi_printers
|
178 |
LEFT JOIN glpi_type_printers ON (glpi_printers.type = glpi_type_printers.ID)
|
179 |
LEFT JOIN glpi_connect_wire ON (glpi_connect_wire.type='".PRINTER_TYPE."' AND glpi_connect_wire.end1=glpi_printers.ID) |
180 |
WHERE glpi_printers.deleted ='0' AND glpi_printers.is_template = '0' ".getEntitiesRestrictRequest("AND","glpi_printers")." |
181 |
GROUP BY glpi_type_printers.name";
|
182 |
$result = $DB->query($query); |
183 |
|
184 |
while ($data=$DB->fetch_assoc($result)){ |
185 |
if (empty($data['NAME'])) $data['NAME']="------"; |
186 |
echo "<tr class='tab_bg_2'><td>".$data['NAME']."</td><td>".$data['COUNT']."</td></tr>"; |
187 |
} |
188 |
|
189 |
echo "<tr><td colspan='2' height=10></td></tr>"; |
190 |
echo "<tr class='tab_bg_1'><td colspan='2'><b>".$LANG["Menu"][16].":</b></td></tr>"; |
191 |
|
192 |
# 4. Get some more number data (Peripherals)
|
193 |
|
194 |
|
195 |
$query = "SELECT count(*) AS COUNT, glpi_type_peripherals.name as NAME |
196 |
FROM glpi_peripherals
|
197 |
LEFT JOIN glpi_type_peripherals ON (glpi_peripherals.type = glpi_type_peripherals.ID)
|
198 |
LEFT JOIN glpi_connect_wire ON (glpi_connect_wire.type='".PERIPHERAL_TYPE."' AND glpi_connect_wire.end1=glpi_peripherals.ID) |
199 |
WHERE glpi_peripherals.deleted ='0' AND glpi_peripherals.is_template = '0' ".getEntitiesRestrictRequest("AND","glpi_peripherals")." |
200 |
GROUP BY glpi_type_peripherals.name";
|
201 |
$result = $DB->query($query); |
202 |
|
203 |
while ($data=$DB->fetch_assoc($result)){ |
204 |
if (empty($data['NAME'])) $data['NAME']="------"; |
205 |
echo "<tr class='tab_bg_2'><td>".$data['NAME']."</td><td>".$data['COUNT']."</td></tr>"; |
206 |
} |
207 |
|
208 |
echo "<tr><td colspan='2' height=10></td></tr>"; |
209 |
echo "<tr class='tab_bg_1'><td colspan='2'><b>".$LANG["Menu"][34].":</b></td></tr>"; |
210 |
|
211 |
# 4. Get some more number data (Peripherals)
|
212 |
|
213 |
|
214 |
|
215 |
$query = "SELECT count(*) AS COUNT, glpi_type_phones.name as NAME |
216 |
FROM glpi_phones
|
217 |
LEFT JOIN glpi_type_phones ON (glpi_phones.type = glpi_type_phones.ID)
|
218 |
LEFT JOIN glpi_connect_wire ON (glpi_connect_wire.type='".PHONE_TYPE."' AND glpi_connect_wire.end1=glpi_phones.ID) |
219 |
WHERE glpi_phones.deleted ='0' AND glpi_phones.is_template = '0' ".getEntitiesRestrictRequest("AND","glpi_phones")." |
220 |
GROUP BY glpi_type_phones.name";
|
221 |
$result = $DB->query($query); |
222 |
|
223 |
while ($data=$DB->fetch_assoc($result)){ |
224 |
if (empty($data['NAME'])) $data['NAME']="------"; |
225 |
echo "<tr class='tab_bg_2'><td>".$data['NAME']."</td><td>".$data['COUNT']."</td></tr>"; |
226 |
} |
227 |
|
228 |
|
229 |
echo "</table></div>"; |
230 |
|
231 |
commonFooter(); |
232 |
|
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 |
?>
|