dreamjob/app/Controller/PdfController.php

64 lines
2.7 KiB
PHP
Raw Normal View History

2014-04-22 20:50:23 +02:00
<?php
App::uses('AppController', 'Controller');
class PdfController extends AppController {
2014-04-23 17:18:47 +02:00
public $uses = array('DreamjobJobApplication','DreamjobCvEntry','DreamjobListCvCategory','DreamjobPageText','DreamjobPageImage');
2014-04-22 22:17:01 +02:00
2014-04-22 20:50:23 +02:00
public function applicationGetPdf(){
2014-04-22 22:17:01 +02:00
$this->MiconwareSession->init($this);
$this->MiconwareSession->initWeb($this);
2014-04-24 00:27:42 +02:00
$this->response->type('application/pdf');
2014-04-22 22:17:01 +02:00
$WORKER = $this->MiconwareSession->getWorker();
$COMPANY = $self = $this->MiconwareSession->getCompany();
$application = null;
if(isset($this->request->params['id'])){
if(is_array($WORKER) and count($WORKER) > 0)
$application = $this->DreamjobJobApplication->find('first',array('conditions' => array('DreamjobJobApplication.worker_id' => $WORKER['AppUser']['id'],'DreamjobJobApplication.id'=> $this->request->params['id'] )));
if(is_array($COMPANY) and count($COMPANY) > 0)
$application = $this->DreamjobJobApplication->find('first',array('conditions' => array('DreamjobJobOpening.company_id' => $COMPANY['AppUser']['id'],'DreamjobJobApplication.id'=> $this->request->params['id'] )));
}
if(!is_array($application) or count($application) <= 0){
$this->set('error', 'dreamjob.error.noPermision');
$this->render('/Home/error');
}else{
$this->set('application',$application);
2014-04-23 12:38:18 +02:00
$cv = $this->DreamjobCvEntry->find('all',array('conditions' => array('worker_id'=> $application['DreamjobJobApplication']['worker_id'])));
$this->set("cv",$cv);
$cvp0 = $this->DreamjobListCvCategory->find('first',array('conditions' => array('DreamjobListCvCategory.position' => 0)));
$this->set('cvp0', $cvp0);
$this->set('edit', false);
2014-04-22 22:17:01 +02:00
$this->layout = 'pdf';
2014-04-23 17:18:47 +02:00
$this->render('/Pdf/application');
}
}
public function profilGetPdf(){
$this->MiconwareSession->init($this);
$this->MiconwareSession->initWeb($this);
2014-04-24 00:27:42 +02:00
$this->response->type('application/pdf');
2014-04-23 17:18:47 +02:00
$WORKER = $this->MiconwareSession->getWorker();
if(!is_array($WORKER) or count($WORKER) <= 0){
$this->set('error', 'dreamjob.error.noPermision');
$this->render('/Home/error');
}else{
$cv = $this->DreamjobCvEntry->find('all',array('conditions' => array('worker_id'=> $WORKER['AppUser']['id'])));
$this->set("cv",$cv);
$cvp0 = $this->DreamjobListCvCategory->find('first',array('conditions' => array('DreamjobListCvCategory.position' => 0)));
$this->set('cvp0', $cvp0);
$this->set('edit', false);
$this->set("pageText",$this->DreamjobPageText->find('all',array('DreamjobPageInh.user_id' =>$WORKER['AppUser']['id'])));
$this->set("pageImage",$this->DreamjobPageImage->find('all',array('DreamjobPageInh.user_id' =>$WORKER['AppUser']['id'])));
$this->layout = 'pdf';
$this->render('/Pdf/profil');
2014-04-22 22:17:01 +02:00
}
2014-04-22 20:50:23 +02:00
}
}
?>