cvs: pear /Calendar/docs/examples 21.php index.html

From: Date: Sat, 10 Jul 2004 11:51:42 +0000
Subject: cvs: pear /Calendar/docs/examples 21.php index.html
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-21709@lists.php.net to get a copy of this message
quipo Sat Jul 10 07:51:42 2004 EDT Added files: /pear/Calendar/docs/examples 21.php Modified files: /pear/Calendar/docs/examples index.html Log: New example (similar to #12) based on Calendar_Month_Weeks instead of Calendar_Month_Weekdays http://cvs.php.net/diff.php/pear/Calendar/docs/examples/index.html?r1=1.2&r2=1.3&ty=u Index: pear/Calendar/docs/examples/index.html diff -u pear/Calendar/docs/examples/index.html:1.2 pear/Calendar/docs/examples/index.html:1.3 --- pear/Calendar/docs/examples/index.html:1.2 Wed Jun 2 13:14:16 2004 +++ pear/Calendar/docs/examples/index.html Sat Jul 10 07:51:41 2004 @@ -19,7 +19,7 @@ <body> <h1>PEAR::Calendar Examples</h1> -<p>$Id: index.html,v 1.2 2004/06/02 17:14:16 quipo Exp $</p> +<p>$Id: index.html,v 1.3 2004/07/10 11:51:41 quipo Exp $</p> <ul> <li><a href="1.php">1.php</a> [<a href="1.phps">src</a>] - shows basic usage, passing all the way down from <code>Calendar_Year</code> to <code>Calendar_Second</code> - more of a quick test it's working</li> <li><a href="2.php">2.php</a> [<a href="2.phps">src</a>] - shows how to build a tabular month using <code>Calendar_Month_Weeks</code>, <code>Calendar_Week</code>, <code>Calendar_Day</code> as well as selecting some dates.</li> @@ -41,6 +41,7 @@ <li><a href="18.php">18.php</a> [<a href="18.phps">src</a>] - demonstrates using the Wrapper decorator</li> <li><a href="19.php">19.php</a> [<a href="19.phps">src</a>] - demonstrates using the Weekday decorator</li> <li><a href="20.php">20.php</a> [<a href="20.phps">src</a>] - shows how to attach a "payload" spanning multiple days, with more than one entry per day</li> +<li><a href="21.php">21.php</a> [<a href="21.phps">src</a>] - same as 12.php but using <code>Calendar_Month_Weeks</code> instead of <code>Calendar_Month_Weekdays</code>.</li> </ul> </body> </html> http://cvs.php.net/co.php/pear/Calendar/docs/examples/21.php?r=1.1&p=1 Index: pear/Calendar/docs/examples/21.php +++ pear/Calendar/docs/examples/21.php <?php /** * Description: a complete year */ function getmicrotime(){ list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); } $start = getmicrotime(); if (!@include 'Calendar/Calendar.php') { define('CALENDAR_ROOT', '../../'); } require_once CALENDAR_ROOT.'Year.php'; require_once CALENDAR_ROOT.'Month/Weeks.php'; define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKS); if (!isset($_GET['year'])) $_GET['year'] = date('Y'); $Year = new Calendar_Year($_GET['year']); $Year->build(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title> <?php echo $Year->thisYear(); ?> </title> <style type="text/css"> body { font-family: Georgia, serif; } caption.year { font-weight: bold; font-size: 120%; font-color: navy; } caption.month { font-size: 110%; font-color: navy; } table.month { border: thin groove #800080 } tr { vertical-align: top; } th, td { text-align: right; font-size: 70%; } #prev { float: left; font-size: 70%; } #next { float: right; font-size: 70%; } weekNumbers { background-color: #e5e5f5; padding-right: 3pt; } </style> </head> <body> <table> <caption class="year"> <?php echo $Year->thisYear(); ?> <div id="next"> <a href="?year=<?php echo $Year->nextYear(); ?>">>></a> </div> <div id="prev"> <a href="?year=<?php echo $Year->prevYear(); ?>"><<</a> </div> </caption> <?php $i = 0; while ($Month = $Year->fetch()) { switch ($i) { case 0: echo "<tr>\n"; break; case 3: case 6: case 9: echo "</tr>\n<tr>\n"; break; case 12: echo "</tr>\n"; break; } echo "<td>\n<table class=\"month\">\n"; echo '<caption class="month">'.date('F', $Month->thisMonth(TRUE)).'</caption>'; echo '<colgroup><col class="weekNumbers"><col span="7"></colgroup>'."\n"; echo "<tr>\n<th>Week</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th><th>S</th>\n</tr>"; $Month->build(); while ($Week = $Month->fetch()) { echo "<tr>\n"; echo '<td>'.$Week->thisWeek('n_in_year')."</td>\n"; $Week->build(); while ($Day = $Week->fetch()) { if ($Day->isEmpty()) { echo "<td>&nbsp;</td>\n"; } else { echo "<td>".$Day->thisDay()."</td>\n"; } } } echo "</table>\n</td>\n"; $i++; } ?> </table> <p>Took: <?php echo ((getmicrotime()-$start)); ?></p> </body> </html>

« previous php.pear.cvs (#21709) next »