<?php  
class ModuleInformation extends Controller {
	function fetch() {
		$config   =& $this->locator->get('config');
		$database =& $this->locator->get('database');
		$language =& $this->locator->get('language');
		$url      =& $this->locator->get('url');
		
		if ($config->get('information_status')) {	
			$language->load('extension/module/information.php');
		
			$view = $this->locator->create('template');
		
    		$view->set('heading_title', $language->get('heading_title'));

    		$view->set('text_contact', $language->get('text_contact'));
    		$view->set('text_sitemap', $language->get('text_sitemap'));

    		$information_data = array();

    		$results = $database->cache('information-' . (int)$language->getId(), "select * from information i left join information_description id on (i.information_id = id.information_id) where id.language_id = '" . (int)$language->getId() . "' order by i.sort_order");

    		foreach ($results as $result) {
      			$information_data[] = array(
        			'title' => $result['title'],
	    			'href'  => $url->href('information', false, array('information_id' => $result['information_id']))
      			);
    		}

    		$view->set('information', $information_data);

    		$view->set('contact', $url->href('contact'));

    		$view->set('sitemap', $url->href('sitemap'));

   			return $view->fetch('module/information.tpl');
		}
	}
}
?>