ryxeo-glpi-git / front / document.form.php @ b67d8923
Historique | Voir | Annoter | Télécharger (5,26 ko)
1 |
<?php
|
---|---|
2 |
/*
|
3 |
* @version $Id: document.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: Julien Dombre
|
33 |
// Purpose of file:
|
34 |
// ----------------------------------------------------------------------
|
35 |
|
36 |
|
37 |
$NEEDED_ITEMS=array("document","computer","printer","monitor","peripheral","networking","software","contract","knowbase","cartridge","consumable","phone","enterprise","contact","tracking"); |
38 |
define('GLPI_ROOT', '..'); |
39 |
include (GLPI_ROOT . "/inc/includes.php"); |
40 |
|
41 |
if(!isset($_GET["ID"])) { |
42 |
$_GET["ID"] = -1; |
43 |
} |
44 |
|
45 |
$doc= new Document(); |
46 |
|
47 |
if (isset($_POST["add"])) |
48 |
{ |
49 |
$doc->check(-1,'w',$_POST['FK_entities']); |
50 |
|
51 |
$newID=$doc->add($_POST); |
52 |
$name=""; |
53 |
if (isset($_POST["name"])){ |
54 |
$name=$_POST["name"]; |
55 |
} else if (isset($_FILES['filename'])){ |
56 |
if (isset($_FILES['filename']['name'])){ |
57 |
$name=$_FILES['filename']['name']; |
58 |
} |
59 |
} |
60 |
logEvent($newID, "documents", 4, "document", $_SESSION["glpiname"]." ".$LANG["log"][20]." ".$name."."); |
61 |
glpi_header($_SERVER['HTTP_REFERER']); |
62 |
} |
63 |
else if (isset($_POST["delete"])) |
64 |
{ |
65 |
$doc->check($_POST["ID"],'w'); |
66 |
|
67 |
$doc->delete($_POST); |
68 |
logEvent($_POST["ID"], "documents", 4, "document", $_SESSION["glpiname"]." ".$LANG["log"][22]); |
69 |
glpi_header($CFG_GLPI["root_doc"]."/front/document.php"); |
70 |
} |
71 |
else if (isset($_POST["restore"])) |
72 |
{ |
73 |
$doc->check($_POST["ID"],'w'); |
74 |
|
75 |
$doc->restore($_POST); |
76 |
logEvent($_POST["ID"], "documents", 4, "document", $_SESSION["glpiname"]." ".$LANG["log"][23]); |
77 |
glpi_header($CFG_GLPI["root_doc"]."/front/document.php"); |
78 |
} |
79 |
else if (isset($_POST["purge"])) |
80 |
{ |
81 |
$doc->check($_POST["ID"],'w'); |
82 |
|
83 |
$doc->delete($_POST,1); |
84 |
logEvent($_POST["ID"], "documents", 4, "document", $_SESSION["glpiname"]." ".$LANG["log"][24]); |
85 |
glpi_header($CFG_GLPI["root_doc"]."/front/document.php"); |
86 |
} |
87 |
|
88 |
else if (isset($_POST["update"])) |
89 |
{ |
90 |
$doc->check($_POST["ID"],'w'); |
91 |
|
92 |
$doc->update($_POST); |
93 |
logEvent($_POST["ID"], "documents", 4, "document", $_SESSION["glpiname"]." ".$LANG["log"][21]); |
94 |
glpi_header($_SERVER['HTTP_REFERER']); |
95 |
} |
96 |
else if (isset($_POST["additem"])){ |
97 |
|
98 |
if ($_POST["right"]=="doc") { |
99 |
$doc->check($_POST["conID"],'w'); |
100 |
} else { // $_POST["right"]=="item" |
101 |
$ci=new CommonItem(); |
102 |
$ci->getFromDB($_POST['type'], $_POST['item']); |
103 |
$ci->obj->check($_POST['item'],'w'); |
104 |
} |
105 |
|
106 |
if ($_POST['type']>0&&$_POST['item']>0){ |
107 |
addDeviceDocument($_POST["conID"],$_POST['type'],$_POST['item']); |
108 |
logEvent($_POST["conID"], "documents", 4, "document", $_SESSION["glpiname"]." ".$LANG["log"][32]); |
109 |
} |
110 |
glpi_header($_SERVER['HTTP_REFERER']); |
111 |
} |
112 |
else if (isset($_POST["deleteitem"])){ |
113 |
|
114 |
$doc->check($_POST["conID"],'w'); |
115 |
|
116 |
if (count($_POST["item"])){ |
117 |
foreach ($_POST["item"] as $key => $val){ |
118 |
deleteDeviceDocument($key);
|
119 |
} |
120 |
} |
121 |
logEvent($_POST["conID"], "documents", 4, "document", $_SESSION["glpiname"]." ".$LANG["log"][33]); |
122 |
glpi_header($_SERVER['HTTP_REFERER']); |
123 |
} |
124 |
else if (isset($_GET["deleteitem"]) && isset($_GET["docid"]) && isset($_GET["devtype"]) && isset($_GET["devid"]) && isset($_GET["ID"])){ |
125 |
|
126 |
$ci=new CommonItem(); |
127 |
$ci->getFromDB($_GET["devtype"], $_GET["devid"]); |
128 |
$ci->obj->check($_GET["devid"],'w'); |
129 |
|
130 |
deleteDeviceDocument($_GET["ID"]); |
131 |
|
132 |
logEvent($_GET["docid"], "documents", 4, "document", $_SESSION["glpiname"]." ".$LANG["log"][33]); |
133 |
glpi_header($_SERVER['HTTP_REFERER']); |
134 |
} |
135 |
else
|
136 |
{ |
137 |
$doc->check($_GET["ID"],'r'); |
138 |
|
139 |
if (!isset($_SESSION['glpi_onglet'])) $_SESSION['glpi_onglet']=1; |
140 |
if (isset($_GET['onglet'])) { |
141 |
$_SESSION['glpi_onglet']=$_GET['onglet']; |
142 |
// glpi_header($_SERVER['HTTP_REFERER']);
|
143 |
} |
144 |
|
145 |
commonHeader($LANG["Menu"][27],$_SERVER['PHP_SELF'],"financial","document"); |
146 |
|
147 |
if ($doc->showForm($_SERVER['PHP_SELF'],$_GET["ID"])){ |
148 |
switch ($_SESSION['glpi_onglet']){ |
149 |
case -1 : |
150 |
showDeviceDocument($_GET["ID"]); |
151 |
showDocumentAssociated(DOCUMENT_TYPE,$_GET["ID"]); |
152 |
displayPluginAction(DOCUMENT_TYPE,$_GET["ID"],$_SESSION['glpi_onglet']); |
153 |
break;
|
154 |
case 5 : |
155 |
showDocumentAssociated(DOCUMENT_TYPE,$_GET["ID"]); |
156 |
break;
|
157 |
case 10 : |
158 |
showNotesForm($_SERVER['PHP_SELF'],DOCUMENT_TYPE,$_GET["ID"]); |
159 |
break;
|
160 |
default :
|
161 |
if ($_GET["ID"]){ |
162 |
if (!displayPluginAction(DOCUMENT_TYPE,$_GET["ID"],$_SESSION['glpi_onglet'])){ |
163 |
showDeviceDocument($_GET["ID"]); |
164 |
} |
165 |
} |
166 |
break;
|
167 |
} |
168 |
} |
169 |
commonFooter(); |
170 |
} |
171 |
|
172 |
?>
|