dreamjob/app/Controller/SearchController.php

60 lines
1.8 KiB
PHP

<?php
App::uses('AppController', 'Controller');
class SearchController extends AppController {
/**
* This controller use User Model
*
* @var array
*/
public $uses = array('DreamjobWorker','DreamjobJobOpening',
'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 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');
}
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');
}
}
}