cvs: peardoc /en/package/datetime/calendar intro-decorators.xml
| From: | Lorenzo Alberton | Date: | Thu, 24 Jun 2004 09:52:24 +0000 |
| Subject: | cvs: peardoc /en/package/datetime/calendar intro-decorators.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-4483@lists.php.net to get a copy of this message | ||
quipo Thu Jun 24 05:52:24 2004 EDT
Modified files:
/peardoc/en/package/datetime/calendar intro-decorators.xml
Log:
complete bundled decorators examples
http://cvs.php.net/diff.php/peardoc/en/package/datetime/calendar/intro-decorators.xml?r1=1.7&r2=1.8&ty=u
Index: peardoc/en/package/datetime/calendar/intro-decorators.xml
diff -u peardoc/en/package/datetime/calendar/intro-decorators.xml:1.7
peardoc/en/package/datetime/calendar/intro-decorators.xml:1.8
--- peardoc/en/package/datetime/calendar/intro-decorators.xml:1.7 Wed Jun 23 18:23:15 2004
+++ peardoc/en/package/datetime/calendar/intro-decorators.xml Thu Jun 24 05:52:24 2004
@@ -1,4 +1,4 @@
-<!-- $Id: intro-decorators.xml,v 1.7 2004/06/23 22:23:15 quipo Exp $ -->
+<!-- $Id: intro-decorators.xml,v 1.8 2004/06/24 09:52:24 quipo Exp $ -->
<refentry id="package.datetime.calendar.intro-decorators">
<refnamediv>
<refname>Calendar Decorators</refname>
@@ -263,19 +263,88 @@
</refsect1>
<refsect1>
- <title>Calendar_Decorator_Uri example</title>
+ <title>Calendar_Decorator_Weekday example</title>
<para>
-
+ Methods defined by this decorator:
+ <itemizedlist>
+ <listitem>
+ <para>setFirstDay($firstDay)</para>
+ <para>
+ Sets the first day of the week (0 = Sunday, 1 = Monday [default] etc)
+ </para>
+ </listitem>
+ <listitem>
+ <para>prevWeekDay($format='int')</para>
+ <para>
+ Returns the previous weekday, formatted according the
<parameter>$format</parameter>
+ parameter (int, array, object, timestamp)
+ </para>
+ </listitem>
+ <listitem>
+ <para>thisWeekDay($format='int')</para>
+ <para>
+ Returns the current weekday, formatted according the
<parameter>$format</parameter>
+ parameter (int, array, object, timestamp)
+ </para>
+ </listitem>
+ <listitem>
+ <para>nextWeekDay($format='int')</para>
+ <para>
+ Returns the next weekday, formatted according the
<parameter>$format</parameter>
+ parameter (int, array, object, timestamp)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ Example:
+ <programlisting role="php">
+<![CDATA[
+$Day = new Calendar_Day(2003, 10, 23);
+$Weekday = & new Calendar_Decorator_Weekday($Day);
+$Weekday->setFirstDay(0); // Set first day of week to Sunday (default Mon)
+echo $Weekday->thisWeekDay(); // Displays 5 - fifth day of week relative to Sun
+]]>
+ </programlisting>
</para>
</refsect1>
<refsect1>
<title>Calendar_Decorator_Wrapper example</title>
<para>
+ <programlisting role="php">
+<![CDATA[
+require_once 'Calendar/Month.php';
+require_once 'Calendar/Decorator.php'; // Not really needed but added to help this make
sense
+require_once 'Calendar/Decorator/Wrapper.php';
+
+class MyBoldDecorator extends Calendar_Decorator
+{
+ function MyBoldDecorator(&$Calendar)
+ {
+ parent::Calendar_Decorator($Calendar);
+ }
+
+ function thisDay()
+ {
+ return '<b>'.parent::thisDay().'</b>';
+ }
+}
+
+$Month = new Calendar_Month(date('Y'), date('n'));
+$Wrapper = & new Calendar_Decorator_Wrapper($Month);
+$Wrapper->build();
+
+echo '<h2>The Wrapper decorator</h2>';
+echo '<i>Day numbers are rendered in bold</i><br /> <br />';
+while ($DecoratedDay = $Wrapper->fetch('MyBoldDecorator')) {
+ echo $DecoratedDay->thisDay().'<br />';
+}
+]]>
+ </programlisting>
</para>
</refsect1>
-
</refentry>
<!-- Keep this comment at the end of the file