<?php 
class Templates_Controller extends Public_Controller{
	
	function __construct(){
		parent::__construct();
	}
	
	function index($inputid=false,$targPath='skins'){
		//$targPath				=	"modules/model/views/templates";
		$paths					=	file::scan_dir($targPath,array("php","html","htm"));
		$this->view				=	new View("templates/index");
		$this->view->targPath	=	$targPath;
		$this->view->paths		=	$paths;
		$this->view->inputid	=	$inputid;
		$this->view->render(true);
	}
	
	function select($inputid,$targPath=false){
		if(!$targPath){
			$targPath			=	'skins';
		}
		else{
			$targPath			=	base64_decode($targPath);
		}
		$paths					=	file::scan_dir($targPath,true,array("php","html","htm"));
		foreach($paths as $path){
			$path['template_path']		=	$path['path'];
			$_paths[]			=	$path;
		}
		$this->view				=	new View("templates/select");
		$this->view->inputid	=	$inputid;
		$this->view->targPath	=	$targPath;
		$this->view->paths		=	$_paths;
		$this->view->render(true);
	}
}