3 * Description: demonstrates using the Textual decorator
6 if (!@include 'Calendar'.DIRECTORY_SEPARATOR.'Calendar.php') {
7 define('CALENDAR_ROOT', '../../');
9 require_once CALENDAR_ROOT.'Day.php';
10 require_once CALENDAR_ROOT.'Month'.DIRECTORY_SEPARATOR.'Weekdays.php';
11 require_once CALENDAR_ROOT.'Decorator'.DIRECTORY_SEPARATOR.'Textual.php';
13 // Could change language like this
14 // setlocale (LC_TIME, "de_DE"); // Unix based (probably)
15 // setlocale (LC_TIME, "ge"); // Windows
17 echo "<hr>Calling: Calendar_Decorator_Textual::monthNames('long');<pre>";
18 print_r(Calendar_Decorator_Textual::monthNames('long'));
21 echo "<hr>Calling: Calendar_Decorator_Textual::weekdayNames('two');<pre>";
22 print_r(Calendar_Decorator_Textual::weekdayNames('two'));
25 echo "<hr>Creating: new Calendar_Day(date('Y'), date('n'), date('d'));<br />";
26 $Calendar = new Calendar_Day(date('Y'), date('n'), date('d'));
29 $Textual = & new Calendar_Decorator_Textual($Calendar);
31 echo '<hr>Previous month is: '.$Textual->prevMonthName('two').'<br />';
32 echo 'This month is: '.$Textual->thisMonthName('short').'<br />';
33 echo 'Next month is: '.$Textual->nextMonthName().'<br /><hr />';
34 echo 'Previous day is: '.$Textual->prevDayName().'<br />';
35 echo 'This day is: '.$Textual->thisDayName('short').'<br />';
36 echo 'Next day is: '.$Textual->nextDayName('one').'<br /><hr />';
38 echo "Creating: new Calendar_Month_Weekdays(date('Y'), date('n'), 6); - Saturday is first day of week<br />";
39 $Calendar = new Calendar_Month_Weekdays(date('Y'), date('n'), 6);
42 $Textual = & new Calendar_Decorator_Textual($Calendar);
44 <p>Rendering calendar....</p>
46 <caption><?php echo $Textual->thisMonthName().' '.$Textual->thisYear(); ?></caption>
49 $dayheaders = $Textual->orderedWeekdays('short');
50 foreach ($dayheaders as $dayheader) {
51 echo '<th>'.$dayheader.'</th>';
57 while ($Day = $Calendar->fetch()) {
58 if ($Day->isFirst()) {
61 if ($Day->isEmpty()) {
62 echo '<td> </td>';
64 echo '<td>'.$Day->thisDay().'</td>';