<?php  
class ModuleFooter extends Controller {
	function fetch() {
		$config   =& $this->locator->get('config');
		$language =& $this->locator->get('language');	
		$database =& $this->locator->get('database');
		$template =& $this->locator->get('template');
		$image    =& $this->locator->get('image');
		if ($config->get('footer_status')) {	
			$language->load('extension/module/footer.php');
		
			$view = $this->locator->create('template');
		
			$view->set('text_powered_by', $language->get('text_powered_by'));		
			
		   //knowledge base
		    $knowledge_base_list=$database->getRows("select kb.knowledge_id,kb.parent_id,kbv.title,kbv.class from knowledge_base kb left join knowledge_base_value kbv on kb.knowledge_id=kbv.knowledge_id where kb.parent_id=0 and kbv.status=1 order by kbv.sort asc");
		    if(is_array($knowledge_base_list)){
		    	foreach($knowledge_base_list as $k=>$v){
		    		$knowledge_base_list[$k]['child']=$database->getRows("select kb.knowledge_id,kb.parent_id,kbv.title,kbv.class,kbv.content from knowledge_base kb left join knowledge_base_value kbv on kb.knowledge_id=kbv.knowledge_id where kb.parent_id='".$v['knowledge_id']."' and kbv.status=1 order by kbv.sort asc");
		    	}
		    }		   
		
		    $view->set('knowledge_base_list',$knowledge_base_list);
			return $view->fetch('module/footer.tpl');
		}
	}
}
?>