ryxeo-glpi-git / front / stat.graph.php @ b67d8923
Historique | Voir | Annoter | Télécharger (8,31 ko)
1 | b67d8923 | Eric Seigne | <?php
|
---|---|---|---|
2 | /*
|
||
3 | * @version $Id: stat.graph.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: Julien Dombre
|
||
33 | // Purpose of file:
|
||
34 | // ----------------------------------------------------------------------
|
||
35 | |||
36 | |||
37 | |||
38 | $NEEDED_ITEMS=array("stat","tracking","user","enterprise","device"); |
||
39 | |||
40 | |||
41 | define('GLPI_ROOT', '..'); |
||
42 | include (GLPI_ROOT . "/inc/includes.php"); |
||
43 | |||
44 | commonHeader($LANG["Menu"][13],$_SERVER['PHP_SELF'],"maintain","stat"); |
||
45 | |||
46 | checkRight("statistic","1"); |
||
47 | |||
48 | if(empty($_POST["date1"])&&empty($_POST["date2"])) { |
||
49 | |||
50 | if (isset($_GET["date1"])) { |
||
51 | $_POST["date1"]=$_GET["date1"]; |
||
52 | } else {
|
||
53 | $year=date("Y")-1; |
||
54 | $_POST["date1"]=date("Y-m-d",mktime(1,0,0,date("m"),date("d"),$year)); |
||
55 | } |
||
56 | if (isset($_GET["date2"])) { |
||
57 | $_POST["date2"]=$_GET["date2"]; |
||
58 | } else {
|
||
59 | $_POST["date2"]=date("Y-m-d"); |
||
60 | } |
||
61 | } |
||
62 | |||
63 | if(empty($_POST["date1"])) $_POST["date1"] = ""; |
||
64 | if(empty($_POST["date2"])) $_POST["date2"] = ""; |
||
65 | if ($_POST["date1"]!=""&&$_POST["date2"]!=""&&strcmp($_POST["date2"],$_POST["date1"])<0){ |
||
66 | $tmp=$_POST["date1"]; |
||
67 | $_POST["date1"]=$_POST["date2"]; |
||
68 | $_POST["date2"]=$tmp; |
||
69 | } |
||
70 | |||
71 | $cleantarget=preg_replace("/[&]date[12]=[0-9-]*/","",$_SERVER['QUERY_STRING']); |
||
72 | $cleantarget=preg_replace("/[&]*ID=([0-9]+[&]{0,1})/","",$cleantarget); |
||
73 | $cleantarget=preg_replace("/&/","&",$cleantarget); |
||
74 | |||
75 | $job=new Job(); |
||
76 | $next=0; |
||
77 | $prev=0; |
||
78 | $title=""; |
||
79 | switch($_GET["type"]){ |
||
80 | case "technicien": |
||
81 | $val1=$_GET["ID"]; |
||
82 | $val2=""; |
||
83 | |||
84 | $next=getNextItem("glpi_users",$_GET["ID"]); |
||
85 | $prev=getPreviousItem("glpi_users",$_GET["ID"]); |
||
86 | $title=$LANG["stats"][16].": ".getAssignName($_GET["ID"],USER_TYPE,1); |
||
87 | break;
|
||
88 | case "technicien_followup": |
||
89 | $val1=$_GET["ID"]; |
||
90 | $val2=""; |
||
91 | |||
92 | $next=getNextItem("glpi_users",$_GET["ID"]); |
||
93 | $prev=getPreviousItem("glpi_users",$_GET["ID"]); |
||
94 | $title=$LANG["stats"][16].": ".getAssignName($_GET["ID"],USER_TYPE,1); |
||
95 | break;
|
||
96 | case "enterprise": |
||
97 | $val1=$_GET["ID"]; |
||
98 | $val2=""; |
||
99 | |||
100 | $next=getNextItem("glpi_enterprises",$_GET["ID"]); |
||
101 | $prev=getPreviousItem("glpi_enterprises",$_GET["ID"]); |
||
102 | $title=$LANG["stats"][44].": ".getAssignName($_GET["ID"],ENTERPRISE_TYPE,1); |
||
103 | break;
|
||
104 | case "user": |
||
105 | $val1=$_GET["ID"]; |
||
106 | $val2=""; |
||
107 | $job->fields["author"]=$_GET["ID"]; |
||
108 | |||
109 | $next=getNextItem("glpi_users",$_GET["ID"]); |
||
110 | $prev=getPreviousItem("glpi_users",$_GET["ID"]); |
||
111 | $title=$LANG["stats"][20].": ".$job->getAuthorName(1); |
||
112 | break;
|
||
113 | case "recipient": |
||
114 | $val1=$_GET["ID"]; |
||
115 | $val2=""; |
||
116 | $job->fields["author"]=$_GET["ID"]; |
||
117 | |||
118 | $next=getNextItem("glpi_users",$_GET["ID"]); |
||
119 | $prev=getPreviousItem("glpi_users",$_GET["ID"]); |
||
120 | $title=$LANG["stats"][20].": ".$job->getAuthorName(1); |
||
121 | break;
|
||
122 | case "category": |
||
123 | $val1=$_GET["ID"]; |
||
124 | $val2=""; |
||
125 | |||
126 | $next=getNextItem("glpi_dropdown_tracking_category",$_GET["ID"]); |
||
127 | $prev=getPreviousItem("glpi_dropdown_tracking_category",$_GET["ID"]); |
||
128 | $title=$LANG["common"][36].": ".getDropdownName("glpi_dropdown_tracking_category",$_GET["ID"]); |
||
129 | break;
|
||
130 | case "group": |
||
131 | $val1=$_GET["ID"]; |
||
132 | $val2=""; |
||
133 | |||
134 | $next=getNextItem("glpi_groups",$_GET["ID"]); |
||
135 | $prev=getPreviousItem("glpi_groups",$_GET["ID"]); |
||
136 | $title=$LANG["common"][35].": ".getDropdownName("glpi_groups",$_GET["ID"]); |
||
137 | break;
|
||
138 | case "assign_group": |
||
139 | $val1=$_GET["ID"]; |
||
140 | $val2=""; |
||
141 | |||
142 | $next=getNextItem("glpi_groups",$_GET["ID"]); |
||
143 | $prev=getPreviousItem("glpi_groups",$_GET["ID"]); |
||
144 | $title=$LANG["common"][35].": ".getDropdownName("glpi_groups",$_GET["ID"]); |
||
145 | break;
|
||
146 | case "priority": |
||
147 | $val1=$_GET["ID"]; |
||
148 | $val2=""; |
||
149 | $next=$prev=0; |
||
150 | if ($val1<5) $next=$val1+1; |
||
151 | if ($val1>1) $prev=$val1-1; |
||
152 | $title=$LANG["joblist"][2].": ".getPriorityName($_GET["ID"]); |
||
153 | break;
|
||
154 | case "request_type": |
||
155 | $val1=$_GET["ID"]; |
||
156 | $val2=""; |
||
157 | $next=$prev=0; |
||
158 | if ($val1<6) $next=$val1+1; |
||
159 | if ($val1>0) $prev=$val1-1; |
||
160 | $title=$LANG["job"][44].": ".getRequestTypeName($_GET["ID"]); |
||
161 | break;
|
||
162 | case "device": |
||
163 | $val1=$_GET["ID"]; |
||
164 | $val2=$_GET["champ"]; |
||
165 | |||
166 | $device_table = getDeviceTable($_GET["champ"]); |
||
167 | |||
168 | $next=getNextItem($device_table,$_GET["ID"]); |
||
169 | $prev=getPreviousItem($device_table,$_GET["ID"]); |
||
170 | |||
171 | $query = "select designation from ".$device_table." WHERE ID='".$_GET['ID']."'"; |
||
172 | $result=$DB->query($query); |
||
173 | |||
174 | $title=$LANG["Menu"][13].": ".$DB->result($result,0,"designation"); |
||
175 | |||
176 | break;
|
||
177 | case "comp_champ": |
||
178 | $val1=$_GET["ID"]; |
||
179 | $val2=$_GET["champ"]; |
||
180 | |||
181 | $table=str_replace("dropdown_type","type_computers",str_replace("location","locations","glpi_dropdown_".$_GET["champ"])); |
||
182 | |||
183 | |||
184 | $next=getNextItem($table,$_GET["ID"]); |
||
185 | $prev=getPreviousItem($table,$_GET["ID"]); |
||
186 | $title=$LANG["stats"][26].": ".getDropdownName($table,$_GET["ID"]); |
||
187 | break;
|
||
188 | |||
189 | } |
||
190 | |||
191 | |||
192 | echo "<div align='center'>"; |
||
193 | echo "<table class='tab_cadre_navigation'>"; |
||
194 | echo "<tr>"; |
||
195 | echo "<td>"; |
||
196 | if ($prev>0) echo "<a href='".$_SERVER['PHP_SELF']."?$cleantarget&date1=".$_POST["date1"]."&date2=".$_POST["date2"]."&ID=$prev'><img src=\"".$CFG_GLPI["root_doc"]."/pics/left.png\" alt='".$LANG["buttons"][12]."' title='".$LANG["buttons"][12]."'></a>"; |
||
197 | echo "</td>"; |
||
198 | |||
199 | echo "<td width='400' align='center'><b>$title</b></td>"; |
||
200 | echo "<td>"; |
||
201 | if ($next>0) echo "<a href='".$_SERVER['PHP_SELF']."?$cleantarget&date1=".$_POST["date1"]."&date2=".$_POST["date2"]."&ID=$next'><img src=\"".$CFG_GLPI["root_doc"]."/pics/right.png\" alt='".$LANG["buttons"][11]."' title='".$LANG["buttons"][11]."'></a>"; |
||
202 | echo "</td>"; |
||
203 | |||
204 | echo "</tr>"; |
||
205 | echo "</table></div><br>"; |
||
206 | |||
207 | |||
208 | $target=preg_replace("/&/","&",$_SERVER["REQUEST_URI"]); |
||
209 | |||
210 | echo "<div align='center'><form method=\"post\" name=\"form\" action=\"".$target."\">"; |
||
211 | echo "<table class='tab_cadre'><tr class='tab_bg_2'><td align='right'>"; |
||
212 | echo $LANG["search"][8]." :</td><td>"; |
||
213 | showCalendarForm("form","date1",$_POST["date1"]); |
||
214 | echo "</td><td rowspan='2' align='center'><input type=\"submit\" class='button' name=\"submit\" value=\"". $LANG["buttons"][7] ."\" /></td></tr>"; |
||
215 | echo "<tr class='tab_bg_2'><td align='right'>".$LANG["search"][9]." :</td><td>"; |
||
216 | showCalendarForm("form","date2",$_POST["date2"]); |
||
217 | echo "</td></tr>"; |
||
218 | echo "</table></form></div>"; |
||
219 | |||
220 | |||
221 | |||
222 | ///////// Stats nombre intervention
|
||
223 | // Total des interventions
|
||
224 | $entrees_total=constructEntryValues("inter_total",$_POST["date1"],$_POST["date2"],$_GET["type"],$val1,$val2); |
||
225 | if (count($entrees_total)>0) |
||
226 | graphBy($entrees_total,$LANG["stats"][5],$LANG["stats"][35],1,"month"); |
||
227 | |||
228 | // Total des interventions r�olues
|
||
229 | $entrees_solved=constructEntryValues("inter_solved",$_POST["date1"],$_POST["date2"],$_GET["type"],$val1,$val2); |
||
230 | if (count($entrees_solved)>0) |
||
231 | graphBy($entrees_solved,$LANG["stats"][11],$LANG["stats"][35],1,"month"); |
||
232 | |||
233 | //Temps moyen de resolution d'intervention
|
||
234 | $entrees_avgtime=constructEntryValues("inter_avgsolvedtime",$_POST["date1"],$_POST["date2"],$_GET["type"],$val1,$val2); |
||
235 | if (count($entrees_avgtime)>0) |
||
236 | graphBy($entrees_avgtime,$LANG["stats"][6],$LANG["job"][21],0,"month"); |
||
237 | |||
238 | //Temps moyen d'intervention r�l
|
||
239 | $entrees_avgtime=constructEntryValues("inter_avgrealtime",$_POST["date1"],$_POST["date2"],$_GET["type"],$val1,$val2); |
||
240 | if (count($entrees_avgtime)>0) |
||
241 | graphBy($entrees_avgtime,$LANG["stats"][25],$LANG["stats"][33],0,"month"); |
||
242 | |||
243 | //Temps moyen de prise en compte de l'intervention
|
||
244 | $entrees_avgtime=constructEntryValues("inter_avgtakeaccount",$_POST["date1"],$_POST["date2"],$_GET["type"],$val1,$val2); |
||
245 | if (count($entrees_avgtime)>0) |
||
246 | graphBy($entrees_avgtime,$LANG["stats"][30],$LANG["job"][21],0,"month"); |
||
247 | |||
248 | commonFooter(); |
||
249 | |||
250 | ?> |