<?php  
class ModuleSearch extends Controller {

	function fetch() { 	

		$config   =& $this->locator->get('config');

		$language =& $this->locator->get('language');

		$session  =& $this->locator->get('session');

		$url      =& $this->locator->get('url');

		$database =& $this->locator->get('database');	
	
		$language->load('extension/module/search.php');

		$template = $this->locator->create('template');		
		
		$template->set('text_categories', $language->get('text_categories'));
    	
      	$template->set('search', $session->get('search.search'));
      	
      	$category_1_data = array();
			
		$category_1_rows = $database->getRows("select c.category_id, cd.name from category c left join category_description cd on (c.category_id = cd.category_id) where parent_id = 0 and c.status = 1 order by c.sort_order");				
		
		foreach ($category_1_rows as $k=>$category_1_row) 
		{ 
			$category_1_data[] = array(
						    'id'=>$category_1_row['category_id'],
							'name'  => $category_1_row['name']
						);
		}
      	$template->set('categories', $category_1_data);	    		
		return $template->fetch('module/search.tpl');	
  	}

}

?>

