Пример #1
0
 function testOrderedWeekdaysShort()
 {
     $weekdayNames = array(0 => 'Sun', 1 => 'Mon', 2 => 'Tue', 3 => 'Wed', 4 => 'Thu', 5 => 'Fri', 6 => 'Sat');
     $nShifts = CALENDAR_FIRST_DAY_OF_WEEK;
     while ($nShifts-- > 0) {
         $day = array_shift($weekdayNames);
         array_push($weekdayNames, $day);
     }
     $this->assertEqual($weekdayNames, Calendar_Util_Textual::orderedWeekdays($this->mockcal, 'short'));
 }
Пример #2
0
echo 'Next month is: ' . Calendar_Util_Textual::nextMonthName($Calendar) . '<br /><hr />';
echo 'Previous day is: ' . Calendar_Util_Textual::prevDayName($Calendar) . '<br />';
echo 'This day is: ' . Calendar_Util_Textual::thisDayName($Calendar, 'short') . '<br />';
echo 'Next day is: ' . Calendar_Util_Textual::nextDayName($Calendar, 'one') . '<br /><hr />';
echo "Creating: new Calendar_Month_Weekdays(date('Y'), date('n'), 6); - Saturday is first day of week<br />";
$Calendar = new Calendar_Month_Weekdays(date('Y'), date('n'), 6);
?>
<p>Rendering calendar....</p>
<table>
<caption><?php 
echo Calendar_Util_Textual::thisMonthName($Calendar) . ' ' . $Calendar->thisYear();
?>
</caption>
<tr>
<?php 
$dayheaders = Calendar_Util_Textual::orderedWeekdays($Calendar, 'short');
foreach ($dayheaders as $dayheader) {
    echo '<th>' . $dayheader . '</th>';
}
?>
</tr>
<?php 
$Calendar->build();
while ($Day = $Calendar->fetch()) {
    if ($Day->isFirst()) {
        echo "<tr>\n";
    }
    if ($Day->isEmpty()) {
        echo '<td>&nbsp;</td>';
    } else {
        echo '<td>' . $Day->thisDay() . '</td>';
Пример #3
0
 /**
  * Returns the days of the week using the order defined in the decorated
  * calendar object. Only useful for Calendar_Month_Weekdays, Calendar_Month_Weeks
  * and Calendar_Week. Otherwise the returned array will begin on Sunday
  * @param string (optional) format of returned months (one,two,short or long)
  * @return array ordered array of week day names
  * @access public
  */
 function orderedWeekdays($format = 'long')
 {
     return Calendar_Util_Textual::orderedWeekdays($this->calendar, $format);
 }
Пример #4
0
 function testOrderedWeekdaysShort()
 {
     $weekdayNames = array(0 => 'Sun', 1 => 'Mon', 2 => 'Tue', 3 => 'Wed', 4 => 'Thu', 5 => 'Fri', 6 => 'Sat');
     $this->assertEqual($weekdayNames, Calendar_Util_Textual::orderedWeekdays($this->mockcal, 'short'));
 }