dreamjob/app/Controller/PdfController.php

71 lines
3.0 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 10:12:06 +02:00
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){
2014-06-10 18:37:45 +02:00
$this->set('error', array('title'=>__('dreamjob.error.noPermision.title'),'text'=>__('dreamjob.error.noPermision.text')));
2014-10-04 15:44:21 +02:00
if(!$this->MiconwareSession->isLoggedin())
$this->render('/Home/login');
else
$this->render('/Home/error');
2014-04-22 22:17:01 +02:00
}else{
2014-04-24 10:12:06 +02:00
$this->response->type('application/pdf');
2014-04-22 22:17:01 +02:00
$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);
$WORKER = $this->MiconwareSession->getWorker();
if(!is_array($WORKER) or count($WORKER) <= 0){
2014-06-10 18:37:45 +02:00
$this->set('error', array('title'=>__('dreamjob.error.noPermision.title'),'text'=>__('dreamjob.error.noPermision.text')));
2014-10-04 15:44:21 +02:00
if(!$this->MiconwareSession->isLoggedin())
$this->render('/Home/login');
else
$this->render('/Home/error');
2014-04-23 17:18:47 +02:00
}else{
2014-04-24 10:12:06 +02:00
$this->response->type('application/pdf');
2014-04-23 17:18:47 +02:00
$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
}
}
?>