ryxeo-glpi-git / inc / link.class.php @ b67d8923
Historique | Voir | Annoter | Télécharger (4,22 ko)
1 |
<?php
|
---|---|
2 |
/*
|
3 |
* @version $Id: link.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: Julien Dombre
|
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 link
|
42 |
class Link extends CommonDBTM { |
43 |
|
44 |
/**
|
45 |
* Constructor
|
46 |
**/
|
47 |
function Link () { |
48 |
$this->table="glpi_links"; |
49 |
} |
50 |
|
51 |
|
52 |
function cleanDBonPurge($ID) { |
53 |
|
54 |
global $DB; |
55 |
|
56 |
$query2="DELETE FROM glpi_links_device WHERE FK_links='$ID'"; |
57 |
$DB->query($query2); |
58 |
} |
59 |
|
60 |
/**
|
61 |
* Print the link form
|
62 |
*
|
63 |
*
|
64 |
* Print g��al link form
|
65 |
*
|
66 |
*@param $target filename : where to go when done.
|
67 |
*@param $ID Integer : Id of the link to print
|
68 |
*
|
69 |
*
|
70 |
*@return Nothing (display)
|
71 |
*
|
72 |
**/
|
73 |
function showForm ($target,$ID) { |
74 |
|
75 |
global $CFG_GLPI, $LANG; |
76 |
|
77 |
if (!haveRight("link","r")) return false; |
78 |
|
79 |
$spotted=false; |
80 |
if (!$ID) { |
81 |
|
82 |
if($this->getEmpty()) $spotted = true; |
83 |
} else {
|
84 |
if($this->getFromDB($ID)) $spotted = true; |
85 |
} |
86 |
|
87 |
if ($spotted){ |
88 |
echo "<form method='post' name=form action=\"$target\"><div class='center'>"; |
89 |
|
90 |
echo "<table class='tab_cadre_fixe' cellpadding='2' >"; |
91 |
echo "<tr><th colspan='2'>"; |
92 |
if (empty($ID)) { |
93 |
echo $LANG["links"][3].":"; |
94 |
|
95 |
} else {
|
96 |
|
97 |
echo $LANG["links"][1]." ID $ID:"; |
98 |
} |
99 |
echo "</th></tr>"; |
100 |
|
101 |
echo "<tr class='tab_bg_1'><td>".$LANG["links"][6].": </td>"; |
102 |
echo "<td>[ID], [NAME], [LOCATION], [LOCATIONID], [IP], [MAC], [NETWORK], [DOMAIN], [SERIAL], [OTHERSERIAL]</td>"; |
103 |
echo "</tr>"; |
104 |
|
105 |
echo "<tr class='tab_bg_1'><td>".$LANG["common"][16].": </td>"; |
106 |
echo "<td>"; |
107 |
autocompletionTextField("name","glpi_links","name",$this->fields["name"],80); |
108 |
echo "</td></tr>"; |
109 |
|
110 |
echo "<tr class='tab_bg_1'><td>".$LANG["links"][1].": </td>"; |
111 |
echo "<td>"; |
112 |
autocompletionTextField("link","glpi_links","link",$this->fields["link"],80); |
113 |
echo "</td></tr>"; |
114 |
|
115 |
echo "<tr class='tab_bg_1'><td>".$LANG["links"][9].": </td>"; |
116 |
echo "<td>"; |
117 |
echo "<textarea name='data' rows='10' cols='80'>".$this->fields["data"]."</textarea>"; |
118 |
echo "</td></tr>"; |
119 |
|
120 |
if (haveRight("link","w")) |
121 |
if ($ID=="") { |
122 |
|
123 |
echo "<tr>"; |
124 |
echo "<td class='tab_bg_2' valign='top' colspan='2'>"; |
125 |
echo "<div class='center'><input type='submit' name='add' value=\"".$LANG["buttons"][8]."\" class='submit'></div>"; |
126 |
echo "</td>"; |
127 |
echo "</tr>"; |
128 |
|
129 |
} else {
|
130 |
|
131 |
echo "<tr>"; |
132 |
echo "<td class='tab_bg_2' valign='top'>"; |
133 |
echo "<input type='hidden' name='ID' value=\"$ID\">\n"; |
134 |
echo "<div class='center'><input type='submit' name='update' value=\"".$LANG["buttons"][7]."\" class='submit' ></div>"; |
135 |
echo "</td>\n\n"; |
136 |
echo "<td class='tab_bg_2' valign='top'>\n"; |
137 |
echo "<input type='hidden' name='ID' value=\"$ID\">\n"; |
138 |
echo "<div class='center'><input type='submit' name='delete' value=\"".$LANG["buttons"][6]."\" class='submit' ></div>"; |
139 |
echo "</td>"; |
140 |
echo "</tr>"; |
141 |
|
142 |
|
143 |
|
144 |
} |
145 |
echo "</table></div></form>"; |
146 |
}else {
|
147 |
echo "<div class='center'><strong>".$LANG["common"][54]."</strong></div>"; |
148 |
return false; |
149 |
|
150 |
} |
151 |
return true; |
152 |
} |
153 |
|
154 |
} |
155 |
|
156 |
?>
|