settings account

This commit is contained in:
Martin Müller 2014-03-18 22:48:22 +01:00
parent 9d7e1bcd4b
commit 7e81651bcd
3 changed files with 50 additions and 13 deletions

View File

@ -10,7 +10,7 @@ class UserController extends AppController {
* @var array * @var array
*/ */
public $uses = array('DreamjobListGraducation','DreamjobWorker','DreamjobCompany','DreamjobPageText','DreamjobPageImage','DreamjobJobOpening','DreamjobCvCategory','DreamjobListGraducation'); public $uses = array('DreamjobListGraducation', 'DreamjobWorker', 'DreamjobCompany', 'DreamjobPageText', 'DreamjobPageImage', 'DreamjobJobOpening', 'DreamjobCvCategory', 'DreamjobListGraducation', 'Mannerofaddress');
public $components = array('MiconwareSession','RequestHandler'); public $components = array('MiconwareSession','RequestHandler');
/** /**
@ -149,21 +149,33 @@ class UserController extends AppController {
$this->render('/Home/error'); $this->render('/Home/error');
}else{ }else{
if ($this->request->is('post')){ if ($this->request->is('post')){
if($this->request->data['User']['password'] == $this->request->data['User']['password2']) { if($this->request->data['User']['password1'] == $this->request->data['User']['password2']) {
if($this->request->data['User']['password1']!='')
$profil['User']['password'] = $this->MiconwareSession->create_hash($this->request->data['User']['password1']);
$profil['User']['password'] = $this->MiconwareSession->create_hash($this->request->data['User']['password']);
$profil['DreamjobUser']['city'] = $this->request->data['DreamjobUser']['city']; $profil['DreamjobUser']['city'] = $this->request->data['DreamjobUser']['city'];
$profil['DreamjobUser']['street'] = $this->request->data['DreamjobUser']['street']; $profil['DreamjobUser']['street'] = $this->request->data['DreamjobUser']['street'];
$profil['DreamjobUser']['postcode'] = $this->request->data['DreamjobUser']['postcode']; $profil['DreamjobUser']['postcode'] = $this->request->data['DreamjobUser']['postcode'];
$profil['AppUser']['bday'] = $this->request->data['AppUser']['bday']; $profil['AppUser']['bday'] = $this->request->data['AppUser']['bday'];
$profil['AppUser']['first_name'] = $this->request->data['AppUser']['first_name'];
$profil['AppUser']['last_name'] = $this->request->data['AppUser']['last_name'];
$result = false; $result = false;
if($company){ if($company){
$profil['DreamjobCompany']['corporateform'] = $this->request->data['DreamjobCompany']['corporateform'];
$profil['DreamjobCompany']['owner'] = $this->request->data['DreamjobCompany']['owner'];
$profil['DreamjobCompany']['branch'] = $this->request->data['DreamjobCompany']['branch'];
$profil['DreamjobCompany']['headcount'] = $this->request->data['DreamjobCompany']['headcount'];
$profil['DreamjobCompany']['bank_details'] = $this->request->data['DreamjobCompany']['bank_details'];
$profil['DreamjobCompany']['website'] = $this->request->data['DreamjobCompany']['website'];
$result = $this->DreamjobCompany->saveSettings($profil); $result = $this->DreamjobCompany->saveSettings($profil);
}else{ }else{
$profil['AppUser']['mannerofaddress_id'] = $this->request->data['AppUser']['mannerofaddress_id'];
$profil['DreamjobWorker']['country'] = $this->request->data['DreamjobWorker']['country']; $profil['DreamjobWorker']['country'] = $this->request->data['DreamjobWorker']['country'];
$profil['DreamjobWorker']['iam'] = $this->request->data['DreamjobWorker']['iam']; $profil['DreamjobWorker']['iam'] = $this->request->data['DreamjobWorker']['iam'];
$profil['DreamjobWorker']['graducation_id'] = $this->request->data['DreamjobWorker']['graducation_id']; $profil['DreamjobWorker']['graducation_id'] = $this->request->data['DreamjobWorker']['graducation_id'];
$profil['DreamjobWorker']['searchhidden'] = $this->request->data['DreamjobWorker']['searchhidden'];
$result = $this->DreamjobWorker->saveSettings($profil); $result = $this->DreamjobWorker->saveSettings($profil);
} }
@ -173,14 +185,16 @@ class UserController extends AppController {
}else{ }else{
$this->MiconwareSession->setFlash('dreamjob.settings.save.error','flash',array('alert'=>'danger')); $this->MiconwareSession->setFlash('dreamjob.settings.save.error','flash',array('alert'=>'danger'));
} }
}else{
}else if($this->request->data['User']['password1']!='' or $this->request->data['User']['password2']!=''){
$this->MiconwareSession->setFlash(__('dreamjob.error.password.notEqual'),'flash',array('alert'=>'danger')); $this->MiconwareSession->setFlash(__('dreamjob.error.password.notEqual'),'flash',array('alert'=>'danger'));
} }
} }
$profil['User']['password']='';
$this->request->data = $profil; $this->request->data = $profil;
$this->set('profil',$profil); $this->set('profil',$profil);
$this->set('graducations',$this->DreamjobListGraducation->find('list')); $this->set('graducations',$this->DreamjobListGraducation->find('list'));
$this->set('mannerofaddresss',$this->Mannerofaddress->find('list'));
$this->render('/User/settings_account'); $this->render('/User/settings_account');
} }
} }

View File

@ -28,23 +28,46 @@ if($profil['AppUser']['take_systemwide']){
</div> </div>
<h1><?=__("dreamjob.settings");?></h1> <h1><?=__("dreamjob.settings");?></h1>
<?php <?php
echo $this->Form->create('DreamjobJobApplication',$default_Form); echo $this->Form->create(false,$default_Form);
?> ?>
<fieldset> <fieldset>
<legend><?=__("dreamjob.account");?></legend> <legend><?=__("dreamjob.account");?></legend>
<?php <?php
echo $this->Form->input('User.mail',array('label'=>array('text'=>__("dreamjob.mail"),"class"=>$default_Form['inputDefaults']['label']['class']),'disabled')); echo $this->Form->input('User.mail',array('label'=>array('text'=>__("dreamjob.mail"),"class"=>$default_Form['inputDefaults']['label']['class']),'disabled'));
echo $this->Form->input('User.password',array('label'=>array('text'=>__("dreamjob.password"),"class"=>$default_Form['inputDefaults']['label']['class']))); echo $this->Form->input('User.password1',array('label'=>array('text'=>__("dreamjob.password"),"class"=>$default_Form['inputDefaults']['label']['class']),'type'=>'password'));
echo $this->Form->input('User.password2',array('label'=>array('text'=>__("dreamjob.password2"),"class"=>$default_Form['inputDefaults']['label']['class']),'type'=>'password')); echo $this->Form->input('User.password2',array('label'=>array('text'=>__("dreamjob.password2"),"class"=>$default_Form['inputDefaults']['label']['class']),'type'=>'password'));
if($WORKER){ if($WORKER){
?> ?>
<legend><?=__("dreamjob.worker");?></legend> <legend><?=__("dreamjob.worker");?></legend>
<?php <?php
echo $this->Form->input('AppUser.bday',array('label'=>array('text'=>__("dreamjob.bday"),"class"=>$default_Form['inputDefaults']['label']['class']))); echo $this->Form->input('AppUser.mannerofaddress_id',array('label'=>array('text'=>__("dreamjob.mannerofaddress_id"),"class"=>$default_Form['inputDefaults']['label']['class'])));
echo $this->Form->input('AppUser.first_name',array('label'=>array('text'=>__("dreamjob.first_name"),"class"=>$default_Form['inputDefaults']['label']['class'])));
echo $this->Form->input('AppUser.last_name',array('label'=>array('text'=>__("dreamjob.last_name"),"class"=>$default_Form['inputDefaults']['label']['class'])));
echo $this->Form->input('AppUser.bday',array('label'=>array('text'=>__("dreamjob.bday"),"class"=>$default_Form['inputDefaults']['label']['class']),"style"=>'width:20%;display:inline-block;'));
echo $this->Form->input('DreamjobWorker.iam',array('label'=>array('text'=>__("dreamjob.iam"),"class"=>$default_Form['inputDefaults']['label']['class']))); echo $this->Form->input('DreamjobWorker.iam',array('label'=>array('text'=>__("dreamjob.iam"),"class"=>$default_Form['inputDefaults']['label']['class'])));
echo $this->Form->input('DreamjobWorker.graducation_id',array('label'=>array('text'=>__("dreamjob.graducation"),"class"=>$default_Form['inputDefaults']['label']['class']))); echo $this->Form->input('DreamjobWorker.graducation_id',array('label'=>array('text'=>__("dreamjob.graducation"),"class"=>$default_Form['inputDefaults']['label']['class'])));
echo $this->Form->input('DreamjobWorker.workexperience',array('label'=>array('text'=>__("dreamjob.workexperience"),"class"=>$default_Form['inputDefaults']['label']['class'])));
?>
<div class="form-group">
<label class="col-sm-3 control-label"><?=__("dreamjob.searchhidden");?></label>
<div class="col-sm-9" style="text-align:left;">
<?=$this->Form->checkbox('DreamjobWorker.searchhidden',array("class"=>'form-control',"label"=>__("dreamjob.searchhidden")))?>
</div>
</div>
<?php
}elseif($COMPANY){
?>
<legend><?=__("dreamjob.company");?></legend>
<?php
echo $this->Form->input('AppUser.nickname',array('label'=>array('text'=>__("dreamjob.company.nickname"),"class"=>$default_Form['inputDefaults']['label']['class'])));
echo $this->Form->input('DreamjobCompany.corporateform',array('label'=>array('text'=>__("dreamjob.corporateform"),"class"=>$default_Form['inputDefaults']['label']['class'])));
echo $this->Form->input('DreamjobCompany.owner',array('label'=>array('text'=>__("dreamjob.owner"),"class"=>$default_Form['inputDefaults']['label']['class'])));
echo $this->Form->input('DreamjobCompany.branch',array('label'=>array('text'=>__("dreamjob.branch"),"class"=>$default_Form['inputDefaults']['label']['class'])));
echo $this->Form->input('DreamjobCompany.headcount',array('label'=>array('text'=>__("dreamjob.headcount"),"class"=>$default_Form['inputDefaults']['label']['class'])));
//echo $this->Form->input('DreamjobCompany.bank_details',array('label'=>array('text'=>__("dreamjob.bank_details"),"class"=>$default_Form['inputDefaults']['label']['class'])));
echo $this->Form->input('DreamjobCompany.website',array('label'=>array('text'=>__("dreamjob.website"),"class"=>$default_Form['inputDefaults']['label']['class'])));
} }
?> ?>
<legend><?=__("dreamjob.addresse");?></legend> <legend><?=__("dreamjob.addresse");?></legend>

View File

@ -89,7 +89,7 @@
if commented, html5 nonsupported browers will reload the page to the specified link. if commented, html5 nonsupported browers will reload the page to the specified link.
*/ */
$.ajax({url:pageurl,data:data,type:typemethode,success: function(data){ $.ajax({url:pageurl,data:data,type:typemethode,success: function(data){
alert = data.split('<!-- alert -->')[1].split('<!-- /alert -->')[0]+$('#alert').html(); alert = data.split('<!-- alert -->')[1].split('<!-- /alert -->')[0];
$('#alert').html(alert); $('#alert').html(alert);
if(back){ if(back){