dreamjob/app/View/Pdf/application_ext.ctp

113 lines
3.7 KiB
Plaintext
Raw Permalink Normal View History

2015-03-31 14:49:03 +02:00
<?php
App::import('Vendor','tcpdf/xtcpdf');
//ob_end_clean();
//header("Content-type: application/pdf");
$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;
$tcpdf = new XTCPDF(true);
$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']['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);
$tcpdf->writeHTML('<h1>'.__('dreamjob.application.extern.pdf').'</h1>');
$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);
$tcpdf->title=__('dreamjob.application.extern.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->setCellMargins(1,0,0,0);
$tcpdf->writeHTML('<br/><h2>'.$application['DreamjobJobApplication']['subject'].'</h2><br/>'.$application['DreamjobJobApplication']['text']);
$tcpdf->setCellMargins(0,0,0,0);
//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;
$pageTypeI = false;
foreach($pageImage as $pg){
if($page['id'] == $pg['DreamjobPageInh']['id']){
$pageType=$pg;
$pageTypeI=true;
}
}
if($pageType==null){
foreach($pageText as $pg){
if($page['id'] == $pg['DreamjobPageInh']['id'])
$pageType=$pg;
}
}
$tcpdf->title=$pageType['DreamjobPageInh']['title'];
$tcpdf->AddPage();
$tcpdf->SetY(35);
$tcpdf->SetTextColor(0, 0, 0);
$tcpdf->SetFont($tcpdf->font);
if(!$pageTypeI){
//$tcpdf->writeHTMLCell(0,235,10,35, $pageType['text'], $dev,0,false,true,'L');
$tcpdf->writeHTML($pageType['DreamjobPageText']['text']);
}else{
$tcpdf->Image(WWW_ROOT.DS.'uploads'.DS.$pageType['DreamjobPageImage']['image'],0,35,0,235,'','','','',300,'C');
}
}
// ...
// etc.
// see the TCPDF examples
//$tcpdf->Output('filename.pdf','I');
// TO Download
echo $tcpdf->Output(__('dreamjob.application.extern.filename.pdf'),'S');
//return null;
//ob_start();
?>