Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
493 ddelon 1
<?php
2
/**
3
* Description: demonstrates using the Uri util
4
*/
5
if (!@include 'Calendar/Calendar.php') {
6
    define('CALENDAR_ROOT', '../../');
7
}
8
require_once CALENDAR_ROOT.'Month/Weekdays.php';
9
require_once CALENDAR_ROOT.'Util/Uri.php';
10
 
11
if (!isset($_GET['jahr'])) $_GET['jahr'] = date('Y');
12
if (!isset($_GET['monat'])) $_GET['monat'] = date('m');
13
 
14
// Build the month
15
$Calendar = new Calendar_Month_Weekdays($_GET['jahr'], $_GET['monat']);
16
 
17
echo ( '<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
 
23
echo "\"Vector\" URIs<pre>";
24
echo ( "Previous Uri:\t".htmlentities($Uri->prev($Calendar, 'month'))."\n" );
25
echo ( "This Uri:\t".htmlentities($Uri->this($Calendar,  'month'))."\n" );
26
echo ( "Next Uri:\t".htmlentities($Uri->next($Calendar, 'month'))."\n" );
27
echo "</pre>";
28
 
29
// Switch to scalar URIs
30
$Uri->separator = '/'; // Default is &amp;
31
$Uri->scalar = true; // Omit variable names
32
 
33
echo "\"Scalar\" URIs<pre>";
34
echo ( "Previous Uri:\t".$Uri->prev($Calendar, 'month')."\n" );
35
echo ( "This Uri:\t".$Uri->this($Calendar,  'month')."\n" );
36
echo ( "Next Uri:\t".$Uri->next($Calendar, 'month')."\n" );
37
echo "</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>