Projet

Général

Profil

Paste
Statistiques
| Branche: | Révision:

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

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

1
<?php
2
/*
3
 * @version $Id: phone.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("phone","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

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

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

    
49
$phone=new Phone();
50

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

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

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

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

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

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

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

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

    
120
        checkRight("phone","w");
121

    
122
        Connect($_POST["sID"],$_POST["item"],PHONE_TYPE);
123
        logEvent($_POST["sID"], "phones", 4, "inventory", $_SESSION["glpiname"]." ".$LANG["log"][26]);
124
        glpi_header($CFG_GLPI["root_doc"]."/front/phone.form.php?ID=".$_POST["sID"]);
125

    
126

    
127
}
128
else
129
{
130
        checkRight("phone","r");
131

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

    
138

    
139
        commonHeader($LANG["help"][35],$_SERVER['PHP_SELF'],"inventory","phone");
140

    
141
        if (!empty($_GET["withtemplate"])) {
142

    
143
                if ($phone->showForm($_SERVER['PHP_SELF'],$_GET["ID"], $_GET["withtemplate"])){
144
                        if ($_GET["ID"]>0){
145

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

    
155
                                        default :
156
                                                if (!displayPluginAction(PHONE_TYPE,$_GET["ID"],$_SESSION['glpi_onglet'],$_GET["withtemplate"])){
157
                                                        if ($_GET["withtemplate"]!=2)        {
158
                                                                showPortsAdd($_GET["ID"],PHONE_TYPE);
159
                                                        }
160
                                                        showPorts($_GET["ID"], PHONE_TYPE,$_GET["withtemplate"]);
161
                                                }
162

    
163
                                                break;
164
                                }
165
                        }
166
                }
167

    
168
        } else {
169

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

    
216

    
217

    
218

    
219

    
220
                }
221
        }
222
        commonFooter();
223
}
224

    
225

    
226
?>
Redmine Appliance - Powered by TurnKey Linux