dreamjob/app/View/Pdf/application.ctp

103 lines
3.6 KiB
Plaintext
Raw Normal View History

2014-04-22 20:50:23 +02:00
<?php
App::import('Vendor','tcpdf/xtcpdf');
2014-04-24 10:53:29 +02:00
ob_end_clean();
header("Content-type: application/pdf");
2014-04-23 14:55:40 +02:00
$cvinhalt = $this->element('user_worker_cv',array('toPDF'=>true,'profil'=>array('User'=>$application['WorkerUser']
2014-04-23 12:38:18 +02:00
,'AppUser'=>$application['AppUserWorker'],'DreamjobWorker'=>$application['DreamjobWorker'],'DreamjobListGraducation'=>$application['WorkerGraducation'],'DreamjobListCity'=>$application['DreamjobWorkerListCity'])));
2014-04-23 19:23:23 +02:00
2014-04-23 22:41:44 +02:00
$cvinhalt .= '<style>span{font-style:italic;font-size:10px;}h1,h2,h3,h4,h5{
2014-04-28 22:49:00 +02:00
border-bottom:1px solid grey;
margin-bottom:3px;
2014-04-23 22:41:44 +02:00
width:100%;
}</style>';
2014-04-23 12:38:18 +02:00
2014-04-23 14:55:40 +02:00
$dev = 0;
2014-04-22 20:50:23 +02:00
$tcpdf = new XTCPDF();
2014-04-23 15:14:14 +02:00
$tcpdf->SetMargins(25,25,20,25);
2014-04-22 20:50:23 +02:00
$tcpdf->SetAuthor("Miconware");
$tcpdf->SetAutoPageBreak( false );
2014-04-22 22:17:01 +02:00
$tcpdf->mail=$application['WorkerUser']['mail'];
2014-04-22 20:50:23 +02:00
$tcpdf->AddPage();
2014-04-22 22:17:01 +02:00
// Deckblatt
2014-04-22 20:50:23 +02:00
$tcpdf->SetY(35);
$tcpdf->SetTextColor(0, 0, 0);
$tcpdf->SetFont($tcpdf->font);
2014-04-28 22:49:00 +02:00
$tcpdf->Image(WWW_ROOT.DS.'uploads'.DS.$application['AppUserWorker']['avatar'],0,40,0,140,'','','','',300,'L');
$tcpdf->SetY(185);
2014-04-29 23:51:16 +02:00
$tcpdf->SetFont($tcpdf->font,'B',$tcpdf->fontsize+4);
2014-04-22 22:17:01 +02:00
$tcpdf->Cell(0,0, __('dreamjob.application'), 0,1,'L');
2014-04-29 23:51:16 +02:00
$tcpdf->SetFont($tcpdf->font,'',$tcpdf->fontsize);
2014-04-22 22:17:01 +02:00
$tcpdf->Cell(0,0, __('dreamjob.application.for').' '.$application['DreamjobJobOpening']['title'], 0,1,'L');
2014-04-22 20:50:23 +02:00
2014-04-22 22:17:01 +02:00
$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
2014-04-22 22:34:12 +02:00
$tcpdf->title=__('dreamjob.application.why');
2014-04-22 20:50:23 +02:00
$tcpdf->AddPage();
$tcpdf->SetY(35);
$tcpdf->SetTextColor(0, 0, 0);
$tcpdf->SetFont($tcpdf->font);
2014-04-22 22:17:01 +02:00
2014-04-29 23:57:29 +02:00
$tcpdf->Cell(0,0, $application['AppUserWorker']['first_name'].' '.$application['AppUserWorker']['last_name'], 0,1,'L');
2014-04-22 22:17:01 +02:00
$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);
2014-04-23 19:23:23 +02:00
$tcpdf->Cell(0,0, $application['AppUser']['nickname'], 0,1,'L');
2014-04-22 22:17:01 +02:00
$tcpdf->Cell(0,0, $application['DreamjobUser']['street'], 0,1,'L');
$tcpdf->Cell(0,0, $application['DreamjobUser']['postcode'].' '.$application['DreamjobListCity']['name'], 0,1,'L');
2014-04-30 00:18:36 +02:00
$tcpdf->Cell(0,5, '', 0,1,'L');
2014-04-30 00:17:31 +02:00
$tcpdf->SetAutoPageBreak( true, 55);
2014-04-29 23:57:29 +02:00
$tcpdf->writeHTML('<h1>'.$application['DreamjobJobApplication']['subject'].'</h1><br/>'.$application['DreamjobJobApplication']['text']);
2014-04-22 22:17:01 +02:00
//Lebenslauf
2014-04-30 00:17:31 +02:00
$tcpdf->SetAutoPageBreak( true, 55);
2014-04-22 22:34:12 +02:00
$tcpdf->title=__('dreamjob.cv');
$tcpdf->AddPage();
$tcpdf->SetY(35);
$tcpdf->SetTextColor(0, 0, 0);
$tcpdf->SetFont($tcpdf->font);
2014-04-22 22:17:01 +02:00
2014-04-23 12:38:18 +02:00
$tcpdf->writeHTML($cvinhalt);
2014-04-23 10:34:50 +02:00
$tcpdf->SetAutoPageBreak( false );
2014-04-22 22:17:01 +02:00
//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;
}
2014-04-22 22:34:12 +02:00
$tcpdf->writeHTMLCell(0,235,10,35, $pageType['text'], $dev,0,false,true,'L');
2014-04-22 22:17:01 +02:00
}else{
$tcpdf->Image(WWW_ROOT.DS.'uploads'.DS.$pageType['image'],0,35,0,235,'','','','',300,'C');
}
}
2014-04-22 20:50:23 +02:00
// ...
// etc.
// see the TCPDF examples
2014-04-24 10:31:59 +02:00
//$tcpdf->Output('filename.pdf','I');
2014-04-22 20:50:23 +02:00
// TO Download
2014-04-24 10:31:59 +02:00
$tcpdf->Output('filename.pdf','D');
2014-04-24 10:53:29 +02:00
return null;
2014-04-22 20:50:23 +02:00
?>