diff --git a/app/Controller/JobController.php b/app/Controller/JobController.php index 285ba0c..f97fd45 100644 --- a/app/Controller/JobController.php +++ b/app/Controller/JobController.php @@ -312,20 +312,25 @@ class JobController extends AppController { $this->set('error', 'dreamjob.error.opening.notFound'); $this->render('/Home/error'); }else{ - if ($this->request->is('post')) { - echo var_dump($this->request->data); - //$this->DreamjobJobApplication->create($this->request->data); - $this->request->data['DreamjobJobOpening']['worker_id'] = $w['AppUser']['id']; - $this->request->data['DreamjobJobOpening']['opening_id'] = $this->request->params['id']; - if ($this->DreamjobJobOpening->saveAssociated($this->request->data)) { - /* - $this->DreamjobJobOpening->worker_id = $w['AppUser']['id']; - $this->DreamjobJobOpening->opening_id = $this->request->params['id'];*/ - if($this->DreamjobJobOpening->save()){ + 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']; + $this->request->data['DreamjobJobApplication']['opening_id'] = $this->request->params['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); + echo var_dump($this->request->data); + $result = $this->DreamjobJobApplication->saveAssociated($this->request->data); + if ($result) { $this->MiconwareSession->setFlash('dreamjob.opening.save.add','flash',array('alert'=>'success')); }else{ $this->MiconwareSession->setFlash('dreamjob.opening.save.error','flash',array('alert'=>'danger')); } + }else{ + $this->MiconwareSession->setFlash('dreamjob.agb.error.notAccept','flash',array('alert'=>'danger')); } } $this->set('pages', $w['DreamjobPageInh']); diff --git a/app/Model/DreamjobJobApplication.php b/app/Model/DreamjobJobApplication.php index ca9a092..a50264d 100644 --- a/app/Model/DreamjobJobApplication.php +++ b/app/Model/DreamjobJobApplication.php @@ -43,7 +43,7 @@ class DreamjobJobApplication extends AppModel { //'required' => false, //'last' => false, // Stop validation after this rule //'on' => 'create', // Limit validation to 'create' or 'update' operations - ), + ) ), 'stars' => array( 'numeric' => array( @@ -225,5 +225,9 @@ class DreamjobJobApplication extends AppModel { 'className' => 'DreamjobJobMsg', 'foreignKey' => 'application_id' ), + 'DreamjobJobApplicationPage' => array( + 'className' => 'DreamjobJobApplicationPage', + 'foreignKey' => 'application_id' + ), ); } diff --git a/app/View/Elements/barleft.ctp b/app/View/Elements/barleft.ctp index f13456a..0c66a3c 100755 --- a/app/View/Elements/barleft.ctp +++ b/app/View/Elements/barleft.ctp @@ -30,6 +30,23 @@ if($isLoggedin){