externe bewerbung Formulat

This commit is contained in:
Martin Müller 2014-08-16 12:58:29 +02:00
parent 0b2e8f6a19
commit d76de46eb6
2 changed files with 69 additions and 22 deletions

View File

@ -381,10 +381,46 @@ class JobController extends AppController {
$pages = $this->request->data['DreamjobJobApplicationPage']['page_id'];
unset($this->request->data['DreamjobJobApplicationPage']['page_id']);
foreach ($pages as $id)
$this->request->data['DreamjobJobApplicationPage'][] = array('page_id' => $id);
$this->request->data['Page'][] = array('id' => $id);
//$result = $this->DreamjobJobApplication->sendApplication($this->request->data);
$result = false;
if ($result) {
$this->request->data['WorkerUser'] = $w['User'];
$this->request->data['AppUserWorker'] = $w['AppUser'];
$this->request->data['DreamjobWorker'] = $w['DreamjobWorker'];
$this->request->data['DreamjobUserWorker'] = $w['DreamjobUser'];
$this->request->data['Mannerofaddress'] = $w['Mannerofaddress'];
$this->request->data['WorkerGraducation'] = $w['DreamjobListGraducation'];
$this->request->data['DreamjobWorkerListCity'] = $w['DreamjobListCity'];
$this->request->data['PageImage'] = $w['DreamjobListCity'];
$this->request->data['PageText'] = $w['DreamjobListCity'];
$view = new View($this, false);
$view->set('cv',$this->DreamjobCvEntry->find('all',array('conditions' => array('worker_id'=> $w['AppUser']['id']))));
$view->set('cvp0',$this->DreamjobListCvCategory->find('first',array('conditions' => array('DreamjobListCvCategory.position' => 0))));
$view->set('edit', false);
$pageText = $this->DreamjobPageText->find('all',array('conditions' => array('DreamjobPageInh.user_id' =>$w['AppUser']['id'])));
$view->set("pageText",$pageText);
$pageImage = $this->DreamjobPageImage->find('all',array('conditions' => array('DreamjobPageInh.user_id' =>$w['AppUser']['id'])));
$view->set("pageImage",$pageImage);
$view->set('application',$this->request->data);
$view->set('profil',$w);
$pdf = $view->render('/Pdf/application_ext');
$Email = new CakeEmail('dreamjobMain');
$Email->to($this->request->data['DreamjobUser']['mail']);
$Email->subject(__('dreamjob.application.extern'));
$Email->template('simple_message');
$Email->viewVars(array('data'=>'test'));
$Email->attachments(array('filename.pdf'=>array('data' =>$pdf,'mimetype' => 'application/pdf')));
if ($Email->send()) {
$this->MiconwareSession->setFlash(__('dreamjob.application.send.success'), 'flash', array('alert' => 'success'));
} else {
$this->MiconwareSession->setFlash(__('dreamjob.application.send.error'), 'flash', array('alert' => 'danger'));
@ -399,8 +435,10 @@ class JobController extends AppController {
$this->request->data['DreamjobUser']['postcode'] = $this->request->query('postcode');
$this->request->data['DreamjobListCity']['name'] = $this->request->query('city');
}
$this->set('pages', $w['DreamjobPageInh']);
$this->render('/Job/application_send_ext');
} else {
$this->set('error', array('title'=>__('dreamjob.error.noWorker.title'),'text'=>__('dreamjob.error.noWorker.text')));
$this->render('/Home/error');

View File

@ -1,7 +1,8 @@
<?php
App::import('Vendor','tcpdf/xtcpdf');
ob_end_clean();
header("Content-type: application/pdf");
//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'])));
@ -35,7 +36,7 @@ $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').'</h1>'.__('dreamjob.application.for').' '.$application['DreamjobJobOpening']['title']);
$tcpdf->writeHTML('<h1>'.__('dreamjob.application.extern').'</h1>');
$tcpdf->SetY(255);
$tcpdf->Cell(0,0, $application['Mannerofaddress']['name'].' '.$application['AppUserWorker']['first_name'].' '.$application['AppUserWorker']['last_name'], 0,1,'R');
@ -60,6 +61,7 @@ $tcpdf->Cell(0,0, $application['DreamjobUser']['postcode'].' '.$application['Dre
$tcpdf->writeHTML('<br/><h2>'.$application['DreamjobJobApplication']['subject'].'</h2><br/>'.$application['DreamjobJobApplication']['text']);
//Lebenslauf
$tcpdf->title=__('dreamjob.cv');
$tcpdf->AddPage();
@ -72,26 +74,32 @@ $tcpdf->SetAutoPageBreak( false );
//Anhang
foreach($application['Page'] as $page){
$tcpdf->title=$page['title'];
$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);
$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;
}
if(!$pageTypeI){
//$tcpdf->writeHTMLCell(0,235,10,35, $pageType['text'], $dev,0,false,true,'L');
$tcpdf->writeHTML($pageType['text']);
$tcpdf->writeHTML($pageType['DreamjobPageText']['text']);
}else{
$tcpdf->Image(WWW_ROOT.DS.'uploads'.DS.$pageType['image'],0,35,0,235,'','','','',300,'C');
$tcpdf->Image(WWW_ROOT.DS.'uploads'.DS.$pageType['DreamjobPageImage']['image'],0,35,0,235,'','','','',300,'C');
}
}
// ...
@ -100,6 +108,7 @@ foreach($application['Page'] as $page){
//$tcpdf->Output('filename.pdf','I');
// TO Download
$tcpdf->Output('/tmp/filename.pdf','F');
// return null;
echo $tcpdf->Output('filename.pdf','S');
//return null;
//ob_start();
?>