Je suis débutant en PHP (sachant que je suis en première année de BTS info) mais j'ai du mal à en comprendre les subtilités...
Je suis actuellement en stage et je suis face à un site intranet particulièrement conséquent.
J'aurais souhaité un peu d'aide afin de comprendre certaines parties du code.
Voici ce sur quoi je butte :
A partir d'une page où l'on renseigne diverses informations, ces dernières sont renvoyées dans un tableau qui est ensuite converti en PDF.
Voici la page qui renseigne toutes les informations :
<?php
include("../pdf/phpToPDF.php");
$date=@$_GET['date'];
$PDF=new phpToPDF();
$PDF->AddPage();
$PDF->SetFont('Arial','B',10);
$PDF->Image("../imgs/logoCSM.jpg", 160, 0);
require '../init.php';
$contenuTableau = array();
//while($row=mysql_fetch_object($req)){
array_push($contenuTableau,'','','');
//}
// Définition des propriétés du reste du contenu du tableau.
//$PDF->Write(10, $titre);
//Décalage de 8 cm à droite
$PDF->Cell(1);
//Texte centré dans une cellule 20*10 mm encadrée et retour à la ligne
$PDF->setXY(10,10);
$PDF->Cell(0,0,"GARDES DU $date",0,1,'C');
$PDF->setXY(0,20);
$reqServ=verifReq("SELECT * FROM cdgservice");
// Définition des propriétés du tableau.
$proprietesTableau = array(
'TB_ALIGN' => 'L',
'L_MARGIN' => 25,
'BRD_COLOR' => array(0,92,177),
'BRD_SIZE' => '0',
);
// Définition des propriétés du header du tableau.
$proprieteHeader = array(
'T_COLOR' => array(255,255,255),
'T_SIZE' => 10,
'T_FONT' => 'Arial',
'T_ALIGN' => 'C',
'V_ALIGN' => 'T',
'T_TYPE' => 'B',
'LN_SIZE' => 5,
'BG_COLOR_COL0' => array(174, 141, 75),
'BG_COLOR' => array(174, 141, 75),
'BRD_COLOR' => array(0,92,177),
'BRD_SIZE' => 0.2,
'BRD_TYPE' => '1',
'BRD_TYPE_NEW_PAGE' => '',
);
$contenuTableau = array();
$contenuHeader = array(
80, 62
"Service", "Intervenant"
);
function cleanTxt2($txt){
$origine = array("<br />", "é", "è", "Ã", "àª", "à®", "à´", "à§");
$change = array("", "é", "è", "à", "ê", "î", "ô", "ç");
$txt=str_replace($origine, $change, $txt);
return $txt;
}
function cleanGrille($txt){
$origine = array("4", "3", "2", "1","false");
$change = array("A", "B", "C", "D", "n/a");
$txt=str_replace($origine, $change, $txt);
return $txt;
}
while($rowServ=mysql_fetch_object($reqServ)){
$reqLiaison=verifReq("SELECT d.idInt,nom
FROM cdgdegarde d,cdgintervenant i
WHERE d.idInt=i.idInt
AND idServ='$rowServ->idServ' AND date='$date'");
if(mysql_num_rows($reqLiaison)!=0){
$nomSet=mysql_result($reqLiaison,0,'nom', 'telephone');
}else{
$nomSet="-";
}
array_push($contenuTableau,$rowServ->libServ,$nomSet);
}
// Définition des propriétés du reste du contenu du tableau.
$proprieteContenu = array(
'T_COLOR' => array(0,0,0),
'T_SIZE' => 9,
'T_FONT' => 'Arial',
'T_ALIGN_COL0' => 'L',
'T_ALIGN' => 'R',
'V_ALIGN' => 'T',
'T_TYPE' => '',
'LN_SIZE' => 8,
'BG_COLOR_COL0' => array(233, 233, 233),
'BG_COLOR' => array(233, 233,233),
'BRD_COLOR' => array(0,92,177),
'BRD_SIZE' => 0.1,
'BRD_TYPE' => '1',
'BRD_TYPE_NEW_PAGE' => '',
);
$PDF->drawTableau($PDF, $proprietesTableau, $proprieteHeader, $contenuHeader, $proprieteContenu, $contenuTableau);
//$PDF->Output();
$nomFichier="CDG$date";
$PDF->Output("fiches/$nomFichier.pdf", "F");
echo '
<iframe src="fiches/'.$nomFichier.'.pdf" width="100%" height="100%" frameborder="none" scrolling="No">
[Your browser does <em>not</em> support <code>iframe</code>,
or has been configured not to display inline frames.
You can access <a href="./fiches/'.$nomFichier.'.pdf">the document</a>
via a link though.]</iframe>
';
?>
J'en comprends certains passages (les plus basiques, tableaux, styles) mais je n'arrive pas à comprendre le fonctionnement... Quel est le cheminement ? Comment est construit le code permettant au final d'afficher ceci :
Je vous serais très reconnaissant pour l'aide apportée. Merci d'avance