dolibarr  9.0.0
modules_export.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2005-2007 Regis Houssin <regis.houssin@inodbox.com>
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 3 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, see <http://www.gnu.org/licenses/>.
17  */
18 
25 require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
26 
27 
31 class ModeleExports extends CommonDocGenerator // This class can't be abstract as there is instance propreties loaded by liste_modeles
32 {
36  public $error='';
37 
38  public $driverlabel=array();
39 
40  public $driverversion=array();
41 
42  public $liblabel=array();
43 
44  public $libversion=array();
45 
46 
47  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
55  function liste_modeles($db,$maxfilenamelength=0)
56  {
57  // phpcs:enable
58  dol_syslog(get_class($this)."::liste_modeles");
59 
60  $dir=DOL_DOCUMENT_ROOT."/core/modules/export/";
61  $handle=opendir($dir);
62 
63  // Recherche des fichiers drivers exports disponibles
64  $i=0;
65  if (is_resource($handle))
66  {
67  while (($file = readdir($handle))!==false)
68  {
69  if (preg_match("/^export_(.*)\.modules\.php$/i",$file,$reg))
70  {
71  $moduleid=$reg[1];
72 
73  // Loading Class
74  $file = $dir."export_".$moduleid.".modules.php";
75  $classname = "Export".ucfirst($moduleid);
76 
77  require_once $file;
78  if (class_exists($classname))
79  {
80  $module = new $classname($db);
81 
82  // Picto
83  $this->picto[$module->id]=$module->picto;
84  // Driver properties
85  $this->driverlabel[$module->id]=$module->getDriverLabel().(empty($module->disabled)?'':' __(Disabled)__'); // '__(Disabled)__' is a key
86  $this->driverdesc[$module->id]=$module->getDriverDesc();
87  $this->driverversion[$module->id]=$module->getDriverVersion();
88  // If use an external lib
89  $this->liblabel[$module->id]=$module->getLibLabel();
90  $this->libversion[$module->id]=$module->getLibVersion();
91  }
92  $i++;
93  }
94  }
95  closedir($handle);
96  }
97 
98  asort($this->driverlabel);
99 
100  return $this->driverlabel;
101  }
102 
103 
110  function getPictoForKey($key)
111  {
112  return $this->picto[$key];
113  }
114 
121  function getDriverLabelForKey($key)
122  {
123  return $this->driverlabel[$key];
124  }
125 
132  function getDriverDescForKey($key)
133  {
134  return $this->driverdesc[$key];
135  }
136 
143  function getDriverVersionForKey($key)
144  {
145  return $this->driverversion[$key];
146  }
147 
154  function getLibLabelForKey($key)
155  {
156  return $this->liblabel[$key];
157  }
158 
165  function getLibVersionForKey($key)
166  {
167  return $this->libversion[$key];
168  }
169 }
Parent class for export modules.
getDriverLabelForKey($key)
Renvoi libelle d&#39;un driver export.
getLibVersionForKey($key)
Renvoi version de librairie externe du driver.
getPictoForKey($key)
Return picto of export driver.
getDriverDescForKey($key)
Renvoi le descriptif d&#39;un driver export.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.
getDriverVersionForKey($key)
Renvoi version d&#39;un driver export.
Parent class for documents generators.
liste_modeles($db, $maxfilenamelength=0)
Load into memory list of available export format.
getLibLabelForKey($key)
Renvoi libelle de librairie externe du driver.