diff --git a/app/Controller/JobController.php b/app/Controller/JobController.php index d07f571..0b3ab13 100644 --- a/app/Controller/JobController.php +++ b/app/Controller/JobController.php @@ -65,6 +65,7 @@ class JobController extends AppController { $this->set('kindofjobs', $this->DreamjobJobOpening->DreamjobListKindofjob->find('list')); $this->set('graducations', $this->DreamjobJobOpening->DreamjobListGraducation->find('list')); $this->set('branches',$this->DreamjobListBranch->find('list')); + $this->set('cities',$this->DreamjobListCity->find('list')); $this->render('/Job/opening_edit'); }else{ $this->set('error', 'dreamjob.error.noCompany'); @@ -100,6 +101,7 @@ class JobController extends AppController { $this->set('kindofjobs', $this->DreamjobJobOpening->DreamjobListKindofjob->find('list')); $this->set('graducations', $this->DreamjobJobOpening->DreamjobListGraducation->find('list')); $this->set('branches',$this->DreamjobListBranch->find('list')); + $this->set('cities',$this->DreamjobListCity->find('list')); } if(empty($this->request->data['DreamjobJobOpening'])){ diff --git a/app/Controller/RegistrationController.php b/app/Controller/RegistrationController.php index 15db8b6..885ed5b 100644 --- a/app/Controller/RegistrationController.php +++ b/app/Controller/RegistrationController.php @@ -36,7 +36,7 @@ class RegistrationController extends AppController { $data = array(); $data['User']['password'] = $this->MiconwareSession->create_hash($this->request->data['User']['password1']); $data['User']['mail'] = $this->request->data['User']['mail']; - $data['DreamjobUser']['city'] = $this->request->data['DreamjobUser']['city']; + $data['DreamjobUser']['city_id'] = $this->request->data['DreamjobUser']['city_id']; $data['DreamjobUser']['street'] = $this->request->data['DreamjobUser']['street']; $data['DreamjobUser']['postcode'] = $this->request->data['DreamjobUser']['postcode']; $data['AppUser']['nickname'] = $this->request->data['AppUser']['nickname']; @@ -67,6 +67,7 @@ class RegistrationController extends AppController { } } $this->set('result',$regResult); + $this->set('cities',$this->DreamjobListCity->find('list')); $this->set('branches',$this->DreamjobListBranch->find('list')); $this->render('/Registration/company'); }else{ @@ -87,7 +88,7 @@ class RegistrationController extends AppController { $data = array(); $data['User']['password'] = $this->MiconwareSession->create_hash($this->request->data['User']['password1']); $data['User']['mail'] = $this->request->data['User']['mail']; - $data['DreamjobUser']['city'] = $this->request->data['DreamjobUser']['city']; + $data['DreamjobUser']['city_id'] = $this->request->data['DreamjobUser']['city_id']; $data['DreamjobUser']['street'] = $this->request->data['DreamjobUser']['street']; $data['DreamjobUser']['postcode'] = $this->request->data['DreamjobUser']['postcode']; $data['AppUser']['bday'] = $this->request->data['AppUser']['bday']; @@ -127,6 +128,7 @@ class RegistrationController extends AppController { } } $this->set('result',$regResult); + $this->set('cities',$this->DreamjobListCity->find('list')); $this->set('mannerofaddresses',$this->Mannerofaddress->find('list')); $this->set('graducations',$this->DreamjobListGraducation->find('list')); $this->render('/Registration/worker'); diff --git a/app/Controller/UserController.php b/app/Controller/UserController.php index 540b6b7..aac06df 100755 --- a/app/Controller/UserController.php +++ b/app/Controller/UserController.php @@ -10,7 +10,7 @@ class UserController extends AppController { * @var array */ - public $uses = array('DreamjobListGraducation', 'DreamjobWorker', 'DreamjobCompany', 'DreamjobPageText','DreamjobPageInh', 'DreamjobPageImage', 'DreamjobJobOpening', 'DreamjobCvEntry', 'DreamjobListCvCategory', 'DreamjobListGraducation', 'DreamjobListJob','DreamjobListKindofjob','DreamjobListBranch','Mannerofaddress','DreamjobISearch','User','AppUser'); + public $uses = array('DreamjobListGraducation', 'DreamjobWorker', 'DreamjobCompany', 'DreamjobPageText','DreamjobPageInh', 'DreamjobPageImage', 'DreamjobJobOpening', 'DreamjobCvEntry', 'DreamjobListCvCategory', 'DreamjobListGraducation', 'DreamjobListJob','DreamjobListKindofjob','DreamjobListBranch','Mannerofaddress','DreamjobISearch','User','AppUser','DreamjobListCity'); public $components = array('MiconwareSession','RequestHandler'); /** @@ -256,7 +256,7 @@ class UserController extends AppController { if($this->request->data['User']['password1']!='') $profil['User']['password'] = $this->MiconwareSession->create_hash($this->request->data['User']['password1']); - $profil['DreamjobUser']['city'] = $this->request->data['DreamjobUser']['city']; + $profil['DreamjobUser']['city_id'] = $this->request->data['DreamjobUser']['city_id']; $profil['DreamjobUser']['street'] = $this->request->data['DreamjobUser']['street']; $profil['DreamjobUser']['postcode'] = $this->request->data['DreamjobUser']['postcode']; $profil['AppUser']['bday'] = $this->request->data['AppUser']['bday']; @@ -299,6 +299,7 @@ class UserController extends AppController { $this->set('graducations',$this->DreamjobListGraducation->find('list')); $this->set('branches',$this->DreamjobListBranch->find('list')); $this->set('mannerofaddresses',$this->Mannerofaddress->find('list')); + $this->set('cities',$this->DreamjobListCity->find('list')); $this->render('/User/settings_account'); } } diff --git a/app/Model/DreamjobCompany.php b/app/Model/DreamjobCompany.php index d5536ff..cfdc633 100755 --- a/app/Model/DreamjobCompany.php +++ b/app/Model/DreamjobCompany.php @@ -120,7 +120,7 @@ class DreamjobCompany extends AppModel { if($result) $result = $this->DreamjobUser->saveField('street',$data['DreamjobUser']['street']); if($result) - $result = $this->DreamjobUser->saveField('city',$data['DreamjobUser']['city']); + $result = $this->DreamjobUser->saveField('city_id',$data['DreamjobUser']['city_id']); if($result) $result = $this->DreamjobUser->saveField('postcode',$data['DreamjobUser']['postcode']); @@ -260,6 +260,12 @@ class DreamjobCompany extends AppModel { 'foreignKey' => false, 'conditions' => array('DreamjobCompany.djaccount_ptr_id=AppUser.id and User.id = AppUser.user_id'), 'limit' => 1 + ), + 'DreamjobListCity' => array( + 'className' => 'DreamjobListCity', + 'foreignKey' => false, + 'conditions' => array('DreamjobListCity.id=DreamjobUser.city_id'), + 'limit' => 1 ) ); public $hasMany = array( diff --git a/app/Model/DreamjobJobOpening.php b/app/Model/DreamjobJobOpening.php index 2b9057e..1427775 100644 --- a/app/Model/DreamjobJobOpening.php +++ b/app/Model/DreamjobJobOpening.php @@ -56,16 +56,6 @@ class DreamjobJobOpening extends AppModel { //'on' => 'create', // Limit validation to 'create' or 'update' operations ), ), - 'city' => array( - 'notEmpty' => array( - 'rule' => array('notEmpty'), - //'message' => 'Your custom message here', - //'allowEmpty' => false, - //'required' => false, - //'last' => false, // Stop validation after this rule - //'on' => 'create', // Limit validation to 'create' or 'update' operations - ), - ), 'postcode' => array( 'notEmpty' => array( 'rule' => array('notEmpty'), @@ -208,6 +198,13 @@ class DreamjobJobOpening extends AppModel { 'conditions' => '', 'fields' => '', 'order' => '' + ), + 'DreamjobListCity' => array( + 'className' => 'DreamjobListCity', + 'foreignKey' => 'city_id', + 'conditions' => '', + 'fields' => '', + 'order' => '' ) ); diff --git a/app/Model/DreamjobUser.php b/app/Model/DreamjobUser.php index bc7d2ea..8b05cfd 100755 --- a/app/Model/DreamjobUser.php +++ b/app/Model/DreamjobUser.php @@ -71,16 +71,6 @@ class DreamjobUser extends AppModel { //'on' => 'create', // Limit validation to 'create' or 'update' operations ), ), - 'city' => array( - 'notEmpty' => array( - 'rule' => array('notEmpty'), - //'message' => 'Your custom message here', - //'allowEmpty' => false, - //'required' => false, - //'last' => false, // Stop validation after this rule - //'on' => 'create', // Limit validation to 'create' or 'update' operations - ), - ), 'postcode' => array( 'notEmpty' => array( 'rule' => array('notEmpty'), @@ -98,6 +88,19 @@ class DreamjobUser extends AppModel { 'AppUser' => array( 'className' => 'AppUser', 'foreignKey' => 'id' + ), + 'User' => array( + 'className' => 'User', + 'foreignKey' => false, + 'conditions' => array('DreamjobWorker.djaccount_ptr_id=AppUser.id and User.id = AppUser.user_id'), + 'limit' => 1 + ), + 'DreamjobListCity' => array( + 'className' => 'DreamjobListCity', + 'foreignKey' => 'city_id', + 'conditions' => '', + 'fields' => '', + 'order' => '' ) ); } diff --git a/app/Model/DreamjobWorker.php b/app/Model/DreamjobWorker.php index c6a5b00..d7d9bad 100755 --- a/app/Model/DreamjobWorker.php +++ b/app/Model/DreamjobWorker.php @@ -137,7 +137,7 @@ class DreamjobWorker extends AppModel { if($result) $result = $this->DreamjobUser->saveField('street',$data['DreamjobUser']['street']); if($result) - $result = $this->DreamjobUser->saveField('city',$data['DreamjobUser']['city']); + $result = $this->DreamjobUser->saveField('city_id',$data['DreamjobUser']['city_id']); if($result) $result = $this->DreamjobUser->saveField('postcode',$data['DreamjobUser']['postcode']); @@ -301,7 +301,13 @@ class DreamjobWorker extends AppModel { 'foreignKey' => false, 'conditions' => array('DreamjobWorker.djaccount_ptr_id=AppUser.id and User.id = AppUser.user_id'), 'limit' => 1 - ) + ), + 'DreamjobListCity' => array( + 'className' => 'DreamjobListCity', + 'foreignKey' => false, + 'conditions' => array('DreamjobListCity.id=DreamjobUser.city_id'), + 'limit' => 1 + ) ); public $hasMany = array( 'DreamjobPageInh' => array( diff --git a/app/View/Elements/job_company_item.ctp b/app/View/Elements/job_company_item.ctp index 94291aa..94d14f2 100644 --- a/app/View/Elements/job_company_item.ctp +++ b/app/View/Elements/job_company_item.ctp @@ -35,7 +35,7 @@ if($company['AppUser']['take_systemwide']){
=__("dreamjob.address");?>:
=$opening['DreamjobUser']['street'];?>
- =$opening['DreamjobUser']['postcode']." ".$opening['DreamjobUser']['city'];?>
+ =$opening['DreamjobUser']['postcode']." ".$opening['DreamjobListCity']['name'];?>