Projet

Général

Profil

Paste
Statistiques
| Branche: | Révision:

ryxeo-glpi-git / front / monitor.form.php @ b67d8923

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

1
<?php
2
/*
3
 * @version $Id: monitor.form.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
$NEEDED_ITEMS=array("monitor","computer","reservation","tracking","infocom","contract","document","user","group","link","enterprise","ocsng");
38
define('GLPI_ROOT', '..');
39
include (GLPI_ROOT . "/inc/includes.php");
40

    
41
if(empty($_GET["ID"])) $_GET["ID"] = "";
42
if(!isset($_GET["sort"])) $_GET["sort"] = "";
43
if(!isset($_GET["order"])) $_GET["order"] = "";
44
if(!isset($_GET["withtemplate"])) $_GET["withtemplate"] = "";
45

    
46
$monitor=new Monitor();
47
if (isset($_POST["add"]))
48
{
49
        checkRight("monitor","w");
50

    
51
        $newID=$monitor->add($_POST);
52
        logEvent($newID, "monitors", 4, "inventory", $_SESSION["glpiname"]." ".$LANG["log"][20]." ".$_POST["name"].".");
53
        glpi_header($_SERVER['HTTP_REFERER']);
54
}
55
else if (isset($_POST["delete"]))
56
{
57
        checkRight("monitor","w");
58

    
59
        if (!empty($_POST["withtemplate"]))
60
                $monitor->delete($_POST,1);
61
        else $monitor->delete($_POST);
62

    
63
        logEvent($_POST["ID"], "monitors", 4, "inventory", $_SESSION["glpiname"]." ".$LANG["log"][22]);
64
        if(!empty($_POST["withtemplate"])) 
65
                glpi_header($CFG_GLPI["root_doc"]."/front/setup.templates.php");
66
        else 
67
                glpi_header($CFG_GLPI["root_doc"]."/front/monitor.php");
68
}
69
else if (isset($_POST["restore"]))
70
{
71
        checkRight("monitor","w");
72

    
73
        $monitor->restore($_POST);
74
        logEvent($_POST["ID"], "monitors", 4, "inventory", $_SESSION["glpiname"]." ".$LANG["log"][23]);
75
        glpi_header($CFG_GLPI["root_doc"]."/front/monitor.php");
76
}
77
else if (isset($_POST["purge"]) || isset($_GET["purge"]))
78
{
79
        checkRight("monitor","w");
80
                
81
        if (isset($_POST["purge"]))
82
                $input["ID"]=$_POST["ID"];
83
        else
84
                $input["ID"] = $_GET["ID"];        
85

    
86
        $monitor->delete($input,1);
87
        logEvent($input["ID"], "monitors", 4, "inventory", $_SESSION["glpiname"]." ".$LANG["log"][24]);
88
        glpi_header($CFG_GLPI["root_doc"]."/front/monitor.php");
89
}
90
else if (isset($_POST["update"]))
91
{
92
        checkRight("monitor","w");
93

    
94
        $monitor->update($_POST);
95
        logEvent($_POST["ID"], "monitors", 4, "inventory", $_SESSION["glpiname"]." ".$LANG["log"][21]);
96
        glpi_header($_SERVER['HTTP_REFERER']);
97
}
98
else if (isset($_GET["unglobalize"]))
99
{
100
        checkRight("monitor","w");
101

    
102
        unglobalizeDevice(MONITOR_TYPE,$_GET["ID"]);
103
        logEvent($_GET["ID"], "monitors", 4, "inventory", $_SESSION["glpiname"]." ".$LANG["log"][60]);
104
        glpi_header($CFG_GLPI["root_doc"]."/front/monitor.form.php?ID=".$_GET["ID"]);
105
}
106
else if (isset($_GET["disconnect"]))
107
{
108
        checkRight("monitor","w");
109
        Disconnect($_GET["ID"]);
110
        logEvent(0, "monitors", 5, "inventory", $_SESSION["glpiname"]." ".$LANG["log"][26]);
111
        glpi_header($_SERVER['HTTP_REFERER']);
112
}
113
else if(isset($_POST["connect"])&&isset($_POST["item"])&&$_POST["item"]>0)
114
{
115
        checkRight("monitor","w");
116

    
117
        Connect($_POST["sID"],$_POST["item"],MONITOR_TYPE);
118
        logEvent($_POST["sID"], "monitors", 4, "inventory", $_SESSION["glpiname"]." ".$LANG["log"][27]);
119
        glpi_header($CFG_GLPI["root_doc"]."/front/monitor.form.php?ID=".$_POST["sID"]);
120

    
121
}
122
else
123
{
124
        checkRight("monitor","r");
125

    
126
        if (!isset($_SESSION['glpi_onglet'])) $_SESSION['glpi_onglet']=1;
127
        if (isset($_GET['onglet'])) {
128
                $_SESSION['glpi_onglet']=$_GET['onglet'];
129
                //                glpi_header($_SERVER['HTTP_REFERER']);
130
        }
131

    
132
        commonHeader($LANG["Menu"][3],$_SERVER['PHP_SELF'],"inventory","monitor");
133

    
134
        if (!empty($_GET["withtemplate"])) {
135

    
136
                if ($monitor->showForm($_SERVER['PHP_SELF'],$_GET["ID"], $_GET["withtemplate"])){
137
                        if ($_GET["ID"]>0){
138
                                switch($_SESSION['glpi_onglet']){
139
                                        case 4 :
140
                                                showInfocomForm($CFG_GLPI["root_doc"]."/front/infocom.form.php",MONITOR_TYPE,$_GET["ID"],1,$_GET["withtemplate"]);
141
                                                showContractAssociated(MONITOR_TYPE,$_GET["ID"],$_GET["withtemplate"]);
142
                                                break;
143
                                        case 5 :                        
144
                                                showDocumentAssociated(MONITOR_TYPE,$_GET["ID"],$_GET["withtemplate"]);
145
                                                break;
146
                                        default :
147
                                                displayPluginAction(MONITOR_TYPE,$_GET["ID"],$_SESSION['glpi_onglet'],$_GET["withtemplate"]);
148
                                                break;
149
                                }
150
                        }
151
                }
152

    
153
        } else {
154

    
155
                if ($monitor->showForm($_SERVER['PHP_SELF'],$_GET["ID"])){
156
                        switch($_SESSION['glpi_onglet']){
157
                                case -1:
158
                                        showConnect($_SERVER['PHP_SELF'],$_GET['ID'],MONITOR_TYPE);
159
                                        showInfocomForm($CFG_GLPI["root_doc"]."/front/infocom.form.php",MONITOR_TYPE,$_GET["ID"]);
160
                                        showContractAssociated(MONITOR_TYPE,$_GET["ID"]);                        
161
                                        showDocumentAssociated(MONITOR_TYPE,$_GET["ID"]);        
162
                                        showJobListForItem($_SESSION["glpiname"],MONITOR_TYPE,$_GET["ID"],$_GET["sort"],$_GET["order"]);
163
                                        showOldJobListForItem($_SESSION["glpiname"],MONITOR_TYPE,$_GET["ID"],$_GET["sort"],$_GET["order"]);        
164
                                        showLinkOnDevice(MONITOR_TYPE,$_GET["ID"]);
165
                                        displayPluginAction(MONITOR_TYPE,$_GET["ID"],$_SESSION['glpi_onglet'],$_GET["withtemplate"]);
166
                                        break;
167
                                case 4 :                        
168
                                        showInfocomForm($CFG_GLPI["root_doc"]."/front/infocom.form.php",MONITOR_TYPE,$_GET["ID"]);
169
                                        showContractAssociated(MONITOR_TYPE,$_GET["ID"]);                        
170
                                        break;
171
                                case 5 :                        
172
                                        showDocumentAssociated(MONITOR_TYPE,$_GET["ID"]);        
173
                                        break;
174
                                case 6 :                        
175
                                        showJobListForItem($_SESSION["glpiname"],MONITOR_TYPE,$_GET["ID"],$_GET["sort"],$_GET["order"]);
176
                                        showOldJobListForItem($_SESSION["glpiname"],MONITOR_TYPE,$_GET["ID"],$_GET["sort"],$_GET["order"]);        
177
                                        break;
178
                                case 7 :
179
                                        showLinkOnDevice(MONITOR_TYPE,$_GET["ID"]);
180
                                        break;        
181
                                case 10 :
182
                                        showNotesForm($_SERVER['PHP_SELF'],MONITOR_TYPE,$_GET["ID"]);
183
                                        break;        
184
                                case 11 :
185
                                        showDeviceReservations($_SERVER['PHP_SELF'],MONITOR_TYPE,$_GET["ID"]);
186
                                        break;
187
                                case 12 :
188
                                        showHistory(MONITOR_TYPE,$_GET["ID"]);
189
                                        break;        
190
                                default :
191
                                        if (!displayPluginAction(MONITOR_TYPE,$_GET["ID"],$_SESSION['glpi_onglet'],$_GET["withtemplate"]))
192
                                                showConnect($_SERVER['PHP_SELF'],$_GET['ID'],MONITOR_TYPE);
193
                                        break;        
194
                        }
195
                }
196
        }
197
        commonFooter();
198
}
199

    
200

    
201
?>
Redmine Appliance - Powered by TurnKey Linux