* @author gERD Schaufelberger */ /** * patTemplate function Holiday * * @version 0.2.0 * @package Wombat * @subpackage patTemplate */ class patTemplate_Function_Holiday extends patTemplate_Function { /** * Function Type * @var integer */ public $_type = PATTEMPLATE_FUNCTION_RUNTIME; /** * Configuration * @var array */ private $config = array( 'inverse' => 0 ); /** * @var WBDatasource_Holiday */ private $holiday; /** * constructor * */ public function __construct() { $this->holiday = WBClass::create('WBDatasource_Holiday'); } /** * Call the Function * * @param array parameters of the function (= attributes of the tag) * @param string content of the tag * @return string content to insert into the template */ public function call($params, $content) { // nothing to do if (empty($content)) { return ''; } $params = array_merge($this->config, $params); $res = $this->holiday->isHoliday(); if (0 < $params['inverse']) { $res = !$res; } if ($res) { return $content; } return ''; } }