diff --git a/app/Controller/JobController.php b/app/Controller/JobController.php index 667e53f..e7f01ec 100644 --- a/app/Controller/JobController.php +++ b/app/Controller/JobController.php @@ -25,7 +25,7 @@ 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->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){ @@ -38,22 +38,66 @@ class JobController extends AppController { } } public function openingAdd() { + $this->MiconwareSession->init($this); + $this->MiconwareSession->initWeb($this); + + $this->set('kindofjobs', $this->DreamjobJobOpening->DreamjobListKindofjob->find('list')); + $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')) { + $this->DreamjobJobOpening->create($this->request->data); + $this->DreamjobJobOpening->data['DreamjobJobOpening']['company_id'] = $this->MiconwareSession->getCompany()['AppUser']['id']; + if ($this->DreamjobJobOpening->save()) { + $this->MiconwareSession->setFlash('dreamjob.opening.save.add','flash',array('alert'=>'success')); + }else{ + $this->MiconwareSession->setFlash('dreamjob.opening.save.error','flash',array('alert'=>'danger')); + } + } + $this->render('/Job/opening_edit'); + } } public function openingEdit() { $this->MiconwareSession->init($this); $this->MiconwareSession->initWeb($this); - $opening = false; - + $a = $this->MiconwareSession->getCompany(); + if(empty($a)){ + $this->set('error', 'dreamjob.error.noCompany'); + $this->render('/Home/error'); + return null; + } if(!empty($this->request->params['id'])){ - $this->request->data = $this->DreamjobJobOpening->findById($this->request->params['id']); + $load = $this->DreamjobJobOpening->findById($this->request->params['id']); + $cid = $a['AppUser']['id']; + if (!empty($load) and $load['DreamjobJobOpening']['company_id'] == $cid) { + if ($this->request->is(array('post', 'put'))) { + $this->DreamjobJobOpening->create($this->request->data); + $this->DreamjobJobOpening->data['DreamjobJobOpening']['id'] = $this->request->params['id']; + $this->DreamjobJobOpening->data['DreamjobJobOpening']['company_id'] = $cid; + echo var_dump($this->DreamjobJobOpening); + if ($this->DreamjobJobOpening->save($this->DreamjobJobOpening->data)) { + $this->MiconwareSession->setFlash('dreamjob.opening.save','flash',array('alert'=>'success')); + + }else + $this->MiconwareSession->setFlash('dreamjob.opening.save.error','flash',array('alert'=>'danger')); + } + } + $this->request->data=$load; + $this->set('kindofjobs', $this->DreamjobJobOpening->DreamjobListKindofjob->find('list')); + $this->set('graducations', $this->DreamjobJobOpening->DreamjobListGraducation->find('list')); } - if(!is_array($opening) and count($opening) <= 0 ){ + if(empty($this->request->data['DreamjobJobOpening'])){ $this->set('error', 'dreamjob.error.opening.notFound'); $this->render('/Home/error'); + }elseif( $this->request->data['DreamjobJobOpening']['company_id'] != $a['AppUser']['id']){ + $this->set('error', 'dreamjob.error.noPermission'); + $this->render('/Home/error'); }else{ - $this->set('opening',$opening); $this->render('/Job/opening_edit'); } } diff --git a/app/Model/DreamjobJobOpening.php b/app/Model/DreamjobJobOpening.php index c874fb7..bc08331 100644 --- a/app/Model/DreamjobJobOpening.php +++ b/app/Model/DreamjobJobOpening.php @@ -44,15 +44,7 @@ class DreamjobJobOpening extends AppModel { //'required' => false, //'last' => false, // Stop validation after this rule //'on' => 'create', // Limit validation to 'create' or 'update' operations - ), - 'userDefined' => array( - 'rule' => array('userDefined'), - //'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 - ), + ) ), 'street' => array( 'notEmpty' => array( diff --git a/app/View/Elements/barleft.ctp b/app/View/Elements/barleft.ctp index 2de58bc..c01f3f3 100755 --- a/app/View/Elements/barleft.ctp +++ b/app/View/Elements/barleft.ctp @@ -15,6 +15,7 @@ if($isLoggedin){ } .column-center{ padding-left:50px; + width:1010px; } --> diff --git a/app/View/Job/opening_edit.ctp b/app/View/Job/opening_edit.ctp index 08af7a2..bae1169 100644 --- a/app/View/Job/opening_edit.ctp +++ b/app/View/Job/opening_edit.ctp @@ -20,122 +20,34 @@ echo $this->Form->create('DreamjobJobOpening',$default_Form); */ - echo $this->request->data['DreamjobJobOpening']['title']; + echo $this->Form->hidden("DreamjobJobOpening.company_id"); + if(!empty($this->request->data['DreamjobJobOpening'])) + echo $this->request->data['DreamjobJobOpening']['title']; + else + echo __("dreamjob.opening.addForm"); ?> - Form->input('DreamjobJobOpening.title',array('label'=>__("dreamjob.title"))); ?> -
- - ${msg_dreamjob_title} -
- - -
-
- Form->input('DreamjobJobOpening.startdate',array('label'=>__("dreamjob.opening.startdate"))); ?> -
- - ${msg_dreamjob_opening_startdate} -
- - -
-
- Form->input('DreamjobJobOpening.enddate'); ?> -
- - ${msg_dreamjob_opening_enddate} -
- - -
-
- Form->input('DreamjobJobOpening.kindofjob'); ?> -
- - ${msg_dreamjob_kindofjob} -
- - - - - -
-
- Form->input('DreamjobJobOpening.graducation'); ?> -
- - ${msg_dreamjob_graducation} -
- - - - - -
-
- Form->input('DreamjobJobOpening.branch'); ?> -
- - ${msg_dreamjob_branch} -
- - - - - -
-
- Form->input('DreamjobJobOpening.active'); ?> -
-
-
- - - - -
- -
-
- - Form->input('DreamjobJobOpening.street'); ?> -
- - ${msg_dreamjob_street} -
- - -
-
- Form->input('DreamjobJobOpening.postcode'); ?> -
- - ${msg_dreamjob_postcode} -
- - -
-
- Form->input('DreamjobJobOpening.city'); ?> -
- - ${msg_dreamjob_city} -
- - -
-
- - Form->input('DreamjobJobOpening.text'); ?> -
- -
-
-
- -
-
+ Form->input('DreamjobJobOpening.title',array('label'=>array('text'=>__("dreamjob.title"),"class"=>$default_Form['inputDefaults']['label']['class']))); + echo $this->Form->input('DreamjobJobOpening.startdate',array('label'=>array('text'=>__("dreamjob.opening.startdate"),"class"=>$default_Form['inputDefaults']['label']['class']),"style"=>'width:20%;display:inline-block;')); + echo $this->Form->input('DreamjobJobOpening.enddate',array('label'=>array('text'=>__("dreamjob.opening.enddate"),"class"=>$default_Form['inputDefaults']['label']['class']),"style"=>'width:20%;display:inline-block;')); + echo $this->Form->input('DreamjobJobOpening.kindofjob_id',array('label'=>array('text'=>__("dreamjob.kindofjob"),"class"=>$default_Form['inputDefaults']['label']['class']))); + echo $this->Form->input('DreamjobJobOpening.graducation_id',array('label'=>array('text'=>__("dreamjob.graducation"),"class"=>$default_Form['inputDefaults']['label']['class']))); + echo $this->Form->input('DreamjobJobOpening.branch',array('label'=>array('text'=>__("dreamjob.branch"),"class"=>$default_Form['inputDefaults']['label']['class']))); ?> +
+ +
+ Form->checkbox('DreamjobJobOpening.active',array("class"=>'form-control',"label"=>__("dreamjob.opening.active")))?> +
+
+ + Form->input('DreamjobJobOpening.street',array('label'=>array('text'=>__("dreamjob.street"),"class"=>$default_Form['inputDefaults']['label']['class']))); + echo $this->Form->input('DreamjobJobOpening.postcode',array('label'=>array('text'=>__("dreamjob.postcode"),"class"=>$default_Form['inputDefaults']['label']['class']))); + echo $this->Form->input('DreamjobJobOpening.city',array("label" => array('text'=>__("dreamjob.city"),"class"=>$default_Form['inputDefaults']['label']['class']))); ?> + + Form->textarea('DreamjobJobOpening.text',array("class"=>'form-control',"rows"=>10)); ?> +
+ Form->button(__('dreamjob.save'),array('div' => false,'class'=>"btn btn-default",'type' => 'submit'));?> +
Form->end(); ?> diff --git a/app/webroot/css/dreamjob.css b/app/webroot/css/dreamjob.css index 96fb5af..9872823 100755 --- a/app/webroot/css/dreamjob.css +++ b/app/webroot/css/dreamjob.css @@ -21,6 +21,9 @@ a:hover{ textarea { resize: none; } +legend{ + margin-top:20px; +} /* * Default */ @@ -33,6 +36,9 @@ textarea { margin-bottom: 20px; color:black; } +.form-group{ + padding:15px 0; +} /* * Logo @@ -305,7 +311,11 @@ body.loading #container{ vertical-align: middle; text-align: center; white-space: nowrap; - width: 110px; + width: 150px; +} +.openingitem .right .btn-group-vertical > .btn{ + width:150px; + overflow-x:hidden; } .openingitem.empty { display: block;