dreamjob/app/Controller/HomeController.php

93 lines
2.8 KiB
PHP
Raw Normal View History

2014-02-18 12:10:29 +01:00
<?php
App::uses('AppController', 'Controller');
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-05 19:01:44 +01:00
private $home_opening_condition = array('contitions'=>array('active'=>true),'order'=>'DreamjobJobOpening.id DESC','limit'=>3);
2014-02-18 12:10:29 +01:00
public function home() {
$this->MiconwareSession->init($this);
$this->MiconwareSession->initWeb($this);
2014-03-05 19:01:44 +01:00
$openings = $this->DreamjobJobOpening->find('all',$this->home_opening_condition);
2014-03-05 00:01:58 +01:00
$this->set('openings',$openings);
2014-02-18 12:10:29 +01:00
$this->set('title', 'dreamjob.startpage');
$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-02-18 12:10:29 +01:00
$this->MiconwareSession->setFlash('dreamjob.loggedin','flash',array('alert'=>'success'));
}else{
$this->MiconwareSession->setFlash('dreamjob.loggedinError','flash',array('alert'=>'danger'));
}
}else{
$this->MiconwareSession->setFlash('dreamjob.loggedinError','flash',array('alert'=>'danger'));
}
$this->MiconwareSession->initWeb($this);
2014-03-05 19:01:44 +01:00
$openings = $this->DreamjobJobOpening->find('all',$this->home_opening_condition);
$this->set('openings',$openings);
2014-02-18 12:10:29 +01:00
$this->set('title', 'dreamjob.startpage');
$this->set('MENU_START', true);
$this->render('/Home/home');
}
public function logout(){
$this->MiconwareSession->init($this);
if($this->MiconwareSession->logout())
$this->MiconwareSession->setFlash('dreamjob.loggingoutSucess','flash',array('alert'=>'success'));
else
$this->MiconwareSession->setFlash('dreamjob.loggingoutError','flash',array('alert'=>'danger'));
$this->MiconwareSession->initWeb($this);
2014-03-05 19:01:44 +01:00
$openings = $this->DreamjobJobOpening->find('all',$this->home_opening_condition);
$this->set('openings',$openings);
2014-02-18 12:10:29 +01:00
$this->set('title', 'dreamjob.startpage');
$this->set('MENU_START', true);
$this->render('/Home/home');
}
public function contact() {
$this->MiconwareSession->init($this);
$this->MiconwareSession->initWeb($this);
$this->set('title', 'dreamjob.contact');
$this->render('/Home/contact');
}
public function impressum() {
$this->MiconwareSession->init($this);
$this->MiconwareSession->initWeb($this);
$this->set('title', 'dreamjob.impressum');
$this->render('/Home/impressum');
}
}