Qual: Centralise declaratin of external lib artichow at one location.

This commit is contained in:
Laurent Destailleur 2011-09-23 23:36:55 +00:00
parent 164ddc8b64
commit 4e302faa07
5 changed files with 119 additions and 32 deletions

View File

@ -78,7 +78,7 @@ class DolGraph
/** /**
* Constructeur * Constructor
*/ */
function DolGraph() function DolGraph()
{ {
@ -121,6 +121,10 @@ class DolGraph
/** /**
* Set Y precision
*
* @param float $which_prec
* @return string
*/ */
function SetPrecisionY($which_prec) function SetPrecisionY($which_prec)
{ {
@ -129,7 +133,9 @@ class DolGraph
} }
/** /**
* \remarks Utiliser SetNumTicks ou SetHorizTickIncrement mais pas les 2 * Utiliser SetNumTicks ou SetHorizTickIncrement mais pas les 2
*
* @param float $xi
*/ */
function SetHorizTickIncrement($xi) function SetHorizTickIncrement($xi)
{ {
@ -138,7 +144,9 @@ class DolGraph
} }
/** /**
* \remarks Utiliser SetNumTicks ou SetHorizTickIncrement mais pas les 2 * Utiliser SetNumTicks ou SetHorizTickIncrement mais pas les 2
*
* @param float $xt
*/ */
function SetNumXTicks($xt) function SetNumXTicks($xt)
{ {
@ -147,7 +155,9 @@ class DolGraph
} }
/** /**
* \brief Set label interval to reduce number of labels * Set label interval to reduce number of labels
*
* @param float $x
*/ */
function SetLabelInterval($x) function SetLabelInterval($x)
{ {
@ -156,7 +166,7 @@ class DolGraph
} }
/** /**
* \brief Hide X grid * Hide X grid
*/ */
function SetHideXGrid($bool) function SetHideXGrid($bool)
{ {
@ -165,7 +175,7 @@ class DolGraph
} }
/** /**
* \brief Hide Y grid * Hide Y grid
*/ */
function SetHideYGrid($bool) function SetHideYGrid($bool)
{ {
@ -173,78 +183,140 @@ class DolGraph
return true; return true;
} }
/**
*
* @param unknown_type $label
*/
function SetYLabel($label) function SetYLabel($label)
{ {
$this->YLabel = $label; $this->YLabel = $label;
} }
/**
*
* @param $w
*/
function SetWidth($w) function SetWidth($w)
{ {
$this->width = $w; $this->width = $w;
} }
/**
*
* @param $title
*/
function SetTitle($title) function SetTitle($title)
{ {
$this->title = $title; $this->title = $title;
} }
/**
*
* @param $data
*/
function SetData($data) function SetData($data)
{ {
$this->data = $data; $this->data = $data;
} }
/**
*
* @param $type
*/
function SetType($type) function SetType($type)
{ {
$this->type = $type; $this->type = $type;
} }
/**
*
* @param $legend
*/
function SetLegend($legend) function SetLegend($legend)
{ {
$this->Legend = $legend; $this->Legend = $legend;
} }
/**
*
* @param $legendwidthmin
*/
function SetLegendWidthMin($legendwidthmin) function SetLegendWidthMin($legendwidthmin)
{ {
$this->LegendWidthMin = $legendwidthmin; $this->LegendWidthMin = $legendwidthmin;
} }
/**
*
* @param $max
*/
function SetMaxValue($max) function SetMaxValue($max)
{ {
$this->MaxValue = $max; $this->MaxValue = $max;
} }
/**
*
*/
function GetMaxValue() function GetMaxValue()
{ {
return $this->MaxValue; return $this->MaxValue;
} }
/**
*
* @param $min
*/
function SetMinValue($min) function SetMinValue($min)
{ {
$this->MinValue = $min; $this->MinValue = $min;
} }
/**
*
*/
function GetMinValue() function GetMinValue()
{ {
return $this->MinValue; return $this->MinValue;
} }
/**
*
* @param $h
*/
function SetHeight($h) function SetHeight($h)
{ {
$this->height = $h; $this->height = $h;
} }
/**
*
* @param $s
*/
function SetShading($s) function SetShading($s)
{ {
$this->SetShading = $s; $this->SetShading = $s;
} }
/**
*
*/
function ResetBgColor() function ResetBgColor()
{ {
unset($this->bgcolor); unset($this->bgcolor);
} }
/**
*
*/
function ResetBgColorGrid() function ResetBgColorGrid()
{ {
unset($this->bgcolorgrid); unset($this->bgcolorgrid);
} }
/**
*
*/
function isGraphKo() function isGraphKo()
{ {
return $this->error; return $this->error;
@ -252,8 +324,10 @@ class DolGraph
/** /**
* \brief Definie la couleur de fond de l'image complete * Definie la couleur de fond de l'image complete
* \param bg_color array(R,G,B) ou 'onglet' ou 'default' *
* @param array $bg_color array(R,G,B) ou 'onglet' ou 'default'
* @return void
*/ */
function SetBgColor($bg_color = array(255,255,255)) function SetBgColor($bg_color = array(255,255,255))
{ {
@ -277,8 +351,9 @@ class DolGraph
} }
/** /**
* \brief Definie la couleur de fond de la grille * Definie la couleur de fond de la grille
* \param bg_colorgrid array(R,G,B) ou 'onglet' ou 'default' *
* @param array $bg_colorgrid array(R,G,B) ou 'onglet' ou 'default'
*/ */
function SetBgColorGrid($bg_colorgrid = array(255,255,255)) function SetBgColorGrid($bg_colorgrid = array(255,255,255))
{ {
@ -301,11 +376,17 @@ class DolGraph
} }
} }
/**
*
*/
function ResetDataColor() function ResetDataColor()
{ {
unset($this->datacolor); unset($this->datacolor);
} }
/**
*
*/
function GetMaxValueInData() function GetMaxValueInData()
{ {
$k = 0; $k = 0;
@ -326,6 +407,9 @@ class DolGraph
return $vals[0]; return $vals[0];
} }
/**
*
*/
function GetMinValueInData() function GetMinValueInData()
{ {
$k = 0; $k = 0;
@ -392,8 +476,10 @@ class DolGraph
} }
/** /**
* Build a graph onto disk * Build a graph onto disk using correct library
* @param file Image file name on disk *
* @param string $file Image file name on disk to generate
* @return void
*/ */
function draw($file) function draw($file)
{ {
@ -410,11 +496,14 @@ class DolGraph
/** /**
* Build a graph onto disk using Artichow library * Build a graph onto disk using Artichow library
* @param file Image file name on disk *
* @param string $file Image file name on disk to generate
* @return void
*/ */
function draw_artichow($file) private function draw_artichow($file)
{ {
global $artichow_defaultfont; global $artichow_defaultfont;
dol_syslog("DolGraph.class::draw_artichow this->type=".$this->type); dol_syslog("DolGraph.class::draw_artichow this->type=".$this->type);
if (! defined('SHADOW_RIGHT_TOP')) define('SHADOW_RIGHT_TOP',3); if (! defined('SHADOW_RIGHT_TOP')) define('SHADOW_RIGHT_TOP',3);
@ -425,7 +514,7 @@ class DolGraph
$classname=''; $classname='';
if ($this->type == 'bars') $classname='BarPlot'; if ($this->type == 'bars') $classname='BarPlot';
if ($this->type == 'lines') $classname='LinePlot'; if ($this->type == 'lines') $classname='LinePlot';
include_once DOL_DOCUMENT_ROOT."/includes/artichow/".$classname.".class.php"; include_once(ARTICHOW_PATH.$classname.".class.php");
// Definition de couleurs // Definition de couleurs
$bgcolor=new Color($this->bgcolor[0],$this->bgcolor[1],$this->bgcolor[2]); $bgcolor=new Color($this->bgcolor[0],$this->bgcolor[1],$this->bgcolor[2]);

View File

@ -181,16 +181,17 @@ define('MAIN_DB_PREFIX',$dolibarr_main_db_prefix);
* To use other version than embeded libraries, define here constant to path. Use '' to use include class path autodetect. * To use other version than embeded libraries, define here constant to path. Use '' to use include class path autodetect.
*/ */
// Path to root libraries // Path to root libraries
if (! defined('ADODB_PATH')) { define('ADODB_PATH', (!isset($dolibarr_lib_ADODB_PATH))?DOL_DOCUMENT_ROOT .'/includes/adodbtime/':(empty($dolibarr_lib_ADODB_PATH)?'':$dolibarr_lib_ADODB_PATH.'/')); } if (! defined('ADODB_PATH')) { define('ADODB_PATH', (!isset($dolibarr_lib_ADODB_PATH))?DOL_DOCUMENT_ROOT.'/includes/adodbtime/':(empty($dolibarr_lib_ADODB_PATH)?'':$dolibarr_lib_ADODB_PATH.'/')); }
if (! defined('TCPDF_PATH')) { define('TCPDF_PATH', (!isset($dolibarr_lib_TCPDF_PATH))?DOL_DOCUMENT_ROOT .'/includes/tcpdf/':(empty($dolibarr_lib_TCPDF_PATH)?'':$dolibarr_lib_TCPDF_PATH.'/')); } if (! defined('TCPDF_PATH')) { define('TCPDF_PATH', (!isset($dolibarr_lib_TCPDF_PATH))?DOL_DOCUMENT_ROOT.'/includes/tcpdf/':(empty($dolibarr_lib_TCPDF_PATH)?'':$dolibarr_lib_TCPDF_PATH.'/')); }
if (! defined('FPDFI_PATH')) { define('FPDFI_PATH', (!isset($dolibarr_lib_FPDFI_PATH))?DOL_DOCUMENT_ROOT .'/includes/fpdfi/':(empty($dolibarr_lib_FPDFI_PATH)?'':$dolibarr_lib_FPDFI_PATH.'/')); } if (! defined('FPDFI_PATH')) { define('FPDFI_PATH', (!isset($dolibarr_lib_FPDFI_PATH))?DOL_DOCUMENT_ROOT.'/includes/fpdfi/':(empty($dolibarr_lib_FPDFI_PATH)?'':$dolibarr_lib_FPDFI_PATH.'/')); }
if (! defined('NUSOAP_PATH')) { define('NUSOAP_PATH', (!isset($dolibarr_lib_NUSOAP_PATH))?DOL_DOCUMENT_ROOT .'/includes/nusoap/lib/':(empty($dolibarr_lib_NUSOAP_PATH)?'':$dolibarr_lib_NUSOAP_PATH.'/')); } if (! defined('NUSOAP_PATH')) { define('NUSOAP_PATH', (!isset($dolibarr_lib_NUSOAP_PATH))?DOL_DOCUMENT_ROOT.'/includes/nusoap/lib/':(empty($dolibarr_lib_NUSOAP_PATH)?'':$dolibarr_lib_NUSOAP_PATH.'/')); }
if (! defined('PHPEXCEL_PATH')) { define('PHPEXCEL_PATH', (!isset($dolibarr_lib_PHPEXCEL_PATH))?DOL_DOCUMENT_ROOT .'/includes/phpexcel/':(empty($dolibarr_lib_PHPEXCEL_PATH)?'':$dolibarr_lib_PHPEXCEL_PATH.'/')); } if (! defined('PHPEXCEL_PATH')) { define('PHPEXCEL_PATH', (!isset($dolibarr_lib_PHPEXCEL_PATH))?DOL_DOCUMENT_ROOT.'/includes/phpexcel/':(empty($dolibarr_lib_PHPEXCEL_PATH)?'':$dolibarr_lib_PHPEXCEL_PATH.'/')); }
if (! defined('GEOIP_PATH')) { define('GEOIP_PATH', (!isset($dolibarr_lib_GEOIP_PATH))?DOL_DOCUMENT_ROOT.'/includes/geoip/':(empty($dolibarr_lib_GEOIP_PATH)?'':$dolibarr_lib_GEOIP_PATH.'/')); } if (! defined('GEOIP_PATH')) { define('GEOIP_PATH', (!isset($dolibarr_lib_GEOIP_PATH))?DOL_DOCUMENT_ROOT.'/includes/geoip/':(empty($dolibarr_lib_GEOIP_PATH)?'':$dolibarr_lib_GEOIP_PATH.'/')); }
if (! defined('ODTPHP_PATH')) { define('ODTPHP_PATH', (!isset($dolibarr_lib_ODTPHP_PATH))?DOL_DOCUMENT_ROOT.'/includes/odtphp/':(empty($dolibarr_lib_ODTPHP_PATH)?'':$dolibarr_lib_ODTPHP_PATH.'/')); } if (! defined('ODTPHP_PATH')) { define('ODTPHP_PATH', (!isset($dolibarr_lib_ODTPHP_PATH))?DOL_DOCUMENT_ROOT.'/includes/odtphp/':(empty($dolibarr_lib_ODTPHP_PATH)?'':$dolibarr_lib_ODTPHP_PATH.'/')); }
if (! defined('ODTPHP_PATHTOPCLZIP')) { define('ODTPHP_PATHTOPCLZIP', (!isset($dolibarr_lib_ODTPHP_PATHTOPCLZIP))?DOL_DOCUMENT_ROOT.'/includes/odtphp/zip/pclzip/':(empty($dolibarr_lib_ODTPHP_PATHTOPCLZIP)?'':$dolibarr_lib_ODTPHP_PATHTOPCLZIP.'/')); } if (! defined('ODTPHP_PATHTOPCLZIP')) { define('ODTPHP_PATHTOPCLZIP', (!isset($dolibarr_lib_ODTPHP_PATHTOPCLZIP))?DOL_DOCUMENT_ROOT.'/includes/odtphp/zip/pclzip/':(empty($dolibarr_lib_ODTPHP_PATHTOPCLZIP)?'':$dolibarr_lib_ODTPHP_PATHTOPCLZIP.'/')); }
if (! defined('ARTICHOW_FONT')) { define('ARTICHOW_FONT', (!isset($dolibarr_font_DOL_DEFAULT_TTF_BOLD))?DOL_DOCUMENT_ROOT.'/includes/artichow/font':dirname($dolibarr_font_DOL_DEFAULT_TTF_BOLD)); } if (! defined('ARTICHOW_PATH')) { define('ARTICHOW_PATH', (!isset($dolibarr_lib_ARTICHOW))?DOL_DOCUMENT_ROOT.'/includes/artichow/':(empty($dolibarr_lib_ARTICHOW)?'':$dolibarr_lib_ARTICHOW.'/')); }
// Other required path // Other required path
if (! defined('ARTICHOW_FONT')) { define('ARTICHOW_FONT', (!isset($dolibarr_font_DOL_DEFAULT_TTF_BOLD))?DOL_DOCUMENT_ROOT.'/includes/artichow/font':dirname($dolibarr_font_DOL_DEFAULT_TTF_BOLD)); }
if (! defined('ARTICHOW_FONT_NAMES')) { define('ARTICHOW_FONT_NAMES', (!isset($dolibarr_font_DOL_DEFAULT_TTF_BOLD))?'Tuffy,TuffyBold,TuffyBoldItalic,TuffyItalic':'DejaVuSans,DejaVuSans-Bold,DejaVuSans-BoldOblique,DejaVuSans-Oblique'); } if (! defined('ARTICHOW_FONT_NAMES')) { define('ARTICHOW_FONT_NAMES', (!isset($dolibarr_font_DOL_DEFAULT_TTF_BOLD))?'Tuffy,TuffyBold,TuffyBoldItalic,TuffyItalic':'DejaVuSans,DejaVuSans-Bold,DejaVuSans-BoldOblique,DejaVuSans-Oblique'); }
if (! defined('DOL_DEFAULT_TTF')) { define('DOL_DEFAULT_TTF', (!isset($dolibarr_font_DOL_DEFAULT_TTF))?DOL_DOCUMENT_ROOT.'/includes/barcode/php-barcode/fonts/Aerial.ttf':(empty($dolibarr_font_DOL_DEFAULT_TTF)?'':$dolibarr_font_DOL_DEFAULT_TTF)); } if (! defined('DOL_DEFAULT_TTF')) { define('DOL_DEFAULT_TTF', (!isset($dolibarr_font_DOL_DEFAULT_TTF))?DOL_DOCUMENT_ROOT.'/includes/barcode/php-barcode/fonts/Aerial.ttf':(empty($dolibarr_font_DOL_DEFAULT_TTF)?'':$dolibarr_font_DOL_DEFAULT_TTF)); }
if (! defined('DOL_DEFAULT_TTF_BOLD')) { define('DOL_DEFAULT_TTF_BOLD', (!isset($dolibarr_font_DOL_DEFAULT_TTF_BOLD))?DOL_DOCUMENT_ROOT.'/includes/barcode/php-barcode/fonts/AerialBd.ttf':(empty($dolibarr_font_DOL_DEFAULT_TTF_BOLD)?'':$dolibarr_font_DOL_DEFAULT_TTF_BOLD)); } if (! defined('DOL_DEFAULT_TTF_BOLD')) { define('DOL_DEFAULT_TTF_BOLD', (!isset($dolibarr_font_DOL_DEFAULT_TTF_BOLD))?DOL_DOCUMENT_ROOT.'/includes/barcode/php-barcode/fonts/AerialBd.ttf':(empty($dolibarr_font_DOL_DEFAULT_TTF_BOLD)?'':$dolibarr_font_DOL_DEFAULT_TTF_BOLD)); }

View File

@ -30,13 +30,12 @@ if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC',1);
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
require_once("../main.inc.php"); require_once("../main.inc.php");
require_once DOL_DOCUMENT_ROOT.'/includes/artichow/Artichow.cfg.php'; require_once(ARTICHOW_PATH.'Artichow.cfg.php');
require_once ARTICHOW."/AntiSpam.class.php"; require_once(ARTICHOW.'/AntiSpam.class.php');
// On cree l'objet anti-spam
$object = new AntiSpam(); $object = new AntiSpam();
// La valeur affichée sur l'image aura 5 lettres // Value of image will contains 5 characters
$value=$object->setRand(5); $value=$object->setRand(5);
$object->setSize(128,36); $object->setSize(128,36);

View File

@ -338,10 +338,9 @@ if (! defined('NOLOGIN'))
// Verification security graphic code // Verification security graphic code
if (isset($_POST["username"]) && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) if (isset($_POST["username"]) && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA))
{ {
require_once DOL_DOCUMENT_ROOT.'/includes/artichow/Artichow.cfg.php'; require_once(ARTICHOW_PATH.'Artichow.cfg.php');
require_once ARTICHOW."/AntiSpam.class.php"; require_once(ARTICHOW.'/AntiSpam.class.php');
// It creates an anti-spam object
$object = new AntiSpam(); $object = new AntiSpam();
// Verifie code // Verifie code

View File

@ -82,10 +82,9 @@ if ($action == 'validatenewpassword' && $username && $passwordmd5)
// Action modif mot de passe // Action modif mot de passe
if ($action == 'buildnewpassword' && $username) if ($action == 'buildnewpassword' && $username)
{ {
require_once DOL_DOCUMENT_ROOT.'/includes/artichow/Artichow.cfg.php'; require_once(ARTICHOW_PATH.'Artichow.cfg.php');
require_once ARTICHOW."/AntiSpam.class.php"; require_once(ARTICHOW.'/AntiSpam.class.php');
// We create anti-spam object
$object = new AntiSpam(); $object = new AntiSpam();
// Verify code // Verify code