source: branches/version-2_5-dev/data/module/Calendar/docs/examples/15.php @ 20116

Revision 20116, 1.5 KB checked in by nanasess, 13 years ago (diff)
  • svn properties を再設定
  • 再設定用のスクリプト追加
  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2/**
3* Shows more on how a week can be used
4*/
5function getmicrotime() {
6    list($usec, $sec) = explode(" ", microtime());
7    return ((float)$usec + (float)$sec);
8}
9$start = getmicrotime();
10
11if (!@include 'Calendar/Calendar.php') {
12    define('CALENDAR_ROOT', '../../');
13}
14require_once CALENDAR_ROOT.'Week.php';
15
16if (!isset($_GET['y'])) $_GET['y'] = date('Y');
17if (!isset($_GET['m'])) $_GET['m'] = date('m');
18if (!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();
24if (!$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();
39while ($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>
Note: See TracBrowser for help on using the repository browser.