dolibarr/htdocs/includes/modules/export/modules_export.php

153 lines
3.5 KiB
PHP
Raw Normal View History

2006-01-08 18:08:20 +01:00
<?php
/* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
2007-11-01 21:39:36 +01:00
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
2006-01-08 18:08:20 +01:00
*
* 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.
* or see http://www.gnu.org/
*/
/**
2009-03-25 22:26:15 +01:00
* \file htdocs/includes/modules/export/modules_export.php
* \ingroup export
* \brief File of parent class for export modules
* \version $Id$
2008-10-28 21:05:23 +01:00
*/
2006-01-08 18:08:20 +01:00
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
2007-09-13 20:10:51 +02:00
2006-01-08 18:08:20 +01:00
/**
2009-03-25 22:26:15 +01:00
* \class ModeleExports
* \brief Parent class for export modules
2008-10-28 21:05:23 +01:00
*/
2006-01-08 18:08:20 +01:00
class ModeleExports
{
2008-10-28 21:05:23 +01:00
var $error='';
2009-03-25 22:26:15 +01:00
var $driverlabel=array();
var $driverversion=array();
2008-10-28 21:05:23 +01:00
2009-03-25 22:26:15 +01:00
var $liblabel=array();
var $libversion=array();
2008-10-28 21:05:23 +01:00
/**
* \brief Constructeur
*/
function ModeleExports()
{
}
/**
2009-03-25 22:26:15 +01:00
* \brief Charge en memoire et renvoie la liste des modeles actifs
2008-10-28 21:05:23 +01:00
* \param db Handler de base
*/
function liste_modeles($db)
{
dol_syslog("ModeleExport::liste_modeles");
2008-10-28 21:05:23 +01:00
$dir=DOL_DOCUMENT_ROOT."/includes/modules/export/";
$handle=opendir($dir);
// Recherche des fichiers drivers exports disponibles
$var=True;
$i=0;
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (preg_match("/^export_(.*)\.modules\.php$/i",$file,$reg))
{
$moduleid=$reg[1];
// Chargement de la classe
$file = $dir."/export_".$moduleid.".modules.php";
$classname = "Export".ucfirst($moduleid);
require_once($file);
$module = new $classname($db);
// Picto
$this->picto[$module->id]=$module->picto;
// Driver properties
$this->driverlabel[$module->id]=$module->getDriverLabel();
$this->driverdesc[$module->id]=$module->getDriverDesc();
$this->driverversion[$module->id]=$module->getDriverVersion();
// If use an external lib
$this->liblabel[$module->id]=$module->getLibLabel();
$this->libversion[$module->id]=$module->getLibVersion();
$i++;
}
}
closedir($handle);
}
return $this->driverlabel;
2008-10-28 21:05:23 +01:00
}
2009-05-19 02:14:27 +02:00
/**
* \brief Return picto of export driver
*/
function getPicto($key)
{
return $this->picto[$key];
}
2008-10-28 21:05:23 +01:00
/**
* \brief Renvoi libelle d'un driver export
*/
function getDriverLabel($key)
{
return $this->driverlabel[$key];
}
2009-09-28 22:06:15 +02:00
/**
* \brief Renvoi le descriptif d'un driver export
*/
function getDriverDesc($key)
{
return $this->driverdesc[$key];
}
2008-10-28 21:05:23 +01:00
/**
* \brief Renvoi version d'un driver export
*/
function getDriverVersion($key)
{
return $this->driverversion[$key];
}
/**
* \brief Renvoi libelle de librairie externe du driver
*/
function getLibLabel($key)
{
return $this->liblabel[$key];
}
/**
* \brief Renvoi version de librairie externe du driver
*/
function getLibVersion($key)
{
return $this->libversion[$key];
}
2006-01-08 18:08:20 +01:00
}
?>