/** @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'); }
/** @inheritdoc */ public function renderMetaBox(WP_Post $post) { OpeningHoursModule::setCurrentSetId($post->ID); $set = OpeningHoursModule::getCurrentSet(); if (count($set->getIrregularOpenings()) < 1) { $set->getIrregularOpenings()->append(IrregularOpening::createDummy()); } $variables = array('irregular_openings' => $set->getIrregularOpenings()); echo self::renderTemplate(static::TEMPLATE_PATH, $variables, 'once'); }
/** @inheritdoc */ public function renderMetaBox(WP_Post $post) { if (!OpeningHoursModule::getSets()->offsetExists($post->ID)) { OpeningHoursModule::getSets()->offsetSet($post->ID, new SetEntity($post->ID)); } OpeningHoursModule::setCurrentSetId($post->ID); $set = OpeningHoursModule::getCurrentSet(); $set->addDummyPeriods(); $variables = array('post' => $post, 'set' => $set); echo static::renderTemplate(static::TEMPLATE_PATH, $variables, 'once'); }
* @var $row_classes string w/ classes for row * @var $cell_classes string w/ classes for all table cells * * @var $highlighted_day_class string w/ class for highlighted day * @var $highlighted_period_class string w/ class for highlighted period * @var $cell_heading_classes string w/ classes for heading cells * @var $cell_periods_classes string w/ classes for cells containing periods * @var $cell_description_classes string w/ classes for description cell * @var $span_period_classes string w/ classes for period time span * @var $time_format string w/ PHP time format to format start and end time of a period with */ echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } OpeningHours::setCurrentSetId($set->getId()); echo '<table class="op-table op-table-overview ' . $table_classes . '" id="' . $table_id_prefix . $set->getId() . '">'; if ($show_description and $set->getDescription()) { echo '<tr class="op-row op-row-description">'; echo '<td class="op-cell ' . $cell_classes . ' ' . $cell_description_classes . '" colspan="2">'; echo $set->getDescription(); echo '</td>'; echo '</tr>'; } $periods = $compress ? $set->getPeriodsGroupedByDayCompressed() : $set->getPeriodsGroupedByDay(); foreach ($periods as $day => $d_periods) { $highlighted_day = ($highlight == 'day' and Dates::isToday($day)) ? $highlighted_day_class : null; echo '<tr class="op-row op-row-day ' . $row_classes . ' ' . $highlighted_day . '">'; echo '<th scope="row" class="op-cell op-cell-heading ' . $cell_heading_classes . ' ' . $cell_classes . '">'; echo Weekdays::getDaysCaption($day, $short); echo '</th>';