dreamjob/app/Controller/SearchController.php

43 lines
1.1 KiB
PHP

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