diff --git a/app/Controller/HomeController.php b/app/Controller/HomeController.php index 1dc42ee..7f6c9c4 100755 --- a/app/Controller/HomeController.php +++ b/app/Controller/HomeController.php @@ -20,11 +20,20 @@ class HomeController extends AppController { * @throws NotFoundException When the view file could not be found * or MissingViewException in debug mode. */ - private $home_opening_condition = array('contitions'=>array('active'=>true),'order'=>'DreamjobJobOpening.id DESC','limit'=>3); + public static function getOpeningCondition(){ + return array('and'=>array( + 'DreamjobJobOpening.active'=>true, + 'DreamjobJobOpening.startdate <='=> date("Y-m-d"), + 'DreamjobJobOpening.enddate >='=> date("Y-m-d", strtotime("+1 day")) + )); + } + private $opening_limit = 3; + public function home() { $this->MiconwareSession->init($this); $this->MiconwareSession->initWeb($this); - $openings = $this->DreamjobJobOpening->find('all',$this->home_opening_condition); + $openings = $this->DreamjobJobOpening->find('all',array('conditions'=>HomeController::getOpeningCondition(), + 'order'=>'DreamjobJobOpening.id DESC','limit'=> $this->opening_limit)); $this->set('openings',$openings); $this->set('title', 'dreamjob.startpage'); $this->set('MENU_START', true); @@ -51,7 +60,8 @@ class HomeController extends AppController { $this->MiconwareSession->initWeb($this); - $openings = $this->DreamjobJobOpening->find('all',$this->home_opening_condition); + $openings = $this->DreamjobJobOpening->find('all',array('conditions'=>HomeController::getOpeningCondition(), + 'order'=>'DreamjobJobOpening.id DESC','limit'=> $this->opening_limit)); $this->set('openings',$openings); $this->set('title', 'dreamjob.startpage'); $this->set('MENU_START', true); @@ -67,7 +77,8 @@ class HomeController extends AppController { $this->MiconwareSession->setFlash('dreamjob.loggingoutError','flash',array('alert'=>'danger')); $this->MiconwareSession->initWeb($this); - $openings = $this->DreamjobJobOpening->find('all',$this->home_opening_condition); + $openings = $this->DreamjobJobOpening->find('all',array('conditions'=>HomeController::getOpeningCondition(), + 'order'=>'DreamjobJobOpening.id DESC','limit'=> $this->opening_limit)); $this->set('openings',$openings); $this->set('title', 'dreamjob.startpage'); $this->set('MENU_START', true); diff --git a/app/Controller/JobController.php b/app/Controller/JobController.php index 63d867d..7a1fb3c 100644 --- a/app/Controller/JobController.php +++ b/app/Controller/JobController.php @@ -133,7 +133,9 @@ class JobController extends AppController { $this->MiconwareSession->setFlash('dreamjob.opening.fav.add','flash',array('alert'=>'success')); } } - $opening = $this->DreamjobJobOpening->find('first',array('conditions' => array('DreamjobJobOpening.id' => $this->request->params['id']))); + $con = HomeController::getOpeningCondition(); + $con['DreamjobJobOpening.id'] = $this->request->params['id']; + $opening = $this->DreamjobJobOpening->find('first',array('conditions' => $con)); } @@ -161,7 +163,9 @@ class JobController extends AppController { $fav_id = array(); foreach($self['Favority'] as $fav) $fav_id[]=$fav['id']; - $openings = $this->DreamjobJobOpening->find('all',array('conditions' => array('DreamjobJobOpening.id' =>$fav_id))); + $con = HomeController::getOpeningCondition(); + $con['DreamjobJobOpening.id'] =$fav_id; + $openings = $this->DreamjobJobOpening->find('all',array('conditions' => $con)); $this->set('openings',$openings); $this->set('opening_MINI',true); $this->render('/Job/favorite'); @@ -310,7 +314,9 @@ class JobController extends AppController { if(!empty($w)){ $opening = null; if(!empty($this->request->params['id'])){ - $opening = $this->DreamjobJobOpening->find('first',array('conditions' => array('DreamjobJobOpening.id' => $this->request->params['id']))); + $con = HomeController::getOpeningCondition(); + $con['DreamjobJobOpening.id'] = $this->request->params['id']; + $opening = $this->DreamjobJobOpening->find('first',array('conditions' => $con)); } if(!is_array($opening) or count($opening) <= 0 ){ $this->set('error', 'dreamjob.error.opening.notFound'); diff --git a/app/Controller/UserController.php b/app/Controller/UserController.php index 8f9053f..1475574 100755 --- a/app/Controller/UserController.php +++ b/app/Controller/UserController.php @@ -100,7 +100,9 @@ class UserController extends AppController { $this->set('page',$page); if(!$hard_error) if($company){ - $openings = $this->DreamjobJobOpening->find('all',array('conditions' => array('DreamjobJobOpening.company_id' => $profil['AppUser']['id'],'DreamjobJobOpening.active'=>1))); + $con = HomeController::getOpeningCondition(); + $con['DreamjobJobOpening.company_id'] = $profil['AppUser']['id']; + $openings = $this->DreamjobJobOpening->find('all',array('conditions' => $con)); $this->set("openings",$openings); $this->render('/User/company'); }else @@ -246,6 +248,7 @@ class UserController extends AppController { $profil['DreamjobWorker']['iam'] = $this->request->data['DreamjobWorker']['iam']; $profil['DreamjobWorker']['graducation_id'] = $this->request->data['DreamjobWorker']['graducation_id']; $profil['DreamjobWorker']['searchhidden'] = $this->request->data['DreamjobWorker']['searchhidden']; + $profil['DreamjobWorker']['workexperience'] = $this->request->data['DreamjobWorker']['workexperience']; $result = $this->DreamjobWorker->saveSettings($profil); } @@ -264,7 +267,7 @@ class UserController extends AppController { $this->request->data = $profil; $this->set('profil',$profil); $this->set('graducations',$this->DreamjobListGraducation->find('list')); - $this->set('mannerofaddresss',$this->Mannerofaddress->find('list')); + $this->set('mannerofaddresses',$this->Mannerofaddress->find('list')); $this->render('/User/settings_account'); } } @@ -288,6 +291,7 @@ class UserController extends AppController { $this->set('error', 'dreamjob.error.noPermision'); $this->render('/Home/error'); }else{ + //PAGE BEARBEITEN if(!empty($this->request->params['page'])){ $image = false; $page = $this->DreamjobPageText->find('first', @@ -319,6 +323,45 @@ class UserController extends AppController { }else $this->MiconwareSession->setFlash(__('dreamjob.error.page.notFound'),'flash',array('alert'=>'danger')); }else{ + // PAGE LOESCHEN + if(!empty($this->request->query['del'])){ + $image = false; + $page = $this->DreamjobPageText->find('first', + array('conditions' => array("DreamjobPageInh.id" => $this->request->query['del'],'DreamjobPageInh.user_id' => $profil['AppUser']['id'])) + ); + if(!is_array($page) or count($page)<= 0){ + $page = $this->DreamjobPageImage->find('first', + array('conditions' => array("DreamjobPageInh.id" => $this->request->query['del'],'DreamjobPageInh.user_id' => $profil['AppUser']['id'])) + ); + $image = true; + } + $result = false; + if(!empty($page) and count($page)> 0){ + $path = null; + if($image){ + $path = WWW_ROOT.$page['DreamjobPageImage']['image']; + $result = $this->DreamjobPageImage->delete($page['DreamjobPageInh']['id'],false); + }else + $result = $this->DreamjobPageText->delete($page['DreamjobPageInh']['id'],false); + if($result){ + $result = $this->DreamjobPageInh->delete($page['DreamjobPageInh']['id'],false); + } + if($path!=null and $result){ + $result = unlink($path); + } + if($result){ + $this->MiconwareSession->refreshCache(); + $profil = $this->MiconwareSession->getWorker(); + if(empty($profil) or count($profil) <= 0) + $profil = $this->MiconwareSession->getCompany(); + $this->MiconwareSession->setFlash('dreamjob.pages.delete','flash',array('alert'=>'success')); + }else{ + $this->MiconwareSession->setFlash('dreamjob.pages.delete.error','flash',array('alert'=>'danger')); + } + } + $result = false; + } + // NEW PAGE if($this->request->is('post')){ if(!empty($this->request->data['DreamjobPageText']['text']) and $this->request->data['DreamjobPageImage']['image']['error']==0){ $this->MiconwareSession->setFlash(__('dreamjob.page.oneType'),'flash',array('alert'=>'danger')); diff --git a/app/View/User/company.ctp b/app/View/User/company.ctp index 5a7ee54..2107aed 100644 --- a/app/View/User/company.ctp +++ b/app/View/User/company.ctp @@ -111,11 +111,6 @@ if($profil['AppUser']['take_systemwide']){ - Bearbeiten. - element('user_page'); }else{ diff --git a/app/webroot/css/dreamjob.css b/app/webroot/css/dreamjob.css index 8348aa4..2fbc12c 100755 --- a/app/webroot/css/dreamjob.css +++ b/app/webroot/css/dreamjob.css @@ -204,14 +204,12 @@ body.loading #container{ .box-extra-left{ display:table-cell; width:240px; - height: 220px; + min-height: 220px; float:left; } .box-extra-left > .box{ width:200px; height: 200px; - margin:0px; - margin-right: 20px; padding: 10px; vertical-align: middle; display:table-cell; @@ -233,6 +231,7 @@ body.loading #container{ margin-top:6px; margin-bottom: 24px; display:table; + width:100%; } .box-title h1{ text-align: center; diff --git a/update.sql b/update.sql index 266e9c2..de3d497 100644 --- a/update.sql +++ b/update.sql @@ -10,14 +10,14 @@ -CREATE TABLE IF NOT EXISTS `mic_dj_job_opening_worker` ( +CREATE TABLE IF NOT EXISTS `mic_dj_jobs_opening_worker` ( `id` int(11) NOT NULL AUTO_INCREMENT, `opening_id` int(11) NOT NULL, `worker_id` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `opening_id` (`opening_id`,`worker_id`), - KEY `mic_dj_job_opening_worker_favOpening` (`opening_id`), - KEY `mic_dj_job_opening_worker_favWorker` (`worker_id`) + KEY `mic_dj_jobs_opening_worker_favOpening` (`opening_id`), + KEY `mic_dj_jobs_opening_worker_favWorker` (`worker_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; @@ -36,6 +36,6 @@ ALTER TABLE `mic_dj_account_cmpy` ADD `pro_user` INT NOT NULL ; -- -- Constraints der Tabelle `mic_dj_job_opening_worker` -- -ALTER TABLE `mic_dj_job_opening_worker` - ADD CONSTRAINT `mic_dj_job_opening_worker_favOpening` FOREIGN KEY (`opening_id`) REFERENCES `mic_dj_jobs_opening` (`id`), - ADD CONSTRAINT `mic_dj_job_opening_worker_favWorker` FOREIGN KEY (`worker_id`) REFERENCES `mic_dj_account_wrk` (`djaccount_ptr_id`); +ALTER TABLE `mic_dj_jobs_opening_worker` + ADD CONSTRAINT `mic_dj_jobs_opening_worker_favOpening` FOREIGN KEY (`opening_id`) REFERENCES `mic_dj_jobs_opening` (`id`), + ADD CONSTRAINT `mic_dj_jobs_opening_worker_favWorker` FOREIGN KEY (`worker_id`) REFERENCES `mic_dj_account_wrk` (`djaccount_ptr_id`);