104 lines
3.6 KiB
PHP
104 lines
3.6 KiB
PHP
<?php
|
|
App::import('Vendor','tcpdf/xtcpdf');
|
|
ob_end_clean();
|
|
header("Content-type: application/pdf");
|
|
|
|
$cvinhalt = $this->element('user_worker_cv',array('toPDF'=>true,'profil'=>array('User'=>$application['WorkerUser']
|
|
,'AppUser'=>$application['AppUserWorker'],'DreamjobWorker'=>$application['DreamjobWorker'],'DreamjobListGraducation'=>$application['WorkerGraducation'],'DreamjobListCity'=>$application['DreamjobWorkerListCity'])));
|
|
|
|
$cvinhalt .= '<style>span{font-style:italic;font-size:10px;}h1,h2,h3,h4,h5{
|
|
border-bottom:1px solid grey;
|
|
margin-bottom:3px;
|
|
width:100%;
|
|
}</style>';
|
|
|
|
|
|
$dev = 0;
|
|
$tcpdf = new XTCPDF();
|
|
$tcpdf->SetMargins(25,25,20,25);
|
|
$tcpdf->SetAuthor("Miconware");
|
|
$tcpdf->SetAutoPageBreak( false );
|
|
|
|
$tcpdf->mail=$application['WorkerUser']['mail'];
|
|
|
|
$tcpdf->AddPage();
|
|
|
|
// Deckblatt
|
|
$tcpdf->SetY(35);
|
|
$tcpdf->SetTextColor(0, 0, 0);
|
|
$tcpdf->SetFont($tcpdf->font);
|
|
$tcpdf->Image(WWW_ROOT.DS.'uploads'.DS.$application['AppUserWorker']['avatar'],0,40,0,140,'','','','',300,'L');
|
|
$tcpdf->SetY(185);
|
|
$tcpdf->SetFont($tcpdf->font,'B',$tcpdf->fontsize+4);
|
|
$tcpdf->Cell(0,0, __('dreamjob.application'), 0,1,'L');
|
|
$tcpdf->SetFont($tcpdf->font,'',$tcpdf->fontsize);
|
|
$tcpdf->Cell(0,0, __('dreamjob.application.for').' '.$application['DreamjobJobOpening']['title'], 0,1,'L');
|
|
|
|
$tcpdf->SetY(255);
|
|
$tcpdf->Cell(0,0, $application['Mannerofaddress']['name'].' '.$application['AppUserWorker']['first_name'].' '.$application['AppUserWorker']['last_name'], 0,1,'R');
|
|
$tcpdf->Cell(0,0, $application['DreamjobUserWorker']['street'], 0,1,'R');
|
|
$tcpdf->Cell(0,0, $application['DreamjobUserWorker']['postcode'].' '.$application['DreamjobWorkerListCity']['name'], 0,1,'R');
|
|
|
|
//Anschreiben
|
|
$tcpdf->title=__('dreamjob.application.why');
|
|
$tcpdf->AddPage();
|
|
$tcpdf->SetY(35);
|
|
$tcpdf->SetTextColor(0, 0, 0);
|
|
$tcpdf->SetFont($tcpdf->font);
|
|
|
|
$tcpdf->Cell(0,0, $application['AppUserWorker']['first_name'].' '.$application['AppUserWorker']['last_name'], 0,1,'L');
|
|
$tcpdf->Cell(0,0, $application['DreamjobUserWorker']['street'], 0,1,'L');
|
|
$tcpdf->Cell(0,0, $application['DreamjobUserWorker']['postcode'].' '.$application['DreamjobWorkerListCity']['name'], 0,1,'L');
|
|
$tcpdf->SetY(60);
|
|
$tcpdf->Cell(0,0, $application['AppUser']['nickname'], 0,1,'L');
|
|
$tcpdf->Cell(0,0, $application['DreamjobUser']['street'], 0,1,'L');
|
|
$tcpdf->Cell(0,0, $application['DreamjobUser']['postcode'].' '.$application['DreamjobListCity']['name'], 0,1,'L');
|
|
|
|
$tcpdf->SetY(85);
|
|
$tcpdf->SetAutoPageBreak( true,50);
|
|
$tcpdf->writeHTML('<h1>'.$application['DreamjobJobApplication']['subject'].'</h1><br/>'.$application['DreamjobJobApplication']['text']);
|
|
|
|
//Lebenslauf
|
|
$tcpdf->title=__('dreamjob.cv');
|
|
$tcpdf->AddPage();
|
|
$tcpdf->SetY(35);
|
|
$tcpdf->SetTextColor(0, 0, 0);
|
|
$tcpdf->SetFont($tcpdf->font);
|
|
|
|
//$tcpdf->writeHTML(0,235,10,35, $cvinhalt, $dev,0,false,true,'L');
|
|
$tcpdf->writeHTML($cvinhalt);
|
|
$tcpdf->SetAutoPageBreak( false );
|
|
|
|
//Anhang
|
|
foreach($application['Page'] as $page){
|
|
$tcpdf->title=$page['title'];
|
|
$tcpdf->AddPage();
|
|
$tcpdf->SetY(35);
|
|
$tcpdf->SetTextColor(0, 0, 0);
|
|
$tcpdf->SetFont($tcpdf->font);
|
|
|
|
$pageType = null;
|
|
foreach($application['PageImage'] as $pg){
|
|
if($page['id'] == $pg['page_ptr_id'])
|
|
$pageType=$pg;
|
|
}
|
|
if($pageType==null){
|
|
foreach($application['PageText'] as $pg){
|
|
if($page['id'] == $pg['page_ptr_id'])
|
|
$pageType=$pg;
|
|
}
|
|
$tcpdf->writeHTMLCell(0,235,10,35, $pageType['text'], $dev,0,false,true,'L');
|
|
}else{
|
|
$tcpdf->Image(WWW_ROOT.DS.'uploads'.DS.$pageType['image'],0,35,0,235,'','','','',300,'C');
|
|
}
|
|
}
|
|
// ...
|
|
// etc.
|
|
// see the TCPDF examples
|
|
|
|
//$tcpdf->Output('filename.pdf','I');
|
|
// TO Download
|
|
$tcpdf->Output('filename.pdf','D');
|
|
return null;
|
|
?>
|