| // | Lorenzo Alberton | // +----------------------------------------------------------------------+ // // $Id$ // /** * @package Calendar * @version $Id$ */ /** * Allows Calendar include path to be redefined * @ignore */ if (!defined('CALENDAR_ROOT')) { define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR); } /** * Load Calendar decorator base class */ require_once CALENDAR_ROOT.'Decorator.php'; /** * Decorator to help with wrapping built children in another decorator * @package Calendar * @access public */ class Calendar_Decorator_Wrapper extends Calendar_Decorator { /** * Constructs Calendar_Decorator_Wrapper * @param object subclass of Calendar * @access public */ function Calendar_Decorator_Wrapper(&$Calendar) { parent::Calendar_Decorator($Calendar); } /** * Wraps objects returned from fetch in the named Decorator class * @param string name of Decorator class to wrap with * @return object instance of named decorator * @access public */ function & fetch($decorator) { $Calendar = parent::fetch(); if ($Calendar) { $ret =& new $decorator($Calendar); } else { $ret = false; } return $ret; } /** * Wraps the returned calendar objects from fetchAll in the named decorator * @param string name of Decorator class to wrap with * @return array * @access public */ function fetchAll($decorator) { $children = parent::fetchAll(); foreach ($children as $key => $Calendar) { $children[$key] = & new $decorator($Calendar); } return $children; } } ?>