Esempio n. 1
0
 public function testIsToday()
 {
     $now = new DateTime('now');
     $today = (int) $now->format('N') - 1;
     $this->assertTrue(Dates::isToday($today));
     $this->assertFalse(Dates::isToday($today + 1));
 }
Esempio n. 2
0
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>';
    echo '<td class="op-cell op-cell-periods ' . $cell_periods_classes . ' ' . $cell_classes . '">';
    if ($include_io) {
        $io = $set->getActiveIrregularOpeningOnWeekday($day);
        if ($io instanceof IrregularOpening) {
            Shortcode::renderIrregularOpening($io, $attributes);
            continue;
        }
    }
    if ($include_holidays) {
        $holiday = $set->getActiveHolidayOnWeekday($day);
        if ($holiday instanceof Holiday) {