@@ -6,9 +6,9 @@ discard block |
||
6 | 6 | if (!@include 'Calendar/Calendar.php') { |
7 | 7 | define('CALENDAR_ROOT', '../../'); |
8 | 8 | } |
9 | -require_once CALENDAR_ROOT.'Day.php'; |
|
10 | -require_once CALENDAR_ROOT.'Month/Weekdays.php'; |
|
11 | -require_once CALENDAR_ROOT.'Util/Textual.php'; |
|
9 | +require_once CALENDAR_ROOT . 'Day.php'; |
|
10 | +require_once CALENDAR_ROOT . 'Month/Weekdays.php'; |
|
11 | +require_once CALENDAR_ROOT . 'Util/Textual.php'; |
|
12 | 12 | |
13 | 13 | // Could change language like this |
14 | 14 | // setlocale (LC_TIME, "de_DE"); // Unix based (probably) |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | echo "<hr>Creating: new Calendar_Day(date('Y'), date('n'), date('d'));<br />"; |
26 | 26 | $Calendar = new Calendar_Day(date('Y'), date('n'), date('d')); |
27 | 27 | |
28 | -echo '<hr>Previous month is: '.Calendar_Util_Textual::prevMonthName($Calendar,'two').'<br />'; |
|
29 | -echo 'This month is: '.Calendar_Util_Textual::thisMonthName($Calendar,'short').'<br />'; |
|
30 | -echo 'Next month is: '.Calendar_Util_Textual::nextMonthName($Calendar).'<br /><hr />'; |
|
31 | -echo 'Previous day is: '.Calendar_Util_Textual::prevDayName($Calendar).'<br />'; |
|
32 | -echo 'This day is: '.Calendar_Util_Textual::thisDayName($Calendar,'short').'<br />'; |
|
33 | -echo 'Next day is: '.Calendar_Util_Textual::nextDayName($Calendar,'one').'<br /><hr />'; |
|
28 | +echo '<hr>Previous month is: ' . Calendar_Util_Textual::prevMonthName($Calendar, 'two') . '<br />'; |
|
29 | +echo 'This month is: ' . Calendar_Util_Textual::thisMonthName($Calendar, 'short') . '<br />'; |
|
30 | +echo 'Next month is: ' . Calendar_Util_Textual::nextMonthName($Calendar) . '<br /><hr />'; |
|
31 | +echo 'Previous day is: ' . Calendar_Util_Textual::prevDayName($Calendar) . '<br />'; |
|
32 | +echo 'This day is: ' . Calendar_Util_Textual::thisDayName($Calendar, 'short') . '<br />'; |
|
33 | +echo 'Next day is: ' . Calendar_Util_Textual::nextDayName($Calendar, 'one') . '<br /><hr />'; |
|
34 | 34 | |
35 | 35 | echo "Creating: new Calendar_Month_Weekdays(date('Y'), date('n'), 6); - Saturday is first day of week<br />"; |
36 | 36 | $Calendar = new Calendar_Month_Weekdays(date('Y'), date('n'), 6); |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | ?> |
39 | 39 | <p>Rendering calendar....</p> |
40 | 40 | <table> |
41 | -<caption><?php echo Calendar_Util_Textual::thisMonthName($Calendar).' '.$Calendar->thisYear(); ?></caption> |
|
41 | +<caption><?php echo Calendar_Util_Textual::thisMonthName($Calendar) . ' ' . $Calendar->thisYear(); ?></caption> |
|
42 | 42 | <tr> |
43 | 43 | <?php |
44 | -$dayheaders = Calendar_Util_Textual::orderedWeekdays($Calendar,'short'); |
|
44 | +$dayheaders = Calendar_Util_Textual::orderedWeekdays($Calendar, 'short'); |
|
45 | 45 | foreach ($dayheaders as $dayheader) { |
46 | - echo '<th>'.$dayheader.'</th>'; |
|
46 | + echo '<th>' . $dayheader . '</th>'; |
|
47 | 47 | } |
48 | 48 | ?> |
49 | 49 | </tr> |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | if ($Day->isEmpty()) { |
57 | 57 | echo '<td> </td>'; |
58 | 58 | } else { |
59 | - echo '<td>'.$Day->thisDay().'</td>'; |
|
59 | + echo '<td>' . $Day->thisDay() . '</td>'; |
|
60 | 60 | } |
61 | 61 | if ($Day->isLast()) { |
62 | 62 | echo "</tr>\n"; |
@@ -4,21 +4,21 @@ discard block |
||
4 | 4 | */ |
5 | 5 | function getmicrotime() |
6 | 6 | { |
7 | - list($usec, $sec) = explode(" ",microtime()); |
|
7 | + list($usec, $sec) = explode(" ", microtime()); |
|
8 | 8 | |
9 | 9 | return ((float) $usec + (float) $sec); |
10 | 10 | } |
11 | 11 | $start = getmicrotime(); |
12 | 12 | |
13 | 13 | if (!@include 'Calendar/Calendar.php') { |
14 | - define('CALENDAR_ROOT','../../'); |
|
14 | + define('CALENDAR_ROOT', '../../'); |
|
15 | 15 | } |
16 | 16 | |
17 | -require_once CALENDAR_ROOT.'Year.php'; |
|
17 | +require_once CALENDAR_ROOT . 'Year.php'; |
|
18 | 18 | |
19 | -define('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKDAYS); |
|
19 | +define('CALENDAR_MONTH_STATE', CALENDAR_USE_MONTH_WEEKDAYS); |
|
20 | 20 | |
21 | -if ( !isset($_GET['year']) ) $_GET['year'] = date('Y'); |
|
21 | +if (!isset($_GET['year'])) $_GET['year'] = date('Y'); |
|
22 | 22 | |
23 | 23 | $Year = new Calendar_Year($_GET['year']); |
24 | 24 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
28 | 28 | <html> |
29 | 29 | <head> |
30 | -<title> <?php echo ( $Year->thisYear() ); ?> </title> |
|
30 | +<title> <?php echo ($Year->thisYear()); ?> </title> |
|
31 | 31 | <style type="text/css"> |
32 | 32 | body { |
33 | 33 | font-family: Georgia, serif; |
@@ -64,55 +64,55 @@ discard block |
||
64 | 64 | <body> |
65 | 65 | <table> |
66 | 66 | <caption class="year"> |
67 | -<?php echo ( $Year->thisYear() ); ?> |
|
67 | +<?php echo ($Year->thisYear()); ?> |
|
68 | 68 | <div id="next"> |
69 | -<a href="?year=<?php echo ( $Year->nextYear() ); ?>">>></a> |
|
69 | +<a href="?year=<?php echo ($Year->nextYear()); ?>">>></a> |
|
70 | 70 | </div> |
71 | 71 | <div id="prev"> |
72 | -<a href="?year=<?php echo ( $Year->prevYear() ); ?>"><<</a> |
|
72 | +<a href="?year=<?php echo ($Year->prevYear()); ?>"><<</a> |
|
73 | 73 | </div> |
74 | 74 | </caption> |
75 | 75 | <?php |
76 | 76 | $i = 0; |
77 | -while ( $Month = $Year->fetch() ) { |
|
77 | +while ($Month = $Year->fetch()) { |
|
78 | 78 | |
79 | 79 | switch ($i) { |
80 | 80 | case 0: |
81 | - echo ( "<tr>\n" ); |
|
81 | + echo ("<tr>\n"); |
|
82 | 82 | break; |
83 | 83 | case 3: |
84 | 84 | case 6: |
85 | 85 | case 9: |
86 | - echo ( "</tr>\n<tr>\n" ); |
|
86 | + echo ("</tr>\n<tr>\n"); |
|
87 | 87 | break; |
88 | 88 | case 12: |
89 | - echo ( "</tr>\n" ); |
|
89 | + echo ("</tr>\n"); |
|
90 | 90 | break; |
91 | 91 | } |
92 | 92 | |
93 | - echo ( "<td>\n<table class=\"month\">\n" ); |
|
94 | - echo ( "<caption class=\"month\">".date('F',$Month->thisMonth(TRUE))."</caption>" ); |
|
95 | - echo ( "<tr>\n<th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th><th>S</th>\n</tr>" ); |
|
93 | + echo ("<td>\n<table class=\"month\">\n"); |
|
94 | + echo ("<caption class=\"month\">" . date('F', $Month->thisMonth(TRUE)) . "</caption>"); |
|
95 | + echo ("<tr>\n<th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th><th>S</th>\n</tr>"); |
|
96 | 96 | $Month->build(); |
97 | - while ( $Day = $Month->fetch() ) { |
|
98 | - if ( $Day->isFirst() ) { |
|
99 | - echo ( "<tr>\n" ); |
|
97 | + while ($Day = $Month->fetch()) { |
|
98 | + if ($Day->isFirst()) { |
|
99 | + echo ("<tr>\n"); |
|
100 | 100 | } |
101 | - if ( $Day->isEmpty() ) { |
|
102 | - echo ( "<td> </td>\n" ); |
|
101 | + if ($Day->isEmpty()) { |
|
102 | + echo ("<td> </td>\n"); |
|
103 | 103 | } else { |
104 | - echo ( "<td>".$Day->thisDay()."</td>\n" ); |
|
104 | + echo ("<td>" . $Day->thisDay() . "</td>\n"); |
|
105 | 105 | } |
106 | - if ( $Day->isLast() ) { |
|
107 | - echo ( "</tr>\n" ); |
|
106 | + if ($Day->isLast()) { |
|
107 | + echo ("</tr>\n"); |
|
108 | 108 | } |
109 | 109 | } |
110 | - echo ( "</table>\n</td>\n" ); |
|
110 | + echo ("</table>\n</td>\n"); |
|
111 | 111 | |
112 | 112 | ++$i; |
113 | 113 | } |
114 | 114 | ?> |
115 | 115 | </table> |
116 | -<p>Took: <?php echo ((getmicrotime()-$start)); ?></p> |
|
116 | +<p>Took: <?php echo ((getmicrotime() - $start)); ?></p> |
|
117 | 117 | </body> |
118 | 118 | </html> |
@@ -18,7 +18,9 @@ |
||
18 | 18 | |
19 | 19 | define('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKDAYS); |
20 | 20 | |
21 | -if ( !isset($_GET['year']) ) $_GET['year'] = date('Y'); |
|
21 | +if ( !isset($_GET['year']) ) { |
|
22 | + $_GET['year'] = date('Y'); |
|
23 | +} |
|
22 | 24 | |
23 | 25 | $Year = new Calendar_Year($_GET['year']); |
24 | 26 |
@@ -6,9 +6,9 @@ discard block |
||
6 | 6 | if (!@include 'Calendar/Calendar.php') { |
7 | 7 | define('CALENDAR_ROOT', '../../'); |
8 | 8 | } |
9 | -require_once CALENDAR_ROOT.'Month.php'; |
|
10 | -require_once CALENDAR_ROOT.'Decorator.php'; // Not really needed but added to help this make sense |
|
11 | -require_once CALENDAR_ROOT.'Decorator/Wrapper.php'; |
|
9 | +require_once CALENDAR_ROOT . 'Month.php'; |
|
10 | +require_once CALENDAR_ROOT . 'Decorator.php'; // Not really needed but added to help this make sense |
|
11 | +require_once CALENDAR_ROOT . 'Decorator/Wrapper.php'; |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Class MyBoldDecorator |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | function thisDay() |
30 | 30 | { |
31 | - return '<b>'.parent::thisDay().'</b>'; |
|
31 | + return '<b>' . parent::thisDay() . '</b>'; |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
@@ -40,5 +40,5 @@ discard block |
||
40 | 40 | echo '<h2>The Wrapper decorator</h2>'; |
41 | 41 | echo '<i>Day numbers are rendered in bold</i><br /> <br />'; |
42 | 42 | while ($DecoratedDay = $Wrapper->fetch('MyBoldDecorator')) { |
43 | - echo $DecoratedDay->thisDay().'<br />'; |
|
43 | + echo $DecoratedDay->thisDay() . '<br />'; |
|
44 | 44 | } |
@@ -5,21 +5,21 @@ discard block |
||
5 | 5 | */ |
6 | 6 | function getmicrotime() |
7 | 7 | { |
8 | - list($usec, $sec) = explode(" ",microtime()); |
|
8 | + list($usec, $sec) = explode(" ", microtime()); |
|
9 | 9 | |
10 | 10 | return ((float) $usec + (float) $sec); |
11 | 11 | } |
12 | 12 | $start = getmicrotime(); |
13 | 13 | |
14 | 14 | if (!@include 'Calendar/Calendar.php') { |
15 | - define('CALENDAR_ROOT','../../'); |
|
15 | + define('CALENDAR_ROOT', '../../'); |
|
16 | 16 | } |
17 | -require_once CALENDAR_ROOT.'Year.php'; |
|
18 | -require_once CALENDAR_ROOT.'Month.php'; |
|
19 | -require_once CALENDAR_ROOT.'Day.php'; |
|
20 | -require_once CALENDAR_ROOT.'Hour.php'; |
|
21 | -require_once CALENDAR_ROOT.'Minute.php'; |
|
22 | -require_once CALENDAR_ROOT.'Second.php'; |
|
17 | +require_once CALENDAR_ROOT . 'Year.php'; |
|
18 | +require_once CALENDAR_ROOT . 'Month.php'; |
|
19 | +require_once CALENDAR_ROOT . 'Day.php'; |
|
20 | +require_once CALENDAR_ROOT . 'Hour.php'; |
|
21 | +require_once CALENDAR_ROOT . 'Minute.php'; |
|
22 | +require_once CALENDAR_ROOT . 'Second.php'; |
|
23 | 23 | |
24 | 24 | // Initialize if not set |
25 | 25 | if (!isset($_POST['y'])) $_POST['y'] = date('Y'); |
@@ -37,38 +37,38 @@ discard block |
||
37 | 37 | <body> |
38 | 38 | <h1>Select and Update</h1> |
39 | 39 | <?php |
40 | -if ( isset($_POST['update']) ) { |
|
41 | - $Second = new Calendar_Second($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h'],$_POST['i'],$_POST['s']); |
|
42 | - if ( !$Second->isValid() ) { |
|
43 | - $V= & $Second->getValidator(); |
|
44 | - echo ('<p>Validation failed:</p>' ); |
|
45 | - while ( $error = $V->fetch() ) { |
|
46 | - echo ( $error->toString() .'<br>' ); |
|
40 | +if (isset($_POST['update'])) { |
|
41 | + $Second = new Calendar_Second($_POST['y'], $_POST['m'], $_POST['d'], $_POST['h'], $_POST['i'], $_POST['s']); |
|
42 | + if (!$Second->isValid()) { |
|
43 | + $V = & $Second->getValidator(); |
|
44 | + echo ('<p>Validation failed:</p>'); |
|
45 | + while ($error = $V->fetch()) { |
|
46 | + echo ($error->toString() . '<br>'); |
|
47 | 47 | } |
48 | 48 | } else { |
49 | - echo ('<p>Validation success.</p>' ); |
|
50 | - echo ( '<p>New timestamp is: '.$Second->getTimeStamp().' which could be used to update a database, for example'); |
|
49 | + echo ('<p>Validation success.</p>'); |
|
50 | + echo ('<p>New timestamp is: ' . $Second->getTimeStamp() . ' which could be used to update a database, for example'); |
|
51 | 51 | } |
52 | 52 | } else { |
53 | 53 | $Year = new Calendar_Year($_POST['y']); |
54 | -$Month = new Calendar_Month($_POST['y'],$_POST['m']); |
|
55 | -$Day = new Calendar_Day($_POST['y'],$_POST['m'],$_POST['d']); |
|
56 | -$Hour = new Calendar_Hour($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h']); |
|
57 | -$Minute = new Calendar_Minute($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h'],$_POST['i']); |
|
58 | -$Second = new Calendar_Second($_POST['y'],$_POST['m'],$_POST['d'],$_POST['h'],$_POST['i'],$_POST['s']); |
|
54 | +$Month = new Calendar_Month($_POST['y'], $_POST['m']); |
|
55 | +$Day = new Calendar_Day($_POST['y'], $_POST['m'], $_POST['d']); |
|
56 | +$Hour = new Calendar_Hour($_POST['y'], $_POST['m'], $_POST['d'], $_POST['h']); |
|
57 | +$Minute = new Calendar_Minute($_POST['y'], $_POST['m'], $_POST['d'], $_POST['h'], $_POST['i']); |
|
58 | +$Second = new Calendar_Second($_POST['y'], $_POST['m'], $_POST['d'], $_POST['h'], $_POST['i'], $_POST['s']); |
|
59 | 59 | ?> |
60 | 60 | <p><b>Set the alarm clock</p></p> |
61 | -<form action="<?php echo ( $_SERVER['PHP_SELF'] ); ?>" method="post"> |
|
62 | -Year: <input type="text" name="y" value="<?php echo ( $_POST['y'] ); ?>" size="4"> |
|
61 | +<form action="<?php echo ($_SERVER['PHP_SELF']); ?>" method="post"> |
|
62 | +Year: <input type="text" name="y" value="<?php echo ($_POST['y']); ?>" size="4"> |
|
63 | 63 | Month:<select name="m"> |
64 | 64 | <?php |
65 | 65 | $selection = array($Month); |
66 | 66 | $Year->build($selection); |
67 | -while ( $Child = & $Year->fetch() ) { |
|
68 | - if ( $Child->isSelected() ) { |
|
69 | - echo ( "<option value=\"".$Child->thisMonth()."\" selected>".$Child->thisMonth()."\n" ); |
|
67 | +while ($Child = & $Year->fetch()) { |
|
68 | + if ($Child->isSelected()) { |
|
69 | + echo ("<option value=\"" . $Child->thisMonth() . "\" selected>" . $Child->thisMonth() . "\n"); |
|
70 | 70 | } else { |
71 | - echo ( "<option value=\"".$Child->thisMonth()."\">".$Child->thisMonth()."\n" ); |
|
71 | + echo ("<option value=\"" . $Child->thisMonth() . "\">" . $Child->thisMonth() . "\n"); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | ?> |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | <?php |
78 | 78 | $selection = array($Day); |
79 | 79 | $Month->build($selection); |
80 | -while ( $Child = & $Month->fetch() ) { |
|
81 | - if ( $Child->isSelected() ) { |
|
82 | - echo ( "<option value=\"".$Child->thisDay()."\" selected>".$Child->thisDay()."\n" ); |
|
80 | +while ($Child = & $Month->fetch()) { |
|
81 | + if ($Child->isSelected()) { |
|
82 | + echo ("<option value=\"" . $Child->thisDay() . "\" selected>" . $Child->thisDay() . "\n"); |
|
83 | 83 | } else { |
84 | - echo ( "<option value=\"".$Child->thisDay()."\">".$Child->thisDay()."\n" ); |
|
84 | + echo ("<option value=\"" . $Child->thisDay() . "\">" . $Child->thisDay() . "\n"); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | ?> |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | <?php |
91 | 91 | $selection = array($Hour); |
92 | 92 | $Day->build($selection); |
93 | -while ( $Child = & $Day->fetch() ) { |
|
94 | - if ( $Child->isSelected() ) { |
|
95 | - echo ( "<option value=\"".$Child->thisHour()."\" selected>".$Child->thisHour()."\n" ); |
|
93 | +while ($Child = & $Day->fetch()) { |
|
94 | + if ($Child->isSelected()) { |
|
95 | + echo ("<option value=\"" . $Child->thisHour() . "\" selected>" . $Child->thisHour() . "\n"); |
|
96 | 96 | } else { |
97 | - echo ( "<option value=\"".$Child->thisHour()."\">".$Child->thisHour()."\n" ); |
|
97 | + echo ("<option value=\"" . $Child->thisHour() . "\">" . $Child->thisHour() . "\n"); |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | ?> |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | <?php |
104 | 104 | $selection = array($Minute); |
105 | 105 | $Hour->build($selection); |
106 | -while ( $Child = & $Hour->fetch() ) { |
|
107 | - if ( $Child->isSelected() ) { |
|
108 | - echo ( "<option value=\"".$Child->thisMinute()."\" selected>".$Child->thisMinute()."\n" ); |
|
106 | +while ($Child = & $Hour->fetch()) { |
|
107 | + if ($Child->isSelected()) { |
|
108 | + echo ("<option value=\"" . $Child->thisMinute() . "\" selected>" . $Child->thisMinute() . "\n"); |
|
109 | 109 | } else { |
110 | - echo ( "<option value=\"".$Child->thisMinute()."\">".$Child->thisMinute()."\n" ); |
|
110 | + echo ("<option value=\"" . $Child->thisMinute() . "\">" . $Child->thisMinute() . "\n"); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | ?> |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | <?php |
117 | 117 | $selection = array($Second); |
118 | 118 | $Minute->build($selection); |
119 | -while ( $Child = & $Minute->fetch() ) { |
|
120 | - if ( $Child->isSelected() ) { |
|
121 | - echo ( "<option value=\"".$Child->thisSecond()."\" selected>".$Child->thisSecond()."\n" ); |
|
119 | +while ($Child = & $Minute->fetch()) { |
|
120 | + if ($Child->isSelected()) { |
|
121 | + echo ("<option value=\"" . $Child->thisSecond() . "\" selected>" . $Child->thisSecond() . "\n"); |
|
122 | 122 | } else { |
123 | - echo ( "<option value=\"".$Child->thisSecond()."\">".$Child->thisSecond()."\n" ); |
|
123 | + echo ("<option value=\"" . $Child->thisSecond() . "\">" . $Child->thisSecond() . "\n"); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | ?> |
@@ -129,6 +129,6 @@ discard block |
||
129 | 129 | <?php |
130 | 130 | } |
131 | 131 | ?> |
132 | -<?php echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' ); ?> |
|
132 | +<?php echo ('<p><b>Took: ' . (getmicrotime() - $start) . ' seconds</b></p>'); ?> |
|
133 | 133 | </body> |
134 | 134 | </html> |
@@ -22,12 +22,24 @@ |
||
22 | 22 | require_once CALENDAR_ROOT.'Second.php'; |
23 | 23 | |
24 | 24 | // Initialize if not set |
25 | -if (!isset($_POST['y'])) $_POST['y'] = date('Y'); |
|
26 | -if (!isset($_POST['m'])) $_POST['m'] = date('n'); |
|
27 | -if (!isset($_POST['d'])) $_POST['d'] = date('j'); |
|
28 | -if (!isset($_POST['h'])) $_POST['h'] = date('H'); |
|
29 | -if (!isset($_POST['i'])) $_POST['i'] = date('i'); |
|
30 | -if (!isset($_POST['s'])) $_POST['s'] = date('s'); |
|
25 | +if (!isset($_POST['y'])) { |
|
26 | + $_POST['y'] = date('Y'); |
|
27 | +} |
|
28 | +if (!isset($_POST['m'])) { |
|
29 | + $_POST['m'] = date('n'); |
|
30 | +} |
|
31 | +if (!isset($_POST['d'])) { |
|
32 | + $_POST['d'] = date('j'); |
|
33 | +} |
|
34 | +if (!isset($_POST['h'])) { |
|
35 | + $_POST['h'] = date('H'); |
|
36 | +} |
|
37 | +if (!isset($_POST['i'])) { |
|
38 | + $_POST['i'] = date('i'); |
|
39 | +} |
|
40 | +if (!isset($_POST['s'])) { |
|
41 | + $_POST['s'] = date('s'); |
|
42 | +} |
|
31 | 43 | ?> |
32 | 44 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
33 | 45 | <html> |
@@ -107,7 +107,7 @@ |
||
107 | 107 | echo ( "<tr>\n" ); |
108 | 108 | |
109 | 109 | if ( $Day->isSelected() ) { |
110 | - echo ( "<td class=\"selected\">".$Day->thisDay()."</td>\n" ); |
|
110 | + echo ( "<td class=\"selected\">".$Day->thisDay()."</td>\n" ); |
|
111 | 111 | } elseif ( $Day->isEmpty() ) { |
112 | 112 | echo ( "<td> </td>\n" ); |
113 | 113 | } else { |
@@ -5,30 +5,30 @@ discard block |
||
5 | 5 | */ |
6 | 6 | function getmicrotime() |
7 | 7 | { |
8 | - list($usec, $sec) = explode(" ",microtime()); |
|
8 | + list($usec, $sec) = explode(" ", microtime()); |
|
9 | 9 | |
10 | 10 | return ((float) $usec + (float) $sec); |
11 | 11 | } |
12 | 12 | $start = getmicrotime(); |
13 | 13 | |
14 | 14 | if (!@include 'Calendar/Calendar.php') { |
15 | - define('CALENDAR_ROOT','../../'); |
|
15 | + define('CALENDAR_ROOT', '../../'); |
|
16 | 16 | } |
17 | -require_once CALENDAR_ROOT.'Month/Weekdays.php'; |
|
18 | -require_once CALENDAR_ROOT.'Day.php'; |
|
17 | +require_once CALENDAR_ROOT . 'Month/Weekdays.php'; |
|
18 | +require_once CALENDAR_ROOT . 'Day.php'; |
|
19 | 19 | |
20 | 20 | if (!isset($_GET['y'])) $_GET['y'] = date('Y'); |
21 | 21 | if (!isset($_GET['m'])) $_GET['m'] = date('m'); |
22 | 22 | if (!isset($_GET['d'])) $_GET['d'] = date('d'); |
23 | 23 | |
24 | 24 | // Build the month |
25 | -$Month = new Calendar_Month_Weekdays($_GET['y'],$_GET['m']); |
|
25 | +$Month = new Calendar_Month_Weekdays($_GET['y'], $_GET['m']); |
|
26 | 26 | |
27 | 27 | // Construct strings for next/previous links |
28 | 28 | $PMonth = $Month->prevMonth('object'); // Get previous month as object |
29 | -$prev = $_SERVER['PHP_SELF'].'?y='.$PMonth->thisYear().'&m='.$PMonth->thisMonth().'&d='.$PMonth->thisDay(); |
|
29 | +$prev = $_SERVER['PHP_SELF'] . '?y=' . $PMonth->thisYear() . '&m=' . $PMonth->thisMonth() . '&d=' . $PMonth->thisDay(); |
|
30 | 30 | $NMonth = $Month->nextMonth('object'); |
31 | -$next = $_SERVER['PHP_SELF'].'?y='.$NMonth->thisYear().'&m='.$NMonth->thisMonth().'&d='.$NMonth->thisDay(); |
|
31 | +$next = $_SERVER['PHP_SELF'] . '?y=' . $NMonth->thisYear() . '&m=' . $NMonth->thisMonth() . '&d=' . $NMonth->thisDay(); |
|
32 | 32 | ?> |
33 | 33 | <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"> |
34 | 34 | <html> |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | <body> |
72 | 72 | |
73 | 73 | <?php |
74 | -$selectedDays = array ( |
|
75 | - new Calendar_Day($_GET['y'],$_GET['m'],$_GET['d']), |
|
76 | - new Calendar_Day($_GET['y'],12,25), |
|
74 | +$selectedDays = array( |
|
75 | + new Calendar_Day($_GET['y'], $_GET['m'], $_GET['d']), |
|
76 | + new Calendar_Day($_GET['y'], 12, 25), |
|
77 | 77 | ); |
78 | 78 | |
79 | 79 | // Build the days in the month |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | <h2>Built with Calendar_Month_Weekday::build()</h2> |
83 | 83 | <table class="calendar"> |
84 | 84 | <caption> |
85 | -<?php echo ( date('F Y',$Month->getTimeStamp())); ?> |
|
85 | +<?php echo (date('F Y', $Month->getTimeStamp())); ?> |
|
86 | 86 | </caption> |
87 | 87 | <tr> |
88 | 88 | <th>M</th> |
@@ -94,43 +94,43 @@ discard block |
||
94 | 94 | <th>S</th> |
95 | 95 | </tr> |
96 | 96 | <?php |
97 | -while ( $Day = $Month->fetch() ) { |
|
97 | +while ($Day = $Month->fetch()) { |
|
98 | 98 | |
99 | 99 | // Build a link string for each day |
100 | - $link = $_SERVER['PHP_SELF']. |
|
101 | - '?y='.$Day->thisYear(). |
|
102 | - '&m='.$Day->thisMonth(). |
|
103 | - '&d='.$Day->thisDay(); |
|
100 | + $link = $_SERVER['PHP_SELF'] . |
|
101 | + '?y=' . $Day->thisYear() . |
|
102 | + '&m=' . $Day->thisMonth() . |
|
103 | + '&d=' . $Day->thisDay(); |
|
104 | 104 | |
105 | 105 | // isFirst() to find start of week |
106 | - if ( $Day->isFirst() ) |
|
107 | - echo ( "<tr>\n" ); |
|
106 | + if ($Day->isFirst()) |
|
107 | + echo ("<tr>\n"); |
|
108 | 108 | |
109 | - if ( $Day->isSelected() ) { |
|
110 | - echo ( "<td class=\"selected\">".$Day->thisDay()."</td>\n" ); |
|
111 | - } elseif ( $Day->isEmpty() ) { |
|
112 | - echo ( "<td> </td>\n" ); |
|
109 | + if ($Day->isSelected()) { |
|
110 | + echo ("<td class=\"selected\">" . $Day->thisDay() . "</td>\n"); |
|
111 | + } elseif ($Day->isEmpty()) { |
|
112 | + echo ("<td> </td>\n"); |
|
113 | 113 | } else { |
114 | - echo ( "<td><a href=\"".$link."\">".$Day->thisDay()."</a></td>\n" ); |
|
114 | + echo ("<td><a href=\"" . $link . "\">" . $Day->thisDay() . "</a></td>\n"); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | // isLast() to find end of week |
118 | - if ( $Day->isLast() ) |
|
119 | - echo ( "</tr>\n" ); |
|
118 | + if ($Day->isLast()) |
|
119 | + echo ("</tr>\n"); |
|
120 | 120 | } |
121 | 121 | ?> |
122 | 122 | <tr> |
123 | 123 | <td> |
124 | -<a href="<?php echo ($prev);?>" class="prevMonth"><< </a> |
|
124 | +<a href="<?php echo ($prev); ?>" class="prevMonth"><< </a> |
|
125 | 125 | </td> |
126 | 126 | <td colspan="5"> </td> |
127 | 127 | <td> |
128 | -<a href="<?php echo ($next);?>" class="nextMonth"> >></a> |
|
128 | +<a href="<?php echo ($next); ?>" class="nextMonth"> >></a> |
|
129 | 129 | </td> |
130 | 130 | </tr> |
131 | 131 | </table> |
132 | 132 | <?php |
133 | -echo ( '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>' ); |
|
133 | +echo ('<p><b>Took: ' . (getmicrotime() - $start) . ' seconds</b></p>'); |
|
134 | 134 | ?> |
135 | 135 | </body> |
136 | 136 | </html> |
@@ -17,9 +17,15 @@ discard block |
||
17 | 17 | require_once CALENDAR_ROOT.'Month/Weekdays.php'; |
18 | 18 | require_once CALENDAR_ROOT.'Day.php'; |
19 | 19 | |
20 | -if (!isset($_GET['y'])) $_GET['y'] = date('Y'); |
|
21 | -if (!isset($_GET['m'])) $_GET['m'] = date('m'); |
|
22 | -if (!isset($_GET['d'])) $_GET['d'] = date('d'); |
|
20 | +if (!isset($_GET['y'])) { |
|
21 | + $_GET['y'] = date('Y'); |
|
22 | +} |
|
23 | +if (!isset($_GET['m'])) { |
|
24 | + $_GET['m'] = date('m'); |
|
25 | +} |
|
26 | +if (!isset($_GET['d'])) { |
|
27 | + $_GET['d'] = date('d'); |
|
28 | +} |
|
23 | 29 | |
24 | 30 | // Build the month |
25 | 31 | $Month = new Calendar_Month_Weekdays($_GET['y'],$_GET['m']); |
@@ -103,8 +109,9 @@ discard block |
||
103 | 109 | '&d='.$Day->thisDay(); |
104 | 110 | |
105 | 111 | // isFirst() to find start of week |
106 | - if ( $Day->isFirst() ) |
|
107 | - echo ( "<tr>\n" ); |
|
112 | + if ( $Day->isFirst() ) { |
|
113 | + echo ( "<tr>\n" ); |
|
114 | + } |
|
108 | 115 | |
109 | 116 | if ( $Day->isSelected() ) { |
110 | 117 | echo ( "<td class=\"selected\">".$Day->thisDay()."</td>\n" ); |
@@ -115,9 +122,10 @@ discard block |
||
115 | 122 | } |
116 | 123 | |
117 | 124 | // isLast() to find end of week |
118 | - if ( $Day->isLast() ) |
|
119 | - echo ( "</tr>\n" ); |
|
120 | -} |
|
125 | + if ( $Day->isLast() ) { |
|
126 | + echo ( "</tr>\n" ); |
|
127 | + } |
|
128 | + } |
|
121 | 129 | ?> |
122 | 130 | <tr> |
123 | 131 | <td> |
@@ -113,7 +113,7 @@ |
||
113 | 113 | echo "<tr>\n"; |
114 | 114 | |
115 | 115 | if ($day->isSelected()) { |
116 | - echo '<td class="selected">'.$day->thisDay().'</td>'."\n"; |
|
116 | + echo '<td class="selected">'.$day->thisDay().'</td>'."\n"; |
|
117 | 117 | } elseif ($day->isEmpty()) { |
118 | 118 | echo '<td> </td>'."\n"; |
119 | 119 | } else { |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | */ |
6 | 6 | function getmicrotime() |
7 | 7 | { |
8 | - list($usec, $sec) = explode(" ",microtime()); |
|
8 | + list($usec, $sec) = explode(" ", microtime()); |
|
9 | 9 | |
10 | 10 | return ((float) $usec + (float) $sec); |
11 | 11 | } |
@@ -15,10 +15,10 @@ discard block |
||
15 | 15 | define('CALENDAR_ENGINE', 'PearDate'); |
16 | 16 | |
17 | 17 | if (!@include 'Calendar/Calendar.php') { |
18 | - define('CALENDAR_ROOT','../../'); |
|
18 | + define('CALENDAR_ROOT', '../../'); |
|
19 | 19 | } |
20 | -require_once CALENDAR_ROOT.'Month/Weekdays.php'; |
|
21 | -require_once CALENDAR_ROOT.'Day.php'; |
|
20 | +require_once CALENDAR_ROOT . 'Month/Weekdays.php'; |
|
21 | +require_once CALENDAR_ROOT . 'Day.php'; |
|
22 | 22 | |
23 | 23 | // Initialize GET variables if not set |
24 | 24 | if (!isset($_GET['y'])) $_GET['y'] = date('Y'); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | // Create an array of days which are "selected" |
32 | 32 | // Used for Week::build() below |
33 | -$selectedDays = array ( |
|
33 | +$selectedDays = array( |
|
34 | 34 | new Calendar_Day($_GET['y'], $_GET['m'], $_GET['d']), |
35 | 35 | new Calendar_Day($_GET['y'], 12, 25), |
36 | 36 | ); |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | |
41 | 41 | // Construct strings for next/previous links |
42 | 42 | $PMonth = $month->prevMonth('object'); // Get previous month as object |
43 | -$prev = $_SERVER['PHP_SELF'].'?y='.$PMonth->thisYear().'&m='.$PMonth->thisMonth().'&d='.$PMonth->thisDay(); |
|
43 | +$prev = $_SERVER['PHP_SELF'] . '?y=' . $PMonth->thisYear() . '&m=' . $PMonth->thisMonth() . '&d=' . $PMonth->thisDay(); |
|
44 | 44 | $NMonth = $month->nextMonth('object'); |
45 | -$next = $_SERVER['PHP_SELF'].'?y='.$NMonth->thisYear().'&m='.$NMonth->thisMonth().'&d='.$NMonth->thisDay(); |
|
45 | +$next = $_SERVER['PHP_SELF'] . '?y=' . $NMonth->thisYear() . '&m=' . $NMonth->thisMonth() . '&d=' . $NMonth->thisDay(); |
|
46 | 46 | |
47 | 47 | $thisDate = new Date($month->thisMonth('timestamp')); |
48 | 48 | ?> |
@@ -103,21 +103,21 @@ discard block |
||
103 | 103 | <?php |
104 | 104 | while ($day = $month->fetch()) { |
105 | 105 | // Build a link string for each day |
106 | - $link = $_SERVER['PHP_SELF']. |
|
107 | - '?y='.$day->thisYear(). |
|
108 | - '&m='.$day->thisMonth(). |
|
109 | - '&d='.$day->thisDay(); |
|
106 | + $link = $_SERVER['PHP_SELF'] . |
|
107 | + '?y=' . $day->thisYear() . |
|
108 | + '&m=' . $day->thisMonth() . |
|
109 | + '&d=' . $day->thisDay(); |
|
110 | 110 | |
111 | 111 | // isFirst() to find start of week |
112 | 112 | if ($day->isFirst()) |
113 | 113 | echo "<tr>\n"; |
114 | 114 | |
115 | 115 | if ($day->isSelected()) { |
116 | - echo '<td class="selected">'.$day->thisDay().'</td>'."\n"; |
|
116 | + echo '<td class="selected">' . $day->thisDay() . '</td>' . "\n"; |
|
117 | 117 | } elseif ($day->isEmpty()) { |
118 | - echo '<td> </td>'."\n"; |
|
118 | + echo '<td> </td>' . "\n"; |
|
119 | 119 | } else { |
120 | - echo '<td><a href="'.$link.'">'.$day->thisDay().'</a></td>'."\n"; |
|
120 | + echo '<td><a href="' . $link . '">' . $day->thisDay() . '</a></td>' . "\n"; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | // isLast() to find end of week |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | </tr> |
138 | 138 | </table> |
139 | 139 | <?php |
140 | -echo '<p><b>Took: '.(getmicrotime()-$start).' seconds</b></p>'; |
|
140 | +echo '<p><b>Took: ' . (getmicrotime() - $start) . ' seconds</b></p>'; |
|
141 | 141 | ?> |
142 | 142 | </body> |
143 | 143 | </html> |
@@ -21,9 +21,15 @@ discard block |
||
21 | 21 | require_once CALENDAR_ROOT.'Day.php'; |
22 | 22 | |
23 | 23 | // Initialize GET variables if not set |
24 | -if (!isset($_GET['y'])) $_GET['y'] = date('Y'); |
|
25 | -if (!isset($_GET['m'])) $_GET['m'] = date('m'); |
|
26 | -if (!isset($_GET['d'])) $_GET['d'] = date('d'); |
|
24 | +if (!isset($_GET['y'])) { |
|
25 | + $_GET['y'] = date('Y'); |
|
26 | +} |
|
27 | +if (!isset($_GET['m'])) { |
|
28 | + $_GET['m'] = date('m'); |
|
29 | +} |
|
30 | +if (!isset($_GET['d'])) { |
|
31 | + $_GET['d'] = date('d'); |
|
32 | +} |
|
27 | 33 | |
28 | 34 | // Build the month |
29 | 35 | $month = new Calendar_Month_Weekdays($_GET['y'], $_GET['m']); |
@@ -109,8 +115,9 @@ discard block |
||
109 | 115 | '&d='.$day->thisDay(); |
110 | 116 | |
111 | 117 | // isFirst() to find start of week |
112 | - if ($day->isFirst()) |
|
113 | - echo "<tr>\n"; |
|
118 | + if ($day->isFirst()) { |
|
119 | + echo "<tr>\n"; |
|
120 | + } |
|
114 | 121 | |
115 | 122 | if ($day->isSelected()) { |
116 | 123 | echo '<td class="selected">'.$day->thisDay().'</td>'."\n"; |
@@ -106,7 +106,7 @@ |
||
106 | 106 | case 6: |
107 | 107 | case 9: |
108 | 108 | echo "</tr>\n<tr>\n"; |
109 | - break; |
|
109 | + break; |
|
110 | 110 | case 12: |
111 | 111 | echo "</tr>\n"; |
112 | 112 | break; |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | */ |
5 | 5 | function getmicrotime() |
6 | 6 | { |
7 | - list($usec, $sec) = explode(" ",microtime()); |
|
7 | + list($usec, $sec) = explode(" ", microtime()); |
|
8 | 8 | |
9 | 9 | return ((float) $usec + (float) $sec); |
10 | 10 | } |
@@ -14,10 +14,10 @@ discard block |
||
14 | 14 | define('CALENDAR_ROOT', '../../'); |
15 | 15 | } |
16 | 16 | |
17 | -require_once CALENDAR_ROOT.'Year.php'; |
|
18 | -require_once CALENDAR_ROOT.'Month/Weeks.php'; |
|
17 | +require_once CALENDAR_ROOT . 'Year.php'; |
|
18 | +require_once CALENDAR_ROOT . 'Month/Weeks.php'; |
|
19 | 19 | |
20 | -define('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKS); |
|
20 | +define('CALENDAR_MONTH_STATE', CALENDAR_USE_MONTH_WEEKS); |
|
21 | 21 | |
22 | 22 | if (!isset($_GET['year'])) $_GET['year'] = date('Y'); |
23 | 23 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | 'n_in_month', |
27 | 27 | ); |
28 | 28 | |
29 | -if (!isset($_GET['week_type']) || !in_array($_GET['week_type'],$week_types) ) { |
|
29 | +if (!isset($_GET['week_type']) || !in_array($_GET['week_type'], $week_types)) { |
|
30 | 30 | $_GET['week_type'] = 'n_in_year'; |
31 | 31 | } |
32 | 32 | |
@@ -113,20 +113,20 @@ discard block |
||
113 | 113 | } |
114 | 114 | |
115 | 115 | echo "<td>\n<table class=\"month\">\n"; |
116 | - echo '<caption class="month">'.date('F', $Month->thisMonth(TRUE)).'</caption>'; |
|
117 | - echo '<colgroup><col class="weekNumbers"><col span="7"></colgroup>'."\n"; |
|
116 | + echo '<caption class="month">' . date('F', $Month->thisMonth(TRUE)) . '</caption>'; |
|
117 | + echo '<colgroup><col class="weekNumbers"><col span="7"></colgroup>' . "\n"; |
|
118 | 118 | 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>"; |
119 | 119 | $Month->build(); |
120 | 120 | while ($Week = $Month->fetch()) { |
121 | 121 | echo "<tr>\n"; |
122 | - echo '<td>'.$Week->thisWeek($_GET['week_type'])."</td>\n"; |
|
122 | + echo '<td>' . $Week->thisWeek($_GET['week_type']) . "</td>\n"; |
|
123 | 123 | $Week->build(); |
124 | 124 | |
125 | 125 | while ($Day = $Week->fetch()) { |
126 | 126 | if ($Day->isEmpty()) { |
127 | 127 | echo "<td> </td>\n"; |
128 | 128 | } else { |
129 | - echo "<td>".$Day->thisDay()."</td>\n"; |
|
129 | + echo "<td>" . $Day->thisDay() . "</td>\n"; |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | } |
@@ -136,6 +136,6 @@ discard block |
||
136 | 136 | } |
137 | 137 | ?> |
138 | 138 | </table> |
139 | -<p>Took: <?php echo ((getmicrotime()-$start)); ?></p> |
|
139 | +<p>Took: <?php echo ((getmicrotime() - $start)); ?></p> |
|
140 | 140 | </body> |
141 | 141 | </html> |
@@ -19,7 +19,9 @@ |
||
19 | 19 | |
20 | 20 | define('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKS); |
21 | 21 | |
22 | -if (!isset($_GET['year'])) $_GET['year'] = date('Y'); |
|
22 | +if (!isset($_GET['year'])) { |
|
23 | + $_GET['year'] = date('Y'); |
|
24 | +} |
|
23 | 25 | |
24 | 26 | $week_types = array( |
25 | 27 | 'n_in_year', |
@@ -5,19 +5,19 @@ |
||
5 | 5 | if (!@include 'Calendar/Calendar.php') { |
6 | 6 | define('CALENDAR_ROOT', '../../'); |
7 | 7 | } |
8 | -require_once CALENDAR_ROOT.'Day.php'; |
|
9 | -require_once CALENDAR_ROOT.'Decorator/Weekday.php'; |
|
8 | +require_once CALENDAR_ROOT . 'Day.php'; |
|
9 | +require_once CALENDAR_ROOT . 'Decorator/Weekday.php'; |
|
10 | 10 | |
11 | -$Day = new Calendar_Day(date('Y'), date('n'),date('d')); |
|
11 | +$Day = new Calendar_Day(date('Y'), date('n'), date('d')); |
|
12 | 12 | $WeekDay = new Calendar_Decorator_Weekday($Day); |
13 | 13 | // $WeekDay->setFirstDay(0); // Make Sunday first Day |
14 | 14 | |
15 | -echo 'Yesterday: '.$WeekDay->prevWeekDay().'<br>'; |
|
16 | -echo 'Today: '.$WeekDay->thisWeekDay().'<br>'; |
|
17 | -echo 'Tomorrow: '.$WeekDay->nextWeekDay().'<br>'; |
|
15 | +echo 'Yesterday: ' . $WeekDay->prevWeekDay() . '<br>'; |
|
16 | +echo 'Today: ' . $WeekDay->thisWeekDay() . '<br>'; |
|
17 | +echo 'Tomorrow: ' . $WeekDay->nextWeekDay() . '<br>'; |
|
18 | 18 | |
19 | 19 | $WeekDay->build(); |
20 | 20 | echo 'Hours today:<br>'; |
21 | -while ( $Hour = $WeekDay->fetch() ) { |
|
22 | - echo $Hour->thisHour().'<br>'; |
|
21 | +while ($Hour = $WeekDay->fetch()) { |
|
22 | + echo $Hour->thisHour() . '<br>'; |
|
23 | 23 | } |
@@ -5,8 +5,8 @@ discard block |
||
5 | 5 | if (!@include 'Calendar/Calendar.php') { |
6 | 6 | define('CALENDAR_ROOT', '../../'); |
7 | 7 | } |
8 | -require_once CALENDAR_ROOT.'Month/Weekdays.php'; |
|
9 | -require_once CALENDAR_ROOT.'Util/Uri.php'; |
|
8 | +require_once CALENDAR_ROOT . 'Month/Weekdays.php'; |
|
9 | +require_once CALENDAR_ROOT . 'Util/Uri.php'; |
|
10 | 10 | |
11 | 11 | if (!isset($_GET['jahr'])) $_GET['jahr'] = date('Y'); |
12 | 12 | if (!isset($_GET['monat'])) $_GET['monat'] = date('m'); |
@@ -14,16 +14,16 @@ discard block |
||
14 | 14 | // Build the month |
15 | 15 | $Calendar = new Calendar_Month_Weekdays($_GET['jahr'], $_GET['monat']); |
16 | 16 | |
17 | -echo ( '<p>The current month is ' |
|
18 | - .$Calendar->thisMonth().' of year '.$Calendar->thisYear().'</p>'); |
|
17 | +echo ('<p>The current month is ' |
|
18 | + .$Calendar->thisMonth() . ' of year ' . $Calendar->thisYear() . '</p>'); |
|
19 | 19 | |
20 | -$Uri = new Calendar_Util_Uri('jahr','monat'); |
|
21 | -$Uri->setFragments('jahr','monat'); |
|
20 | +$Uri = new Calendar_Util_Uri('jahr', 'monat'); |
|
21 | +$Uri->setFragments('jahr', 'monat'); |
|
22 | 22 | |
23 | 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" ); |
|
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 | 27 | echo "</pre>"; |
28 | 28 | |
29 | 29 | // Switch to scalar URIs |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | $Uri->scalar = true; // Omit variable names |
32 | 32 | |
33 | 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" ); |
|
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 | 37 | echo "</pre>"; |
38 | 38 | |
39 | 39 | // Restore the vector URIs |
@@ -41,6 +41,6 @@ discard block |
||
41 | 41 | $Uri->scalar = false; |
42 | 42 | ?> |
43 | 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> |
|
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 | 46 | </p> |
@@ -8,8 +8,12 @@ |
||
8 | 8 | require_once CALENDAR_ROOT.'Month/Weekdays.php'; |
9 | 9 | require_once CALENDAR_ROOT.'Util/Uri.php'; |
10 | 10 | |
11 | -if (!isset($_GET['jahr'])) $_GET['jahr'] = date('Y'); |
|
12 | -if (!isset($_GET['monat'])) $_GET['monat'] = date('m'); |
|
11 | +if (!isset($_GET['jahr'])) { |
|
12 | + $_GET['jahr'] = date('Y'); |
|
13 | +} |
|
14 | +if (!isset($_GET['monat'])) { |
|
15 | + $_GET['monat'] = date('m'); |
|
16 | +} |
|
13 | 17 | |
14 | 18 | // Build the month |
15 | 19 | $Calendar = new Calendar_Month_Weekdays($_GET['jahr'], $_GET['monat']); |