<?php
/**
 * @package legacyRender
 * @version $Id: ThemeSelect.class.php,v 1.1.2.2.2.1 2006/10/14 16:46:38 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('Legacy_ThemeSelect.IsSelectableTheme', 'legacyRender_ThemeSelect::isSelectableTheme');
		$controller->mRoot->mDelegateManager->add('LegacyThemeHandler.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;
		}
    }
}

?>
