From 810201098b0d65f620ddb4a9c5b35d95e4ffa54e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20M=C3=BCller?= Date: Wed, 23 Apr 2014 17:18:47 +0200 Subject: [PATCH] subject in application --- app/Config/routes.php | 7 +++-- app/Controller/PdfController.php | 27 +++++++++++++++++-- app/Model/DreamjobWorker.php | 11 +++++++- app/View/Elements/user_worker_cv.ctp | 2 +- app/View/Elements/user_worker_cv_edit.ctp | 2 +- app/View/Elements/user_worker_header.ctp | 8 +++--- app/View/Elements/user_worker_item.ctp | 2 +- app/View/Job/application.ctp | 2 +- app/View/Pdf/{opening.ctp => application.ctp} | 0 app/View/User/company.ctp | 2 +- 10 files changed, 50 insertions(+), 13 deletions(-) rename app/View/Pdf/{opening.ctp => application.ctp} (100%) diff --git a/app/Config/routes.php b/app/Config/routes.php index 8dfcb68..4589182 100755 --- a/app/Config/routes.php +++ b/app/Config/routes.php @@ -58,8 +58,7 @@ Router::connect('/application', array('controller' => 'job', 'action' => 'applicationList')); Router::connect('/application/:id', array('controller' => 'job', 'action' => 'applicationGet'),array("id" => "[0-9]+")); - Router::connect('/application/:id/pdf', array('controller' => 'pdf', 'action' => 'applicationGetPdf'),array("id" => "[0-9]+")); - Router::connect('/application/:id.pdf', array('controller' => 'pdf', 'action' => 'applicationGetPdf'),array("id" => "[0-9]+")); + Router::connect('/application/:id/page/:page', array('controller' => 'job', 'action' => 'applicationGet'),array("id" => "[0-9]+","page" => "[0-9]+")); Router::connect('/application/:id/curriculum:vitea', array('controller' => 'job', 'action' => 'applicationGet'), array("id" => "[0-9]+",'vitea' => '(?i:vitea)')); Router::connect('/application/:id/mess:ages', array('controller' => 'job', 'action' => 'applicationGet'), array("id" => "[0-9]+",'ages' => '(?i:ages)')); @@ -80,6 +79,10 @@ Router::connect('/test/', array('controller' => 'user', 'action' => 'test')); + Router::parseExtensions('pdf'); + Router::connect('/application/:id.pdf', array('controller' => 'pdf', 'action' => 'applicationGetPdf'),array("id" => "[0-9]+")); + Router::connect('/profil.pdf', array('controller' => 'pdf', 'action' => 'profilGetPdf')); + Router::parseExtensions('json'); Router::connect('/profil/save/cv', array('controller' => 'user', 'action' => 'saveCvJson')); Router::connect('/settings/pages/delete', array('controller' => 'user', 'action' => 'savePageDeleteJson')); diff --git a/app/Controller/PdfController.php b/app/Controller/PdfController.php index e25fb59..c06f17b 100644 --- a/app/Controller/PdfController.php +++ b/app/Controller/PdfController.php @@ -4,7 +4,7 @@ App::uses('AppController', 'Controller'); class PdfController extends AppController { - public $uses = array('DreamjobJobApplication','DreamjobCvEntry','DreamjobListCvCategory'); + public $uses = array('DreamjobJobApplication','DreamjobCvEntry','DreamjobListCvCategory','DreamjobPageText','DreamjobPageImage'); public function applicationGetPdf(){ $this->MiconwareSession->init($this); @@ -31,7 +31,30 @@ class PdfController extends AppController { $this->set('cvp0', $cvp0); $this->set('edit', false); $this->layout = 'pdf'; - $this->render('/Pdf/opening'); + $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', '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'); } } } diff --git a/app/Model/DreamjobWorker.php b/app/Model/DreamjobWorker.php index d7d9bad..f61d98e 100755 --- a/app/Model/DreamjobWorker.php +++ b/app/Model/DreamjobWorker.php @@ -307,7 +307,13 @@ class DreamjobWorker extends AppModel { 'foreignKey' => false, 'conditions' => array('DreamjobListCity.id=DreamjobUser.city_id'), 'limit' => 1 - ) + ), + 'Mannerofaddress' => array( + 'className' => 'Mannerofaddress', + 'foreignKey' => false, + 'conditions' => array('DreamjobWorker.djaccount_ptr_id=AppUser.id and Mannerofaddress.id=AppUser.mannerofaddress_id'), + 'limit' => 1 + ), ); public $hasMany = array( 'DreamjobPageInh' => array( @@ -315,6 +321,9 @@ class DreamjobWorker extends AppModel { 'foreignKey' => 'user_id', 'order' => "DreamjobPageInh.position" ), + + + 'DreamjobJobApplication' => array( 'className' => 'DreamjobJobApplication', 'foreignKey' => 'worker_id' diff --git a/app/View/Elements/user_worker_cv.ctp b/app/View/Elements/user_worker_cv.ctp index 5455dab..0f8d5bc 100644 --- a/app/View/Elements/user_worker_cv.ctp +++ b/app/View/Elements/user_worker_cv.ctp @@ -36,7 +36,7 @@ if($edit){ - + diff --git a/app/View/Elements/user_worker_cv_edit.ctp b/app/View/Elements/user_worker_cv_edit.ctp index 50ccfd6..d74e7a0 100644 --- a/app/View/Elements/user_worker_cv_edit.ctp +++ b/app/View/Elements/user_worker_cv_edit.ctp @@ -36,7 +36,7 @@ echo $this->Html->link($text,array('controller'=>'user','action'=>'profil'),arra - + diff --git a/app/View/Elements/user_worker_header.ctp b/app/View/Elements/user_worker_header.ctp index a71f027..c16a993 100644 --- a/app/View/Elements/user_worker_header.ctp +++ b/app/View/Elements/user_worker_header.ctp @@ -38,13 +38,15 @@

:
-

- 0){ ?> + 0 and !isset($application)){ ?>

- + + Html->link(__('dreamjob.application.mappePDF'),array('controller'=>'pdf','action'=>'profilGetPdf'));?> + + Html->link(__('dreamjob.application.mappePDF'),array('controller'=>'pdf','action'=>'applicationGetPdf','id'=>$application['DreamjobJobApplication']['id']));?> diff --git a/app/View/Elements/user_worker_item.ctp b/app/View/Elements/user_worker_item.ctp index c62c6d8..d72b9d1 100644 --- a/app/View/Elements/user_worker_item.ctp +++ b/app/View/Elements/user_worker_item.ctp @@ -40,7 +40,7 @@ - + Time->format('d.m.Y H:i', $profil['DreamjobJobApplication']['created']);?> diff --git a/app/View/Job/application.ctp b/app/View/Job/application.ctp index 434ac37..86fb01d 100644 --- a/app/View/Job/application.ctp +++ b/app/View/Job/application.ctp @@ -49,7 +49,7 @@ 'AppUser'=>$application["AppUserWorker"], 'User'=>$application["WorkerUser"], 'DreamjobListGraducation'=>$application["WorkerGraducation"]); - echo $this->element('user_worker_header',array('profil'=>$profil)); + echo $this->element('user_worker_header',array('profil'=>$profil,'application'=>$application)); ?> diff --git a/app/View/Pdf/opening.ctp b/app/View/Pdf/application.ctp similarity index 100% rename from app/View/Pdf/opening.ctp rename to app/View/Pdf/application.ctp diff --git a/app/View/User/company.ctp b/app/View/User/company.ctp index 72b672d..247e5f1 100644 --- a/app/View/User/company.ctp +++ b/app/View/User/company.ctp @@ -67,7 +67,7 @@ if($profil['AppUser']['take_systemwide']){


- +