diff --git a/app/Config/routes.php b/app/Config/routes.php index b683bf3..8f99ea9 100755 --- a/app/Config/routes.php +++ b/app/Config/routes.php @@ -37,6 +37,7 @@ Router::connect('/opening', array('controller' => 'job', 'action' => 'openingList')); Router::connect('/opening/add', array('controller' => 'job', 'action' => 'openingAdd')); + Router::connect('/opening/edit/:id', array('controller' => 'job', 'action' => 'openingEdit'),array("id" => "[0-9]+")); Router::connect('/opening/:id', array('controller' => 'job', 'action' => 'openingGet'),array("id" => "[0-9]+")); Router::connect('/opening/:id/:favorite', array('controller' => 'job', 'action' => 'openingGet'), array("id" => "[0-9]+",'favorite' => '(?i:favorite)')); diff --git a/app/Controller/JobController.php b/app/Controller/JobController.php index bf3d779..667e53f 100644 --- a/app/Controller/JobController.php +++ b/app/Controller/JobController.php @@ -24,6 +24,10 @@ class JobController extends AppController { $this->MiconwareSession->initWeb($this); $self = $this->MiconwareSession->getCompany(); + if(!empty($this->request->query['del'])){ + //$this->DreamjobJobFavority->delete($this->request->query['del'],false); + $this->MiconwareSession->setFlash('dreamjob.opening.delete','flash',array('alert'=>'success')); + } if(!is_array($self) and count($self) <= 0){ $this->set('error', 'dreamjob.error.noPermision'); $this->render('/Home/error'); @@ -35,6 +39,24 @@ class JobController extends AppController { } public function openingAdd() { } + public function openingEdit() { + $this->MiconwareSession->init($this); + $this->MiconwareSession->initWeb($this); + $opening = false; + + + if(!empty($this->request->params['id'])){ + $this->request->data = $this->DreamjobJobOpening->findById($this->request->params['id']); + } + + if(!is_array($opening) and count($opening) <= 0 ){ + $this->set('error', 'dreamjob.error.opening.notFound'); + $this->render('/Home/error'); + }else{ + $this->set('opening',$opening); + $this->render('/Job/opening_edit'); + } + } public function openingGet() { $this->MiconwareSession->init($this); diff --git a/app/View/Elements/job_opening_item.ctp b/app/View/Elements/job_opening_item.ctp index a453c8f..efc27f5 100644 --- a/app/View/Elements/job_opening_item.ctp +++ b/app/View/Elements/job_opening_item.ctp @@ -5,7 +5,7 @@ $opening_in_app = false; $opening_in_fav=false; - if(is_array($WORKER) and count($WORKER)>0){ + if(isset($WORKER) and is_array($WORKER) and count($WORKER)>0){ foreach($WORKER['Favority'] as $val){ if($val['id'] == $opening['DreamjobJobOpening']['id']) $opening_in_fav=true; @@ -66,12 +66,13 @@ if($opening['AppUser']['take_systemwide']){