rajout des commentaires doxygen
This commit is contained in:
parent
8790860e7f
commit
5cdf2897e7
@ -1,373 +1,386 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* $Source$
|
* $Source$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Inspire de PDF_Label
|
/* Inspire de PDF_Label
|
||||||
* PDF_Label - PDF label editing
|
* PDF_Label - PDF label editing
|
||||||
* @package PDF_Label
|
* @package PDF_Label
|
||||||
* @author Laurent PASSEBECQ <lpasseb@numericable.fr>
|
* @author Laurent PASSEBECQ <lpasseb@numericable.fr>
|
||||||
* @copyright 2003 Laurent PASSEBECQ
|
* @copyright 2003 Laurent PASSEBECQ
|
||||||
* disponible ici : http://www.fpdf.org/fr/script/script29.php
|
* disponible ici : http://www.fpdf.org/fr/script/script29.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
// PDF_Label
|
// PDF_Label
|
||||||
//
|
//
|
||||||
// Classe afin d'éditer au format PDF des étiquettes
|
// Classe afin d'éditer au format PDF des étiquettes
|
||||||
// au format Avery ou personnalisé
|
// au format Avery ou personnalisé
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Copyright (C) 2003 Laurent PASSEBECQ (LPA)
|
// Copyright (C) 2003 Laurent PASSEBECQ (LPA)
|
||||||
// Basé sur les fonctions de Steve Dillon : steved@mad.scientist.com
|
// Basé sur les fonctions de Steve Dillon : steved@mad.scientist.com
|
||||||
//
|
//
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// VERSIONS :
|
// VERSIONS :
|
||||||
// 1.0 : Initial release
|
// 1.0 : Initial release
|
||||||
// 1.1 : + : Added unit in the constructor
|
// 1.1 : + : Added unit in the constructor
|
||||||
// + : Now Positions start @ (1,1).. then the first image @top-left of a page is (1,1)
|
// + : Now Positions start @ (1,1).. then the first image @top-left of a page is (1,1)
|
||||||
// + : Added in the description of a label :
|
// + : Added in the description of a label :
|
||||||
// font-size : defaut char size (can be changed by calling Set_Char_Size(xx);
|
// font-size : defaut char size (can be changed by calling Set_Char_Size(xx);
|
||||||
// paper-size : Size of the paper for this sheet (thanx to Al Canton)
|
// paper-size : Size of the paper for this sheet (thanx to Al Canton)
|
||||||
// metric : type of unit used in this description
|
// metric : type of unit used in this description
|
||||||
// You can define your label properties in inches by setting metric to 'in'
|
// You can define your label properties in inches by setting metric to 'in'
|
||||||
// and printing in millimiter by setting unit to 'mm' in constructor.
|
// and printing in millimiter by setting unit to 'mm' in constructor.
|
||||||
// Added some labels :
|
// Added some labels :
|
||||||
// 5160, 5161, 5162, 5163,5164 : thanx to Al Canton : acanton@adams-blake.com
|
// 5160, 5161, 5162, 5163,5164 : thanx to Al Canton : acanton@adams-blake.com
|
||||||
// 8600 : thanx to Kunal Walia : kunal@u.washington.edu
|
// 8600 : thanx to Kunal Walia : kunal@u.washington.edu
|
||||||
// + : Added 3mm to the position of labels to avoid errors
|
// + : Added 3mm to the position of labels to avoid errors
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
//require_once('fpdf.php');
|
//require_once('fpdf.php');
|
||||||
|
|
||||||
class PDF_card extends FPDF {
|
/*! \file PDF_card.class.php
|
||||||
|
\brief Classe afin d'éditer au format PDF des étiquettes au format Avery ou personnalisé
|
||||||
// Propriétés privées
|
\author Steve Dillon
|
||||||
var $_Avery_Name = ''; // Nom du format de l'étiquette
|
\author Laurent Passebecq
|
||||||
var $_Margin_Left = 0; // Marge de gauche de l'étiquette
|
\author Rodolphe Quiedville
|
||||||
var $_Margin_Top = 0; // marge en haut de la page avant la première étiquette
|
\author Jean Louis Bergamo.
|
||||||
var $_X_Space = 0; // Espace horizontal entre 2 bandes d'étiquettes
|
\version $Revision$
|
||||||
var $_Y_Space = 0; // Espace vertical entre 2 bandes d'étiquettes
|
*/
|
||||||
var $_X_Number = 0; // Nombre d'étiquettes sur la largeur de la page
|
|
||||||
var $_Y_Number = 0; // Nombre d'étiquettes sur la hauteur de la page
|
/*! \class PDF_card
|
||||||
var $_Width = 0; // Largeur de chaque étiquette
|
\brief Classe afin d'éditer au format PDF des étiquettes au format Avery ou personnalisé
|
||||||
var $_Height = 0; // Hauteur de chaque étiquette
|
*/
|
||||||
var $_Char_Size = 10; // Hauteur des caractères
|
|
||||||
var $_Line_Height = 10; // Hauteur par défaut d'une ligne
|
class PDF_card extends FPDF {
|
||||||
var $_Metric = 'mm'; // Type of metric.. Will help to calculate good values
|
|
||||||
var $_Metric_Doc = 'mm'; // Type of metric for the doc..
|
// Propriétés privées
|
||||||
|
var $_Avery_Name = ''; // Nom du format de l'étiquette
|
||||||
var $_COUNTX = 1;
|
var $_Margin_Left = 0; // Marge de gauche de l'étiquette
|
||||||
var $_COUNTY = 1;
|
var $_Margin_Top = 0; // marge en haut de la page avant la première étiquette
|
||||||
var $_First = 1;
|
var $_X_Space = 0; // Espace horizontal entre 2 bandes d'étiquettes
|
||||||
|
var $_Y_Space = 0; // Espace vertical entre 2 bandes d'étiquettes
|
||||||
// Listing of labels size
|
var $_X_Number = 0; // Nombre d'étiquettes sur la largeur de la page
|
||||||
var $_Avery_Labels = array (
|
var $_Y_Number = 0; // Nombre d'étiquettes sur la hauteur de la page
|
||||||
'5160'=>array('name'=>'5160',
|
var $_Width = 0; // Largeur de chaque étiquette
|
||||||
'paper-size'=>'letter',
|
var $_Height = 0; // Hauteur de chaque étiquette
|
||||||
'metric'=>'mm',
|
var $_Char_Size = 10; // Hauteur des caractères
|
||||||
'marginLeft'=>1.762,
|
var $_Line_Height = 10; // Hauteur par défaut d'une ligne
|
||||||
'marginTop'=>10.7,
|
var $_Metric = 'mm'; // Type of metric.. Will help to calculate good values
|
||||||
'NX'=>3,
|
var $_Metric_Doc = 'mm'; // Type of metric for the doc..
|
||||||
'NY'=>10,
|
|
||||||
'SpaceX'=>3.175,
|
var $_COUNTX = 1;
|
||||||
'SpaceY'=>0,
|
var $_COUNTY = 1;
|
||||||
'width'=>66.675,
|
var $_First = 1;
|
||||||
'height'=>25.4,
|
|
||||||
'font-size'=>8),
|
// Listing of labels size
|
||||||
'5161'=>array('name'=>'5161',
|
var $_Avery_Labels = array (
|
||||||
'paper-size'=>'letter',
|
'5160'=>array('name'=>'5160',
|
||||||
'metric'=>'mm',
|
'paper-size'=>'letter',
|
||||||
'marginLeft'=>0.967,
|
'metric'=>'mm',
|
||||||
'marginTop'=>10.7,
|
'marginLeft'=>1.762,
|
||||||
'NX'=>2,
|
'marginTop'=>10.7,
|
||||||
'NY'=>10,
|
'NX'=>3,
|
||||||
'SpaceX'=>3.967,
|
'NY'=>10,
|
||||||
'SpaceY'=>0,
|
'SpaceX'=>3.175,
|
||||||
'width'=>101.6,
|
'SpaceY'=>0,
|
||||||
'height'=>25.4,
|
'width'=>66.675,
|
||||||
'font-size'=>8),
|
'height'=>25.4,
|
||||||
'5162'=>array('name'=>'5162',
|
'font-size'=>8),
|
||||||
'paper-size'=>'letter',
|
'5161'=>array('name'=>'5161',
|
||||||
'metric'=>'mm',
|
'paper-size'=>'letter',
|
||||||
'marginLeft'=>0.97,
|
'metric'=>'mm',
|
||||||
'marginTop'=>20.224,
|
'marginLeft'=>0.967,
|
||||||
'NX'=>2,
|
'marginTop'=>10.7,
|
||||||
'NY'=>7,
|
'NX'=>2,
|
||||||
'SpaceX'=>4.762,
|
'NY'=>10,
|
||||||
'SpaceY'=>0,
|
'SpaceX'=>3.967,
|
||||||
'width'=>100.807,
|
'SpaceY'=>0,
|
||||||
'height'=>35.72,
|
'width'=>101.6,
|
||||||
'font-size'=>8),
|
'height'=>25.4,
|
||||||
'5163'=>array('name'=>'5163',
|
'font-size'=>8),
|
||||||
'paper-size'=>'letter',
|
'5162'=>array('name'=>'5162',
|
||||||
'metric'=>'mm',
|
'paper-size'=>'letter',
|
||||||
'marginLeft'=>1.762,
|
'metric'=>'mm',
|
||||||
'marginTop'=>10.7,
|
'marginLeft'=>0.97,
|
||||||
'NX'=>2,
|
'marginTop'=>20.224,
|
||||||
'NY'=>5,
|
'NX'=>2,
|
||||||
'SpaceX'=>3.175,
|
'NY'=>7,
|
||||||
'SpaceY'=>0,
|
'SpaceX'=>4.762,
|
||||||
'width'=>101.6,
|
'SpaceY'=>0,
|
||||||
'height'=>50.8,
|
'width'=>100.807,
|
||||||
'font-size'=>8),
|
'height'=>35.72,
|
||||||
'5164'=>array('name'=>'5164',
|
'font-size'=>8),
|
||||||
'paper-size'=>'letter',
|
'5163'=>array('name'=>'5163',
|
||||||
'metric'=>'in',
|
'paper-size'=>'letter',
|
||||||
'marginLeft'=>0.148,
|
'metric'=>'mm',
|
||||||
'marginTop'=>0.5,
|
'marginLeft'=>1.762,
|
||||||
'NX'=>2,
|
'marginTop'=>10.7,
|
||||||
'NY'=>3,
|
'NX'=>2,
|
||||||
'SpaceX'=>0.2031,
|
'NY'=>5,
|
||||||
'SpaceY'=>0,
|
'SpaceX'=>3.175,
|
||||||
'width'=>4.0,
|
'SpaceY'=>0,
|
||||||
'height'=>3.33,
|
'width'=>101.6,
|
||||||
'font-size'=>12),
|
'height'=>50.8,
|
||||||
'8600'=>array('name'=>'8600',
|
'font-size'=>8),
|
||||||
'paper-size'=>'letter',
|
'5164'=>array('name'=>'5164',
|
||||||
'metric'=>'mm',
|
'paper-size'=>'letter',
|
||||||
'marginLeft'=>7.1,
|
'metric'=>'in',
|
||||||
'marginTop'=>19,
|
'marginLeft'=>0.148,
|
||||||
'NX'=>3,
|
'marginTop'=>0.5,
|
||||||
'NY'=>10,
|
'NX'=>2,
|
||||||
'SpaceX'=>9.5,
|
'NY'=>3,
|
||||||
'SpaceY'=>3.1,
|
'SpaceX'=>0.2031,
|
||||||
'width'=>66.6,
|
'SpaceY'=>0,
|
||||||
'height'=>25.4,
|
'width'=>4.0,
|
||||||
'font-size'=>8),
|
'height'=>3.33,
|
||||||
'L7163'=>array('name'=>'L7163',
|
'font-size'=>12),
|
||||||
'paper-size'=>'A4',
|
'8600'=>array('name'=>'8600',
|
||||||
'metric'=>'mm',
|
'paper-size'=>'letter',
|
||||||
'marginLeft'=>5,
|
'metric'=>'mm',
|
||||||
'marginTop'=>15,
|
'marginLeft'=>7.1,
|
||||||
'NX'=>2,
|
'marginTop'=>19,
|
||||||
'NY'=>7,
|
'NX'=>3,
|
||||||
'SpaceX'=>25,
|
'NY'=>10,
|
||||||
'SpaceY'=>0,
|
'SpaceX'=>9.5,
|
||||||
'width'=>99.1,
|
'SpaceY'=>3.1,
|
||||||
'height'=>38.1,
|
'width'=>66.6,
|
||||||
'font-size'=>10),
|
'height'=>25.4,
|
||||||
'FREELUG'=>array('name'=>'FREELUG',
|
'font-size'=>8),
|
||||||
'paper-size'=>'A4',
|
'L7163'=>array('name'=>'L7163',
|
||||||
'metric'=>'mm',
|
'paper-size'=>'A4',
|
||||||
'marginLeft'=>0,
|
'metric'=>'mm',
|
||||||
'marginTop'=>0,
|
'marginLeft'=>5,
|
||||||
'NX'=>2,
|
'marginTop'=>15,
|
||||||
'NY'=>8,
|
'NX'=>2,
|
||||||
'SpaceX'=>0,
|
'NY'=>7,
|
||||||
'SpaceY'=>0,
|
'SpaceX'=>25,
|
||||||
'width'=>105,
|
'SpaceY'=>0,
|
||||||
'height'=>38,
|
'width'=>99.1,
|
||||||
'font-size'=>10),
|
'height'=>38.1,
|
||||||
'CARD'=>array('name'=>'CARD',
|
'font-size'=>10),
|
||||||
'paper-size'=>'A4',
|
'FREELUG'=>array('name'=>'FREELUG',
|
||||||
'metric'=>'mm',
|
'paper-size'=>'A4',
|
||||||
'marginLeft'=>15,
|
'metric'=>'mm',
|
||||||
'marginTop'=>15,
|
'marginLeft'=>0,
|
||||||
'NX'=>2,
|
'marginTop'=>0,
|
||||||
'NY'=>5,
|
'NX'=>2,
|
||||||
'SpaceX'=>0,
|
'NY'=>8,
|
||||||
'SpaceY'=>0,
|
'SpaceX'=>0,
|
||||||
'width'=>85,
|
'SpaceY'=>0,
|
||||||
'height'=>54,
|
'width'=>105,
|
||||||
'font-size'=>10,
|
'height'=>38,
|
||||||
'logo1'=>'logo1.jpg',
|
'font-size'=>10),
|
||||||
'logo2'=>'logo2.jpg',
|
'CARD'=>array('name'=>'CARD',
|
||||||
'fond'=>'fond.jpg')
|
'paper-size'=>'A4',
|
||||||
);
|
'metric'=>'mm',
|
||||||
|
'marginLeft'=>15,
|
||||||
// convert units (in to mm, mm to in)
|
'marginTop'=>15,
|
||||||
// $src and $dest must be 'in' or 'mm'
|
'NX'=>2,
|
||||||
function _Convert_Metric ($value, $src, $dest) {
|
'NY'=>5,
|
||||||
if ($src != $dest) {
|
'SpaceX'=>0,
|
||||||
$tab['in'] = 39.37008;
|
'SpaceY'=>0,
|
||||||
$tab['mm'] = 1000;
|
'width'=>85,
|
||||||
return $value * $tab[$dest] / $tab[$src];
|
'height'=>54,
|
||||||
} else {
|
'font-size'=>10,
|
||||||
return $value;
|
'logo1'=>'logo1.jpg',
|
||||||
}
|
'logo2'=>'logo2.jpg',
|
||||||
}
|
'fond'=>'fond.jpg')
|
||||||
|
);
|
||||||
// Give the height for a char size given.
|
|
||||||
function _Get_Height_Chars($pt) {
|
// convert units (in to mm, mm to in)
|
||||||
// Tableau de concordance entre la hauteur des caractères et de l'espacement entre les lignes
|
// $src and $dest must be 'in' or 'mm'
|
||||||
$_Table_Hauteur_Chars = array(6=>2, 7=>2.5, 8=>3, 9=>4, 10=>5, 11=>6, 12=>7, 13=>8, 14=>9, 15=>10);
|
function _Convert_Metric ($value, $src, $dest) {
|
||||||
if (in_array($pt, array_keys($_Table_Hauteur_Chars))) {
|
if ($src != $dest) {
|
||||||
return $_Table_Hauteur_Chars[$pt];
|
$tab['in'] = 39.37008;
|
||||||
} else {
|
$tab['mm'] = 1000;
|
||||||
return 100; // There is a prob..
|
return $value * $tab[$dest] / $tab[$src];
|
||||||
}
|
} else {
|
||||||
}
|
return $value;
|
||||||
|
}
|
||||||
function _Set_Format($format) {
|
}
|
||||||
$this->_Metric = $format['metric'];
|
|
||||||
$this->_Avery_Name = $format['name'];
|
// Give the height for a char size given.
|
||||||
$this->_Margin_Left = $this->_Convert_Metric ($format['marginLeft'], $this->_Metric, $this->_Metric_Doc);
|
function _Get_Height_Chars($pt) {
|
||||||
$this->_Margin_Top = $this->_Convert_Metric ($format['marginTop'], $this->_Metric, $this->_Metric_Doc);
|
// Tableau de concordance entre la hauteur des caractères et de l'espacement entre les lignes
|
||||||
$this->_X_Space = $this->_Convert_Metric ($format['SpaceX'], $this->_Metric, $this->_Metric_Doc);
|
$_Table_Hauteur_Chars = array(6=>2, 7=>2.5, 8=>3, 9=>4, 10=>5, 11=>6, 12=>7, 13=>8, 14=>9, 15=>10);
|
||||||
$this->_Y_Space = $this->_Convert_Metric ($format['SpaceY'], $this->_Metric, $this->_Metric_Doc);
|
if (in_array($pt, array_keys($_Table_Hauteur_Chars))) {
|
||||||
$this->_X_Number = $format['NX'];
|
return $_Table_Hauteur_Chars[$pt];
|
||||||
$this->_Y_Number = $format['NY'];
|
} else {
|
||||||
$this->_Width = $this->_Convert_Metric ($format['width'], $this->_Metric, $this->_Metric_Doc);
|
return 100; // There is a prob..
|
||||||
$this->_Height = $this->_Convert_Metric ($format['height'], $this->_Metric, $this->_Metric_Doc);
|
}
|
||||||
$this->Set_Char_Size( $format['font-size']);
|
}
|
||||||
}
|
|
||||||
|
function _Set_Format($format) {
|
||||||
function PDF_card ($format, $posX=1, $posY=1, $unit='mm') {
|
$this->_Metric = $format['metric'];
|
||||||
if (is_array($format)) {
|
$this->_Avery_Name = $format['name'];
|
||||||
// Si c'est un format personnel alors on maj les valeurs
|
$this->_Margin_Left = $this->_Convert_Metric ($format['marginLeft'], $this->_Metric, $this->_Metric_Doc);
|
||||||
$Tformat = $format;
|
$this->_Margin_Top = $this->_Convert_Metric ($format['marginTop'], $this->_Metric, $this->_Metric_Doc);
|
||||||
} else {
|
$this->_X_Space = $this->_Convert_Metric ($format['SpaceX'], $this->_Metric, $this->_Metric_Doc);
|
||||||
// Si c'est un format avery on stocke le nom de ce format selon la norme Avery.
|
$this->_Y_Space = $this->_Convert_Metric ($format['SpaceY'], $this->_Metric, $this->_Metric_Doc);
|
||||||
// Permettra d'aller récupérer les valeurs dans le tableau _Avery_Labels
|
$this->_X_Number = $format['NX'];
|
||||||
$Tformat = $this->_Avery_Labels[$format];
|
$this->_Y_Number = $format['NY'];
|
||||||
}
|
$this->_Width = $this->_Convert_Metric ($format['width'], $this->_Metric, $this->_Metric_Doc);
|
||||||
|
$this->_Height = $this->_Convert_Metric ($format['height'], $this->_Metric, $this->_Metric_Doc);
|
||||||
parent::FPDF('P', $unit, $Tformat['paper-size']);
|
$this->Set_Char_Size( $format['font-size']);
|
||||||
$this->SetMargins(0,0);
|
}
|
||||||
$this->SetAutoPageBreak(false);
|
|
||||||
|
function PDF_card ($format, $posX=1, $posY=1, $unit='mm') {
|
||||||
$this->_Metric_Doc = $unit;
|
if (is_array($format)) {
|
||||||
// Permet de commencer l'impression à l'étiquette désirée dans le cas où la page a déjà servie
|
// Si c'est un format personnel alors on maj les valeurs
|
||||||
if ($posX > 0) $posX--; else $posX=0;
|
$Tformat = $format;
|
||||||
if ($posY > 0) $posY--; else $posY=0;
|
} else {
|
||||||
$this->_COUNTX = $posX;
|
// Si c'est un format avery on stocke le nom de ce format selon la norme Avery.
|
||||||
$this->_COUNTY = $posY;
|
// Permettra d'aller récupérer les valeurs dans le tableau _Avery_Labels
|
||||||
$this->_Set_Format($Tformat);
|
$Tformat = $this->_Avery_Labels[$format];
|
||||||
}
|
}
|
||||||
|
|
||||||
//Méthode qui permet de modifier la taille des caractères
|
parent::FPDF('P', $unit, $Tformat['paper-size']);
|
||||||
// Cela modiera aussi l'espace entre chaque ligne
|
$this->SetMargins(0,0);
|
||||||
function Set_Char_Size($pt) {
|
$this->SetAutoPageBreak(false);
|
||||||
if ($pt > 3) {
|
|
||||||
$this->_Char_Size = $pt;
|
$this->_Metric_Doc = $unit;
|
||||||
$this->_Line_Height = $this->_Get_Height_Chars($pt);
|
// Permet de commencer l'impression à l'étiquette désirée dans le cas où la page a déjà servie
|
||||||
$this->SetFont('Arial','',$pt);
|
if ($posX > 0) $posX--; else $posX=0;
|
||||||
}
|
if ($posY > 0) $posY--; else $posY=0;
|
||||||
}
|
$this->_COUNTX = $posX;
|
||||||
|
$this->_COUNTY = $posY;
|
||||||
// On imprime une étiqette
|
$this->_Set_Format($Tformat);
|
||||||
function Add_PDF_card($texte,$header='',$footer='') {
|
}
|
||||||
// We are in a new page, then we must add a page
|
|
||||||
if (($this->_COUNTX ==0) and ($this->_COUNTY==0) and (!$this->_First==1)) {
|
//Méthode qui permet de modifier la taille des caractères
|
||||||
$this->AddPage();
|
// Cela modiera aussi l'espace entre chaque ligne
|
||||||
}
|
function Set_Char_Size($pt) {
|
||||||
$this->_First=0;
|
if ($pt > 3) {
|
||||||
$_PosX = $this->_Margin_Left+($this->_COUNTX*($this->_Width+$this->_X_Space));
|
$this->_Char_Size = $pt;
|
||||||
$_PosY = $this->_Margin_Top+($this->_COUNTY*($this->_Height+$this->_Y_Space));
|
$this->_Line_Height = $this->_Get_Height_Chars($pt);
|
||||||
|
$this->SetFont('Arial','',$pt);
|
||||||
if ($this->_Avery_Name == "CARD") {
|
}
|
||||||
$Tformat=$this->_Avery_Labels["CARD"];
|
}
|
||||||
//$this->_Pointille($_PosX,$_PosY,$_PosX+$this->_Width,$_PosY+$this->_Height,0.3,25);
|
|
||||||
$this->_Croix($_PosX,$_PosY,$_PosX+$this->_Width,$_PosY+$this->_Height,0.3,10);
|
// On imprime une étiqette
|
||||||
if($Tformat['fond'] != '' and file_exists($Tformat['fond'])){
|
function Add_PDF_card($texte,$header='',$footer='') {
|
||||||
$this->image($Tformat['fond'],$_PosX,$_PosY,$this->_Width,$this->_Height);
|
// We are in a new page, then we must add a page
|
||||||
}
|
if (($this->_COUNTX ==0) and ($this->_COUNTY==0) and (!$this->_First==1)) {
|
||||||
if($Tformat['logo1'] != '' and file_exists($Tformat['logo1'])){
|
$this->AddPage();
|
||||||
$this->image($Tformat['logo1'],$_PosX+$this->_Width-21,$_PosY+1,20,20);
|
}
|
||||||
}
|
$this->_First=0;
|
||||||
if($Tformat['logo2'] != '' and file_exists($Tformat['logo2'])){
|
$_PosX = $this->_Margin_Left+($this->_COUNTX*($this->_Width+$this->_X_Space));
|
||||||
$this->image($Tformat['logo2'],$_PosX+$this->_Width-21,$_PosY+25,20,20);
|
$_PosY = $this->_Margin_Top+($this->_COUNTY*($this->_Height+$this->_Y_Space));
|
||||||
}
|
|
||||||
|
if ($this->_Avery_Name == "CARD") {
|
||||||
//$this->image('logo1.jpg',$_PosX+$this->_Width-21,$_PosY+1,20);
|
$Tformat=$this->_Avery_Labels["CARD"];
|
||||||
if ($header!=''){
|
//$this->_Pointille($_PosX,$_PosY,$_PosX+$this->_Width,$_PosY+$this->_Height,0.3,25);
|
||||||
$this->SetXY($_PosX, $_PosY+1);
|
$this->_Croix($_PosX,$_PosY,$_PosX+$this->_Width,$_PosY+$this->_Height,0.3,10);
|
||||||
$this->Cell($this->_Width, $this->_Line_Height,$header,0,1,'C');
|
if($Tformat['fond'] != '' and file_exists($Tformat['fond'])){
|
||||||
}
|
$this->image($Tformat['fond'],$_PosX,$_PosY,$this->_Width,$this->_Height);
|
||||||
$this->SetXY($_PosX+3, $_PosY+3+$this->_Line_Height);
|
}
|
||||||
$this->MultiCell($this->_Width, $this->_Line_Height, $texte);
|
if($Tformat['logo1'] != '' and file_exists($Tformat['logo1'])){
|
||||||
if ($footer!=''){
|
$this->image($Tformat['logo1'],$_PosX+$this->_Width-21,$_PosY+1,20,20);
|
||||||
$this->SetXY($_PosX, $_PosY+$this->_Height-$this->_Line_Height-1);
|
}
|
||||||
$this->Cell($this->_Width, $this->_Line_Height,$footer,0,1,'C');
|
if($Tformat['logo2'] != '' and file_exists($Tformat['logo2'])){
|
||||||
}
|
$this->image($Tformat['logo2'],$_PosX+$this->_Width-21,$_PosY+25,20,20);
|
||||||
|
}
|
||||||
}else{
|
|
||||||
$this->SetXY($_PosX+3, $_PosY+3);
|
//$this->image('logo1.jpg',$_PosX+$this->_Width-21,$_PosY+1,20);
|
||||||
$this->MultiCell($this->_Width, $this->_Line_Height, $texte);
|
if ($header!=''){
|
||||||
}
|
$this->SetXY($_PosX, $_PosY+1);
|
||||||
$this->_COUNTY++;
|
$this->Cell($this->_Width, $this->_Line_Height,$header,0,1,'C');
|
||||||
|
}
|
||||||
if ($this->_COUNTY == $this->_Y_Number) {
|
$this->SetXY($_PosX+3, $_PosY+3+$this->_Line_Height);
|
||||||
// Si on est en bas de page, on remonte le 'curseur' de position
|
$this->MultiCell($this->_Width, $this->_Line_Height, $texte);
|
||||||
$this->_COUNTX++;
|
if ($footer!=''){
|
||||||
$this->_COUNTY=0;
|
$this->SetXY($_PosX, $_PosY+$this->_Height-$this->_Line_Height-1);
|
||||||
}
|
$this->Cell($this->_Width, $this->_Line_Height,$footer,0,1,'C');
|
||||||
|
}
|
||||||
if ($this->_COUNTX == $this->_X_Number) {
|
|
||||||
// Si on est en bout de page, alors on repart sur une nouvelle page
|
}else{
|
||||||
$this->_COUNTX=0;
|
$this->SetXY($_PosX+3, $_PosY+3);
|
||||||
$this->_COUNTY=0;
|
$this->MultiCell($this->_Width, $this->_Line_Height, $texte);
|
||||||
}
|
}
|
||||||
}
|
$this->_COUNTY++;
|
||||||
|
|
||||||
function _Pointille($x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$nbPointilles=15)
|
if ($this->_COUNTY == $this->_Y_Number) {
|
||||||
{
|
// Si on est en bas de page, on remonte le 'curseur' de position
|
||||||
$this->SetLineWidth($epaisseur);
|
$this->_COUNTX++;
|
||||||
$longueur=abs($x1-$x2);
|
$this->_COUNTY=0;
|
||||||
$hauteur=abs($y1-$y2);
|
}
|
||||||
if($longueur>$hauteur) {
|
|
||||||
$Pointilles=($longueur/$nbPointilles)/2; // taille des pointilles
|
if ($this->_COUNTX == $this->_X_Number) {
|
||||||
}
|
// Si on est en bout de page, alors on repart sur une nouvelle page
|
||||||
else {
|
$this->_COUNTX=0;
|
||||||
$Pointilles=($hauteur/$nbPointilles)/2;
|
$this->_COUNTY=0;
|
||||||
}
|
}
|
||||||
for($i=$x1;$i<=$x2;$i+=$Pointilles+$Pointilles) {
|
}
|
||||||
for($j=$i;$j<=($i+$Pointilles);$j++) {
|
|
||||||
if($j<=($x2-1)) {
|
function _Pointille($x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$nbPointilles=15)
|
||||||
$this->Line($j,$y1,$j+1,$y1); // on trace le pointill? du haut, point par point
|
{
|
||||||
$this->Line($j,$y2,$j+1,$y2); // on trace le pointill? du bas, point par point
|
$this->SetLineWidth($epaisseur);
|
||||||
}
|
$longueur=abs($x1-$x2);
|
||||||
}
|
$hauteur=abs($y1-$y2);
|
||||||
}
|
if($longueur>$hauteur) {
|
||||||
for($i=$y1;$i<=$y2;$i+=$Pointilles+$Pointilles) {
|
$Pointilles=($longueur/$nbPointilles)/2; // taille des pointilles
|
||||||
for($j=$i;$j<=($i+$Pointilles);$j++) {
|
}
|
||||||
if($j<=($y2-1)) {
|
else {
|
||||||
$this->Line($x1,$j,$x1,$j+1); // on trace le pointill? du haut, point par point
|
$Pointilles=($hauteur/$nbPointilles)/2;
|
||||||
$this->Line($x2,$j,$x2,$j+1); // on trace le pointill? du bas, point par point
|
}
|
||||||
}
|
for($i=$x1;$i<=$x2;$i+=$Pointilles+$Pointilles) {
|
||||||
}
|
for($j=$i;$j<=($i+$Pointilles);$j++) {
|
||||||
}
|
if($j<=($x2-1)) {
|
||||||
}
|
$this->Line($j,$y1,$j+1,$y1); // on trace le pointill? du haut, point par point
|
||||||
|
$this->Line($j,$y2,$j+1,$y2); // on trace le pointill? du bas, point par point
|
||||||
/*
|
}
|
||||||
* Fonction realisant une croix aux 4 coins des cartes
|
}
|
||||||
*/
|
}
|
||||||
function _Croix($x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$taille=5)
|
for($i=$y1;$i<=$y2;$i+=$Pointilles+$Pointilles) {
|
||||||
{
|
for($j=$i;$j<=($i+$Pointilles);$j++) {
|
||||||
$this->SetLineWidth($epaisseur);
|
if($j<=($y2-1)) {
|
||||||
$lg=$taille/2;
|
$this->Line($x1,$j,$x1,$j+1); // on trace le pointill? du haut, point par point
|
||||||
// croix haut gauche
|
$this->Line($x2,$j,$x2,$j+1); // on trace le pointill? du bas, point par point
|
||||||
$this->Line($x1,$y1-$lg,$x1,$y1+$lg);
|
}
|
||||||
$this->Line($x1-$lg,$y1,$x1+$lg,$y1);
|
}
|
||||||
// croix bas gauche
|
}
|
||||||
$this->Line($x1,$y2-$lg,$x1,$y2+$lg);
|
}
|
||||||
$this->Line($x1-$lg,$y2,$x1+$lg,$y2);
|
|
||||||
// croix haut droit
|
/*
|
||||||
$this->Line($x2,$y1-$lg,$x2,$y1+$lg);
|
* Fonction realisant une croix aux 4 coins des cartes
|
||||||
$this->Line($x2-$lg,$y1,$x2+$lg,$y1);
|
*/
|
||||||
// croix bas droit
|
function _Croix($x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$taille=5)
|
||||||
$this->Line($x2,$y2-$lg,$x2,$y2+$lg);
|
{
|
||||||
$this->Line($x2-$lg,$y2,$x2+$lg,$y2);
|
$this->SetLineWidth($epaisseur);
|
||||||
|
$lg=$taille/2;
|
||||||
}
|
// croix haut gauche
|
||||||
}
|
$this->Line($x1,$y1-$lg,$x1,$y1+$lg);
|
||||||
?>
|
$this->Line($x1-$lg,$y1,$x1+$lg,$y1);
|
||||||
|
// croix bas gauche
|
||||||
|
$this->Line($x1,$y2-$lg,$x1,$y2+$lg);
|
||||||
|
$this->Line($x1-$lg,$y2,$x1+$lg,$y2);
|
||||||
|
// croix haut droit
|
||||||
|
$this->Line($x2,$y1-$lg,$x2,$y1+$lg);
|
||||||
|
$this->Line($x2-$lg,$y1,$x2+$lg,$y1);
|
||||||
|
// croix bas droit
|
||||||
|
$this->Line($x2,$y2-$lg,$x2,$y2+$lg);
|
||||||
|
$this->Line($x2-$lg,$y2,$x2+$lg,$y2);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|||||||
@ -20,6 +20,16 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*! \file auteur.class.php
|
||||||
|
\brief Classe permettant de gèrer des auteurs
|
||||||
|
\author Rodolphe Quideville
|
||||||
|
\version $Revision$
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \class Auteur
|
||||||
|
\brief Classe permettant de gèrer des auteurs
|
||||||
|
*/
|
||||||
|
|
||||||
class Auteur {
|
class Auteur {
|
||||||
var $db ;
|
var $db ;
|
||||||
|
|
||||||
@ -29,33 +39,36 @@ class Auteur {
|
|||||||
Function Auteur($DB, $id=0) {
|
Function Auteur($DB, $id=0) {
|
||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
$this->id = $id ;
|
$this->id = $id ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Function create($user) {
|
|
||||||
|
Function create($user) {
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."auteur (fk_user_author) VALUES (".$user->id.")";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."auteur (fk_user_author) VALUES (".$user->id.")";
|
||||||
|
|
||||||
if ($this->db->query($sql) )
|
if ($this->db->query($sql) )
|
||||||
{
|
{
|
||||||
$id = $this->db->last_insert_id();
|
$id = $this->db->last_insert_id();
|
||||||
|
|
||||||
if ( $this->update($id, $user) )
|
if ( $this->update($id, $user) )
|
||||||
{
|
{
|
||||||
return $id;
|
return $id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Function liste_array ()
|
|
||||||
|
Function liste_array ()
|
||||||
{
|
{
|
||||||
$ga = array();
|
$ga = array();
|
||||||
|
|
||||||
@ -64,14 +77,14 @@ class Auteur {
|
|||||||
if ($this->db->query($sql) )
|
if ($this->db->query($sql) )
|
||||||
{
|
{
|
||||||
$nump = $this->db->num_rows();
|
$nump = $this->db->num_rows();
|
||||||
|
|
||||||
if ($nump)
|
if ($nump)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $nump)
|
while ($i < $nump)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($i);
|
$obj = $this->db->fetch_object($i);
|
||||||
|
|
||||||
$ga[$obj->rowid] = $obj->nom;
|
$ga[$obj->rowid] = $obj->nom;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -82,14 +95,15 @@ class Auteur {
|
|||||||
{
|
{
|
||||||
print $this->db->error();
|
print $this->db->error();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Function update($id, $user)
|
|
||||||
|
Function update($id, $user)
|
||||||
{
|
{
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."auteur ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."auteur ";
|
||||||
@ -103,12 +117,14 @@ class Auteur {
|
|||||||
print $this->db->error() . ' in ' . $sql;
|
print $this->db->error() . ' in ' . $sql;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
|
/*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Function liste_livre($id_type='', $status=0)
|
|
||||||
|
Function liste_livre($id_type='', $status=0)
|
||||||
{
|
{
|
||||||
$ga = array();
|
$ga = array();
|
||||||
if ($id_type == 'oscid')
|
if ($id_type == 'oscid')
|
||||||
@ -130,14 +146,14 @@ class Auteur {
|
|||||||
if ($this->db->query($sql) )
|
if ($this->db->query($sql) )
|
||||||
{
|
{
|
||||||
$nump = $this->db->num_rows();
|
$nump = $this->db->num_rows();
|
||||||
|
|
||||||
if ($nump)
|
if ($nump)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $nump)
|
while ($i < $nump)
|
||||||
{
|
{
|
||||||
$row = $this->db->fetch_row($i);
|
$row = $this->db->fetch_row($i);
|
||||||
|
|
||||||
$ga[$row[0]] = $row[1];
|
$ga[$row[0]] = $row[1];
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -147,15 +163,17 @@ class Auteur {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $this->db->error();
|
print $this->db->error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
|
/*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Function fetch ($id) {
|
|
||||||
|
Function fetch ($id) {
|
||||||
|
|
||||||
$sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."auteur WHERE rowid = $id";
|
$sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."auteur WHERE rowid = $id";
|
||||||
|
|
||||||
$result = $this->db->query($sql) ;
|
$result = $this->db->query($sql) ;
|
||||||
@ -166,14 +184,14 @@ class Auteur {
|
|||||||
|
|
||||||
$this->id = $result["rowid"];
|
$this->id = $result["rowid"];
|
||||||
$this->nom = stripslashes($result["nom"]);
|
$this->nom = stripslashes($result["nom"]);
|
||||||
|
|
||||||
$this->db->free();
|
$this->db->free();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $this->db->error();
|
print $this->db->error();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +200,8 @@ class Auteur {
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Function delete() {
|
|
||||||
|
Function delete() {
|
||||||
|
|
||||||
$livres = $this->liste_livre();
|
$livres = $this->liste_livre();
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,16 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*! \file Client.class.php
|
||||||
|
\brief Classe permettant de gèrer des clients de la boutique online
|
||||||
|
\author Rodolphe Quiedeville
|
||||||
|
\version $Revision$
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \class Client
|
||||||
|
\brief Classe permettant de gèrer des clients de la boutique online
|
||||||
|
*/
|
||||||
|
|
||||||
class Client {
|
class Client {
|
||||||
var $db ;
|
var $db ;
|
||||||
|
|
||||||
@ -29,12 +39,13 @@ class Client {
|
|||||||
Function Client($DB, $id=0) {
|
Function Client($DB, $id=0) {
|
||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
$this->id = $id ;
|
$this->id = $id ;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
*
|
/*!
|
||||||
*
|
\brief fonction permettant de recupèrer les informations d'un clients de la boutique
|
||||||
*
|
\param id id du client
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Function fetch ($id) {
|
Function fetch ($id) {
|
||||||
|
|
||||||
$sql = "SELECT customers_id, customers_lastname, customers_firstname FROM ".DB_NAME_OSC.".customers WHERE customers_id = $id";
|
$sql = "SELECT customers_id, customers_lastname, customers_firstname FROM ".DB_NAME_OSC.".customers WHERE customers_id = $id";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user