dreamjob/app/Controller/RegistrationController.php

78 lines
2.5 KiB
PHP
Raw Normal View History

2014-04-02 20:38:01 +02:00
<?php
App::uses('AppController', 'Controller');
class RegistrationController extends AppController {
/**
* This controller use User Model
*
* @var array
*/
public $uses = array('Mannerofaddress','DreamjobListGraducation','DreamjobListBranch');
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']);
$result = $this->DreamjobCompany->registration($this->request->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{
$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']);
$result = $this->DreamjobWorker->registration($this->request->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{
$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');
}
}
}
?>