production/Controleur/ControleurAjaximprimereseaucollege.php
2025-12-02 11:29:44 +00:00

85 lines
2.4 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleurrequete.php'; // OK
require_once 'Modele/Police.php';
class ControleurAjaximprimereseaucollege extends Controleurrequete
{
private $police;
public function __construct()
{
$this->police = new Police();
}
public function index()
{
$idCollege = $this->requete->getParametreFormulaire("idCollege");
$reseausoin = $this->police->getReseausoincommege($idCollege) ;
$nomReseau = $this->police->getlibellereseausoincollege($idCollege) ;
$pdf = new FPDF_Protection("L");
$pdf->SetAuthor('EBENE SOLUTIONS INFORMATIQUES');
$userPassword = '';
$ownerPassword = null;
$pdf->SetProtection(['print'], $userPassword, $ownerPassword);
$pdf->AliasNbPages();
$pdf->AddPage();
$ht=4;
$pdf->SetMargins(10, 10, 10) ;
$pdf->SetFont('Arial','BI', 8);
$pdf->Cell(0,$ht,convertirc($_SESSION['nomSociete']),0,0,'L',false);
$pdf->ln(5);
$pdf->Cell(0,$ht,convertirc($nomReseau),0,1,'R',false);
$pdf->SetFont('Arial','', 8);
$pdf->Cell(0,$ht,convertirc('Edition : '.heureCouranteLang($_SESSION['lang'])),0,1,'L',false);
$pdf->SetFont('Arial','B', 8);
$ht=5;
$pdf->Cell(30,$ht,convertirc(_("Ville")),1,0,'C',false);
$pdf->Cell(30,$ht,convertirc(_("Type")),1,0,'C',false);
$pdf->Cell(105,$ht,convertirc(_("Prestataire")),1,0,'L',false);
$pdf->Cell(60,$ht,convertirc(_("Téléphone")),1,0,'C',false);
$pdf->Cell(50,$ht,convertirc("Email"),1,1,'C',false);
$pdf->SetFont('Arial','', 8);
foreach ($reseausoin as $v)
{
$typeprestataire =$v['typeprestataire'];
if (est_anglophone())
{
$typeprestataire = $v['typeprestataireEng'];
}
$pdf->Cell(30,$ht,convertirc($v['ville']),1,0,'C',false);
$pdf->Cell(30,$ht,convertirc($typeprestataire),1,0,'C',false);
$pdf->Cell(105,$ht,convertirc($v['prestataire']),1,0,'L',false);
$pdf->Cell(60,$ht,convertirc($v['telephone']),1,0,'C',false);
$pdf->Cell(50,$ht,convertirc($v['email']),1,1,'C',false);
}
$fichier="Temp/TEMP_RESEAU_SOIN_COLLEGE"."_".uniqid().".pdf";
$pdf->Output($fichier,"F");
$t_html =' <div id ="div_imprime_reseau" class="alert alert-info"> ';
$t_html .=' <a style="font-size:15pt;" href="'.$fichier.'" target="_blank" > '._("TELECHARGER").' </a> ';
$t_html .=' </div ';
echo $t_html;
}
}