<?php

if (!defined('XOOPS_ROOT_PATH')) exit();

require_once XOOPS_MODULE_PATH . "/legacyRender/admin/class/AbstractListAction.class.php";
require_once XOOPS_MODULE_PATH . "/legacyRender/admin/forms/TplfileFilterForm.class.php";

class LegacyRender_TplfileListAction extends LegacyRender_AbstractListAction
{
	function &_getHandler()
	{
		$handler =& xoops_getmodulehandler('tplfile');
		return $handler;
	}

	function &_getFilterForm()
	{
		$filter =& new LegacyRender_TplfileFilterForm($this->mPageNavi);
		return $filter;
	}
	
	function _getBaseUrl()
	{
		return "./index.php?action=TplfileList";
	}

	function executeViewIndex(&$controller, &$xoopsUser, &$render)
	{
		$render->setTemplateName("tplfile_list.html");
		$render->setAttribute('objects', $this->mObjects);
		$render->setAttribute('pageNavi', $this->mPageNavi);
		$render->setAttribute('filterForm', $this->mFilter);
		
		//
		// TODO We must fetch only module objects that has templates.
		// 
		// fetch module objects, assign to template for pull-down menu.
		//
		$moduleHandler =& xoops_gethandler('module');
		$modules =& $moduleHandler->getObjects();
		$render->setAttribute('modules', $modules);

		$handler =& xoops_getmodulehandler('tplset');
		$tplsets =& $handler->getObjects();
		$render->setAttribute('tplsets', $tplsets);
	}
}

?>
