dreamjob/app/View/Pdf/application_ext.ctp

115 lines
3.8 KiB
Plaintext
Raw Normal View History

2014-08-16 09:17:04 +02:00
<?php
App::import('Vendor','tcpdf/xtcpdf');
2014-08-16 12:58:29 +02:00
//ob_end_clean();
//header("Content-type: application/pdf");
2014-08-16 09:17:04 +02:00
$cvinhalt = $this->element('user_worker_cv_pdf',array('profil'=>array('User'=>$application['WorkerUser']
,'AppUser'=>$application['AppUserWorker'],'DreamjobWorker'=>$application['DreamjobWorker'],'DreamjobListGraducation'=>$application['WorkerGraducation'],'DreamjobListCity'=>$application['DreamjobWorkerListCity'])));
$dev = 0;
2014-09-24 21:13:56 +02:00
$tcpdf = new XTCPDF(true);
2014-08-16 09:17:04 +02:00
$tcpdf->SetMargins(25,35,25,20);
$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);
$url=WWW_ROOT.DS.'img'.DS.'icon_user.png';
if($application['AppUserWorker']['take_systemwide']){
if($application['WorkerUser']['avatar'])
$url = WWW_ROOT.DS.'uploads'.DS.$application['WorkerUser']['avatar'];
}else
if($profil['AppUserWorker']['avatar'])
$url = WWW_ROOT.DS.'uploads'.DS.$application['AppUserWorker']['avatar'];
$tcpdf->Image($url,0,40,0,140,'','','','',300,'L');
$tcpdf->SetY(185);
//$tcpdf->SetFont($tcpdf->font,'B',$tcpdf->fontsize+4);
//$tcpdf->Cell(0,0, , 0,1,'L');
//$tcpdf->SetFont($tcpdf->font,'',$tcpdf->fontsize);
2014-09-23 15:03:35 +02:00
$tcpdf->writeHTML('<h1>'.__('dreamjob.application.extern.pdf').'</h1>');
2014-08-16 09:17:04 +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
$tcpdf->SetAutoPageBreak( true, 20);
2014-09-23 15:03:35 +02:00
$tcpdf->title=__('dreamjob.application.extern.why');
2014-08-16 09:17:04 +02:00
$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->writeHTML('<br/><h2>'.$application['DreamjobJobApplication']['subject'].'</h2><br/>'.$application['DreamjobJobApplication']['text']);
2014-08-16 12:58:29 +02:00
2014-08-16 09:17:04 +02:00
//Lebenslauf
$tcpdf->title=__('dreamjob.cv');
$tcpdf->AddPage();
$tcpdf->SetY(35);
$tcpdf->SetTextColor(0, 0, 0);
$tcpdf->SetFont($tcpdf->font);
$tcpdf->writeHTML($cvinhalt);
$tcpdf->SetAutoPageBreak( false );
//Anhang
foreach($application['Page'] as $page){
$pageType = null;
2014-08-16 12:58:29 +02:00
$pageTypeI = false;
foreach($pageImage as $pg){
if($page['id'] == $pg['DreamjobPageInh']['id']){
2014-08-16 09:17:04 +02:00
$pageType=$pg;
2014-08-16 12:58:29 +02:00
$pageTypeI=true;
}
2014-08-16 09:17:04 +02:00
}
if($pageType==null){
2014-08-16 12:58:29 +02:00
foreach($pageText as $pg){
if($page['id'] == $pg['DreamjobPageInh']['id'])
2014-08-16 09:17:04 +02:00
$pageType=$pg;
}
2014-08-16 12:58:29 +02:00
}
$tcpdf->title=$pageType['DreamjobPageInh']['title'];
$tcpdf->AddPage();
$tcpdf->SetY(35);
$tcpdf->SetTextColor(0, 0, 0);
$tcpdf->SetFont($tcpdf->font);
if(!$pageTypeI){
2014-08-16 09:17:04 +02:00
//$tcpdf->writeHTMLCell(0,235,10,35, $pageType['text'], $dev,0,false,true,'L');
2014-08-16 12:58:29 +02:00
$tcpdf->writeHTML($pageType['DreamjobPageText']['text']);
2014-08-16 09:17:04 +02:00
}else{
2014-08-16 12:58:29 +02:00
$tcpdf->Image(WWW_ROOT.DS.'uploads'.DS.$pageType['DreamjobPageImage']['image'],0,35,0,235,'','','','',300,'C');
2014-08-16 09:17:04 +02:00
}
}
// ...
// etc.
// see the TCPDF examples
//$tcpdf->Output('filename.pdf','I');
// TO Download
2014-09-24 16:47:37 +02:00
echo $tcpdf->Output(__('dreamjob.application.extern.filename.pdf'),'S');
2014-08-16 12:58:29 +02:00
//return null;
//ob_start();
2014-08-16 09:17:04 +02:00
?>