Now let's add the application logic to retrieve the vacancies
based on the users' culture. We modified the model to allow us to pass in the culture
; we also need to refactor the action. Open up the vacancies action class in apps/frontend/modules/vacancies/actions/actions.class.php
and amend the index action:
public function executeIndex()
{
$this->vacanciesArray = VacancyPeer::getVacancies($this-> getUser()->getCulture());
if(count($this->vacanciesArray) < 1)
{
return 'NoVacancies';
}
else
{
return sfView::SUCCESS;
}
}
We have passed in the culture
to our model using the user object. The logic also takes into account that there might not be any vacancies. This time we are going to create a template for this rather than setting a flash variable.
Let's create it now while we are on the subject of handling the no-vacancies pages. Create a new template in apps/frontend/modules/vacancies/templates/indexNoVacancies.php
. The following is a simple template:
<h1>No...