ryxeo-glpi-git / front / printer.form.php @ b67d8923
Historique | Voir | Annoter | Télécharger (7,4 ko)
1 |
<?php
|
---|---|
2 |
/*
|
3 |
* @version $Id: printer.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 |
|
38 |
$NEEDED_ITEMS=array("printer","computer","networking","reservation","tracking","cartridge","contract","infocom","document","user","group","link","enterprise","ocsng"); |
39 |
|
40 |
define('GLPI_ROOT', '..'); |
41 |
include (GLPI_ROOT . "/inc/includes.php"); |
42 |
|
43 |
|
44 |
if(!isset($_GET["ID"])) $_GET["ID"] = ""; |
45 |
if(!isset($_GET["sort"])) $_GET["sort"] = ""; |
46 |
if(!isset($_GET["order"])) $_GET["order"] = ""; |
47 |
|
48 |
if(!isset($_GET["withtemplate"])) $_GET["withtemplate"] = ""; |
49 |
|
50 |
$print=new Printer(); |
51 |
if (isset($_POST["add"])) |
52 |
{ |
53 |
checkRight("printer","w"); |
54 |
|
55 |
$newID=$print->add($_POST); |
56 |
logEvent($newID, "printers", 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("printer","w"); |
62 |
|
63 |
if (!empty($_POST["withtemplate"])) |
64 |
$print->delete($_POST,1); |
65 |
else $print->delete($_POST); |
66 |
logEvent($_POST["ID"], "printers", 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/printer.php"); |
71 |
} |
72 |
else if (isset($_POST["restore"])) |
73 |
{ |
74 |
checkRight("printer","w"); |
75 |
$print->restore($_POST); |
76 |
logEvent($_POST["ID"], "printers", 4, "inventory", $_SESSION["glpiname"]." ".$LANG["log"][23]); |
77 |
glpi_header($CFG_GLPI["root_doc"]."/front/printer.php"); |
78 |
} |
79 |
else if (isset($_POST["purge"]) || isset($_GET["purge"])) |
80 |
{ |
81 |
checkRight("printer","w"); |
82 |
|
83 |
if (isset($_POST["purge"])) |
84 |
$input["ID"]=$_POST["ID"]; |
85 |
else
|
86 |
$input["ID"] = $_GET["ID"]; |
87 |
|
88 |
$print->delete($input,1); |
89 |
logEvent($input["ID"], "printers", 4, "inventory", $_SESSION["glpiname"]." ".$LANG["log"][24]); |
90 |
glpi_header($CFG_GLPI["root_doc"]."/front/printer.php"); |
91 |
} |
92 |
else if (isset($_POST["update"])) |
93 |
{ |
94 |
checkRight("printer","w"); |
95 |
|
96 |
$print->update($_POST); |
97 |
logEvent($_POST["ID"], "printers", 4, "inventory", $_SESSION["glpiname"]." ".$LANG["log"][21]); |
98 |
glpi_header($_SERVER['HTTP_REFERER']); |
99 |
} |
100 |
else if (isset($_GET["unglobalize"])) |
101 |
{ |
102 |
checkRight("printer","w"); |
103 |
|
104 |
unglobalizeDevice(PRINTER_TYPE,$_GET["ID"]); |
105 |
logEvent($_GET["ID"], "printers", 4, "inventory", $_SESSION["glpiname"]." ".$LANG["log"][60]); |
106 |
glpi_header($CFG_GLPI["root_doc"]."/front/printer.form.php?ID=".$_GET["ID"]); |
107 |
} |
108 |
else if (isset($_GET["disconnect"])) |
109 |
{ |
110 |
checkRight("printer","w"); |
111 |
Disconnect($_GET["ID"]); |
112 |
logEvent(0, "printers", 5, "inventory", $_SESSION["glpiname"]." ".$LANG["log"][26]); |
113 |
glpi_header($_SERVER['HTTP_REFERER']); |
114 |
} |
115 |
else if(isset($_POST["connect"])&&isset($_POST["item"])&&$_POST["item"]>0) |
116 |
{ |
117 |
checkRight("printer","w"); |
118 |
Connect($_POST["sID"],$_POST["item"],PRINTER_TYPE); |
119 |
logEvent($_POST["sID"], "printers", 4, "inventory", $_SESSION["glpiname"]." ".$LANG["log"][27]); |
120 |
glpi_header($CFG_GLPI["root_doc"]."/front/printer.form.php?ID=".$_POST["sID"]); |
121 |
} |
122 |
else
|
123 |
{ |
124 |
checkRight("printer","r"); |
125 |
|
126 |
commonHeader($LANG["Menu"][2],$_SERVER['PHP_SELF'],"inventory","printer"); |
127 |
|
128 |
if (!isset($_SESSION['glpi_onglet'])) $_SESSION['glpi_onglet']=1; |
129 |
if (isset($_GET['onglet'])) { |
130 |
$_SESSION['glpi_onglet']=$_GET['onglet']; |
131 |
} |
132 |
|
133 |
if (!empty($_GET["withtemplate"])) { |
134 |
|
135 |
if ($print->showForm($_SERVER['PHP_SELF'],$_GET["ID"], $_GET["withtemplate"])){ |
136 |
|
137 |
if ($_GET["ID"]>0){ |
138 |
switch($_SESSION['glpi_onglet']){ |
139 |
case 3 : |
140 |
if ($_GET["withtemplate"]!=2) showPortsAdd($_GET["ID"],PRINTER_TYPE); |
141 |
showPorts($_GET["ID"], PRINTER_TYPE,$_GET["withtemplate"]); |
142 |
break;
|
143 |
|
144 |
case 4 : |
145 |
showInfocomForm($CFG_GLPI["root_doc"]."/front/infocom.form.php",PRINTER_TYPE,$_GET["ID"],1,$_GET["withtemplate"]); |
146 |
showContractAssociated(PRINTER_TYPE,$_GET["ID"],$_GET["withtemplate"]); |
147 |
break;
|
148 |
case 5 : |
149 |
showDocumentAssociated(PRINTER_TYPE,$_GET["ID"],$_GET["withtemplate"]); |
150 |
break;
|
151 |
default :
|
152 |
displayPluginAction(PRINTER_TYPE,$_GET["ID"],$_SESSION['glpi_onglet'],$_GET["withtemplate"]); |
153 |
break;
|
154 |
} |
155 |
} |
156 |
} |
157 |
|
158 |
} else {
|
159 |
|
160 |
if ($print->showForm($_SERVER['PHP_SELF'],$_GET["ID"], $_GET["withtemplate"])){ |
161 |
|
162 |
switch($_SESSION['glpi_onglet']){ |
163 |
case -1: |
164 |
showCartridgeInstalled($_GET["ID"]); |
165 |
showCartridgeInstalled($_GET["ID"],1); |
166 |
showConnect($_SERVER['PHP_SELF'],$_GET["ID"],PRINTER_TYPE); |
167 |
showPortsAdd($_GET["ID"],PRINTER_TYPE); |
168 |
showPorts($_GET["ID"], PRINTER_TYPE,$_GET["withtemplate"]); |
169 |
showInfocomForm($CFG_GLPI["root_doc"]."/front/infocom.form.php",PRINTER_TYPE,$_GET["ID"]); |
170 |
showContractAssociated(PRINTER_TYPE,$_GET["ID"]); |
171 |
showDocumentAssociated(PRINTER_TYPE,$_GET["ID"]); |
172 |
showJobListForItem($_SESSION["glpiname"],PRINTER_TYPE,$_GET["ID"],$_GET["sort"],$_GET["order"]); |
173 |
showOldJobListForItem($_SESSION["glpiname"],PRINTER_TYPE,$_GET["ID"],$_GET["sort"],$_GET["order"]); |
174 |
showLinkOnDevice(PRINTER_TYPE,$_GET["ID"]); |
175 |
displayPluginAction(PRINTER_TYPE,$_GET["ID"],$_SESSION['glpi_onglet'],$_GET["withtemplate"]); |
176 |
break;
|
177 |
case 3 : |
178 |
showConnect($_SERVER['PHP_SELF'],$_GET["ID"],PRINTER_TYPE); |
179 |
showPortsAdd($_GET["ID"],PRINTER_TYPE); |
180 |
showPorts($_GET["ID"], PRINTER_TYPE,$_GET["withtemplate"]); |
181 |
break;
|
182 |
case 4 : |
183 |
showInfocomForm($CFG_GLPI["root_doc"]."/front/infocom.form.php",PRINTER_TYPE,$_GET["ID"]); |
184 |
showContractAssociated(PRINTER_TYPE,$_GET["ID"]); |
185 |
break;
|
186 |
case 5 : |
187 |
showDocumentAssociated(PRINTER_TYPE,$_GET["ID"]); |
188 |
break;
|
189 |
case 6 : |
190 |
showJobListForItem($_SESSION["glpiname"],PRINTER_TYPE,$_GET["ID"],$_GET["sort"],$_GET["order"]); |
191 |
showOldJobListForItem($_SESSION["glpiname"],PRINTER_TYPE,$_GET["ID"],$_GET["sort"],$_GET["order"]); |
192 |
break;
|
193 |
case 7 : |
194 |
showLinkOnDevice(PRINTER_TYPE,$_GET["ID"]); |
195 |
break;
|
196 |
|
197 |
case 10 : |
198 |
showNotesForm($_SERVER['PHP_SELF'],PRINTER_TYPE,$_GET["ID"]); |
199 |
break;
|
200 |
case 11 : |
201 |
showDeviceReservations($_SERVER['PHP_SELF'],PRINTER_TYPE,$_GET["ID"]); |
202 |
break;
|
203 |
case 12 : |
204 |
showHistory(PRINTER_TYPE,$_GET["ID"]); |
205 |
break;
|
206 |
default :
|
207 |
if (!displayPluginAction(PRINTER_TYPE,$_GET["ID"],$_SESSION['glpi_onglet'],$_GET["withtemplate"])){ |
208 |
showCartridgeInstalled($_GET["ID"]); |
209 |
showCartridgeInstalled($_GET["ID"],1); |
210 |
} |
211 |
break;
|
212 |
} |
213 |
|
214 |
|
215 |
} |
216 |
} |
217 |
commonFooter(); |
218 |
} |
219 |
|
220 |
|
221 |
?>
|