Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
493 ddelon 1
<?php
2
/**
3
* Description: a complete year
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
 
15
require_once CALENDAR_ROOT.'Year.php';
16
 
17
define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKDAYS);
18
 
19
if ( !isset($_GET['year']) ) $_GET['year'] = date('Y');
20
 
21
$Year = new Calendar_Year($_GET['year']);
22
 
23
$Year->build();
24
?>
25
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
26
<html>
27
<head>
28
<title> <?php echo ( $Year->thisYear() ); ?> </title>
29
<style type="text/css">
30
body {
31
    font-family: Georgia, serif;
32
}
33
caption.year {
34
    font-weight: bold;
35
    font-size: 120%;
36
    font-color: navy;
37
}
38
caption.month {
39
    font-size: 110%;
40
    font-color: navy;
41
}
42
table.month {
43
    border: thin groove #800080
44
}
45
tr {
46
    vertical-align: top;
47
}
48
th, td {
49
    text-align: right;
50
    font-size: 70%;
51
}
52
#prev {
53
    float: left;
54
    font-size: 70%;
55
}
56
#next {
57
    float: right;
58
    font-size: 70%;
59
}
60
</style>
61
</head>
62
<body>
63
<table>
64
<caption class="year">
65
<?php echo ( $Year->thisYear() ); ?>
66
<div id="next">
67
<a href="?year=<?php echo ( $Year->nextYear() ); ?>">>></a>
68
</div>
69
<div id="prev">
70
<a href="?year=<?php echo ( $Year->prevYear() ); ?>"><<</a>
71
</div>
72
</caption>
73
<?php
74
$i = 0;
75
while ( $Month = $Year->fetch() ) {
76
 
77
    switch ( $i ) {
78
        case 0:
79
            echo ( "<tr>\n" );
80
            break;
81
        case 3:
82
        case 6:
83
        case 9:
84
            echo ( "</tr>\n<tr>\n" );
85
            break;
86
        case 12:
87
            echo ( "</tr>\n" );
88
            break;
89
    }
90
 
91
    echo ( "<td>\n<table class=\"month\">\n" );
92
    echo ( "<caption class=\"month\">".date('F',$Month->thisMonth(TRUE))."</caption>" );
93
    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>" );
94
    $Month->build();
95
    while ( $Day = $Month->fetch() ) {
96
        if ( $Day->isFirst() ) {
97
            echo ( "<tr>\n" );
98
        }
99
        if ( $Day->isEmpty() ) {
100
            echo ( "<td>&nbsp;</td>\n" );
101
        } else {
102
            echo ( "<td>".$Day->thisDay()."</td>\n" );
103
        }
104
        if ( $Day->isLast() ) {
105
            echo ( "</tr>\n" );
106
        }
107
    }
108
    echo ( "</table>\n</td>\n" );
109
 
110
    $i++;
111
}
112
?>
113
</table>
114
<p>Took: <?php echo ((getmicrotime()-$start)); ?></p>
115
</body>
116
</html>