<?php

/**
 * IndexController
 *
 * @author Arkadiusz Rychlik <a.rychlik at eppe.com.pl>
 */
class Main_Faq_Controller_IndexController extends Eppe_Frontend_Controller_Action {
	
	public function indexAction() {
		$groupsEnabled = Faq_Module_Module::getInstance()->groupsEnabled();

		if($groupsEnabled){
			$groups = R::findAll('faqgroup','active = ? ORDER BY name',[true]);			
			$this->view->faqgroups = $groups;
		}
		else{
			$qas = R::findAll('faqqa','active = ? ORDER BY question',[true]);			
			$this->view->faqqas = $qas;
		}
		
		$this->view->groupsEnabled = $groupsEnabled;
	}
	
}
