* Copyright (C) 2004 Laurent Destailleur * * This program 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. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ * $Source$ */ require("./pre.inc.php"); $acts[0] = "add"; $acts[1] = "delete"; $actl[0] = "Ajouter"; $actl[1] = "Enlever"; $tabid[1] = "llx_c_forme_juridique"; $tabid[2] = "llx_c_departements"; $tabid[3] = "llx_c_regions"; if (!$user->admin) accessforbidden(); if ($user->admin) { if ($_GET["action"] == 'delete') { $sql = "UPDATE ".$tabid[$_GET["id"]]." SET active = 0 WHERE rowid=".$_GET["rowid"]; $result = $db->query($sql); if (!$result) { print $db->error(); } } if ($_GET["action"] == 'add') { $sql = "UPDATE ".$tabid[$_GET["id"]]." SET active = 1 WHERE rowid=".$_GET["rowid"]; $result = $db->query($sql); if (!$result) { print $db->error(); } } } llxHeader(); print_titre("Configuration des dictionnaires de données"); print '
'; $active = 1; $sql = array(); if ($_GET["id"]) { ShowTable($db,1, $_GET["id"], $actl, $acts); ShowTable($db,0, $_GET["id"], $actl, $acts); } else { print 'Forme Juridique
'; print 'Départements
'; print 'Régions
'; } $db->close(); llxFooter(); Function ShowTable($db, $active, $id, $actl, $acts) { global $bc; $sql[1] = "SELECT code, libelle, active FROM llx_c_forme_juridique WHERE active = $active ORDER BY code ASC"; $sql[2] = "SELECT rowid, code_departement as code , nom as libelle, active FROM llx_c_departements WHERE active = $active ORDER BY code ASC"; $sql[3] = "SELECT rowid, code_region as code , nom as libelle, active FROM llx_c_regions WHERE active = $active ORDER BY code ASC"; if ($db->query($sql[$id])) { $num = $db->num_rows(); $i = 0; $var=True; if ($num) { print ''; print ''; while ($i < $num) { $obj = $db->fetch_object( $i); $var=!$var; print "\n"; $i++; } print '
CodeValeurType
\n"; print $obj->code.''.$obj->libelle.''; print ''.$actl[$active].''; print "
'; } } } ?>