/** @inheritdoc */ public function renderMetaBox(WP_Post $post) { OpeningHoursModule::setCurrentSetId($post->ID); $set = OpeningHoursModule::getCurrentSet(); if (count($set->getHolidays()) < 1) { $set->getHolidays()->append(Holiday::createDummyPeriod()); } $variables = array('holidays' => $set->getHolidays()); echo $this->renderTemplate(self::TEMPLATE_PATH, $variables, 'once'); }
/** Action: Render Single Dummy Holiday */ public static function renderSingleDummyHoliday() { echo self::renderTemplate(Holidays::TEMPLATE_PATH_SINGLE, array('holiday' => Holiday::createDummyPeriod()), 'once'); die; }
/** * Renders a Holiday Item for Overview table * * @param Holiday $holiday The Holiday item to show * @param array $attributes The shortcode attributes */ public static function renderHoliday(Holiday $holiday, array $attributes) { echo '<span class="op-period-time holiday ' . $attributes['span_period_classes'] . '">' . $holiday->getName() . '</span>'; }
public function testDateSetters() { $holiday = new Holiday('Test Holiday', new DateTime('2016-01-02'), new DateTime('2016-01-03')); $this->assertEquals(new DateTime('2016-01-02 00:00:00'), $holiday->getDateStart()); $this->assertEquals(new DateTime('2016-01-03 23:59:59'), $holiday->getDateEnd()); }