dreamjob/app/Controller/PdfController.php

65 lines
2.8 KiB
PHP

<?php
App::uses('AppController', 'Controller');
class PdfController extends AppController {
public $uses = array('DreamjobJobApplication','DreamjobCvEntry','DreamjobListCvCategory','DreamjobPageText','DreamjobPageImage');
public function applicationGetPdf(){
$this->MiconwareSession->init($this);
$this->MiconwareSession->initWeb($this);
$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', array('title'=>__('dreamjob.error.noPermision.title'),'text'=>__('dreamjob.error.noPermision.text')));
$this->render('/Home/error');
}else{
$this->response->type('application/pdf');
$this->set('application',$application);
$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);
$this->layout = 'pdf';
$this->render('/Pdf/application');
}
}
public function profilGetPdf(){
$this->MiconwareSession->init($this);
$this->MiconwareSession->initWeb($this);
$WORKER = $this->MiconwareSession->getWorker();
if(!is_array($WORKER) or count($WORKER) <= 0){
$this->set('error', array('title'=>__('dreamjob.error.noPermision.title'),'text'=>__('dreamjob.error.noPermision.text')));
$this->render('/Home/error');
}else{
$this->response->type('application/pdf');
$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');
}
}
}
?>