<?php
/**
 * @package legacyRender
 * @version $Id: ThemeSelect.class.php,v 1.1.2.2 2006/08/02 09:45:02 minahito Exp $
 */

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

class legacyRender_ThemeSelect extends XCube_ActionFilter
{
    function legacyRender_ThemeSelect(&$controller)
    {
		parent::XCube_ActionFilter($controller);
		$controller->mRoot->mDelegateManager->add('Base_ThemeSelect.IsSelectableTheme', 'legacyRender_ThemeSelect::isSelectableTheme');
		$controller->mRoot->mDelegateManager->add('BaseThemeHandler.GetInstalledThemes', 'LegacyRender_DelegateFunctions::getInstalledThemes', XOOPS_ROOT_PATH . "/modules/legacyRender/kernel/DelegateFunctions.class.php");
    }
    
    function isSelectableTheme(&$flag, $theme_name)
	{
		$handler =& xoops_getmodulehandler('theme', 'legacyRender');
		$themeArr =& $handler->getObjects(new Criteria('name', $theme_name));
		
		if (count($themeArr) == 1 && $themeArr[0]->get('enable_select')) {
			$flag = true;
		}
    }
}

?>
