<?php 
class ControllerInformation extends Controller {
	function index() {  
		$database =& $this->locator->get('database');
		$language =& $this->locator->get('language');
		$module   =& $this->locator->get('module');
		$request  =& $this->locator->get('request');
		$response =& $this->locator->get('response');
		$template =& $this->locator->get('template');
		$url      =& $this->locator->get('url');
		
    	$language->load('controller/information.php');
		
		$information_info = $database->getRow("select * from information i left join information_description id on (i.information_id = id.information_id) where i.information_id = '" . (int)$request->get('information_id') . "' and id.language_id = '" . (int)$language->getId() . "'");
   		
		if ($information_info) {
	  		$template->set('title', $information_info['title']); 

      		$view = $this->locator->create('template');

      		$view->set('heading_title', $information_info['title']);

      		$view->set('description', $information_info['description']);

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

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

      		$template->set('content', $view->fetch('content/information.tpl'));
	  
	  		$template->set($module->fetch());
	  
	  		$response->set($template->fetch('layout.tpl'));
    	} else {
	  		$template->set('title', $language->get('text_error'));

      		$view = $this->locator->create('template');

      		$view->set('heading_title', $language->get('text_error'));

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

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

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

	  		$template->set('content', $view->fetch('content/error.tpl'));

	  		$template->set($module->fetch());
	  
	  		$response->set($template->fetch('layout.tpl'));
    	}
  	}
}
?>
