Projet

Général

Profil

Paste
Statistiques
| Branche: | Révision:

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

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

1
<?php
2
/*
3
 * @version $Id: peripheral.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("peripheral","infocom","contract","user","group","link","networking","document","tracking","reservation","computer","enterprise","ocsng");
38

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

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

    
46
if(!isset($_GET["withtemplate"])) $_GET["withtemplate"] = "";
47

    
48
$peripheral=new Peripheral();
49

    
50
if (isset($_POST["add"]))
51
{
52
        checkRight("peripheral","w");
53

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

    
62
        if (!empty($_POST["withtemplate"]))
63
                $peripheral->delete($_POST,1);
64
        else $peripheral->delete($_POST);
65

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

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

    
84
        if (isset($_POST["purge"]))
85
                $input["ID"]=$_POST["ID"];
86
        else
87
                $input["ID"] = $_GET["ID"];        
88

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

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

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

    
119
        checkRight("peripheral","w");
120

    
121
        Connect($_POST["sID"],$_POST["item"],PERIPHERAL_TYPE);
122
        logEvent($_POST["sID"], "peripherals", 4, "inventory", $_SESSION["glpiname"]." ".$LANG["log"][26]);
123
        glpi_header($CFG_GLPI["root_doc"]."/front/peripheral.form.php?ID=".$_POST["sID"]);
124
}
125
else
126
{
127
        checkRight("peripheral","r");
128

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

    
135

    
136
        commonHeader($LANG["Menu"][16],$_SERVER['PHP_SELF'],"inventory","peripheral");
137

    
138
        if (!empty($_GET["withtemplate"])) {
139

    
140
                if ($peripheral->showForm($_SERVER['PHP_SELF'],$_GET["ID"], $_GET["withtemplate"])){
141
                        if ($_GET["ID"]>0){
142

    
143
                                switch($_SESSION['glpi_onglet']){
144
                                        case 4 :
145
                                                showInfocomForm($CFG_GLPI["root_doc"]."/front/infocom.form.php",PERIPHERAL_TYPE,$_GET["ID"],1,$_GET["withtemplate"]);
146
                                                showContractAssociated(PERIPHERAL_TYPE,$_GET["ID"],$_GET["withtemplate"]);
147
                                                break;
148
                                        case 5 :
149
                                                showDocumentAssociated(PERIPHERAL_TYPE,$_GET["ID"],$_GET["withtemplate"]);
150
                                                break;
151

    
152
                                        default :
153
                                                if (!displayPluginAction(PERIPHERAL_TYPE,$_GET["ID"],$_SESSION['glpi_onglet'],$_GET["withtemplate"])){
154
                                                        if ($_GET["withtemplate"]!=2)        showPortsAdd($_GET["ID"],PERIPHERAL_TYPE);
155
                                                        showPorts($_GET["ID"], PERIPHERAL_TYPE,$_GET["withtemplate"]);
156
                                                }
157

    
158
                                                break;
159
                                }
160
                        }
161
                }
162

    
163
        } else {
164

    
165
                if ($peripheral->showForm($_SERVER['PHP_SELF'],$_GET["ID"])){
166
                        switch($_SESSION['glpi_onglet']){
167
                                case -1:
168
                                        showConnect($_SERVER['PHP_SELF'],$_GET["ID"],PERIPHERAL_TYPE);
169
                                        showPortsAdd($_GET["ID"],PERIPHERAL_TYPE);
170
                                        showPorts($_GET["ID"], PERIPHERAL_TYPE,$_GET["withtemplate"]);
171
                                        showInfocomForm($CFG_GLPI["root_doc"]."/front/infocom.form.php",PERIPHERAL_TYPE,$_GET["ID"]);
172
                                        showContractAssociated(PERIPHERAL_TYPE,$_GET["ID"]);
173
                                        showDocumentAssociated(PERIPHERAL_TYPE,$_GET["ID"]);
174
                                        showJobListForItem($_SESSION["glpiname"],PERIPHERAL_TYPE,$_GET["ID"],$_GET["sort"],$_GET["order"]);
175
                                        showOldJobListForItem($_SESSION["glpiname"],PERIPHERAL_TYPE,$_GET["ID"],$_GET["sort"],$_GET["order"]);
176
                                        showLinkOnDevice(PERIPHERAL_TYPE,$_GET["ID"]);
177
                                        displayPluginAction(PERIPHERAL_TYPE,$_GET["ID"],$_SESSION['glpi_onglet'],$_GET["withtemplate"]);
178
                                        break;
179
                                case 4 :
180
                                        showInfocomForm($CFG_GLPI["root_doc"]."/front/infocom.form.php",PERIPHERAL_TYPE,$_GET["ID"]);
181
                                        showContractAssociated(PERIPHERAL_TYPE,$_GET["ID"]);
182
                                        break;
183
                                case 5 :
184
                                        showDocumentAssociated(PERIPHERAL_TYPE,$_GET["ID"]);
185
                                        break;
186
                                case 6 :
187
                                        showJobListForItem($_SESSION["glpiname"],PERIPHERAL_TYPE,$_GET["ID"],$_GET["sort"],$_GET["order"]);
188
                                        showOldJobListForItem($_SESSION["glpiname"],PERIPHERAL_TYPE,$_GET["ID"],$_GET["sort"],$_GET["order"]);
189
                                        break;
190
                                case 7 :
191
                                        showLinkOnDevice(PERIPHERAL_TYPE,$_GET["ID"]);
192
                                        break;        
193
                                case 10 :
194
                                        showNotesForm($_SERVER['PHP_SELF'],PERIPHERAL_TYPE,$_GET["ID"]);
195
                                        break;        
196
                                case 11 :
197
                                        showDeviceReservations($_SERVER['PHP_SELF'],PERIPHERAL_TYPE,$_GET["ID"]);
198
                                        break;
199
                                case 12 :
200
                                        showHistory(PERIPHERAL_TYPE,$_GET["ID"]);
201
                                        break;                
202
                                default :
203
                                        if (!displayPluginAction(PERIPHERAL_TYPE,$_GET["ID"],$_SESSION['glpi_onglet'],$_GET["withtemplate"])){
204
                                                showConnect($_SERVER['PHP_SELF'],$_GET["ID"],PERIPHERAL_TYPE);
205
                                                showPortsAdd($_GET["ID"],PERIPHERAL_TYPE);
206
                                                showPorts($_GET["ID"], PERIPHERAL_TYPE,$_GET["withtemplate"]);
207
                                        }
208
                                        break;
209
                        }
210
                }
211
        }
212
        commonFooter();
213
}
214

    
215

    
216
?>
Redmine Appliance - Powered by TurnKey Linux