source: branches/comu-ver2/data/module/Calendar/docs/examples/18.phps @ 17073

Revision 17073, 915 bytes checked in by Yammy, 16 years ago (diff)

カレンダーブロックを追加(PEAR::Calendarクラス使用仕様)

Line 
1<?php
2/**
3* Description: demonstrates using the Wrapper decorator
4*/
5
6if (!@include 'Calendar/Calendar.php') {
7    define('CALENDAR_ROOT', '../../');
8}
9require_once CALENDAR_ROOT.'Month.php';
10require_once CALENDAR_ROOT.'Decorator.php'; // Not really needed but added to help this make sense
11require_once CALENDAR_ROOT.'Decorator/Wrapper.php';
12
13class MyBoldDecorator extends Calendar_Decorator
14{
15    function MyBoldDecorator(&$Calendar)
16    {
17        parent::Calendar_Decorator($Calendar);
18    }
19
20    function thisDay()
21    {
22        return '<b>'.parent::thisDay().'</b>';
23    }
24}
25
26$Month = new Calendar_Month(date('Y'), date('n'));
27
28$Wrapper = & new Calendar_Decorator_Wrapper($Month);
29$Wrapper->build();
30
31echo '<h2>The Wrapper decorator</h2>';
32echo '<i>Day numbers are rendered in bold</i><br /> <br />';
33while ($DecoratedDay = $Wrapper->fetch('MyBoldDecorator')) {
34    echo $DecoratedDay->thisDay().'<br />';
35}
36?>
Note: See TracBrowser for help on using the repository browser.