2014-04-02 20:38:01 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
App::uses('AppController', 'Controller');
|
2014-04-08 19:28:07 +02:00
|
|
|
App::uses('CakeEmail', 'Network/Email');
|
2014-04-02 20:38:01 +02:00
|
|
|
|
|
|
|
class RegistrationController extends AppController {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This controller use User Model
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
2014-04-13 13:28:39 +02:00
|
|
|
public $componens = array('MiconwareSession');
|
2014-04-09 19:30:26 +02:00
|
|
|
public $uses = array('Mannerofaddress','DreamjobListGraducation','DreamjobListBranch','DreamjobWorker','DreamjobCompany','User');
|
2014-04-08 19:28:07 +02:00
|
|
|
|
2014-04-02 20:38:01 +02:00
|
|
|
|
|
|
|
public function main() {
|
|
|
|
$this->MiconwareSession->init($this);
|
|
|
|
$this->MiconwareSession->initWeb($this);
|
|
|
|
if(!$this->MiconwareSession->isLoggedin()){
|
|
|
|
$this->render('/Registration/main');
|
|
|
|
}else{
|
|
|
|
$this->set('error', 'dreamjob.error.loggedin');
|
|
|
|
$this->render('/Home/error');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function company() {
|
|
|
|
$this->MiconwareSession->init($this);
|
|
|
|
$this->MiconwareSession->initWeb($this);
|
|
|
|
if(!$this->MiconwareSession->isLoggedin()){
|
|
|
|
if ($this->request->is('post')){
|
|
|
|
if($this->request->data['DreamjobCompany']['agb']) {
|
|
|
|
unset($this->request->data['DreamjobCompany']['agb']);
|
2014-04-08 19:28:07 +02:00
|
|
|
if($this->request->data['User']['password1'] == $this->request->data['User']['password2']) {
|
|
|
|
$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']['street'] = $this->request->data['DreamjobUser']['street'];
|
|
|
|
$data['DreamjobUser']['postcode'] = $this->request->data['DreamjobUser']['postcode'];
|
|
|
|
$data['AppUser']['nickname'] = $this->request->data['AppUser']['nickname'];
|
|
|
|
|
|
|
|
$data['DreamjobCompany']['corporateform'] = $this->request->data['DreamjobCompany']['corporateform'];
|
|
|
|
$data['DreamjobCompany']['owner'] = $this->request->data['DreamjobCompany']['owner'];
|
|
|
|
$data['DreamjobCompany']['branch_id'] = $this->request->data['DreamjobCompany']['branch_id'];
|
|
|
|
$data['DreamjobCompany']['headcount'] = $this->request->data['DreamjobCompany']['headcount'];
|
|
|
|
$data['DreamjobCompany']['bank_details'] = '';
|
|
|
|
//$data['DreamjobCompany']['bank_details'] = $this->request->data['DreamjobCompany']['bank_details'];
|
|
|
|
$data['DreamjobCompany']['website'] = $this->request->data['DreamjobCompany']['website'];
|
2014-04-08 19:47:05 +02:00
|
|
|
$key = $this->MiconwareSession->generateKey();
|
|
|
|
$data['User']['code'] = "a:".$key;
|
|
|
|
$data['User']['is_active'] = false;
|
2014-04-08 19:28:07 +02:00
|
|
|
|
|
|
|
$result = $this->DreamjobCompany->registration($data);
|
|
|
|
if ($result) {
|
|
|
|
$this->MiconwareSession->setFlash('dreamjob.registration.done','flash',array('alert'=>'success'));
|
|
|
|
}else{
|
|
|
|
$this->MiconwareSession->setFlash('dreamjob.registration.error','flash',array('alert'=>'danger'));
|
|
|
|
}
|
|
|
|
}else if($this->request->data['User']['password1']!='' or $this->request->data['User']['password2']!=''){
|
|
|
|
$this->MiconwareSession->setFlash(__('dreamjob.error.password.notEqual'),'flash',array('alert'=>'danger'));
|
2014-04-02 20:38:01 +02:00
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$this->MiconwareSession->setFlash('dreamjob.agb.error.notAccept','flash',array('alert'=>'danger'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->set('branches',$this->DreamjobListBranch->find('list'));
|
|
|
|
$this->render('/Registration/company');
|
|
|
|
}else{
|
|
|
|
$this->set('error', 'dreamjob.error.loggedin');
|
|
|
|
$this->render('/Home/error');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function worker() {
|
|
|
|
$this->MiconwareSession->init($this);
|
|
|
|
$this->MiconwareSession->initWeb($this);
|
|
|
|
if(!$this->MiconwareSession->isLoggedin()){
|
|
|
|
if ($this->request->is('post')){
|
|
|
|
if($this->request->data['DreamjobWorker']['agb']) {
|
|
|
|
unset($this->request->data['DreamjobWorker']['agb']);
|
2014-04-08 19:28:07 +02:00
|
|
|
if($this->request->data['User']['password1'] == $this->request->data['User']['password2']) {
|
|
|
|
$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']['street'] = $this->request->data['DreamjobUser']['street'];
|
|
|
|
$data['DreamjobUser']['postcode'] = $this->request->data['DreamjobUser']['postcode'];
|
|
|
|
$data['AppUser']['bday'] = $this->request->data['AppUser']['bday'];
|
|
|
|
$data['AppUser']['first_name'] = $this->request->data['AppUser']['first_name'];
|
|
|
|
$data['AppUser']['last_name'] = $this->request->data['AppUser']['last_name'];
|
|
|
|
//WORKER
|
|
|
|
$data['AppUser']['mannerofaddress_id'] = $this->request->data['AppUser']['mannerofaddress_id'];
|
|
|
|
$data['DreamjobWorker']['country'] = $this->request->data['DreamjobWorker']['country'];
|
|
|
|
$data['DreamjobWorker']['iam'] = $this->request->data['DreamjobWorker']['iam'];
|
|
|
|
$data['DreamjobWorker']['graducation_id'] = $this->request->data['DreamjobWorker']['graducation_id'];
|
|
|
|
$data['DreamjobWorker']['searchhidden'] = true;
|
|
|
|
$data['DreamjobWorker']['workexperience'] = $this->request->data['DreamjobWorker']['workexperience'];
|
|
|
|
|
2014-04-08 19:47:05 +02:00
|
|
|
$key = $this->MiconwareSession->generateKey();
|
|
|
|
$data['User']['code'] = "a:".$key;
|
|
|
|
$data['User']['is_active'] = false;
|
2014-04-08 19:28:07 +02:00
|
|
|
|
|
|
|
$result = $this->DreamjobWorker->registration($data);
|
|
|
|
|
|
|
|
if($result){
|
2014-04-08 19:47:05 +02:00
|
|
|
$result = $this->registrationMail($data,$key);
|
2014-04-08 19:28:07 +02:00
|
|
|
if($result){
|
|
|
|
$this->log("Registratrion Mail:"+$data['User']['mail']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($result) {
|
|
|
|
$this->MiconwareSession->setFlash('dreamjob.registration.done','flash',array('alert'=>'success'));
|
|
|
|
}else{
|
|
|
|
$this->MiconwareSession->setFlash('dreamjob.registration.error','flash',array('alert'=>'danger'));
|
|
|
|
}
|
|
|
|
}else if($this->request->data['User']['password1']!='' or $this->request->data['User']['password2']!=''){
|
|
|
|
$this->MiconwareSession->setFlash(__('dreamjob.error.password.notEqual'),'flash',array('alert'=>'danger'));
|
2014-04-02 20:38:01 +02:00
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$this->MiconwareSession->setFlash('dreamjob.agb.error.notAccept','flash',array('alert'=>'danger'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->set('mannerofaddresses',$this->Mannerofaddress->find('list'));
|
|
|
|
$this->set('graducations',$this->DreamjobListGraducation->find('list'));
|
|
|
|
$this->render('/Registration/worker');
|
|
|
|
}else{
|
|
|
|
$this->set('error', 'dreamjob.error.loggedin');
|
|
|
|
$this->render('/Home/error');
|
|
|
|
}
|
|
|
|
}
|
2014-04-08 20:31:52 +02:00
|
|
|
public function active(){
|
2014-04-09 19:30:26 +02:00
|
|
|
$this->MiconwareSession->init($this);
|
|
|
|
$this->MiconwareSession->initWeb($this);
|
|
|
|
if(!$this->MiconwareSession->isLoggedin() and !empty($this->request->params['code']) and !empty($this->request->query['mail']) ){
|
|
|
|
$result = $this->User->activeLinkUser($this->request->query['mail'],$this->request->params['code']);
|
|
|
|
$this->set("result",$result);
|
|
|
|
$this->render('/Registration/active');
|
|
|
|
}else{
|
|
|
|
$this->set('error', 'dreamjob.error.loggedin');
|
|
|
|
$this->render('/Home/error');
|
|
|
|
}
|
2014-04-08 20:31:52 +02:00
|
|
|
}
|
|
|
|
|
2014-04-02 20:38:01 +02:00
|
|
|
}
|
|
|
|
?>
|