* @package Kronolith */ class Kronolith_Calendar_Holiday extends Kronolith_Calendar { /** * The Date_Holidays driver information. * * @var array */ protected $_driver; /** * Constructor. * * @param array $params A hash with any parameters that this calendar * might need. * Required parameters: * - share: The share of this calendar. */ public function __construct($params = array()) { if (!isset($params['driver'])) { throw new BadMethodCallException('driver parameter is missing'); } parent::__construct($params); } /** * Returns the name of this calendar. * * @return string This calendar's name. */ public function name() { return Horde_Nls_Translation::t($this->_driver['title']); } /** * Whether this calendar is supposed to be displayed in lists. * * @return boolean True if this calendar should be displayed. */ public function display() { return in_array($this->_driver['id'], $GLOBALS['calendar_manager']->get(Kronolith::DISPLAY_HOLIDAYS)); } /** * Returns a hash representing this calendar. * * @return array A simple hash. */ public function toHash() { $hash = parent::toHash(); $hash['show'] = $this->display(); return $hash; } }