146 lines
4.0 KiB
PHP
146 lines
4.0 KiB
PHP
<?php
|
|
|
|
App::uses('AppController', 'Controller');
|
|
|
|
class SearchController extends AppController {
|
|
|
|
/**
|
|
* This controller use User Model
|
|
*
|
|
* @var array
|
|
*/
|
|
|
|
public $uses = array('DreamjobWorker','DreamjobJobOpening','DreamjobCompany',
|
|
'DreamjobListBranch','DreamjobListCity','DreamjobListKindofjob','DreamjobListGraducation');
|
|
public $components = array('MiconwareSession');
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
public function beforeFilter(){
|
|
$this->Security->unlockedActions[]="opening";
|
|
$this->Security->unlockedActions[]="company";
|
|
$this->Security->unlockedActions[]="auto";
|
|
$this->Security->unlockedActions[]="education";
|
|
$this->Security->unlockedActions[]="academy";
|
|
$this->Security->unlockedActions[]="internship";
|
|
parent::beforeFilter();
|
|
}
|
|
|
|
public function choose() {
|
|
$this->MiconwareSession->init($this);
|
|
|
|
$profil = $this->MiconwareSession->getCompany();
|
|
if(!empty($profil) and count($profil) > 0){
|
|
$this->worker();
|
|
}else{
|
|
$this->opening();
|
|
}
|
|
}
|
|
|
|
private function spezial($type) {
|
|
$this->MiconwareSession->init($this);
|
|
$this->MiconwareSession->initWeb($this);
|
|
$profil = $this->MiconwareSession->getWorker();
|
|
if(!empty($profil) and count($profil) > 0){
|
|
$con = $this->MiconwareSession->getOpeningCondition();
|
|
|
|
|
|
|
|
|
|
$openings = $this->DreamjobJobOpening->find('all',array('conditions' => $con));
|
|
$this->set("branches",$this->DreamjobListBranch->find('list'));
|
|
$this->set("cities",$this->DreamjobListCity->find('list'));
|
|
$this->set("openings",$openings);
|
|
$this->render('/Search/'.$type);
|
|
}else{
|
|
$this->set('error', 'dreamjob.error.noPermision');
|
|
$this->render('/Home/error');
|
|
}
|
|
|
|
}
|
|
|
|
public function opening() {
|
|
$this->MiconwareSession->init($this);
|
|
|
|
$this->MiconwareSession->initWeb($this);
|
|
|
|
$con = $this->MiconwareSession->getOpeningCondition();
|
|
$openings = $this->DreamjobJobOpening->find('all',array('conditions' => $con));
|
|
|
|
$this->set("branches",$this->DreamjobListBranch->find('list'));
|
|
$this->set("cities",$this->DreamjobListCity->find('list'));
|
|
$this->set("graducations",$this->DreamjobListGraducation->find('list'));
|
|
$this->set("kindofjobs",$this->DreamjobListKindofjob->find('list'));
|
|
|
|
$this->set("openings",$openings);
|
|
$this->render('/Search/opening');
|
|
|
|
}
|
|
public function company() {
|
|
$this->MiconwareSession->init($this);
|
|
|
|
$this->MiconwareSession->initWeb($this);
|
|
|
|
$companies = $this->DreamjobCompany->find('all');
|
|
|
|
$this->set("branches",$this->DreamjobListBranch->find('list'));
|
|
$this->set("cities",$this->DreamjobListCity->find('list'));
|
|
|
|
$this->set("companies",$companies);
|
|
$this->render('/Search/company');
|
|
|
|
}
|
|
|
|
public function auto() {
|
|
$this->MiconwareSession->init($this);
|
|
|
|
$this->MiconwareSession->initWeb($this);
|
|
$profil = $this->MiconwareSession->getWorker();
|
|
if(!empty($profil) and count($profil) > 0){
|
|
$con = $this->MiconwareSession->getOpeningCondition();
|
|
$openings = $this->DreamjobJobOpening->find('all',array('conditions' => $con));
|
|
|
|
$this->set("openings",$openings);
|
|
$this->render('/Search/auto');
|
|
}else{
|
|
$this->set('error', 'dreamjob.error.noPermision');
|
|
$this->render('/Home/error');
|
|
}
|
|
}
|
|
|
|
public function worker(){
|
|
$this->MiconwareSession->init($this);
|
|
|
|
$this->MiconwareSession->initWeb($this);
|
|
$profil = $this->MiconwareSession->getCompany();
|
|
if(!empty($profil) and count($profil) > 0){
|
|
$workers = $this->DreamjobWorker->find('all',array('conditions' => array('DreamjobWorker.searchhidden'=>false)));
|
|
$this->set("workers",$workers);
|
|
$this->render('/Search/worker');
|
|
}else{
|
|
$this->set('error', 'dreamjob.error.noPermision');
|
|
$this->render('/Home/error');
|
|
}
|
|
}
|
|
|
|
|
|
public function education() {
|
|
$this->spezial('education');
|
|
|
|
}
|
|
public function academy() {
|
|
$this->spezial('academy');
|
|
|
|
}
|
|
public function internship() {
|
|
$this->spezial('internship');
|
|
|
|
}
|
|
}
|