jobController Test

This commit is contained in:
Martin Müller 2014-03-02 12:29:41 +01:00
parent 397934001b
commit 841e2ffe12
1 changed files with 8 additions and 9 deletions

View File

@ -42,24 +42,23 @@ class JobController extends AppController {
public function openingAdd() { public function openingAdd() {
$this->MiconwareSession->init($this); $this->MiconwareSession->init($this);
$this->MiconwareSession->initWeb($this); $this->MiconwareSession->initWeb($this);
/* $c = $this->MiconwareSession->getCompany();
$this->set('kindofjobs', $this->DreamjobJobOpening->DreamjobListKindofjob->find('list')); if(!empty($c)){
$this->set('graducations', $this->DreamjobJobOpening->DreamjobListGraducation->find('list'));
*/
if(empty($this->MiconwareSession->getCompany())){
$this->set('error', 'dreamjob.error.noCompany');
$this->render('/Home/error');
}else{
if ($this->request->is('post')) { if ($this->request->is('post')) {
$this->DreamjobJobOpening->create($this->request->data); $this->DreamjobJobOpening->create($this->request->data);
$this->DreamjobJobOpening->data['DreamjobJobOpening']['company_id'] = $this->MiconwareSession->getCompany()['AppUser']['id']; $this->DreamjobJobOpening->data['DreamjobJobOpening']['company_id'] = $c['AppUser']['id'];
if ($this->DreamjobJobOpening->save()) { if ($this->DreamjobJobOpening->save()) {
$this->MiconwareSession->setFlash('dreamjob.opening.save.add','flash',array('alert'=>'success')); $this->MiconwareSession->setFlash('dreamjob.opening.save.add','flash',array('alert'=>'success'));
}else{ }else{
$this->MiconwareSession->setFlash('dreamjob.opening.save.error','flash',array('alert'=>'danger')); $this->MiconwareSession->setFlash('dreamjob.opening.save.error','flash',array('alert'=>'danger'));
} }
} }
$this->set('kindofjobs', $this->DreamjobJobOpening->DreamjobListKindofjob->find('list'));
$this->set('graducations', $this->DreamjobJobOpening->DreamjobListGraducation->find('list'));
$this->render('/Job/opening_edit'); $this->render('/Job/opening_edit');
}else{
$this->set('error', 'dreamjob.error.noCompany');
$this->render('/Home/error');
} }
} }
public function openingEdit() { public function openingEdit() {