[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> 3 * 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 19 * $Id: export.class.php,v 1.2 2005/12/03 04:25:10 eldy Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/exports/export.class.php,v $ 21 */ 22 23 /** 24 \file htdocs/exports/export.class.php 25 \ingroup core 26 \brief Fichier de la classe des exports 27 \version $Revision: 1.2 $ 28 */ 29 30 31 /** 32 \class Export 33 \brief Classe permettant la gestion des exports 34 */ 35 36 class Export 37 { 38 var $array_export_code=array(); 39 var $array_export_module=array(); 40 var $array_export_label=array(); 41 var $array_export_fields_code=array(); 42 var $array_export_fields_label=array(); 43 var $array_export_sql=array(); 44 45 46 /** 47 * \brief Constructeur de la classe 48 * \param DB Handler accès base de données 49 */ 50 function Export($DB) 51 { 52 $this->db=$DB; 53 } 54 55 56 /** 57 * \brief Charge les lots de données exportables 58 * \param user Objet utilisateur qui exporte 59 * \param filter Code export pour charger un lot de données particulier 60 */ 61 function load_arrays($user,$filter='') 62 { 63 dolibarr_syslog("Export::load_arrays user=$user filter=$filter"); 64 65 $dir=DOL_DOCUMENT_ROOT."/includes/modules"; 66 $handle=opendir($dir); 67 68 // Recherche des exports disponibles 69 $var=True; 70 $i=0; 71 while (($file = readdir($handle))!==false) 72 { 73 if (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS') 74 { 75 if (eregi("^(mod.*)\.class\.php",$file,$reg)) 76 { 77 $modulename=$reg[1]; 78 79 // Chargement de la classe 80 $file = $dir."/".$modulename.".class.php"; 81 $classname = $modulename; 82 require_once($file); 83 $module = new $classname($db); 84 85 if (is_array($module->export_code)) 86 { 87 foreach($module->export_code as $r => $value) 88 { 89 if ($filter && $filter != $module->export_code[$r]) next; 90 // Test si permissions ok \todo tester sur toutes permissions 91 $perm=$module->export_permission[$r][0]; 92 if (strlen($perms[2]) > 0) 93 { 94 $bool=$user->rights->$perm[0]->$perm[1]->$perm[2]; 95 } 96 else 97 { 98 $bool=$user->rights->$perm[0]->$perm[1]; 99 } 100 if ($bool) // Permissions ok 101 { 102 dolibarr_syslog("Export chargé pour le module ".$modulename." en index ".$i); 103 $this->array_export_module[$i]=$module; 104 $this->array_export_code[$i]=$module->export_code[$r]; 105 $this->array_export_label[$i]=$module->export_label[$r]; 106 $this->array_export_fields_code[$i]=$module->export_fields_code[$r]; 107 $this->array_export_fields_label[$i]=$module->export_fields_label[$r]; 108 $this->array_export_sql[$i]=$module->export_sql[$r]; 109 $i++; 110 } 111 } 112 } 113 } 114 } 115 } 116 closedir($handle); 117 } 118 119 } 120 121 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |