dolibarr 18.0.6
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 <https://www.gnu.org/licenses/>.
17 */
18
25require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
26
27
31class ModeleExports extends CommonDocGenerator // This class can't be abstract as there is instance propreties loaded by listOfAvailableExportFormat
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
54 public function listOfAvailableExportFormat($db, $maxfilenamelength = 0)
55 {
56 dol_syslog(get_class($this)."::listOfAvailableExportFormat");
57
58 $dir = DOL_DOCUMENT_ROOT."/core/modules/export/";
59 $handle = opendir($dir);
60
61 // Recherche des fichiers drivers exports disponibles
62 $i = 0;
63 if (is_resource($handle)) {
64 while (($file = readdir($handle)) !== false) {
65 $reg = array();
66 if (preg_match("/^export_(.*)\.modules\.php$/i", $file, $reg)) {
67 $moduleid = $reg[1];
68 if ($moduleid == 'csv') {
69 continue; // This may happen if on old file export_csv.modules.php was not correctly deleted
70 }
71
72 // Loading Class
73 $file = $dir."export_".$moduleid.".modules.php";
74 $classname = "Export".ucfirst($moduleid);
75
76 require_once $file;
77 if (class_exists($classname)) {
78 $module = new $classname($db);
79
80 // Picto
81 $this->picto[$module->id] = $module->picto;
82 // Driver properties
83 $this->driverlabel[$module->id] = $module->getDriverLabel().(empty($module->disabled) ? '' : ' __(Disabled)__'); // '__(Disabled)__' is a key
84 $this->driverdesc[$module->id] = $module->getDriverDesc();
85 $this->driverversion[$module->id] = $module->getDriverVersion();
86 // If use an external lib
87 $this->liblabel[$module->id] = $module->getLibLabel();
88 $this->libversion[$module->id] = $module->getLibVersion();
89 }
90 $i++;
91 }
92 }
93 closedir($handle);
94 }
95
96 asort($this->driverlabel);
97
98 return $this->driverlabel;
99 }
100
101
108 public function getPictoForKey($key)
109 {
110 return $this->picto[$key];
111 }
112
119 public function getDriverLabelForKey($key)
120 {
121 return $this->driverlabel[$key];
122 }
123
130 public function getDriverDescForKey($key)
131 {
132 return $this->driverdesc[$key];
133 }
134
141 public function getDriverVersionForKey($key)
142 {
143 return $this->driverversion[$key];
144 }
145
152 public function getLibLabelForKey($key)
153 {
154 return $this->liblabel[$key];
155 }
156
163 public function getLibVersionForKey($key)
164 {
165 return $this->libversion[$key];
166 }
167}
Parent class for documents generators.
Parent class for export modules.
getDriverLabelForKey($key)
Return label of driver export.
getDriverVersionForKey($key)
Renvoi version d'un driver export.
getLibVersionForKey($key)
Return version of driver lib.
getDriverDescForKey($key)
Renvoi le descriptif d'un driver export.
listOfAvailableExportFormat($db, $maxfilenamelength=0)
Load into memory list of available export format.
getLibLabelForKey($key)
Renvoi label of driver lib.
getPictoForKey($key)
Return picto of export driver.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.