Projet

Général

Profil

Paste
Statistiques
| Branche: | Révision:

ryxeo-glpi-git / htdocs / front / stat.location.php @ 1c14bcc4

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

1
<?php
2
/*
3
 * @version $Id: stat.location.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
$NEEDED_ITEMS=array("stat","tracking","user","setup","device");
39

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

    
43
commonHeader($LANG["Menu"][13],$_SERVER['PHP_SELF'],"maintain","stat");
44

    
45
checkRight("statistic","1");
46

    
47
echo "<div align='center'><p><b><span class='icon_consol'>".$LANG["Menu"][13]."</span></b></p>";
48

    
49
if (isset($_GET["date1"])) $_POST["date1"] = $_GET["date1"];
50
if (isset($_GET["date2"])) $_POST["date2"] = $_GET["date2"];
51

    
52
if(empty($_POST["date1"])&&empty($_POST["date2"])) {
53
        $year=date("Y")-1;
54
        $_POST["date1"]=date("Y-m-d",mktime(1,0,0,date("m"),date("d"),$year));
55

    
56
        $_POST["date2"]=date("Y-m-d");
57
}
58

    
59
if ($_POST["date1"]!=""&&$_POST["date2"]!=""&&strcmp($_POST["date2"],$_POST["date1"])<0){
60
        $tmp=$_POST["date1"];
61
        $_POST["date1"]=$_POST["date2"];
62
        $_POST["date2"]=$tmp;
63
}
64

    
65
if(!isset($_GET["start"])) $_GET["start"] = 0;
66

    
67
if (isset($_GET["dropdown"])) $_POST["dropdown"] = $_GET["dropdown"];
68
if(empty($_POST["dropdown"])) $_POST["dropdown"] = "glpi_type_computers";
69

    
70
echo "<form method=\"post\" name=\"form\" action=\"stat.location.php\">";
71

    
72
echo "<table class='tab_cadre'><tr class='tab_bg_2'><td rowspan='2'>";
73
echo "<select name=\"dropdown\">";
74

    
75
echo "<option value=\"glpi_type_computers\" ".($_POST["dropdown"]=="glpi_type_computers"?"selected":"").">".$LANG["common"][17]."</option>";
76
echo "<option value=\"glpi_dropdown_model\" ".($_POST["dropdown"]=="glpi_dropdown_model"?"selected":"").">".$LANG["common"][22]."</option>";
77

    
78
echo "<option value=\"glpi_dropdown_os\" ".($_POST["dropdown"]=="glpi_dropdown_os"?"selected":"").">".$LANG["computers"][9]."</option>";
79
echo "<option value=\"glpi_dropdown_locations\" ".($_POST["dropdown"]=="glpi_dropdown_locations"?"selected":"").">".$LANG["common"][15]."</option>";
80

    
81
$devices=getDictDeviceLabel(-1);
82

    
83
foreach ($devices as $i => $name){
84
        echo "<option value=\"$i\" ".($_POST["dropdown"]==$i?"selected":"").">$name</option>";
85
}
86
echo "</select></td>";
87

    
88

    
89
echo "<td align='right'>";
90
echo $LANG["search"][8]." :</td><td>";
91
showCalendarForm("form","date1",$_POST["date1"]);
92
echo "</td><td rowspan='2' align='center'><input type=\"submit\" class='button' name=\"submit\" Value=\"". $LANG["buttons"][7] ."\" /></td></tr>";
93
echo "<tr class='tab_bg_2'><td align='right'>".$LANG["search"][9]." :</td><td>";
94
showCalendarForm("form","date2",$_POST["date2"]);
95
echo "</td></tr>";
96
echo "</table></form></div>";
97

    
98
echo "<div align ='center'>";
99

    
100
if(is_dropdown_stat($_POST["dropdown"])) {
101

    
102
        $type="comp_champ";
103
        $field=getDropdownNameFromTableForStats($_POST["dropdown"]);
104

    
105
        $val=getStatsItems($_POST["date1"],$_POST["date2"],$_POST["dropdown"]);
106
        $params=array("type"=>$type,"field"=>$field,"table"=>$_POST["dropdown"],"date1"=>$_POST["date1"],"date2"=>$_POST["date2"],"start"=>$_GET["start"]);
107
        printPager($_GET['start'],count($val),$_SERVER['PHP_SELF'],"date1=".$_POST["date1"]."&amp;date2=".$_POST["date2"]."&amp;dropdown=".$_POST["dropdown"],STAT_TYPE,$params);
108

    
109
        displayStats($type,$field,$_POST["date1"],$_POST["date2"],$_GET['start'],$val,$field);
110

    
111

    
112
} else {
113

    
114
        $type="device";
115
        $field=$_POST["dropdown"];
116

    
117
        $val=getStatsItems($_POST["date1"],$_POST["date2"],$_POST["dropdown"]);
118
        $params=array("type"=>$type,"field"=>$field,"date1"=>$_POST["date1"],"date2"=>$_POST["date2"],"start"=>$_GET["start"]);
119
        printPager($_GET['start'],count($val),$_SERVER['PHP_SELF'],"date1=".$_POST["date1"]."&amp;date2=".$_POST["date2"]."&amp;dropdown=".$_POST["dropdown"],STAT_TYPE,$params);
120

    
121
        displayStats($type,$field,$_POST["date1"],$_POST["date2"],$_GET['start'],$val,$field);
122
}
123

    
124

    
125
echo "</div>"; 
126

    
127

    
128
commonFooter();
129
?>
Redmine Appliance - Powered by TurnKey Linux