2014-02-18 12:10:29 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
App::uses('AppController', 'Controller');
|
2014-05-05 16:44:28 +02:00
|
|
|
App::uses('CakeEmail', 'Network/Email');
|
2014-02-18 12:10:29 +01:00
|
|
|
|
|
|
|
class HomeController extends AppController {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This controller use User Model
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
2014-03-02 12:14:02 +01:00
|
|
|
|
2014-03-05 00:01:58 +01:00
|
|
|
public $uses = array("DreamjobJobOpening");
|
2014-02-18 12:10:29 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Displays a view
|
|
|
|
*
|
|
|
|
* @param mixed What page to display
|
|
|
|
* @return void
|
|
|
|
* @throws NotFoundException When the view file could not be found
|
|
|
|
* or MissingViewException in debug mode.
|
|
|
|
*/
|
2014-03-28 16:22:19 +01:00
|
|
|
|
2014-05-06 11:11:18 +02:00
|
|
|
private static $opening_limit = 5;
|
2014-05-02 19:10:28 +02:00
|
|
|
|
|
|
|
function beforeFilter(){
|
|
|
|
$this->Security->unlockedActions[]="login";
|
|
|
|
parent::beforeFilter();
|
|
|
|
}
|
2014-03-26 19:49:36 +01:00
|
|
|
|
2014-02-18 12:10:29 +01:00
|
|
|
public function home() {
|
|
|
|
$this->MiconwareSession->init($this);
|
|
|
|
$this->MiconwareSession->initWeb($this);
|
2014-05-25 09:39:28 +02:00
|
|
|
$c = $this->MiconwareSession->getCompany();
|
|
|
|
if (!empty($c))
|
|
|
|
return $this->redirect(array('controller'=>'home','action' => 'company'));
|
2014-03-28 16:22:19 +01:00
|
|
|
$openings = $this->DreamjobJobOpening->find('all',array('conditions'=>$this->MiconwareSession->getOpeningCondition(),
|
2014-05-02 19:10:28 +02:00
|
|
|
'order'=>'DreamjobJobOpening.id DESC','limit'=> self::$opening_limit));
|
2014-03-05 00:01:58 +01:00
|
|
|
$this->set('openings',$openings);
|
2014-06-10 18:37:45 +02:00
|
|
|
$this->set('title', __('dreamjob.startpage'));
|
2014-02-18 12:10:29 +01:00
|
|
|
$this->set('MENU_START', true);
|
|
|
|
$this->render('/Home/home');
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function login(){
|
|
|
|
$this->MiconwareSession->init($this);
|
|
|
|
|
|
|
|
if($this->request->is('post') and isset($this->request->data['User']['mail']) and isset($this->request->data['User']['password'])){
|
|
|
|
if($this->MiconwareSession->login(
|
|
|
|
$this->request->data['User']['mail'],
|
|
|
|
$this->request->data['User']['password'])
|
|
|
|
){
|
2014-03-02 11:35:22 +01:00
|
|
|
$this->MiconwareSession->refreshCache();
|
2014-06-10 18:37:45 +02:00
|
|
|
$this->MiconwareSession->setFlash(__('dreamjob.loggedin.success'),'flash',array('alert'=>'success'));
|
2014-02-18 12:10:29 +01:00
|
|
|
}else{
|
2014-06-10 18:37:45 +02:00
|
|
|
$this->MiconwareSession->setFlash(__('dreamjob.loggedin.error'),'flash',array('alert'=>'danger'));
|
2014-02-18 12:10:29 +01:00
|
|
|
}
|
|
|
|
}else{
|
2015-01-05 19:55:59 +01:00
|
|
|
if(isset($this->params['url']['mail']) && isset($this->params['url']['password'])){
|
|
|
|
$this->request->data['User']['mail'] = $this->params['url']['mail'];
|
|
|
|
$this->request->data['User']['password'] = $this->params['url']['password'];
|
|
|
|
}
|
2014-02-18 12:10:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$this->MiconwareSession->initWeb($this);
|
2014-10-04 15:44:21 +02:00
|
|
|
$this->render('/Home/login');
|
2014-02-18 12:10:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function logout(){
|
|
|
|
$this->MiconwareSession->init($this);
|
|
|
|
|
|
|
|
if($this->MiconwareSession->logout())
|
2014-06-10 18:37:45 +02:00
|
|
|
$this->MiconwareSession->setFlash(__('dreamjob.loggingout.success'),'flash',array('alert'=>'success'));
|
2014-02-18 12:10:29 +01:00
|
|
|
else
|
2014-06-10 18:37:45 +02:00
|
|
|
$this->MiconwareSession->setFlash(__('dreamjob.loggingout.error'),'flash',array('alert'=>'danger'));
|
2014-02-18 12:10:29 +01:00
|
|
|
|
|
|
|
$this->MiconwareSession->initWeb($this);
|
2014-03-28 16:22:19 +01:00
|
|
|
$openings = $this->DreamjobJobOpening->find('all',array('conditions'=>$this->MiconwareSession->getOpeningCondition(),
|
2014-05-02 19:10:28 +02:00
|
|
|
'order'=>'DreamjobJobOpening.id DESC','limit'=> self::$opening_limit));
|
2014-03-05 19:01:44 +01:00
|
|
|
$this->set('openings',$openings);
|
2014-06-10 18:37:45 +02:00
|
|
|
$this->set('title', __('dreamjob.startpage'));
|
2014-02-18 12:10:29 +01:00
|
|
|
$this->set('MENU_START', true);
|
|
|
|
$this->render('/Home/home');
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function impressum() {
|
|
|
|
$this->MiconwareSession->init($this);
|
|
|
|
$this->MiconwareSession->initWeb($this);
|
2014-06-10 18:37:45 +02:00
|
|
|
$this->set('title', __('dreamjob.impressum'));
|
2014-02-18 12:10:29 +01:00
|
|
|
$this->render('/Home/impressum');
|
|
|
|
}
|
2014-03-23 10:16:15 +01:00
|
|
|
|
|
|
|
|
2014-03-26 09:15:43 +01:00
|
|
|
public function agb() {
|
2014-03-23 10:16:15 +01:00
|
|
|
$this->MiconwareSession->init($this);
|
|
|
|
$this->MiconwareSession->initWeb($this);
|
2014-06-10 18:37:45 +02:00
|
|
|
$this->set('title', __('dreamjob.agb'));
|
2014-03-23 10:16:15 +01:00
|
|
|
$this->render('/Home/agb');
|
|
|
|
}
|
2014-05-02 19:10:28 +02:00
|
|
|
|
|
|
|
public function company() {
|
2014-05-04 15:10:09 +02:00
|
|
|
if($this->request->is('post')){
|
2014-05-02 19:10:28 +02:00
|
|
|
$Email = new CakeEmail('dreamjobMain');
|
|
|
|
$Email->to('service@dream-job.eu');
|
2014-05-05 18:27:29 +02:00
|
|
|
$Email->from(array($this->request->data['mail']['adresse'] => $this->request->data['mail']['first_name'].' '.$this->request->data['mail']['last_name']));
|
2014-05-02 19:10:28 +02:00
|
|
|
$Email->subject('[Dreamjob-Kontakt-Firma]'.$this->request->data['mail']['subject']);
|
|
|
|
$Email->template('contact');
|
2014-05-05 18:27:29 +02:00
|
|
|
$Email->viewVars(array('text'=>$this->request->data,'strip_tags'=>$this->MiconwareSession->strip_tags));
|
2014-05-02 19:10:28 +02:00
|
|
|
if($Email->send())
|
2014-06-10 18:37:45 +02:00
|
|
|
$this->MiconwareSession->setFlash(__('dreamjob.contactSend.success'),'flash',array('alert'=>'success'));
|
2014-05-02 19:10:28 +02:00
|
|
|
else
|
|
|
|
$this->MiconwareSession->setFlash(__('dreamjob.contactSend.error'),'flash',array('alert'=>'danger'));
|
|
|
|
}
|
|
|
|
$this->MiconwareSession->init($this);
|
|
|
|
$this->MiconwareSession->initWeb($this);
|
|
|
|
$this->set('MENU_START_company', true);
|
2014-06-10 18:37:45 +02:00
|
|
|
$this->set('title', __('dreamjob.company'));
|
2014-05-02 19:10:28 +02:00
|
|
|
$this->render('/Home/company');
|
|
|
|
}
|
2014-02-18 12:10:29 +01:00
|
|
|
}
|