<?php
/**
* @author:  Bunzia Alexander <nifus@mail.ru> <http://www.weblancer.net/users/nifus/>
* @copyright: Copyright (c) 2010, Bunzia Alexander
* @version: 1.0
* @license: http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @package HiLo CMS
*/


class autocatalog_view{
	static $error = false;
	static $act = 'index';
	static $table = 'menu';
	static $tmpl_path = false;
	static $m_path = false;
	static $m_url = false;

	 function __construct(){

	}
	
	static function get(){
		global $MAIN_PAGE;
		//self::$tmpl_path = MAIN_PATH.'/tmp/view/project/controls/'.$MAIN_PAGE -> dirname();
		self::$m_path = MAIN_SOURCE_PATH.'/modules/'.$MAIN_PAGE -> dirname();
		self::$m_url = MAIN_SOURCE_URL.'/modules/'.$MAIN_PAGE -> dirname();
	

		
		include_once(self::$m_path.'/inc/url.php');
		include_once(self::$m_path.'/inc/class.autocatalog.php');

		include_once(MAIN_SOURCE_PATH.'/inc/class.html.php');
		self::$act = !empty($_REQUEST['act']) ? $_REQUEST['act'] : self::$act;
		

		if ( false===is_callable('self::'.self::$act, false)){
			sys_error(ERROR_404);
		}
		$func = self::$act;
		return self::$func();
	}
	
	

	static function index(){
		$p =  autoCatalog::query('f');
		//$p -> set_debug(1);
		$p -> orderby_sort('ASC');
		$p -> where_alias($_GET['alias']);
		$p -> get('*, images as imagesArray',false);
	
		$t = new PHPTAL( self::$m_path.'/tmpl/view/main.html' );
		$t -> row = $p -> row();

		return $t -> execute();
	}
	
	

	
	


}

