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
*/
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');
/**
@ -149,38 +149,52 @@ class UserController extends AppController {
$this->render('/Home/error');
}else{
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']) {
$profil['User']['password'] = $this->MiconwareSession->create_hash($this->request->data['User']['password']);
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']['street'] = $this->request->data['DreamjobUser']['street'];
$profil['DreamjobUser']['postcode'] = $this->request->data['DreamjobUser']['postcode'];
$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;
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);
}else{
$profil['AppUser']['mannerofaddress_id'] = $this->request->data['AppUser']['mannerofaddress_id'];
$profil['DreamjobWorker']['country'] = $this->request->data['DreamjobWorker']['country'];
$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'];
$result = $this->DreamjobWorker->saveSettings($profil);
}
if($result){
$this->MiconwareSession->setFlash('dreamjob.settings.save','flash',array('alert'=>'success'));
}else{
$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'));
}
}
$profil['User']['password']='';
$this->request->data = $profil;
$this->set('profil',$profil);
$this->set('graducations',$this->DreamjobListGraducation->find('list'));
$this->set('mannerofaddresss',$this->Mannerofaddress->find('list'));
$this->render('/User/settings_account');
}
}

View File

@ -28,23 +28,46 @@ if($profil['AppUser']['take_systemwide']){
</div>
<h1><?=__("dreamjob.settings");?></h1>
<?php
echo $this->Form->create('DreamjobJobApplication',$default_Form);
echo $this->Form->create(false,$default_Form);
?>
<fieldset>
<legend><?=__("dreamjob.account");?></legend>
<?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.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'));
if($WORKER){
if($WORKER){
?>
<legend><?=__("dreamjob.worker");?></legend>
<?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.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>

View File

@ -89,7 +89,7 @@
if commented, html5 nonsupported browers will reload the page to the specified link.
*/
$.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);
if(back){