databasefile; include "../lib/class.horses.php"; include "../lib/class.arr_multisort.php"; $horses = new Horses(); $data = $horses->get_data($id); if ($data["avendre"]==0) die("Error - ForbiddenAccess denied"); $horses->free(); } if (isset($_GET["lang"])) { $lang = $_GET["lang"]; } else $lang='fr'; class PDF extends FPDF { function Header() { global $lang; $this->AddFont('MyFairCody',''); $this->AddFont('TwCenMT-CondensedBold',''); $this->AddFont('TwCenMT-Condensed',''); $this->AddFont('TwCenMT-Regular',''); $this->AddFont('TwCenMT-Italic',''); $this->Image('images/sf.jpg',10,10,15); $this->Image('images/cnlogo.jpg',180,10,20); $this->SetFont('MyFairCody','',15); $this->Cell(80); if ($lang=='fr') $this->Cell(30,10,utf8_encode('Le Haras de B\'N�ville pr�sente'),0,0,'C'); else $this->Cell(30,10,utf8_encode('Haras de B\'N�ville presents'),0,0,'C'); $this->Ln(15); } function Footer() { global $lang; $this->SetY(-15); $this->SetFont('Arial','I',12); if ($lang=='fr') $this->Cell(0,10,'Pour plus d\'informations, http://www.haras-de-bneville.com',0,0,'C'); else $this->Cell(0,10,'For more information, http://www.haras-de-bneville.com',0,0,'C'); //$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); } } $lh = 5; //cadre titre $pdf = new PDF(); $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->SetFont('MyFairCody','',26); $pdf->SetTextColor(38,126,39); $pdf->SetDrawColor(38,126,39); //texte titre $x_title = $pdf->GetX(); $y_title = $pdf->GetY(); $pdf->Cell(30); $pdf->SetLineWidth(0.2); $pdf->Cell(125,18,$data["nom"],1,0,'C'); $pdf->SetLineWidth(0.6); $pdf->Rect($x_title+29,$y_title-1,127,20,''); $pdf->SetTextColor(0,0,0); $pdf->Ln(28); //arbre g�n�alogique $pdf->Image('images/tree.png',10,168,180); //cadre coordonnees $x_title = $pdf->GetX(); $y_title = $pdf->GetY(); $pdf->SetLineWidth(0.2); $pdf->Rect($x_title,$y_title,58,115,''); $pdf->SetLineWidth(0.4); $pdf->Rect($x_title-1,$y_title-1,60,117,''); $pdf->SetFont('MyFairCody','',12); //image $horses = new Horses(); $photo = $horses->get_main_picture($id); $horses->free(); if (strlen($photo[0])>0) { if (file_exists('.'.$photo[0])) $pdf->Image('.'.$photo[0],$x_title+62,$y_title,125); } //coordonn�es $pdf->Image('images/jb.jpg',$x_title+5,$y_title+5); $pdf->SetFont('TwCenMT-CondensedBold','',11); $y_title += 15; $pdf->Text($x_title+24,$y_title,'Jean-Baptiste THIEBOT'); $pdf->SetFont('TwCenMT-Condensed','',11); $y_title += $lh; if ($lang=='fr') $pdf->Text($x_title+24,$y_title,utf8_encode('Eleveur - Propri�taire')); else $pdf->Text($x_title+24,$y_title,'Breeder - Owner'); $y_title += $lh*5; $pdf->SetTextColor(102,0,0); $pdf->SetFont('TwCenMT-CondensedBold','',16); $pdf->Text($x_title+5,$y_title,utf8_encode('Haras de B\'N�ville')); $y_title += $lh; $pdf->SetTextColor(0,0,0); $pdf->SetFont('TwCenMT-Regular','',11); $pdf->Text($x_title+5,$y_title,'4 La Maison'); $y_title += $lh; $pdf->Text($x_title+5,$y_title,'50340 BENOISTVILLE'); $y_title += $lh; $pdf->Text($x_title+5,$y_title,'FRANCE'); $y_title += $lh; $y_title += $lh; $pdf->SetFont('TwCenMT-Italic','',11); if ($lang=='fr') $pdf->Text($x_title+3,$y_title,utf8_encode('T�l�phone :')); else $pdf->Text($x_title+3,$y_title,'Phone :'); $pdf->SetFont('TwCenMT-Regular','',11); $pdf->Text($x_title+22,$y_title,'+33 2 33 52 51 49'); $y_title += $lh; $pdf->SetFont('TwCenMT-Italic','',11); if ($lang=='fr') $pdf->Text($x_title+3,$y_title,'Mobile :'); else $pdf->Text($x_title+3,$y_title,'Cell :'); $pdf->SetFont('TwCenMT-Regular','',11); $pdf->Text($x_title+22,$y_title,'+33 6 82 34 58 03'); $y_title += $lh; $pdf->SetFont('TwCenMT-Italic','',11); $pdf->Text($x_title+3,$y_title,'Fax :'); $pdf->SetFont('TwCenMT-Regular','',11); $pdf->Text($x_title+22,$y_title,'+33 2 33 52 51 49'); $y_title += $lh; $y_title += $lh; $pdf->SetFont('TwCenMT-Italic','',11); $pdf->Text($x_title+2,$y_title,'Email :'); $y_title += $lh; $pdf->SetFont('TwCenMT-Regular','',11); $pdf->Text($x_title+2,$y_title,'jb.thiebot@haras-de-bneville.com'); $y_title += $lh; $y_title += $lh; $pdf->SetFont('TwCenMT-Italic','',11); if ($lang=='fr') $pdf->Text($x_title+2,$y_title,'Site Internet :'); else $pdf->Text($x_title+2,$y_title,'Website :'); $y_title += $lh; $pdf->SetFont('TwCenMT-Regular','',11); $pdf->Text($x_title+2,$y_title,'http://www.haras-de-bneville.com'); //tableau $pdf->SetFont('Arial','B',12); $pdf->Ln(97); $pdf->SetFillColor(212,241,170); $pdf->Cell(62); $pdf->Cell(20,7,'Age','LTB',0,'C',true); if ($lang=='fr') $pdf->Cell(25,7,'Genre','TB',0,'C',true); else $pdf->Cell(25,7,'Gender','TB',0,'C',true); if ($lang=='fr') $pdf->Cell(20,7,'Taille','TB',0,'C',true); else $pdf->Cell(20,7,'Height','TB',0,'C',true); if ($lang=='fr') $pdf->Cell(25,7,'Robe','TB',0,'C',true); else $pdf->Cell(25,7,'Coat','TB',0,'C',true); $pdf->Cell(35,7,'Race','RTB',0,'C',true); $pdf->SetFont('Arial','',12); $pdf->Ln(7); $pdf->SetFillColor(255,255,255); $pdf->Cell(62); $datestr = explode("-",$data["datenaiss"]); $datenaiss_time = mktime(0,0,0,$datestr[1],$datestr[2],$datestr[0]); $age = floor( (date("Y") - $datestr[0]) ); if ($datestr[0]<=1970) $pdf->Cell(20,7,'N.C.','LTB',0,'C',true); else $pdf->Cell(20,7,$age.($lang=='fr'?' ans':' y/o'),'LTB',0,'C',true); $pdf->Cell(25,7,$data["genre"],'TB',0,'C',true); $pdf->Cell(20,7,$data["taille"].(strlen($data["taille"])?'cm':''),'TB',0,'C',true); $fs = 12; $pdf->SetFont('Arial','',$fs); while (($pdf->GetStringWidth($data["robe"])>25) && $fs>5) $pdf->SetFont('Arial','',--$fs); $pdf->Cell(25,7,$data["robe"],'TB',0,'C',true); $fs = 12; $pdf->SetFont('Arial','',$fs); while (($pdf->GetStringWidth($data["robe"])>35) && $fs>5) $pdf->SetFont('Arial','',--$fs); $pdf->Cell(35,7,$data["race"],'RTB',0,'C',true); $pdf->SetFont('Arial','',12); // ASCENDANCE $horse = new Horses(); $data = $horse->get_data($id); $p_p_id = 0; $m_p_id = 0; $m_p_id = 0; $m_m_id = 0; $p_p_p_id = 0; $m_p_p_id = 0; $p_m_p_id = 0; $m_m_p_id = 0; $p_p_m_id = 0; $m_p_m_id = 0; $p_m_m_id = 0; $m_m_m_id = 0; //cot� P�re //P et M / P ids if ($data["pereid"]) { $pere_data = $horse->get_data($data["pereid"]); $p_p_id = $pere_data["pereid"]; $m_p_id = $pere_data["mereid"]; } //P / P affich $p_p_name = $horse->get_name($p_p_id); $p_p_race = $horse->get_race($p_p_id); //P / P / P et M / P / P ids if ($p_p_id) { $p_p_data = $horse->get_data($p_p_id); $p_p_p_id = $p_p_data["pereid"]; $m_p_p_id = $p_p_data["mereid"]; } //P / P / P affich $p_p_p_name = $horse->get_name($p_p_p_id); $p_p_p_race = $horse->get_race($p_p_p_id); //M / P / P affich $m_p_p_name = $horse->get_name($m_p_p_id); $m_p_p_race = $horse->get_race($m_p_p_id); //M / P affich $m_p_name = $horse->get_name($m_p_id); $m_p_race = $horse->get_race($m_p_id); //P / M / P et M / M / P ids if ($m_p_id) { $m_p_data = $horse->get_data($m_p_id); $p_m_p_id = $m_p_data["pereid"]; $m_m_p_id = $m_p_data["mereid"]; } //P / M / P affich $p_m_p_name = $horse->get_name($p_m_p_id); $p_m_p_race = $horse->get_race($p_m_p_id); //M / M / P affich $m_m_p_name = $horse->get_name($m_m_p_id); $m_m_p_race = $horse->get_race($m_m_p_id); //cot� M�re //P et M / M ids if ($data["mereid"]) { $mere_data = $horse->get_data($data["mereid"]); $p_m_id = $mere_data["pereid"]; $m_m_id = $mere_data["mereid"]; } //P / M affich $p_m_name = $horse->get_name($p_m_id); $p_m_race = $horse->get_race($p_m_id); //P / P / M et M / P / M ids if ($p_m_id) { $p_m_data = $horse->get_data($p_m_id); $p_p_m_id = $p_m_data["pereid"]; $m_p_m_id = $p_m_data["mereid"]; } //P / P / M affich $p_p_m_name = $horse->get_name($p_p_m_id); $p_p_m_race = $horse->get_race($p_p_m_id); //M / P / M affich $m_p_m_name = $horse->get_name($m_p_m_id); $m_p_m_race = $horse->get_race($m_p_m_id); //M / M affich $m_m_name = $horse->get_name($m_m_id); $m_m_race = $horse->get_race($m_m_id); //P / M / M et M / M / M ids if ($m_m_id) { $m_m_data = $horse->get_data($m_m_id); $p_m_m_id = $m_m_data["pereid"]; $m_m_m_id = $m_m_data["mereid"]; } //P / M / M affich $p_m_m_name = $horse->get_name($p_m_m_id); $p_m_m_race = $horse->get_race($p_m_m_id); //M / M / M affich $m_m_m_name = $horse->get_name($m_m_m_id); $m_m_m_race = $horse->get_race($m_m_m_id); $fs = 12; $pdf->SetFont('Arial','',$fs); while (($pdf->GetStringWidth($data["nom"])>38) && $fs>5) $pdf->SetFont('Arial','B',--$fs); $pdf->Text(31-($pdf->GetStringWidth($data["nom"])/2),225.5,$data["nom"]); $fs = 12; $pdf->SetFont('Arial','',$fs); while (($pdf->GetStringWidth($pere_data["nom"])>38) && $fs>5) $pdf->SetFont('Arial','',--$fs); $pdf->Text(80-($pdf->GetStringWidth($pere_data["nom"])/2),195,$pere_data["nom"]); $pdf->SetFont('Arial','I',8); $pdf->Text(80-($pdf->GetStringWidth($pere_data["race"])/2),199,$pere_data["race"]); $fs = 12; $pdf->SetFont('Arial','',$fs); while (($pdf->GetStringWidth($mere_data["nom"])>38) && $fs>5) $pdf->SetFont('Arial','',--$fs); $pdf->Text(80-($pdf->GetStringWidth($mere_data["nom"])/2),253,$mere_data["nom"]); $pdf->SetFont('Arial','I',8); $pdf->Text(80-($pdf->GetStringWidth($mere_data["race"])/2),257,$mere_data["race"]); $fs = 12; $pdf->SetFont('Arial','',$fs); while (($pdf->GetStringWidth($p_p_name)>38) && $fs>5) $pdf->SetFont('Arial','',--$fs); $pdf->Text(124.5-($pdf->GetStringWidth($p_p_name)/2),181.5,$p_p_name); $pdf->SetFont('Arial','I',8); $pdf->Text(124.5-($pdf->GetStringWidth($p_p_race)/2),185.5,$p_p_race); $fs = 12; $pdf->SetFont('Arial','',$fs); while (($pdf->GetStringWidth($m_p_name)>38) && $fs>5) $pdf->SetFont('Arial','',--$fs); $pdf->Text(124.5-($pdf->GetStringWidth($m_p_name)/2),210,$m_p_name); $pdf->SetFont('Arial','I',8); $pdf->Text(124.5-($pdf->GetStringWidth($m_p_race)/2),214,$m_p_race); $fs = 12; $pdf->SetFont('Arial','',$fs); while (($pdf->GetStringWidth($p_m_name)>38) && $fs>5) $pdf->SetFont('Arial','',--$fs); $pdf->Text(124.5-($pdf->GetStringWidth($p_m_name)/2),238.5,$p_m_name); $pdf->SetFont('Arial','I',8); $pdf->Text(124.5-($pdf->GetStringWidth($p_m_race)/2),242.5,$p_m_race); $fs = 12; $pdf->SetFont('Arial','',$fs); while (($pdf->GetStringWidth($m_m_name)>38) && $fs>5) $pdf->SetFont('Arial','',--$fs); $pdf->Text(124.5-($pdf->GetStringWidth($m_m_name)/2),267,$m_m_name); $pdf->SetFont('Arial','I',8); $pdf->Text(124.5-($pdf->GetStringWidth($m_m_race)/2),271,$m_m_race); $fs = 12; $pdf->SetFont('Arial','',$fs); while (($pdf->GetStringWidth($p_p_p_name)>38) && $fs>5) $pdf->SetFont('Arial','',--$fs); $pdf->Text(168-($pdf->GetStringWidth($p_p_p_name)/2),174.5,$p_p_p_name); $pdf->SetFont('Arial','I',8); $pdf->Text(168-($pdf->GetStringWidth($p_p_p_race)/2),178.5,$p_p_p_race); $fs = 12; $pdf->SetFont('Arial','',$fs); while (($pdf->GetStringWidth($m_p_p_name)>38) && $fs>5) $pdf->SetFont('Arial','',--$fs); $pdf->Text(168-($pdf->GetStringWidth($m_p_p_name)/2),188.8,$m_p_p_name); $pdf->SetFont('Arial','I',8); $pdf->Text(168-($pdf->GetStringWidth($m_p_p_race)/2),192.8,$m_p_p_race); $fs = 12; $pdf->SetFont('Arial','',$fs); while (($pdf->GetStringWidth($p_m_p_name)>38) && $fs>5) $pdf->SetFont('Arial','',--$fs); $pdf->Text(168-($pdf->GetStringWidth($p_m_p_name)/2),203,$p_m_p_name); $pdf->SetFont('Arial','I',8); $pdf->Text(168-($pdf->GetStringWidth($p_m_p_race)/2),207,$p_m_p_race); $fs = 12; $pdf->SetFont('Arial','',$fs); while (($pdf->GetStringWidth($m_m_p_name)>38) && $fs>5) $pdf->SetFont('Arial','',--$fs); $pdf->Text(168-($pdf->GetStringWidth($m_m_p_name)/2),217.3,$m_m_p_name); $pdf->SetFont('Arial','I',8); $pdf->Text(168-($pdf->GetStringWidth($m_m_p_race)/2),221.3,$m_m_p_race); $fs = 12; $pdf->SetFont('Arial','',$fs); while (($pdf->GetStringWidth($p_p_m_name)>38) && $fs>5) $pdf->SetFont('Arial','',--$fs); $pdf->Text(168-($pdf->GetStringWidth($p_p_m_name)/2),231.5,$p_p_m_name); $pdf->SetFont('Arial','I',8); $pdf->Text(168-($pdf->GetStringWidth($p_p_m_race)/2),235.5,$p_p_m_race); $fs = 12; $pdf->SetFont('Arial','',$fs); while (($pdf->GetStringWidth($m_p_m_name)>38) && $fs>5) $pdf->SetFont('Arial','',--$fs); $pdf->Text(168-($pdf->GetStringWidth($m_p_m_name)/2),245.5,$m_p_m_name); $pdf->SetFont('Arial','I',8); $pdf->Text(168-($pdf->GetStringWidth($m_p_m_race)/2),249.5,$m_p_m_race); $fs = 12; $pdf->SetFont('Arial','',$fs); while (($pdf->GetStringWidth($p_m_m_name)>38) && $fs>5) $pdf->SetFont('Arial','',--$fs); $pdf->Text(168-($pdf->GetStringWidth($p_m_m_name)/2),260,$p_m_m_name); $pdf->SetFont('Arial','I',8); $pdf->Text(168-($pdf->GetStringWidth($p_m_m_race)/2),264,$p_m_m_race); $fs = 12; $pdf->SetFont('Arial','',$fs); while (($pdf->GetStringWidth($m_m_m_name)>38) && $fs>5) $pdf->SetFont('Arial','',--$fs); $pdf->Text(168-($pdf->GetStringWidth($m_m_m_name)/2),274.2,$m_m_m_name); $pdf->SetFont('Arial','I',8); $pdf->Text(168-($pdf->GetStringWidth($m_m_m_race)/2),278.2,$m_m_m_race); $horse->free(); $pdf->Output(); ?>