categories = Doctrine::getTable('JobCategory')->createQuery()
->addWhere('parent_id IS NULL')
->addWhere('priority > ?', 0)
->orderBy('priority DESC')
->execute();
$this->list = $this->getCategoryList($this->categories, 'jobs_offers_category');
}
public function executeDemandsMenu()
{
$this->categories = Doctrine::getTable('JobCategory')->createQuery()
->addWhere('parent_id IS NULL')
->orderBy('priority DESC')
->addWhere('priority > ?', 0)
->execute();
$this->list = $this->getCategoryListRecursively($this->categories, 'jobs_demands_category');
}
protected function getCategoryList(Doctrine_Collection $categories, $route)
{
$result = '
';
foreach($categories as $category)
{
$result .= '- ';
$result .= ''.$category->getName().'';
$result .= '
';
}
$result .= '
';
return $result;
}
/**
* Rekurzivně vygeneruje seznam kategorií
*
* @param Doctrine_Collection $categories
* @param string $url
* @return string
*/
protected function getCategoryListRecursively(Doctrine_Collection $categories, $route)
{
$result = '';
foreach($categories as $category)
{
$result .= '- ';
if($category->hasChildren())
{
$result .= ''.$category->getName().'';
$result .= $this->getCategoryListRecursively($category->getChildren(), $route);
}
else
{
$result .= ''.$category->getName().'';
}
$result .= '
';
}
$result .= '
';
return $result;
}
public function executeDemandsButton()
{
}
public function executeOffersButton()
{
}
public function executeGoogleAnalytics()
{
}
}