/web/acc/manager/htdocs/vouchers_new.php |
---|
0,0 → 1,316 |
<?php |
// for developpement purpose |
// CONST ROOT = "C:/Serveurs/Alcasar-mageia/"; |
CONST ROOT = "/"; |
require_once(ROOT.'var/www/html/acc/manager/lib/alcasar/ticketspdf.class.php'); |
/* |
TODO : |
- refonte de GenRandUsersName() |
- traiter si $nbfailuser (nombre de ticket non créé pour cause de doublon) |
*/ |
// POUR LES BESOINS DU DEVELOPPEMENT |
// BUFFERISATION DES DONNEES ENVOYEES AU CLIENT (compatibilité avec les fichiers existants) |
ob_start(); |
//Common Functions |
function sec_imp($time) |
/* Formatage des secondes avant l'impression */ |
{ |
$heure=0;$minute=0;$seconde=0; |
$heure = floor($time/3600); |
$reste = $time%3600; |
if ($heure!=0) $result = $heure.' H '; |
$minute = floor($reste/60); |
if ($minute!=0) $result = $result.$minute.' min '; |
$seconde = $reste%60; |
if ($seconde!=0) $result = $result.$seconde.' s '; |
return $result; |
} |
function GenPassword($nb_car="8") |
{ |
/* generation aléatoire du mot de passe */ |
$password = ""; |
$chaine = "aAzZeErRtTyYuUIopP152346897mMLkK"; |
$chaine .= "jJhHgGfFdDsSqQwWxXcCvVbBnN152346897"; |
while($nb_car != 0) |
{ |
$i = rand(0,71); |
$password = $password.$chaine[$i]; |
$nb_car --; |
} |
return $password ; |
} |
function GenRandUsersName() |
{ |
$nb_car= 12; |
$chaine = "AZE489RTYU2PML5KJ35HGF9DSQWXCV3BN267"; |
//$i = rand(0,25); |
//$j = rand(0,25); |
//$k = rand(0,25); |
$userName = ""; |
while($nb_car != 0) |
{ |
$i = rand(0,35); |
$userName .= $chaine[$i]; |
$nb_car --; |
} |
//return "T".$chaine[$i].substr(time(),4).$chaine[$j].$chaine[$k]; |
return $userName; |
} |
if (isset($_POST['nbtickets'])&& is_numeric($_POST['nbtickets'])){ |
$nbtickets = (int)$_POST['nbtickets']; |
} else { |
header("Location: voucher_new.php"); |
exit; |
} |
// Gestion de la langue |
// if (is_file("../lib/langues.php")) |
// include("../lib/langues.php"); |
// Langue du Ticket d'impression en fonction de la liste déroulante |
if (isset($_POST["langue_imp"])) { $langue_imp = $_POST["langue_imp"]; } else { $langue_imp = "en"; }; |
switch ($langue_imp){ |
case 'fr': |
$l_title_imp = "TICKET D'ACCÈS INTERNET"; |
$l_footer_imp = "Généré par ALCASAR"; |
//$l_explain1_imp = "Entrer 'alcasar' dans votre navigateur pour gérer votre compte (mot de passe, certificat, etc.)."; |
//$l_explain2_imp = "Entrer 'logout' dans votre navigateur pour vous déconnecter."; |
$l_explain = "Entrer 'alcasar' dans votre navigateur pour gérer votre compte |
(mot de passe, certificat, etc.). |
Entrer 'logout' dans votre navigateur pour vous déconnecter."; |
$l_login_imp = "Utilisateur :"; |
$l_password_imp = "Mot de passe :"; |
$l_max_all_session_imp="Durée totale autorisée :"; |
$l_session_timeout_imp="Durée d'une session :"; |
$l_max_daily_session_imp="Durée journalière :"; |
$l_max_monthly_session_imp ="Durée mensuelle :"; |
$l_expiration_imp="Date d'expiration :"; |
$l_unlimited="Illimitée"; |
$l_without="Aucune"; |
break; |
case 'de': |
$l_title_imp = "INTERNETZUGANG TICKET"; |
$l_footer_imp = "Präsentiert von ALCASAR"; |
//$l_explain1_imp = "Geben Sie 'Alcasar' in Ihrem Browser, um Ihr Konto zu verwalten (kennwort, zertifikat, etc.)."; |
//$l_explain2_imp = "Geben Sie 'logout' in Ihrem Browser zu trennen."; |
$l_explain = "Geben Sie 'Alcasar' in Ihrem Browser, um Ihr Konto zu verwalten (kennwort, zertifikat, etc.). |
Geben Sie 'logout' in Ihrem Browser zu trennen. |
"; |
$l_login_imp = "Login :"; |
$l_password_imp = "Passwort :"; |
$l_max_all_session_imp="Maximale erlaubt Dauer :"; |
$l_session_timeout_imp="Dauer der Sitzung :"; |
$l_max_daily_session_imp="Stunden täglich :"; |
$l_max_monthly_session_imp ="monatlich Dauer :"; |
$l_expiration_imp="Verfallsdatum :"; |
$l_unlimited="Unbegrentz"; |
$l_without="Ohne"; |
break; |
case 'nl': |
$l_title_imp = "ONTVANGST INTERNET"; |
$l_footer_imp = "Powered by ALCASAR"; |
//$l_explain1_imp = "Voer 'Alcasar' in uw browser om uw account te beheren (wachtwoord, certificaat, etc.)."; |
//$l_explain2_imp = "Voer 'logout' in uw browser de verbinding te verbreken."; |
$l_explain = "Voer 'Alcasar' in uw browser om uw account te beheren (wachtwoord, certificaat, etc.). |
Voer 'logout' in uw browser de verbinding te verbreken."; |
$l_login_imp = "Gebruikers :"; |
$l_password_imp = "Wachtwoord :"; |
$l_max_all_session_imp="Totaal toegestane tijd :"; |
$l_session_timeout_imp="Sessieduur :"; |
$l_max_daily_session_imp="Dagelijkse uren :"; |
$l_max_monthly_session_imp ="Maandelijkse duur :"; |
$l_expiration_imp="Vervaldatum :"; |
$l_unlimited="Onbeperkte"; |
$l_without="Ohne"; |
break; |
case 'es': |
$l_title_imp = "BONO INTERNET"; |
$l_footer_imp = "Desarrollado por ALCASAR"; |
//$l_explain1_imp = "Escribe 'Alcasar' de su navegador para administrar su cuenta (contraseña, certificado, etc.)."; |
//$l_explain2_imp = "Escribe 'logout' de su navegador para desconectar."; |
$l_explain = "Escribe 'Alcasar' de su navegador para administrar su cuenta (contraseña, certificado, etc.). |
Escribe 'logout' de su navegador para desconectar."; |
$l_login_imp = "Usuario :"; |
$l_password_imp = "Contraseña :"; |
$l_max_all_session_imp="Tiempo total permitido :"; |
$l_session_timeout_imp="Duraciôn de Sesiôn :"; |
$l_max_daily_session_imp="Horas diarias :"; |
$l_max_monthly_session_imp ="Duraciôn mensual :"; |
$l_expiration_imp="Fecha de caducidad :"; |
$l_unlimited="Ilimitado"; |
$l_without="Sin"; |
break; |
case 'it': |
$l_title_imp = "RICEVIMENTO INTERNET"; |
$l_footer_imp = "Powered by ALCASAR"; |
//$l_explain1_imp = "Inserisci 'alcasar' nel tuo browser per gestire il tuo account (password, certificato, ecc)."; |
//$l_explain2_imp = "Inserisci 'logout' nel tuo browser per disconnettersi."; |
$l_explain = "Inserisci 'alcasar' nel tuo browser per gestire il tuo account (password, certificato, ecc). |
Inserisci 'logout' nel tuo browser per disconnettersi."; |
$l_login_imp = "Utenti :"; |
$l_password_imp = "Password :"; |
$l_max_all_session_imp="Tempo totale consentito:"; |
$l_session_timeout_imp="Durata della sessione :"; |
$l_max_daily_session_imp="Ore giornaliere :"; |
$l_max_monthly_session_imp ="Durata mensile :"; |
$l_expiration_imp="Data di scadenza :"; |
$l_unlimited="Illimitato"; |
$l_without="Senza"; |
break; |
case 'pt': |
$l_title_imp = "BILHETE DE ACESSO À INTERNET"; |
$l_footer_imp = "Desenvolvido por ALCASAR"; |
//$l_explain1_imp = "Digite 'Alcasar' no seu navegador para gerenciar sua conta (senha, certidão, etc)."; |
//$l_explain2_imp = "Digite 'logout' no seu navegador para desligar."; |
$l_explain = "Digite 'Alcasar' no seu navegador para gerenciar sua conta (senha, certidão, etc). |
Digite 'logout' no seu navegador para desligar."; |
$l_login_imp = "Usuário :"; |
$l_password_imp = "Senha :"; |
$l_max_all_session_imp="Tempo máximo de toda conexão :"; |
$l_session_timeout_imp="Fim da conexão :"; |
$l_max_daily_session_imp="Conexão máxima diária :"; |
$l_max_monthly_session_imp ="MConexão máxima mensal :"; |
$l_expiration_imp="Data de vencimento :"; |
$l_unlimited="Ilimitado"; |
$l_without="Sem"; |
break; |
default: |
$l_title_imp = "INTERNET ACCESS TICKET"; |
$l_footer_imp = "Powered by ALCASAR"; |
$l_explain1_imp = "Enter 'alcasar' in your browser to manage your account (password, certificate, etc.)."; |
$l_explain2_imp = "Enter 'logout' in your browser to disconnect."; |
$l_explain = "Enter 'alcasar' in your browser to manage your account (password, certificate, etc.). |
Enter 'logout' in your browser to disconnect."; |
$l_login_imp = "Login :"; |
$l_password_imp = "Password :"; |
$l_max_all_session_imp="Total time allowed :"; |
$l_session_timeout_imp="Session timeout :"; |
$l_max_daily_session_imp="Max daily session :"; |
$l_max_monthly_session_imp ="Max monthly session :"; |
$l_expiration_imp="Expiration date :"; |
$l_unlimited="Unlimited"; |
$l_without="Without"; |
break; |
} |
require(ROOT.'etc/freeradius-web/config.php'); |
require('../lib/attrshow.php'); |
require('../lib/defaults.php'); |
if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){ |
$colspan=2; |
$show_ops=1; |
}else{ |
$show_ops = 0; |
$colspan=1; |
} |
$LIBpath = "../lib/"; |
require(ROOT.'etc/freeradius-web/config.php'); |
if (is_file($LIBpath."sql/drivers/$config[sql_type]/functions.php")) |
{ |
include_once($LIBpath."sql/drivers/$config[sql_type]/functions.php"); |
} |
else |
{ |
echo "<b>Could not include SQL library</b><br>\n"; |
exit(); |
} |
include_once($LIBpath.'functions.php'); |
if ($config['sql_use_operators'] == 'true') |
{ |
include_once($LIBpath."operators.php"); |
$text = ',op'; |
$passwd_op = ",':='"; |
} |
$link = @da_sql_pconnect($config); |
$nbfailuser = 0; |
// Préparation de la fiche PDF |
$pdf = new ticketsPDF(2,3); |
$pdf->setTicketsTitle($l_title_imp); |
$pdf->setTicketsFooter($l_footer_imp); |
if ($link) |
{ |
if (is_file($LIBpath."crypt/$config[general_encryption_method].php")) |
{ |
include($LIBpath."crypt/$config[general_encryption_method].php"); |
// ajout des comptes (mêmes attributs pour tous sauf login + mdp) |
for ($i = 1; $i <= $nbtickets; $i++) |
{ |
// effacement des variables |
$login = ""; |
$passwd = ""; |
// création des données uniques |
$login = GenRandUsersName(); |
$passwd = GenPassword(); |
$login = da_sql_escape_string($login); |
$passwd = da_sql_escape_string($passwd); |
// création des variables d'impression |
$login_imp = $login; |
$passwd1_imp = $passwd; |
// encryption du mot de passe |
$passwd = da_encrypt($passwd); |
// test si l'usager existe |
if (is_file("../lib/$config[general_lib_type]/user_info.php")) |
include("../lib/$config[general_lib_type]/user_info.php"); |
if ($user_exists == "no"){ |
// Création de l'usager |
if (is_file("../lib/$config[general_lib_type]/create_user.php")) |
include("../lib/$config[general_lib_type]/create_user.php"); |
/* Petit traitement pré-impression pour la lisibilité */ |
/* Récupération des attributs du groupe le cas échéant */ |
if ($group!=''){ |
$saved_login = $login; |
$login = $group; |
if (is_file("../lib/sql/group_info.php")) |
include("../lib/sql/group_info.php"); |
$login = $saved_login;} |
/* Si les valeurs de durée sont vide remplissage avec la valeur 'Illimitée'*/ |
/* et formatage des secondes sous le format Heure min ses*/ |
if ($sto_imp==''){ $sto_imp=$l_unlimited;} |
else { $sto_imp=sec_imp($sto_imp);} |
if ($mas_imp==''){ $mas_imp=$l_unlimited;} |
else { $mas_imp=sec_imp($mas_imp);} |
if ($mds_imp==''){ $mds_imp=$l_unlimited;} |
else { $mds_imp=sec_imp($mds_imp);} |
if ($mms_imp==''){ $mms_imp=$l_unlimited;} |
else { $mms_imp=sec_imp($mms_imp);} |
/*Formatage de la date afin d'être lisible dans toute les langues 'jj mm yyyy'*/ |
$exp_imp = $Expiration; |
if ($exp_imp!=''){ $exp_imp=date("d - m - Y",strtotime($exp_imp));} |
else { $exp_imp=$l_without;} |
// Ajout d'un ticket sur la fiche PDF |
$pdf->newTickets(); |
$pdf->Ln(5); |
$pdf->addInfos($l_login_imp, $login_imp); |
$pdf->addInfos($l_password_imp, $passwd1_imp); |
$pdf->Ln(5); |
$pdf->addInfos($l_max_all_session_imp, $mas_imp); |
$pdf->addInfos($l_session_timeout_imp, $sto_imp); |
$pdf->addInfos($l_max_daily_session_imp, $mds_imp); |
$pdf->addInfos($l_expiration_imp, $exp_imp); |
$pdf->Ln(10); |
$pdf->addComment($l_explain); |
} else { |
$nbfailuser++; |
}# if user |
} # end for |
} # end if (is file) |
} # end if (link) |
//Affichage de la fiche de tickets |
ob_end_clean(); |
$pdf->Output(); |
?> |
/web/acc/manager/htdocs/voucher_new.php |
---|
1,9 → 1,12 |
<?php |
<?php |
// ticket d'impression (thank's to Geoffroy MUSITELLI) |
//gestion de la langue |
if (is_file("../lib/langues.php")) |
include("../lib/langues.php"); |
require('/etc/freeradius-web/config.php'); |
// for developpement purpose |
// CONST ROOT = "C:/Serveurs/Alcasar-mageia/"; |
CONST ROOT = "/"; |
require(ROOT.'etc/freeradius-web/config.php'); |
if ($show == 1){ |
header("Location: user_admin.php?login=$login"); |
exit; |
19,7 → 22,7 |
} |
?> |
<html><head><title>Voucher creation</title> |
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>"> |
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>"> |
<link rel="stylesheet" href="/css/style.css"> |
<link rel="stylesheet" type="text/css" href="/css/epoch_styles.css" /> |
<script type="text/javascript" src="/js/epoch_classes.js"></script> |
32,12 → 35,31 |
dp_cal = new Epoch('epoch_popup','popup',document.getElementById('popup_container')); |
}; |
/*Fin calendrier*/ |
function createTickets(arg){ |
var nbtickets = prompt("Saisissez le nombre d'utilisateurs à créer", ""); |
// On test la pression sur le boutton "annuler" |
if (nbtickets===null){ |
alert('nbtickets===null'); |
return false; |
} |
// On test la valeur saisie n'est pas un nombre |
if (isNaN(nbtickets)===true){ |
return false; |
} |
// Conversion en entier de nbtickets |
nbtickets = parseInt(nbtickets) |
// Configuration et envoie du formulaire |
arg.nbtickets.value = nbtickets |
arg.action = "vouchers_new.php"; |
arg.submit(); |
return true; |
} |
</script> |
</head> |
<body> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th><?php echo"$l_users_managment"; ?></th></tr> |
<tr><th><?php echo"$l_users_managment"; ?></th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr> |
</TABLE> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1> |
51,7 → 73,7 |
<td bgcolor="black"> |
<table border=0 width=100% cellpadding=2 cellspacing=0> |
<tr bgcolor="#907030" align=right valign=top><th> |
<font color="white"><?php echo "$l_user_create"; ?></font> |
<font color="white"><?php echo "$l_user_create"; ?></font> |
</th></tr> |
</table> |
</td></tr> |
58,7 → 80,7 |
<tr bgcolor="black" valign=top><td colspan=2> |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top> |
<tr><td> |
<?php |
<?php |
function sec_imp($time) |
/* Formatage des secondes avant l'impression */ |
{ |
129,7 → 151,7 |
<input type=hidden name=show value="0"> |
<input type=hidden name=langue_imp value='fr'> |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
<?php |
<?php |
echo <<<EOM |
<tr> |
<td class="etiquette" colspan=$colspan> |
350,8 → 372,17 |
if ($create == 1){ |
echo "<a href=\"ticket.pdf\">Ticket</a><br>"; |
echo "<input type=submit class=button value=\"$l_show_profile\" OnClick=\"this.form.show.value=1\">";} |
else{ |
else{ |
echo "<input type=submit class=button value=\"$l_create\" OnClick=\"return formControl('newuser');\">"; |
echo "<input type='hidden' name='nbtickets' value=''>"; |
echo "<br>Ou :<br>"; |
$l_create_multiple = "Créer plusieurs tickets"; |
echo "<input type=button class=button value=\"$l_create_multiple\" OnClick=\"return createTickets(this.form);\">"; |
$l_create_multiple_comment = "<br>Remarques : lors de la création plusieurs tickets sysmultanément :<br> |
- l'identifiant et le mot de passe sont générés aléatoirement,<br> |
- les champs \"Nom, prénom\" et \"Adresse de couriel\" ne sont pas pris en compte.<br> "; |
echo $l_create_multiple_comment; |
} |
?> |
</form> |
/web/acc/manager/lib/alcasar/ticketspdf.class.php |
---|
0,0 → 1,253 |
<?php |
require_once('../lib/fpdf/fpdf.php'); |
/* |
TODO : |
- réécriture au format PHP5 |
- Ajout d'une fonction pour le choix des logos à ajouter |
- Meilleur calcule du découpage de la page lors de l"utilisation de format de papier plus atypique |
- Ajout des commentaires au format PHPDoc |
- Intégration au package Alcasar for alcasar V3. |
*/ |
/** |
* Alcasar |
* |
* class for Alcasar web interface |
* |
* @package Alcasar |
* @author Alcasar Dev Team (steweb57) |
* @copyright Copyright (c) 2013 , www.alcasar.net |
* @license GPL V3 |
* @link http://www.alcasar.net |
* @version 0.1 |
*/ |
class ticketsPDF extends FPDF |
{ |
/**************************************************************** |
* * |
* Private properties * |
* * |
*****************************************************************/ |
var $_COUNTX = 0; // Current x ticket position |
var $_COUNTY = 1; // Current y ticket position |
//var $_image = array(); // Images to add to each ticket |
var $_title; // Title text for each ticket |
var $_footer; // Footer text for each ticket |
var $_X; // Number of tickets horizontally |
var $_Y; // Number of tickets vertically |
var $_width; // Ticket width |
var $_height; // Ticket height |
var $_margin = 5; // Margin |
var $_padding = 5; // Padding |
/** |
* Constructor method : <b>ticketsPDF(int x,int y)</b> |
* |
* <p>Create the class instance</p> |
* |
* @access public |
* @param int $x, $y |
* @return void |
*/ |
function ticketsPDF($x = 1, $y = 1) { |
// For the moment, only "P", "mm", "A4" format |
parent::FPDF('P', 'mm', 'A4'); |
$this->AddPage(); |
/* |
$x = number of tickets horizontally |
$y = number of tickets vertically |
*/ |
$this->_X = $x; |
$this->_Y = $y; |
$this->_width = (int)((210 - ($this->_margin*2))/$this->_X); |
$this->_height = (int)((297 - ($this->_margin*2))/$this->_Y); |
} |
/**************************************************************** |
* * |
* Private methods * |
* * |
*****************************************************************/ |
function _ticketHeader() |
{ |
$currentX = $this->_margin + (($this->_COUNTX - 1) * $this->_width ) + $this->_padding; |
$currentY = $this->_margin + (($this->_COUNTY - 1) * $this->_height ) + $this->_padding; |
$this->SetXY($currentX, $currentY); |
$this->SetFont('Arial','B',9); |
$this->SetTextColor(250,1,10); |
$this->Cell($this->_width-10,10,$this->_title,0,1,'C'); |
} |
function _ticketFooter() |
{ |
$currentX = $this->_margin + (($this->_COUNTX - 1) * $this->_width ) + $this->_padding; |
$currentY = (($this->_COUNTY) * $this->_height) - 5; |
$this->SetXY($currentX, $currentY); |
$this->SetTextColor(0); |
$this->SetFont('Arial','',9); |
$this->Cell($this->_width-10,10,$this->_footer,0,0,'C'); |
} |
function _addTicketsImages() |
{ |
// Add Alcasar Logo |
$currentX = $this->_margin + (($this->_COUNTX - 1) * $this->_width ) + $this->_padding; |
$currentY = $this->_margin + (($this->_COUNTY - 1) * $this->_height ) + $this->_padding; |
$this->Image('../../../images/logo-alcasar.png',$currentX,$currentY,20); |
// Add other logo |
$currentX = $this->_margin + (($this->_COUNTX) * $this->_width ) - $this->_padding - 15; |
$this->Image('../../../images/organisme.png',$currentX,$currentY,15); |
} |
//fonction arc de cercle |
function _Arc($x1, $y1, $x2, $y2, $x3, $y3) |
{ |
$h = $this->h; |
$this->_out(sprintf('%.2F %.2F %.2F %.2F %.2F %.2F c ', $x1*$this->k, ($h-$y1)*$this->k, |
$x2*$this->k, ($h-$y2)*$this->k, $x3*$this->k, ($h-$y3)*$this->k)); |
} |
// gestion automatique du format UFT8 |
function _cleanUTF8($txt='') |
{ |
if (mb_detect_encoding($txt)=="UTF-8") |
{ |
//exit(utf8_decode($txt)); |
return utf8_decode($txt); |
} else { |
//exit($txt); |
return $txt; |
} |
} |
/**************************************************************** |
* * |
* Public methods * |
* * |
*****************************************************************/ |
//fonction rectangle |
//Rectangle : x, y : coin supérieur gauche du rectangle.w, h : largeur et hauteur. r : rayon des coins arrondis. |
//style : comme celui de Rect() : F, D (défaut), FD ou DF. |
function RoundedRect($x, $y, $w, $h, $r, $style = '') |
{ |
$k = $this->k; |
$hp = $this->h; |
if($style=='F') |
$op='f'; |
elseif($style=='FD' or $style=='DF') |
$op='B'; |
else |
$op='S'; |
$MyArc = 4/3 * (sqrt(2) - 1); |
$this->_out(sprintf('%.2F %.2F m',($x+$r)*$k,($hp-$y)*$k )); |
$xc = $x+$w-$r ; |
$yc = $y+$r; |
$this->_out(sprintf('%.2F %.2F l', $xc*$k,($hp-$y)*$k )); |
$this->_Arc($xc + $r*$MyArc, $yc - $r, $xc + $r, $yc - $r*$MyArc, $xc + $r, $yc); |
$xc = $x+$w-$r ; |
$yc = $y+$h-$r; |
$this->_out(sprintf('%.2F %.2F l',($x+$w)*$k,($hp-$yc)*$k)); |
$this->_Arc($xc + $r, $yc + $r*$MyArc, $xc + $r*$MyArc, $yc + $r, $xc, $yc + $r); |
$xc = $x+$r ; |
$yc = $y+$h-$r; |
$this->_out(sprintf('%.2F %.2F l',$xc*$k,($hp-($y+$h))*$k)); |
$this->_Arc($xc - $r*$MyArc, $yc + $r, $xc - $r, $yc + $r*$MyArc, $xc - $r, $yc); |
$xc = $x+$r ; |
$yc = $y+$r; |
$this->_out(sprintf('%.2F %.2F l',($x)*$k,($hp-$yc)*$k )); |
$this->_Arc($xc - $r, $yc - $r*$MyArc, $xc - $r*$MyArc, $yc - $r, $xc, $yc - $r); |
$this->_out($op); |
} |
function newTickets() |
{ |
$this->_COUNTX++; |
if ($this->_COUNTX > $this->_X) { |
// Row full, we start a new one |
$this->_COUNTX=1; |
$this->_COUNTY++; |
if ($this->_COUNTY > $this->_Y) { |
// End of page reached, we start a new one |
$this->_COUNTY=1; |
$this->AddPage(); |
} |
} |
$this->_ticketHeader(); |
$this->_ticketFooter(); |
$currentX = $this->_margin + (($this->_COUNTX - 1) * $this->_width ) + $this->_padding; |
$currentY = $this->_margin + (($this->_COUNTY - 1) * $this->_height ) + $this->_padding; |
$this->SetXY($currentX, $currentY+10); |
//création du cadre arrondi qui entoure le ticket d'impression |
//x, y : coin supérieur gauche du rectangle.w, h : largeur et hauteur. r : rayon des coins arrondis. |
//style : comme celui de Rect() : F, D (défaut), FD ou DF. |
$RoundedRectX = (($this->_COUNTX - 1) * ($this->_width))+($this->_width/6); |
$this->RoundedRect($RoundedRectX, $currentY+10, ($this->_width-($this->_width/4)), $this->_height/2, 3.5, 'D'); |
$this->_addTicketsImages(); |
} |
function addInfos($title, $value) |
{ |
$currentX = $this->_margin + (($this->_COUNTX - 1) * $this->_width ) + $this->_padding; |
$this->SetX($currentX); |
$this->SetTextColor(0); |
$this->SetFont('Arial','',9); |
$this->Cell(($this->_width/2)-5,5,$title,0,0,'R'); |
$this->SetFont('Arial','B',9); |
$this->Cell(($this->_width/2)-5,5,$value,0,1,'L'); |
} |
function addComment($txt, $align = "J") |
{ |
$currentX = $this->_margin + (($this->_COUNTX - 1) * $this->_width ) + $this->_padding; |
$this->SetX($currentX); |
$this->SetTextColor(0); |
$this->SetFont('Arial','',8); |
//$this->Cell($this->_width-10,5,$txt,0,1,$align); |
$this->MultiCell($this->_width - $this->_padding - 5, 5, $txt, 0, $align); |
} |
function setTicketsTitle($txt) |
{ |
$this->_title = $txt; |
} |
function setTicketsFooter($txt) |
{ |
$this->_footer = $txt; |
} |
function AcceptPageBreak() |
{ |
return false; |
} |
function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='') |
{ |
$txt = $this->_cleanUTF8($txt); |
parent::Cell($w, $h, $txt, $border, $ln, $align, $fill, $link); |
} |
/* |
//For futur use |
function addTicketsImage($file, $x, $y, $w) |
{ |
$this->_image[] = array('file'=>$file, 'x'=>$x, 'y'=>$y, 'w'=>$w); |
} |
*/ |
/* |
Function Ln($h=null) |
{ |
parent::Ln($h); |
$currentX = $this->_margin + (($this->_COUNTX - 1) * $this->_width ) + $this->_padding; |
$this->SetX($currentX); |
} |
*/ |
} |
?> |