Subversion Repositories Applications.papyrus

Rev

Rev 1688 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
493 ddelon 1
<?php
2
/**
3
* Description: demonstrates using the Wrapper decorator
4
*/
5
 
6
if (!@include 'Calendar/Calendar.php') {
7
    define('CALENDAR_ROOT', '../../');
8
}
9
require_once CALENDAR_ROOT.'Month.php';
10
require_once CALENDAR_ROOT.'Decorator.php'; // Not really needed but added to help this make sense
11
require_once CALENDAR_ROOT.'Decorator/Wrapper.php';
12
 
13
class 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
 
31
echo '<h2>The Wrapper decorator</h2>';
32
echo '<i>Day numbers are rendered in bold</i><br /> <br />';
33
while ($DecoratedDay = $Wrapper->fetch('MyBoldDecorator')) {
34
    echo $DecoratedDay->thisDay().'<br />';
35
}
36
?>