Beispiel #1
0
function cards_makeme()
{
    global $tpl, $pdo, $srcdir, $tmpdir, $config;
    include_once $srcdir . DS . 'libs' . DS . 'barcode.php';
    //Verif
    $sql = $pdo->prepare('SELECT COUNT(*) FROM user_mandate WHERE um_user = ? AND um_mandate = ?');
    $sql->bindValue(1, $_SESSION['user']['user_id']);
    $sql->bindValue(2, $_POST['mandate']);
    $sql->execute();
    $TEST = $sql->fetch();
    if ($TEST[0] == 0) {
        modexec('syscore', 'moderror');
        quit();
    }
    $mdl = new Modele('card');
    $mdt = new Modele('mandate');
    $mdt->fetch($_POST['mandate']);
    $usr = new Modele('users');
    $usr->fetch($_SESSION['user']['user_id']);
    $filename = tempnam($tmpdir, 'img');
    if ($mdl->addFrom(array('card_user' => $usr->user_id, 'card_mandate' => $mdt->mandate_id, 'card_maketime' => date('Y-m-d'), 'card_picture' => $filename))) {
        $tpl->assign('hsuccess', true);
    } else {
        $tpl->assign('hsuccess', false);
    }
    $imgd = imagecreatefrompng($srcdir . DS . 'libs' . DS . 'card_bg.png');
    $fdir = $srcdir . DS . 'libs' . DS . 'font' . DS;
    $c_black = imagecolorallocate($imgd, 0, 0, 0);
    $picture = imagecreatefrompng($usr->user_photo);
    imagecopy($imgd, $picture, 950, 180, 0, 0, 210, 270);
    _resize_logo($imgd);
    imagettftext($imgd, 30, 0, 20, 40, $c_black, $fdir . 'data-latin.ttf', 'LATEB');
    imagettftext($imgd, 30, 0, 20, 100, $c_black, $fdir . 'go3v2.ttf', 'Carte de membre');
    imagettftext($imgd, 30, 0, 800, 100, $c_black, $fdir . 'go3v2.ttf', 'Validité: ' . $mdt->mandate_label);
    imagettftext($imgd, 50, 0, 20, 240, $c_black, $fdir . 'AccidentalPresidency.ttf', "Nom:");
    imagettftext($imgd, 50, 0, 455, 240, $c_black, $fdir . 'data-latin.ttf', $usr->user_lastname);
    imagettftext($imgd, 50, 0, 20, 310, $c_black, $fdir . 'AccidentalPresidency.ttf', "Prénom:");
    imagettftext($imgd, 50, 0, 455, 310, $c_black, $fdir . 'data-latin.ttf', $usr->user_firstname);
    imagettftext($imgd, 50, 0, 20, 370, $c_black, $fdir . 'AccidentalPresidency.ttf', "Pseudo:");
    imagettftext($imgd, 50, 0, 455, 370, $c_black, $fdir . 'data-latin.ttf', $usr->user_name);
    imagettftext($imgd, 50, 0, 20, 430, $c_black, $fdir . 'AccidentalPresidency.ttf', "Date de naissance:");
    imagettftext($imgd, 50, 0, 455, 430, $c_black, $fdir . 'data-latin.ttf', $usr->user_born);
    imagettftext($imgd, 50, 0, 20, 490, $c_black, $fdir . 'AccidentalPresidency.ttf', "Statut:");
    imagettftext($imgd, 50, 0, 455, 490, $c_black, $fdir . 'data-latin.ttf', "membre " . _find_user_status($usr));
    imagettftext($imgd, 50, 0, 20, 550, $c_black, $fdir . 'AccidentalPresidency.ttf', "Immatriculation:");
    imagettftext($imgd, 50, 0, 455, 550, $c_black, $fdir . 'data-latin.ttf', $config['assoInfo']['assoId'] . " - " . $usr->user_id);
    /*imagettftext($imgd, 30, 0, 60, 150, $c_black, $fdir . 'go3v2.ttf', $mdt->mandate_label);
      imagettftext($imgd, 50, 0, 60, 240, $c_black, $fdir . 'AccidentalPresidency.ttf', "Immatriculation: " . $usr->user_id);
      imagettftext($imgd, 50, 0, 60, 300, $c_black, $fdir . 'AccidentalPresidency.ttf', "Pseudo: " . $usr->user_name);
      imagettftext($imgd, 50, 0, 60, 360, $c_black, $fdir . 'AccidentalPresidency.ttf', "Prénom: " . $usr->user_firstname);
      imagettftext($imgd, 50, 0, 60, 420, $c_black, $fdir . 'AccidentalPresidency.ttf', "Nom: " . $usr->user_lastname);*/
    $cbfile = tempnam($tmpdir, 'cb');
    imagebarcode($cbfile, str_pad($mdl->getKey(), 12, '0', STR_PAD_LEFT), 600, 70, 5);
    $codebar = imagecreatefrompng($cbfile);
    imagecopy($imgd, $codebar, 275, 580, 0, 0, 600, 70);
    unlink($cbfile);
    imagepng($imgd, $filename);
    modexec('index', 'profile');
}
Beispiel #2
-1
function index_print()
{
    global $root, $srcdir, $tmpdir;
    include_once $srcdir . DS . 'libs' . DS . 'fpdf.php';
    include_once $srcdir . DS . 'libs' . DS . 'barcode.php';
    if (!isset($_POST['mandate'])) {
        $_POST['mandate'] = 1;
    }
    if (!isset($_POST['subscription'])) {
        $_POST['subscription'] = 1;
    }
    $mdt = new Modele('mandate');
    $mdt->fetch($_POST['mandate']);
    $sub = new Modele('subscription');
    $sub->fetch($_POST['subscription']);
    $usr = new Modele('users');
    $usr->fetch($_SESSION['user']['user_id']);
    $sublist = new Modele('subscription');
    //$sublist->find(array('subscription_mandate' => $mdt->mandate_id));
    $sublist->find();
    if (new DateTime($mdt->mandate_start) > new DateTime() || new DateTime($mdt->mandate_end) < new DateTime()) {
        modexec('syscore', 'moderror');
    }
    ob_start();
    $pdf = new FPDF();
    $pdf->AddPage();
    $pdf->SetXY(18, 12);
    $pdf->SetFont('Arial', '', 30);
    $pdf->Cell(180, 10, 'EPITANIME', 0, 0, 'C');
    $pdf->SetFont('Arial', '', 10);
    $pdf->SetXY(18, 21);
    $pdf->Cell(180, 5, 'FEUILLE DE RENSEIGNEMENTS ' . uc($mdt->mandate_label), 0, 0, 'C');
    $pdf->SetXY(18, 26);
    $pdf->Cell(180, 5, 'Veuillez remplir lisiblement en lettres capitales', 0, 0, 'C');
    $pdf->SetFont('Arial', 'B', 10);
    $pdf->SetXY(18, 35);
    $pdf->Cell(180, 5, 'Informations essentielles :', 0, 0, '');
    $pdf->SetXY(18, 40);
    $pdf->Cell(50, 5, 'Pseudo', 1, 0, '');
    $pdf->SetXY(18, 45);
    $pdf->Cell(50, 5, 'Nom', 1, 0, '');
    $pdf->SetXY(18, 50);
    $pdf->Cell(50, 5, uc('Prénom'), 1, 0, '');
    $pdf->SetXY(18, 55);
    $pdf->Cell(50, 5, 'Adresse', 1, 0, '');
    $pdf->SetXY(18, 60);
    $pdf->Cell(50, 5, 'Code postal', 1, 0, '');
    $pdf->SetXY(18, 65);
    $pdf->Cell(50, 5, 'Ville', 1, 0, '');
    $pdf->SetXY(18, 70);
    $pdf->Cell(50, 5, 'Sexe', 1, 0, '');
    $pdf->SetXY(18, 75);
    $pdf->Cell(50, 5, 'Date de naissance', 1, 0, '');
    $pdf->SetXY(18, 80);
    $pdf->Cell(50, 5, uc('Téléphone'), 1, 0, '');
    $pdf->SetXY(18, 85);
    $pdf->Cell(50, 5, 'Courriel', 1, 0, '');
    $pdf->SetXY(18, 95);
    $pdf->Cell(50, 5, uc('Réservé aux étudiants IONIS'), 0, 0, '');
    $pdf->SetXY(18, 100);
    $pdf->Cell(50, 5, 'Login', 1, 0, '');
    $pdf->SetXY(18, 105);
    $pdf->Cell(50, 5, 'Ecole', 1, 0, '');
    $pdf->SetXY(18, 110);
    $pdf->Cell(50, 5, 'Promotion', 1, 0, '');
    $pdf->SetXY(18, 120);
    $pdf->Cell(50, 5, uc('Réservé aux membres prenant l\'inscription FFG (fédération française de GO)'), 0, 0, '');
    $pdf->SetXY(18, 125);
    $pdf->Cell(50, 5, uc('Nationalité'), 1, 0, '');
    $pdf->SetXY(18, 130);
    $pdf->Cell(50, 5, 'Niveau', 1, 0, '');
    $pdf->SetXY(18, 135);
    $pdf->Cell(50, 5, 'Pseudo FFG', 1, 0, '');
    $pdf->SetFont('Arial', '', 12);
    $pdf->SetXY(18, 222);
    $pdf->Cell(160, 5, uc('Reçu par ______________________ le ___/___/20___ , accompagné de la cotisation choisie.'), 0, 0, '');
    $pdf->SetFont('Arial', 'B', 10);
    $pdf->SetXY(38, 230);
    $pdf->Cell(50, 5, 'Signature du membre', 1, 0, '');
    $pdf->Rect(38, 235, 50, 20);
    $pdf->SetXY(130, 230);
    $pdf->Cell(50, 5, uc('Signature du récepteur'), 1, 0, '');
    $pdf->Rect(130, 235, 50, 20);
    $pdf->SetFont('Arial', '', 8);
    $pdf->SetXY(18, 260);
    $pdf->MultiCell(180, 3, uc('Les informations recueillies sont nécessaires pour votre adhésion. Elles font l’objet d’un traitement informatique et sont destinées au secrétariat de l’association. En application de l’article 34 de la loi du 6 janvier 1978, vous bénéficiez d’un droit d’accès et de rectification aux informations qui vous concernent. Si vous souhaitez exercer ce droit et obtenir communication des informations vous concernant, veuillez vous adresser au secrétariat de l’association.'));
    $pdf->SetFont('Arial', '', 10);
    $pdf->SetXY(68, 40);
    $pdf->Cell(130, 5, uc($usr->user_name), 1, 0, '');
    $pdf->SetXY(68, 45);
    $pdf->Cell(130, 5, uc($usr->user_lastname), 1, 0, '');
    $pdf->SetXY(68, 50);
    $pdf->Cell(130, 5, uc($usr->user_firstname), 1, 0, '');
    $pdf->SetXY(68, 55);
    $pdf->Cell(130, 5, uc($usr->user_address), 1, 0, '');
    $pdf->SetXY(68, 60);
    $pdf->Cell(130, 5, uc($usr->user_cp), 1, 0, '');
    $pdf->SetXY(68, 65);
    $pdf->Cell(130, 5, uc($usr->user_town), 1, 0, '');
    $pdf->SetXY(68, 70);
    $pdf->Cell(130, 5, uc($usr->user_sexe), 1, 0, '');
    $pdf->SetXY(68, 75);
    $pdf->Cell(130, 5, uc($usr->user_born), 1, 0, '');
    $pdf->SetXY(68, 80);
    $pdf->Cell(130, 5, uc($usr->user_phone), 1, 0, '');
    $pdf->SetXY(68, 85);
    $pdf->Cell(130, 5, uc($usr->user_email), 1, 0, '');
    $pdf->SetXY(68, 100);
    $pdf->Cell(130, 5, uc($usr->user_login), 1, 0, '');
    $pdf->SetXY(68, 105);
    $pdf->Cell(130, 5, uc($usr->user_type->ut_name), 1, 0, '');
    $pdf->SetXY(68, 110);
    $pdf->Cell(130, 5, uc($usr->user_promo), 1, 0, '');
    $pdf->SetXY(68, 125);
    $pdf->Cell(130, 5, '', 1, 0, '');
    $pdf->SetXY(68, 130);
    $pdf->Cell(130, 5, '', 1, 0, '');
    $pdf->SetXY(68, 135);
    $pdf->Cell(130, 5, '', 1, 0, '');
    $pdf->SetFont('Arial', 'B', 10);
    $pdf->SetXY(18, 145);
    $pdf->Cell(50, 5, uc('Cotisation'), 0, 0, '');
    $cb = '9' . str_pad($mdt->getKey(), 4, '0', STR_PAD_LEFT) . str_pad($usr->getKey(), 7, '0', STR_PAD_LEFT);
    $cbfile = tempnam($tmpdir, 'cb');
    imagebarcode($cbfile, $cb, 200, 40, 2);
    $pdf->Image($cbfile, 10, 10, 30, 0, 'PNG');
    unlink($cbfile);
    $pdf->SetFont('Arial', 'I', 8);
    $pdf->SetXY(185, 10);
    $pdf->Cell(10, 5, $usr->getKey(), 0, 0, 'R');
    $pos = -1;
    $pdf->SetFont('Arial', '', 10);
    while ($c = $sublist->next()) {
        $pos++;
        $x = 25 + $pos % 2 * 90;
        $y = 150 + 5 * floor($pos / 2);
        $pdf->SetXY($x, $y);
        $pdf->Cell(60, 5, uc($c['subscription_label']), 1, 0, '');
        $pdf->Cell(15, 5, number_format($c['subscription_price'], 2, ',', '') . ' ' . chr(128), 1, 0, '');
        $pdf->Rect($x + 75, $y, 5, 5);
        if ($c['subscription_id'] == $sub->subscription_id) {
            $pdf->SetFont('Arial', 'B', 12);
            $pdf->Cell(5, 5, 'X', 0, 0, 'C');
            $pdf->SetFont('Arial', '', 10);
        }
    }
    if (ob_get_flush() == '') {
        $pdf->Output('inscription.pdf', 'I');
    }
    quit();
}