1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
|
<?php
/*
* @version $Id: HEADER 3795 2006-08-22 03:57:36Z moyo $
-------------------------------------------------------------------------
GLPI - Gestionnaire Libre de Parc Informatique
Copyright (C) 2003-2006 by the INDEPNET Development Team.
http://indepnet.net/ http://glpi-project.org
-------------------------------------------------------------------------
LICENSE
This file is part of GLPI.
GLPI is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GLPI; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file: Julien Dombre
// Purpose of file:
// ----------------------------------------------------------------------
// CLASSES contact
class Group extends CommonDBTM{
function Group () {
$this->table="glpi_groups";
$this->type=GROUP_TYPE;
}
function cleanDBonPurge($ID) {
global $db,$cfg_glpi,$LINK_ID_TABLE;
$query = "DELETE from glpi_users_groups WHERE FK_groups = '$ID'";
$db->query($query);
foreach ($cfg_glpi["linkuser_type"] as $type){
$query2="UPDATE ".$LINK_ID_TABLE[$type]." SET FK_groups=0 WHERE FK_groups='$ID';";
$db->query($query2);
}
}
function post_getEmpty () {
global $cfg_glpi;
$this->fields["ldap_field"]=$cfg_glpi["ldap_field_group"];
}
function defineOnglets($withtemplate){
global $lang;
if (haveRight("user","r"))
$ong[1]=$lang["Menu"][14];
$ong[2]=$lang["common"][1];
return $ong;
}
/**
* Print a good title for coontact pages
*
*
*
*
*@return nothing (diplays)
*
**/
function title(){
global $lang,$HTMLRel;
echo "<div align='center'><table border='0'><tr><td>";
echo "<img src=\"".$HTMLRel."pics/groupes.png\" alt='".$lang["financial"][24]."' title='".$lang["financial"][24]."'></td>";
if (haveRight("group","w")){
echo "<td><a class='icon_consol' href=\"group.form.php?new=1\"><b>".$lang["setup"][602]."</b></a></td>";
} else echo "<td><span class='icon_sous_nav'><b>".$lang["setup"][602]."</b></span></td>";
echo "</tr></table></div>";
}
/**
* Print the group form
*
*
* Print group form
*
*@param $target filename : where to go when done.
*@param $ID Integer : Id of the contact to print
*
*
*@return Nothing (display)
*
**/
function showForm ($target,$ID) {
global $cfg_glpi, $lang,$HTMLRel;
if (!haveRight("group","r")) return false;
$con_spotted=false;
if (empty($ID)) {
if($this->getEmpty()) $con_spotted = true;
} else {
if($this->getfromDB($ID)) $con_spotted = true;
}
if ($con_spotted){
echo "<form method='post' name=form action=\"$target\"><div align='center'>";
echo "<table class='tab_cadre_fixe' cellpadding='2' >";
echo "<tr><th colspan='2'><b>";
if (empty($ID)) {
echo $lang["setup"][605].":";
} else {
echo $lang["common"][35]." ID $ID:";
}
echo "</b></th></tr>";
echo "<tr><td class='tab_bg_1' valign='top'>";
echo "<table cellpadding='1' cellspacing='0' border='0'>\n";
echo "<tr><td>".$lang["common"][16].": </td>";
echo "<td>";
autocompletionTextField("name","glpi_groups","name",$this->fields["name"],30);
echo "</td></tr>";
if(!empty($cfg_glpi["ldap_host"])){
echo "<tr><td colspan='2' align='center'>".$lang["setup"][256].": </td>";
echo "</tr>";
echo "<tr><td>".$lang["setup"][260].": </td>";
echo "<td>";
autocompletionTextField("ldap_field","glpi_groups","ldap_field",$this->fields["ldap_field"],30);
echo "</td></tr>";
echo "<tr><td>".$lang["setup"][601].": </td>";
echo "<td>";
autocompletionTextField("ldap_value","glpi_groups","ldap_value",$this->fields["ldap_value"],30);
echo "</td></tr>";
echo "<tr><td colspan='2' align='center'>".$lang["setup"][257].": </td>";
echo "</tr>";
echo "<tr><td>".$lang["setup"][261].": </td>";
echo "<td>";
autocompletionTextField("ldap_group_dn","glpi_groups","ldap_group_dn",$this->fields["ldap_group_dn"],30);
echo "</td></tr>";
}
echo "</table>";
echo "</td>\n";
echo "<td class='tab_bg_1' valign='top'>";
echo "<table cellpadding='1' cellspacing='0' border='0'><tr><td>";
echo $lang["common"][25].": </td></tr>";
echo "<tr><td align='center'><textarea cols='45' rows='4' name='comments' >".$this->fields["comments"]."</textarea>";
echo "</td></tr></table>";
echo "</td>";
echo "</tr>";
if (haveRight("group","w"))
if ($ID=="") {
echo "<tr>";
echo "<td class='tab_bg_2' valign='top' colspan='2'>";
echo "<div align='center'><input type='submit' name='add' value=\"".$lang["buttons"][8]."\" class='submit'></div>";
echo "</td>";
echo "</tr>";
} else {
echo "<tr>";
echo "<td class='tab_bg_2' valign='top'>";
echo "<input type='hidden' name='ID' value=\"$ID\">\n";
echo "<div align='center'><input type='submit' name='update' value=\"".$lang["buttons"][7]."\" class='submit' ></div>";
echo "</td>\n\n";
echo "<td class='tab_bg_2' valign='top'>\n";
echo "<div align='center'><input type='submit' name='delete' value=\"".$lang["buttons"][6]."\" class='submit'></div>";
echo "</td>";
echo "</tr>";
}
echo "</table></div></form>";
} else {
echo "<div align='center'><b>".$lang["financial"][38]."</b></div>";
return false;
}
return true;
}
}
?>
|