source: branches/version-2_5-dev/data/module/Calendar/docs/examples/22.phps @ 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
Line 
1<?php
2/**
3* Description: demonstrates using the Uri util
4*/
5if (!@include 'Calendar/Calendar.php') {
6    define('CALENDAR_ROOT', '../../');
7}
8require_once CALENDAR_ROOT.'Month/Weekdays.php';
9require_once CALENDAR_ROOT.'Util/Uri.php';
10
11if (!isset($_GET['jahr'])) $_GET['jahr'] = date('Y');
12if (!isset($_GET['monat'])) $_GET['monat'] = date('m');
13
14// Build the month
15$Calendar = new Calendar_Month_Weekdays($_GET['jahr'], $_GET['monat']);
16
17echo ( '<p>The current month is '
18        .$Calendar->thisMonth().' of year '.$Calendar->thisYear().'</p>');
19
20$Uri = & new Calendar_Util_Uri('jahr','monat');
21$Uri->setFragments('jahr','monat');
22
23echo "\"Vector\" URIs<pre>";
24echo ( "Previous Uri:\t".htmlentities($Uri->prev($Calendar, 'month'))."\n" );
25echo ( "This Uri:\t".htmlentities($Uri->this($Calendar,  'month'))."\n" );
26echo ( "Next Uri:\t".htmlentities($Uri->next($Calendar, 'month'))."\n" );
27echo "</pre>";
28
29// Switch to scalar URIs
30$Uri->separator = '/'; // Default is &amp;
31$Uri->scalar = true; // Omit variable names
32
33echo "\"Scalar\" URIs<pre>";
34echo ( "Previous Uri:\t".$Uri->prev($Calendar, 'month')."\n" );
35echo ( "This Uri:\t".$Uri->this($Calendar,  'month')."\n" );
36echo ( "Next Uri:\t".$Uri->next($Calendar, 'month')."\n" );
37echo "</pre>";
38
39// Restore the vector URIs
40$Uri->separator = '&amp;';
41$Uri->scalar = false;
42?>
43<p>
44<a href="<?php echo($_SERVER['PHP_SELF'].'?'.$Uri->prev($Calendar, 'month'));?>">Prev</a> :
45<a href="<?php echo($_SERVER['PHP_SELF'].'?'.$Uri->next($Calendar, 'month'));?>">Next</a>
46</p>
Note: See TracBrowser for help on using the repository browser.