dreamjob/app/Controller/SearchController.php

60 lines
1.8 KiB
PHP
Raw Normal View History

2014-03-29 21:39:56 +01:00
<?php
App::uses('AppController', 'Controller');
class SearchController extends AppController {
/**
* This controller use User Model
*
* @var array
*/
2014-04-15 21:43:23 +02:00
public $uses = array('DreamjobWorker','DreamjobJobOpening',
'DreamjobListBranch','DreamjobListCity','DreamjobListKindofjob','DreamjobListGraducation');
2014-03-29 21:39:56 +01:00
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.
*/
2014-04-15 21:43:23 +02:00
public function openings() {
$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/searchopenings');
}
2014-03-29 21:39:56 +01:00
public function listopening() {
$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/listworkers');
}else{
$con = $this->MiconwareSession->getOpeningCondition();
$openings = $this->DreamjobJobOpening->find('all',array('conditions' => $con));
$this->set("openings",$openings);
$this->render('/Search/listopenings');
}
}
}