public function testGetDaysCaption()
 {
     $this->assertEquals('Tuesday', Weekdays::getDaysCaption(1));
     $this->assertEquals('Tue.', Weekdays::getDaysCaption(1, true));
     $this->assertEquals('Monday, Wednesday, Friday', Weekdays::getDaysCaption(array(0, 2, 4)));
     $this->assertEquals('Mon., Wed., Fri.', Weekdays::getDaysCaption(array(0, 2, 4), true));
     $this->assertEquals('Monday - Friday', Weekdays::getDaysCaption(range(0, 4)));
     $this->assertEquals('Mon. - Fri.', Weekdays::getDaysCaption(range(0, 4), true));
     $this->assertEquals('Monday, Tuesday, Wednesday, Friday', Weekdays::getDaysCaption(array(0, 1, 2, 4)));
     $this->assertEquals('Mon., Tue., Wed., Fri.', Weekdays::getDaysCaption(array(0, 1, 2, 4), true));
     $this->assertEquals('Monday - Friday', Weekdays::getDaysCaption(array(2, 0, 4, 1, 3)));
     $this->assertEquals('Monday, Wednesday, Friday', Weekdays::getDaysCaption('0,2,4'));
     $this->assertEquals('Monday - Friday', Weekdays::getDaysCaption('0,1,2,3,4'));
     $this->assertEquals('Monday, Tuesday, Wednesday, Friday', Weekdays::getDaysCaption('0,1,2,4'));
     $this->assertEquals('Monday - Friday', Weekdays::getDaysCaption('2,0,4,1,3'));
     $this->assertEquals('Monday - Friday', Weekdays::getDaysCaption(' 2 ,0    , 4 ,  1 , 3 '));
 }
Example #2
0
}
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) {
            Shortcode::renderHoliday($holiday, $attributes);
            continue;
        }