Line 1... |
Line 1... |
1 |
<?php
|
1 |
<?php
|
2 |
require_once('/var/www/html/acc/manager/lib/alcasar/ticketspdf.class.php');
|
- |
|
- |
|
2 |
/**
|
3 |
// ticket d'impression (thank's to Geoffroy MUSITELLI)
|
3 |
* Print tickets of the new user
|
- |
|
4 |
*
|
4 |
//--recupération des variables provenant du formulaire
|
5 |
* @author Tom Houdayer
|
5 |
$langue_imp=utf8_decode($_POST["langue_imp"]);
|
6 |
* @copyright Copyright (C) ALCASAR (http://www.alcasar.net)
|
6 |
$log_imp=$_POST["log_imp"];
|
7 |
* @license GPL-3.0
|
7 |
$passwd_imp=$_POST["passwd_imp"];
|
- |
|
8 |
$exp_imp=utf8_decode($_POST["exp_imp"]);
|
- |
|
9 |
$sto_imp=utf8_decode($_POST["sto_imp"]);
|
8 |
* @version $Id: ticket_user.php 2168 2017-04-18 17:39:54Z tom.houdayer $
|
10 |
$mas_imp=utf8_decode($_POST["mas_imp"]);
|
- |
|
11 |
$mds_imp=utf8_decode($_POST["mds_imp"]);
|
- |
|
12 |
$mms_imp=utf8_decode($_POST["mms_imp"]);
|
- |
|
- |
|
9 |
*/
|
- |
|
10 |
|
13 |
// Langue du Ticket d'impression en fonction de la liste déroulante
|
11 |
require_once __DIR__ . '/../lib/alcasar/TicketsGenerator.php';
|
14 |
if (isset($_POST["langue_imp"])) { $langue_imp = $_POST["langue_imp"]; } else { $langue_imp = "en"; };
|
12 |
$langue_imp = ((isset($_POST['langue_imp'])) ? $_POST['langue_imp'] : 'en');
|
15 |
if (is_file("../lib/langues_imp.php")) include("../lib/langues_imp.php") ;
|
13 |
require_once __DIR__ . '/../lib/langues_imp.php';
|
16 |
// Si les valeurs de durée ne sont pas définies, on les remplace par la valeur 'Illimitée'
|
- |
|
17 |
if (($sto_imp=='') or ($sto_imp=='-')){ $sto_imp=$l_unlimited;}
|
- |
|
18 |
if (($mas_imp=='') or ($mas_imp=='-')){ $mas_imp=$l_unlimited;}
|
- |
|
19 |
if (($mds_imp=='') or ($mds_imp=='-')){ $mds_imp=$l_unlimited;}
|
- |
|
20 |
if (($mms_imp=='') or ($mms_imp=='-')){ $mms_imp=$l_unlimited;}
|
- |
|
21 |
//création de la classe PDF pour faire l'entête et pieds de page
|
- |
|
- |
|
14 |
|
22 |
$pdf = new ticketsPDF(2,3);
|
15 |
// Get datas from form
|
23 |
$pdf->setTicketsTitle($l_title_imp);
|
- |
|
24 |
$pdf->setTicketsFooter($l_footer_imp);
|
16 |
if ((!isset($_POST['log_imp'])) || (!isset($_POST['passwd_imp'])) || (!isset($_POST['exp_imp'])) || (!isset($_POST['sto_imp'])) || (!isset($_POST['mas_imp'])) || (!isset($_POST['mds_imp']))) {
|
25 |
$pdf->newTickets();
|
17 |
exit();
|
26 |
$pdf->Ln(5);
|
18 |
}
|
27 |
$pdf->addInfos($l_login_imp, $log_imp);
|
19 |
$log_imp = $_POST['log_imp'];
|
28 |
$pdf->addInfos($l_password_imp, $passwd_imp);
|
20 |
$passwd_imp = $_POST['passwd_imp'];
|
29 |
$pdf->Ln(5);
|
- |
|
30 |
$pdf->addInfos($l_max_all_session_imp, $mas_imp);
|
21 |
$exp_imp = ((($_POST['exp_imp'] === '') || ($_POST['exp_imp'] === '-')) ? $l_without : utf8_decode($_POST['exp_imp']));
|
31 |
$pdf->addInfos($l_session_timeout_imp, $sto_imp);
|
22 |
$sto_imp = ((($_POST['sto_imp'] === '') || ($_POST['sto_imp'] === '-')) ? $l_unlimited : utf8_decode($_POST['sto_imp']));
|
32 |
$pdf->addInfos($l_max_daily_session_imp, $mds_imp);
|
23 |
$mas_imp = ((($_POST['mas_imp'] === '') || ($_POST['mas_imp'] === '-')) ? $l_unlimited : utf8_decode($_POST['mas_imp']));
|
33 |
$pdf->addInfos($l_expiration_imp, $exp_imp);
|
24 |
$mds_imp = ((($_POST['mds_imp'] === '') || ($_POST['mds_imp'] === '-')) ? $l_unlimited : utf8_decode($_POST['mds_imp']));
|
- |
|
25 |
|
34 |
$pdf->Ln(10);
|
26 |
// Generate tickets
|
35 |
$pdf->addComment($l_explain);
|
27 |
$ticketsGenerator = new TicketsGenerator(['language' => $langue_imp]);
|
36 |
|
28 |
|
37 |
// Création du duplicata
|
29 |
// Add user
|
38 |
$pdf->newTickets();
|
30 |
$ticketsGenerator->addTicket([
|
39 |
$pdf->Ln(5);
|
- |
|
40 |
$pdf->addInfos($l_login_imp, $log_imp);
|
31 |
'username' => $log_imp,
|
41 |
$pdf->addInfos($l_password_imp, $passwd_imp);
|
32 |
'password' => $passwd_imp,
|
42 |
$pdf->Ln(5);
|
- |
|
43 |
$pdf->addInfos($l_max_all_session_imp, $mas_imp);
|
33 |
'maxAllSession' => $mas_imp,
|
44 |
$pdf->addInfos($l_session_timeout_imp, $sto_imp);
|
34 |
'sessionTimeout' => $sto_imp,
|
45 |
$pdf->addInfos($l_max_daily_session_imp, $mds_imp);
|
35 |
'maxDailySession' => $mds_imp,
|
46 |
$pdf->addInfos($l_expiration_imp, $exp_imp);
|
36 |
'expiration' => $exp_imp
|
47 |
$pdf->Ln(10);
|
37 |
]);
|
48 |
$pdf->addComment($l_duplicate,'C');//à mettre en rouge
|
- |
|
49 |
|
38 |
|
50 |
// envoie du document au navigateur
|
39 |
// Save the PDF and redirect user to it
|
51 |
$ticket_name="ticket_".$log_imp.".pdf";
|
40 |
$filename = 'ticket_' . $log_imp . '.pdf';
|
52 |
$pdf->Output($ticket_name);
|
41 |
$ticketsGenerator->saveAs($filename);
|
53 |
header ('Location: '.$ticket_name);
|
42 |
header('Location: ' . $filename);
|
54 |
?>
|
- |
|