* Copyright (C) 2004-2006 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Andre Cianfarani * * 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/commande.php \ingroup commande \brief Page d'administration-configuration du module Commande \version $Revision$ */ require("./pre.inc.php"); $langs->load("admin"); $langs->load("orders"); llxHeader(); if (!$user->admin) accessforbidden(); /* * Actions */ if ($_GET["action"] == 'setmod') { dolibarr_set_const($db,'COMMANDE_ADDON',$_GET["value"]); } if ($_GET["action"] == 'set') { $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_model_pdf (nom) VALUES ('".$_GET["value"]."')"; $resql=$db->query($sql); if (! $resql) { dolibarr_print_error($db); } } if ($_GET["action"] == 'setpdf') { dolibarr_set_const($db,'COMMANDE_ADDON_PDF',$_GET["value"]); // On active le modele $sql_del = "delete from ".MAIN_DB_PREFIX."commande_model_pdf where nom = '".$_GET["value"]."';"; $resql=$db->query($sql_del); $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_model_pdf (nom) VALUES ('".$_GET["value"]."')"; $resql=$db->query($sql); if (! $resql) { dolibarr_print_error($db); } } if ($_GET["action"] == 'del') { $sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_model_pdf WHERE nom='".$_GET["value"]."'"; $resql=$db->query($sql); if (! $resql) { dolibarr_print_error($db); } } /* * Affichage page */ $dir = "../includes/modules/commande/"; print_titre($langs->trans("OrdersSetup")); print "
"; print_titre($langs->trans("OrdersNumberingModules")); print ''; print ''; print ''; print ''; print ''; print "\n"; clearstatcache(); $dir = "../includes/modules/commande/"; $handle = opendir($dir); if ($handle) { $var=true; while (($file = readdir($handle))!==false) { if (substr($file, 0, 13) == 'mod_commande_' && substr($file, strlen($file)-3, 3) == 'php') { $file = substr($file, 0, strlen($file)-4); require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/".$file.".php"); $modCommande = new $file; $var=!$var; print ''; print ''; if ($conf->global->COMMANDE_ADDON == "$file") { print ''; } else { print ''; } print ''; } } closedir($handle); } print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Activated").'
'.$modCommande->nom."\n"; print $modCommande->info(); print ''; print $modCommande->getExample(); print ''; print img_tick(); print ''.$langs->trans("Activate").'
'; /* * PDF */ print '
'; print_titre($langs->trans("OrdersModelModule")); print "\n"; print "\n"; print ' \n"; print " \n"; print ' \n"; print ' \n"; print "\n"; clearstatcache(); $def = array(); $sql = "SELECT nom FROM ".MAIN_DB_PREFIX."commande_model_pdf"; $resql=$db->query($sql); if ($resql) { $i = 0; $num_rows=$db->num_rows($resql); while ($i < $num_rows) { $obj = $db->fetch_object($resql); array_push($def, $obj->nom); $i++; } } else { dolibarr_print_error($db); } $handle=opendir($dir); $var=True; while (($file = readdir($handle))!==false) { if (eregi('\.modules\.php$',$file) && substr($file,0,4) == 'pdf_') { $name = substr($file, 4, strlen($file) -16); $classname = substr($file, 0, strlen($file) -12); $var=!$var; print "\n \n \n"; // Activé print "\n"; // Defaut print "'; } } closedir($handle); print '
'.$langs->trans("Name")."".$langs->trans("Description")."'.$langs->trans("Activated")."'.$langs->trans("Default")."
"; print "$name"; print "\n"; require_once($dir.$file); $obj = new $classname($db); print $obj->description; print "\n"; if (in_array($name, $def)) { print img_tick().' '; if ($conf->global->COMMANDE_ADDON_PDF != "$name") { print ''.$langs->trans("Disable").''; } } else { print ''.$langs->trans("Activate").''; } print ""; if ($conf->global->COMMANDE_ADDON_PDF == "$name") { print img_tick(); } else { print ''.$langs->trans("Default").''; } print '
'; llxFooter('$Date$ - $Revision$'); ?>