Calendar
[ class tree: Calendar ] [ index: Calendar ] [ all elements ]

Source for file 15.php

Documentation is available at 15.php

  1. <?php
  2. /**
  3. * Shows more on how a week can be used
  4. */
  5. function getmicrotime() {
  6.     list($usec, $sec) = explode(" ", microtime());
  7.     return ((float)$usec + (float)$sec);
  8. }
  9. $start = getmicrotime();
  10.  
  11. if (!@include 'Calendar/Calendar.php') {
  12.     define('CALENDAR_ROOT', '../../');
  13. }
  14. require_once CALENDAR_ROOT.'Week.php';
  15.  
  16. if (!isset($_GET['y'])) $_GET['y'] = date('Y');
  17. if (!isset($_GET['m'])) $_GET['m'] = date('m');
  18. if (!isset($_GET['d'])) $_GET['d'] = 1;
  19.  
  20. // Build the month
  21. $Week = new Calendar_Week($_GET['y'], $_GET['m'], $_GET['d']);
  22. /*
  23. $Validator = $Week->getValidator();
  24. if (!$Validator->isValidWeek()) {
  25.     die ('Please enter a valid week!');
  26. }
  27. */
  28. ?>
  29. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  30. <html>
  31. <head>
  32. <title> Paging Weeks </title>
  33. </head>
  34. <body>
  35. <h1>Paging Weeks</h1>
  36. <h2>Week: <?php echo $Week->thisWeek().' '.date('F Y',$Week->thisMonth(true)); ?></h2>
  37. <?php
  38. $Week->build();
  39. while ($Day = $Week->fetch()) {
  40.     echo '<p>'.date('jS F',$Day->thisDay(true))."</p>\n";
  41. }
  42. $days = $Week->fetchAll();
  43.  
  44. $prevWeek = $Week->prevWeek('array');
  45. $prevWeekLink = $_SERVER['PHP_SELF'].
  46.                     '?y='.$prevWeek['year'].
  47.                     '&m='.$prevWeek['month'].
  48.                     '&d='.$prevWeek['day'];
  49.  
  50. $nextWeek = $Week->nextWeek('array');
  51. $nextWeekLink = $_SERVER['PHP_SELF'].
  52.                     '?y='.$nextWeek['year'].
  53.                     '&m='.$nextWeek['month'].
  54.                     '&d='.$nextWeek['day'];
  55. ?>
  56. <p><a href="<?php echo $prevWeekLink; ?>"><<</a> | <a href="<?php echo $nextWeekLink; ?>">>></a></p>
  57. </body>
  58. </html>

Documentation generated on Mon, 11 Mar 2019 15:37:47 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.