diff --git a/app/Config/routes.php b/app/Config/routes.php index 10e4b03..ec0a271 100755 --- a/app/Config/routes.php +++ b/app/Config/routes.php @@ -83,6 +83,7 @@ Router::connect('/application/:id/arc:hiv', array('controller' => 'job', 'action' => 'applicationGet'), array("id" => "[0-9]+",'hiv' => '(?i:hiv)')); Router::connect('/applicate/:id', array('controller' => 'job', 'action' => 'applicationSend'),array("id" => "[0-9]+")); + Router::connect('/applicate/extern', array('controller' => 'job', 'action' => 'applicationSendExt')); Router::connect('/favorite', array('controller' => 'job', 'action' => 'favorite')); diff --git a/app/Controller/JobController.php b/app/Controller/JobController.php index f48f612..7e8da35 100644 --- a/app/Controller/JobController.php +++ b/app/Controller/JobController.php @@ -321,6 +321,7 @@ class JobController extends AppController { } } + public function applicationSend() { $this->MiconwareSession->init($this); $this->MiconwareSession->initWeb($this); @@ -366,6 +367,39 @@ class JobController extends AppController { $this->render('/Home/error'); } } + public function applicationSendExt() { + $this->MiconwareSession->init($this); + $this->MiconwareSession->initWeb($this); + $w = $this->MiconwareSession->getWorker(); + if (!empty($w)) { + if ($this->request->is('post')) { + if ($this->request->data['DreamjobJobApplication']['agb']) { + unset($this->request->data['DreamjobJobApplication']['agb']); + + $this->request->data['DreamjobJobApplication']['worker_id'] = $w['AppUser']['id']; + + $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); + //$result = $this->DreamjobJobApplication->sendApplication($this->request->data); + $result = false; + if ($result) { + $this->MiconwareSession->setFlash(__('dreamjob.application.send.success'), 'flash', array('alert' => 'success')); + } else { + $this->MiconwareSession->setFlash(__('dreamjob.application.send.error'), 'flash', array('alert' => 'danger')); + } + } else { + $this->MiconwareSession->setFlash(__('dreamjob.agb.error.notAccept'), 'flash', array('alert' => 'danger')); + } + } + $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'); + } + } }