[ PHPXref.com ] [ Generated: Sun Jul 20 17:59:13 2008 ] [ GLPI 0.65 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/stats/ -> graph_item.php (source)

   1  <?php
   2  /*
   3   * @version $Id: graph_item.php,v 1.14 2006/02/24 05:15:47 moyo Exp $
   4   ----------------------------------------------------------------------
   5   GLPI - Gestionnaire Libre de Parc Informatique
   6   Copyright (C) 2003-2006 by the INDEPNET Development Team.
   7   
   8   http://indepnet.net/   http://glpi.indepnet.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  include  ("_relpos.php");
  37  include  ($phproot . "/glpi/includes.php");
  38  include  ($phproot . "/glpi/includes_tracking.php");
  39  include  ($phproot . "/glpi/includes_enterprises.php");
  40  include  ($phproot . "/glpi/includes_users.php");
  41  include  ($phproot . "/glpi/includes_devices.php");
  42  require  ("functions.php");
  43  
  44  
  45  checkAuthentication("normal");
  46  commonHeader($lang["title"][11],$_SERVER["PHP_SELF"]);
  47  
  48  if(empty($_POST["date1"])&&empty($_POST["date2"])) {
  49  $year=date("Y")-2;
  50  $_POST["date1"]=date("Y-m-d",mktime(1,0,0,date("m"),date("d"),$year));
  51  
  52  $_POST["date2"]=date("Y-m-d");
  53  }
  54  
  55  if(empty($_POST["date1"])) $_POST["date1"] = "";
  56  if(empty($_POST["date2"])) $_POST["date2"] = "";
  57  if ($_POST["date1"]!=""&&$_POST["date2"]!=""&&strcmp($_POST["date2"],$_POST["date1"])<0){
  58  $tmp=$_POST["date1"];
  59  $_POST["date1"]=$_POST["date2"];
  60  $_POST["date2"]=$tmp;
  61  }
  62  
  63  
  64  $cleantarget=preg_replace("/[&]*ID=([0-9]+[&]{0,1})/","",$_SERVER['QUERY_STRING']);
  65  $cleantarget=preg_replace("/&/","&amp;",$cleantarget);
  66  
  67  $job=new Job();
  68  switch($_GET["type"]){
  69  case "technicien":
  70      $val1=$_GET["ID"];
  71      $val2="";
  72  
  73      $next=getNextItem("glpi_users",$_GET["ID"]);
  74      $prev=getPreviousItem("glpi_users",$_GET["ID"]);
  75  
  76      echo "<div align='center'>";
  77      echo "<table class='icon_nav'>";
  78      echo "<tr>";
  79      echo "<td >";
  80      if ($prev>0) echo "<a href='".$_SERVER['PHP_SELF']."?$cleantarget&amp;ID=$prev'><img src=\"".$HTMLRel."pics/left.png\" alt='".$lang["buttons"][12]."' title='".$lang["buttons"][12]."'></a>";
  81      echo "</td>";
  82      echo "<td style='text-align=center; padding:0px 30px 0px 30px;'><b>".$lang["stats"][16].": ".getAssignName($_GET["ID"],USER_TYPE,1)."</b></td>";
  83      echo "<td  >";
  84      if ($next>0) echo "<a href='".$_SERVER['PHP_SELF']."?$cleantarget&amp;ID=$next'><img src=\"".$HTMLRel."pics/right.png\" alt='".$lang["buttons"][11]."' title='".$lang["buttons"][11]."'></a>";
  85      echo "</td>";
  86      echo "</tr>";
  87      echo "</table></div><br>";
  88      break;
  89  case "enterprise":
  90      $val1=$_GET["ID"];
  91      $val2="";
  92  
  93      $next=getNextItem("glpi_enterprises",$_GET["ID"]);
  94      $prev=getPreviousItem("glpi_enterprises",$_GET["ID"]);
  95  
  96      echo "<div align='center'>";
  97      echo "<table class='icon_nav'>";
  98      echo "<tr>";
  99      echo "<td >";
 100      if ($prev>0) echo "<a href='".$_SERVER['PHP_SELF']."?$cleantarget&amp;ID=$prev'><img src=\"".$HTMLRel."pics/left.png\" alt='".$lang["buttons"][12]."' title='".$lang["buttons"][12]."'></a>";
 101      echo "</td>";
 102      echo "<td style='text-align=center; padding:0px 30px 0px 30px;'><b>".$lang["stats"][44].": ".getAssignName($_GET["ID"],ENTERPRISE_TYPE,1)."</b></td>";
 103      echo "<td  >";
 104      if ($next>0) echo "<a href='".$_SERVER['PHP_SELF']."?$cleantarget&amp;ID=$next'><img src=\"".$HTMLRel."pics/right.png\" alt='".$lang["buttons"][11]."' title='".$lang["buttons"][11]."'></a>";
 105      echo "</td>";
 106      echo "</tr>";
 107      echo "</table></div><br>";
 108      break;
 109  case "user":
 110      $val1=$_GET["ID"];
 111      $val2="";
 112      $job->fields["author"]=$_GET["ID"];
 113  
 114      $next=getNextItem("glpi_users",$_GET["ID"]);
 115      $prev=getPreviousItem("glpi_users",$_GET["ID"]);
 116  
 117      echo "<div align='center'>";
 118      echo "<table class='icon_nav'>";
 119      echo "<tr>";
 120      echo "<td>";
 121      if ($prev>0) echo "<a href='".$_SERVER['PHP_SELF']."?$cleantarget&amp;ID=$prev'><img src=\"".$HTMLRel."pics/left.png\" alt='".$lang["buttons"][12]."' title='".$lang["buttons"][12]."'></a>";
 122      echo "</td>";
 123      echo "<td width='400' align='center'><b>".$lang["stats"][20].": ".$job->getAuthorName(1)."</b></td>";
 124      echo "<td>";
 125      if ($next>0) echo "<a href='".$_SERVER['PHP_SELF']."?$cleantarget&amp;ID=$next'><img src=\"".$HTMLRel."pics/right.png\" alt='".$lang["buttons"][11]."' title='".$lang["buttons"][11]."'></a>";
 126      echo "</td>";
 127      echo "</tr>";
 128      echo "</table></div><br>";
 129  
 130      break;    
 131  case "category":
 132      $val1=$_GET["ID"];
 133      $val2="";
 134  
 135      $next=getNextItem("glpi_dropdown_tracking_category",$_GET["ID"]);
 136      $prev=getPreviousItem("glpi_dropdown_tracking_category",$_GET["ID"]);
 137      
 138      echo "<div align='center'>";
 139      echo "<table class='icon_nav'>";
 140      echo "<tr>";
 141      echo "<td>";
 142      if ($prev>0) echo "<a href='".$_SERVER['PHP_SELF']."?$cleantarget&amp;ID=$prev'><img src=\"".$HTMLRel."pics/left.png\" alt='".$lang["buttons"][12]."' title='".$lang["buttons"][12]."'></a>";
 143      echo "</td>";
 144      echo "<td width='400' align='center'><b>".$lang["stats"][41].": ".getDropdownName("glpi_dropdown_tracking_category",$_GET["ID"])."</b></td>";
 145      echo "<td>";
 146      if ($next>0) echo "<a href='".$_SERVER['PHP_SELF']."?$cleantarget&amp;ID=$next'><img src=\"".$HTMLRel."pics/right.png\" alt='".$lang["buttons"][11]."' title='".$lang["buttons"][11]."'></a>";
 147      echo "</td>";
 148      echo "</tr>";
 149      echo "</table></div><br>";
 150  
 151      break;    
 152  case "priority":
 153      $val1=$_GET["ID"];
 154      $val2="";
 155      $next=$prev=0;
 156      if ($val1<5) $next=$val1+1;
 157      if ($val1>1) $prev=$val1-1;
 158  
 159      echo "<div align='center'>";
 160      echo "<table class='icon_nav'>";
 161      echo "<tr>";
 162      echo "<td>";
 163      if ($prev>0) echo "<a href='".$_SERVER['PHP_SELF']."?$cleantarget&amp;ID=$prev'><img src=\"".$HTMLRel."pics/left.png\" alt='".$lang["buttons"][12]."' title='".$lang["buttons"][12]."'></a>";
 164      echo "</td>";
 165      echo "<td width='400' align='center'><b>".$lang["stats"][41].": ".getPriorityName($_GET["ID"])."</b></td>";
 166      echo "<td>";
 167      if ($next>0) echo "<a href='".$_SERVER['PHP_SELF']."?$cleantarget&amp;ID=$next'><img src=\"".$HTMLRel."pics/right.png\" alt='".$lang["buttons"][11]."' title='".$lang["buttons"][11]."'></a>";
 168      echo "</td>";
 169      echo "</tr>";
 170      echo "</table></div><br>";
 171  
 172      break;    
 173  case "device":
 174      $val1=$_GET["ID"];
 175      $val2=$_GET["device"];
 176  
 177      $device_table = getDeviceTable($_GET["device"]);
 178  
 179      $next=getNextItem($device_table,$_GET["ID"]);
 180      $prev=getPreviousItem($device_table,$_GET["ID"]);
 181      
 182      $query = "select  designation from ".$device_table." WHERE ID='".$_GET['ID']."'";
 183      $result=$db->query($query);
 184      
 185      echo "<div align='center'>";
 186      echo "<table class='icon_nav'>";
 187      echo "<tr>";
 188      echo "<td>";
 189      if ($prev>0) echo "<a href='".$_SERVER['PHP_SELF']."?$cleantarget&amp;ID=$prev'><img src=\"".$HTMLRel."pics/left.png\" alt='".$lang["buttons"][12]."' title='".$lang["buttons"][12]."'></a>";
 190      echo "</td>";
 191      echo "<td width='400' align='center'><b>".$lang["stats"][19].": ".$db->result($result,0,"designation")."</b></td>";
 192      echo "<td>";
 193      if ($next>0) echo "<a href='".$_SERVER['PHP_SELF']."?$cleantarget&amp;ID=$next'><img src=\"".$HTMLRel."pics/right.png\" alt='".$lang["buttons"][11]."' title='".$lang["buttons"][11]."'></a>";
 194      echo "</td>";
 195      echo "</tr>";
 196      echo "</table></div><br>";
 197  
 198      break;
 199  case "comp_champ":
 200      $val1=$_GET["ID"];
 201      $val2=$_GET["champ"];
 202  
 203      $table=str_replace("dropdown_type","type_computers",str_replace("location","locations","glpi_dropdown_".$_GET["champ"]));
 204  
 205  
 206      $next=getNextItem($table,$_GET["ID"]);
 207      $prev=getPreviousItem($table,$_GET["ID"]);
 208      
 209      echo "<div align='center'>";
 210      echo "<table class='icon_nav'>";
 211      echo "<tr>";
 212      echo "<td>";
 213      if ($prev>0) echo "<a href='".$_SERVER['PHP_SELF']."?$cleantarget&amp;ID=$prev'><img src=\"".$HTMLRel."pics/left.png\" alt='".$lang["buttons"][12]."' title='".$lang["buttons"][12]."'></a>";
 214      echo "</td>";
 215  
 216      echo "<td width='400' align='center'><b>".$lang["stats"][26].": ".getDropdownName($table,$_GET["ID"])."</b></td>";
 217      echo "<td>";
 218      if ($next>0) echo "<a href='".$_SERVER['PHP_SELF']."?$cleantarget&amp;ID=$next'><img src=\"".$HTMLRel."pics/right.png\" alt='".$lang["buttons"][11]."' title='".$lang["buttons"][11]."'></a>";
 219      echo "</td>";
 220  
 221      echo "</tr>";
 222      echo "</table></div><br>";
 223  
 224      break;
 225  
 226  }
 227  $target=preg_replace("/&/","&amp;",$_SERVER["REQUEST_URI"]);
 228  
 229  echo "<div align='center'><form method=\"post\" name=\"form\" action=\"".$target."\">";
 230  echo "<table class='tab_cadre'><tr class='tab_bg_2'><td align='right'>";
 231  echo $lang["search"][8]." :</td><td>";
 232  showCalendarForm("form","date1",$_POST["date1"]);
 233  echo "</td><td rowspan='2' align='center'><input type=\"submit\" class='button' name=\"submit\" value=\"". $lang["buttons"][7] ."\" /></td></tr>";
 234  echo "<tr class='tab_bg_2'><td align='right'>".$lang["search"][9]." :</td><td>";
 235  showCalendarForm("form","date2",$_POST["date2"]);
 236  echo "</td></tr>";
 237  echo "</table></form></div>";
 238  
 239  
 240  
 241  ///////// Stats nombre intervention
 242  // Total des interventions
 243  $entrees_total=constructEntryValues("inter_total",$_POST["date1"],$_POST["date2"],$_GET["type"],$val1,$val2);
 244      if (count($entrees_total)>0)
 245  graphBy($entrees_total,$lang["stats"][5],$lang["stats"][35],1,"month");
 246  
 247  // Total des interventions résolues
 248  $entrees_solved=constructEntryValues("inter_solved",$_POST["date1"],$_POST["date2"],$_GET["type"],$val1,$val2);
 249      if (count($entrees_solved)>0)
 250  graphBy($entrees_solved,$lang["stats"][11],$lang["stats"][35],1,"month");
 251  
 252  //Temps moyen de resolution d'intervention
 253  $entrees_avgtime=constructEntryValues("inter_avgsolvedtime",$_POST["date1"],$_POST["date2"],$_GET["type"],$val1,$val2);
 254      if (count($entrees_avgtime)>0)
 255  graphBy($entrees_avgtime,$lang["stats"][6],$lang["stats"][32],0,"month");
 256  
 257  //Temps moyen d'intervention réel
 258  $entrees_avgtime=constructEntryValues("inter_avgrealtime",$_POST["date1"],$_POST["date2"],$_GET["type"],$val1,$val2);
 259      if (count($entrees_avgtime)>0)
 260  graphBy($entrees_avgtime,$lang["stats"][25],$lang["stats"][33],0,"month");
 261  
 262  //Temps moyen de prise en compte de l'intervention
 263  $entrees_avgtime=constructEntryValues("inter_avgtakeaccount",$_POST["date1"],$_POST["date2"],$_GET["type"],$val1,$val2);
 264      if (count($entrees_avgtime)>0)
 265  graphBy($entrees_avgtime,$lang["stats"][30],$lang["stats"][32],0,"month");
 266  
 267  commonFooter();
 268  
 269  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]