ryxeo-glpi-git / htdocs / inc / typedoc.class.php @ 1c14bcc4
Historique | Voir | Annoter | Télécharger (4,35 ko)
1 | 1c14bcc4 | Eric Seigne | <?php
|
---|---|---|---|
2 | /*
|
||
3 | * @version $Id: typedoc.class.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 | if (!defined('GLPI_ROOT')){ |
||
37 | die("Sorry. You can't access directly to this file"); |
||
38 | } |
||
39 | |||
40 | |||
41 | // CLASSES peripherals
|
||
42 | |||
43 | |||
44 | class Typedoc extends CommonDBTM { |
||
45 | |||
46 | |||
47 | /**
|
||
48 | * Constructor
|
||
49 | **/
|
||
50 | function Typedoc () { |
||
51 | $this->table="glpi_type_docs"; |
||
52 | $this->type=TYPEDOC_TYPE; |
||
53 | } |
||
54 | |||
55 | /**
|
||
56 | * Print the typedoc form
|
||
57 | *
|
||
58 | *@param $target form target
|
||
59 | *@param $ID Integer : Id of the typedoc
|
||
60 | *
|
||
61 | *@return boolean : typedoc found
|
||
62 | **/
|
||
63 | function showForm ($target,$ID) { |
||
64 | |||
65 | global $CFG_GLPI, $LANG; |
||
66 | |||
67 | if (!haveRight("typedoc","r")) return false; |
||
68 | |||
69 | $spotted = false; |
||
70 | |||
71 | if(empty($ID)) { |
||
72 | if($this->getEmpty()) $spotted = true; |
||
73 | } else {
|
||
74 | if($this->getFromDB($ID)) $spotted = true; |
||
75 | } |
||
76 | |||
77 | if ($spotted){ |
||
78 | |||
79 | echo "<div class='center'><form method='post' name=form action=\"$target\">"; |
||
80 | |||
81 | echo "<table class='tab_cadre' cellpadding='2'>"; |
||
82 | |||
83 | echo "<tr><th align='center' >"; |
||
84 | if (empty($ID)){ |
||
85 | echo $LANG["document"][17]; |
||
86 | } else {
|
||
87 | echo $LANG["common"][2]." ".$this->fields["ID"]; |
||
88 | } |
||
89 | |||
90 | echo "</th><th align='center'>".$LANG["common"][26]." : ".convDateTime($this->fields["date_mod"]); |
||
91 | echo "</th></tr>"; |
||
92 | |||
93 | echo "<tr class='tab_bg_1'><td>".$LANG["common"][16].": </td><td>"; |
||
94 | autocompletionTextField("name","glpi_type_docs","name",$this->fields["name"],20); |
||
95 | echo "</td></tr>"; |
||
96 | |||
97 | echo "<tr class='tab_bg_1'><td>".$LANG["document"][9].": </td><td>"; |
||
98 | autocompletionTextField("ext","glpi_type_docs","ext",$this->fields["ext"],20); |
||
99 | |||
100 | echo "</td></tr>"; |
||
101 | |||
102 | echo "<tr class='tab_bg_1'><td>".$LANG["document"][10].": </td><td>"; |
||
103 | dropdownIcons("icon",$this->fields["icon"],$CFG_GLPI["typedoc_icon_dir"]); |
||
104 | if (!empty($this->fields["icon"])) echo " <img style='vertical-align:middle;' alt='' src='".$CFG_GLPI["typedoc_icon_dir"]."/".$this->fields["icon"]."'>"; |
||
105 | echo "</td></tr>"; |
||
106 | |||
107 | echo "<tr class='tab_bg_1'><td>".$LANG["document"][4].": </td><td>"; |
||
108 | autocompletionTextField("mime","glpi_type_docs","mime",$this->fields["mime"],20); |
||
109 | echo "</td></tr>"; |
||
110 | |||
111 | echo "<tr class='tab_bg_1'><td>".$LANG["document"][11].": </td><td>"; |
||
112 | dropdownYesNo("upload",$this->fields["upload"]); |
||
113 | echo "</td></tr>"; |
||
114 | |||
115 | if (haveRight("typedoc","w")) { |
||
116 | echo "<tr>"; |
||
117 | if(empty($ID)){ |
||
118 | |||
119 | echo "<td class='tab_bg_2' valign='top' colspan='3'>"; |
||
120 | echo "<div class='center'><input type='submit' name='add' value=\"".$LANG["buttons"][8]."\" class='submit'></div>"; |
||
121 | echo "</td>"; |
||
122 | |||
123 | } else {
|
||
124 | |||
125 | echo "<td class='tab_bg_2' valign='top' align='center'>"; |
||
126 | echo "<input type='hidden' name='ID' value=\"$ID\">\n"; |
||
127 | echo "<input type='submit' name='update' value=\"".$LANG["buttons"][7]."\" class='submit'>"; |
||
128 | echo "</td>"; |
||
129 | echo "<td class='tab_bg_2' valign='top'>\n"; |
||
130 | echo "<div class='center'>"; |
||
131 | echo "<input type='submit' name='delete' value=\"".$LANG["buttons"][6]."\" class='submit'>"; |
||
132 | echo "</div>"; |
||
133 | echo "</td>"; |
||
134 | } |
||
135 | echo "</tr>"; |
||
136 | } |
||
137 | |||
138 | echo "</table></form></div>"; |
||
139 | |||
140 | return true; |
||
141 | } |
||
142 | else {
|
||
143 | echo "<div class='center'><strong>".$LANG["common"][54]."</strong></div>"; |
||
144 | return false; |
||
145 | } |
||
146 | |||
147 | } |
||
148 | |||
149 | } |
||
150 | |||
151 | ?> |