* Copyright (C) 2004 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Eric Seigne * * 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$ */ /** \file htdocs/admin/expedition.php \ingroup expedition \brief Page d'administration/configuration du module Expedition \version $Revision$ */ require("./pre.inc.php"); $langs->load("admin"); $langs->load("sendings"); if (!$user->admin) accessforbidden(); /* * Actions */ if ($_GET["action"] == 'set') { $file = DOL_DOCUMENT_ROOT . '/expedition/mods/methode_expedition_'.$_GET["value"].'.modules.php'; $classname = 'methode_expedition_'.$_GET["value"]; require_once($file); $obj = new $classname(); // Mise a jour statut $sql = "UPDATE ".MAIN_DB_PREFIX."expedition_methode set status='".$_GET["statut"]."'"; $sql.= " WHERE rowid = ".$obj->id; print "$sql"; exit; Header("Location: expedition.php"); } if ($_GET["action"] == 'setpdf') { $sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'EXPEDITION_ADDON_PDF';"; $db->query($sql); $sql=''; $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES ('EXPEDITION_ADDON_PDF','".$_GET["value"]."',0)"; if ($db->query($sql)) { // la constante qui a été lue en avant du nouveau set // on passe donc par une variable pour avoir un affichage cohérent $expedition_addon_var_pdf = $value; } Header("Location: expedition.php"); } llxHeader(); // positionne la variable pour le test d'affichage de l'icone $expedition_addon_var_pdf = EXPEDITION_ADDON_PDF; $expedition_default = EXPEDITION_DEFAULT; if ($_GET["action"] == 'setdef') { $sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'EXPEDITION_ADDON';"; $db->query($sql); $sql=''; $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES ('EXPEDITION_ADDON','".$value."',0)"; if ($db->query($sql)) { // la constante qui a été lue en avant du nouveau set // on passe donc par une variable pour avoir un affichage cohérent $expedition_default = $_GET["value"]; } } /* * * * */ $dir = DOL_DOCUMENT_ROOT."/expedition/mods/"; /* * Méthode de livraison */ print_titre($langs->trans("SendingsSetup")); print "
"; print_titre($langs->trans("SendingMethod")); print ''; print ''; print ''; print ''; print ''; print "\n"; if(is_dir($dir)) { $handle=opendir($dir); while (($file = readdir($handle))!==false) { if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,19) == 'methode_expedition_') { $name = substr($file, 19, strlen($file) - 31); $classname = substr($file, 0, strlen($file) - 12); require_once($dir.$file); $obj = new $classname(); print ''; } } closedir($handle); } else { print "\n"; } print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Active").''.$langs->trans("Default").'
'; echo $obj->name; print "\n"; print $obj->description; print ''; print " "; print "\n"; print ''.$langs->trans("Activate").''; print ''; if ($expedition_default == "$name") { print img_tick(); } else { print " "; } print "\n"; print ''.$langs->trans("Activate").''; print '
ERROR: $dir is not a directory !
'; print '
'; /* * * PDF * */ print_titre($langs->trans("SendingsReceiptModel")); print ''; print ''; print ''; print ''; print "\n"; clearstatcache(); $dir = DOL_DOCUMENT_ROOT."/expedition/mods/pdf/"; if(is_dir($dir)) { $handle=opendir($dir); while (($file = readdir($handle))!==false) { if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,15) == 'pdf_expedition_') { $name = substr($file, 15, strlen($file) - 27); $classname = substr($file, 0, strlen($file) - 12); print ''; } } closedir($handle); } else { print "\n"; } print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Active").'
'; echo "$name"; print "\n"; require_once($dir.$file); $obj = new $classname(); print $obj->description; print ''; if ($expedition_addon_var_pdf == "$name") { print img_tick(); } else { print " "; } print "\n"; print ''.$langs->trans("Activate").''; print '
ERROR: $dir is not a directory !
'; /* * * */ $db->close(); llxFooter(); ?>