~cruzjbishop/anelectron/trunk

« back to all changes in this revision

Viewing changes to themes/default/calendar_theme.php

  • Committer: Cruz Julian Bishop
  • Date: 2012-03-18 22:16:46 UTC
  • Revision ID: cruzjbishop@gmail.com-20120318221646-se8p54bd2g7i936n
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
function monthview_theme() {
 
4
 
 
5
    global $globals, $cal, $dbtables, $user, $l, $theme;
 
6
    global $days, $month, $year, $day, $birthdays, $today;
 
7
 
 
8
    //Next and Previous Months
 
9
    $nextmonth = $month + 1;
 
10
    $nextyear = $year;
 
11
    $prevyear = $year;
 
12
 
 
13
    if ($nextmonth == 13) {
 
14
        $nextmonth = '01';
 
15
        $nextyear = $year + 1;
 
16
    } elseif ($nextmonth < 10) {
 
17
        $nextmonth = '0' . $nextmonth;
 
18
    }
 
19
 
 
20
    $prevmonth = $month - 1;
 
21
 
 
22
    if ($prevmonth == 00) {
 
23
        $prevmonth = 12;
 
24
        $prevyear = $year - 1;
 
25
    } elseif ($prevmonth < 10) {
 
26
        $prevmonth = '0' . $prevmonth;
 
27
    }
 
28
 
 
29
    //The headers
 
30
    aefheader($l['<title>']);
 
31
 
 
32
    echo '<link rel="stylesheet" type="text/css" href="' . $theme['url'] . '/calendar.css" />
 
33
    <br />
 
34
<table width="100%" cellpadding="0" cellspacing="0" border="0">
 
35
 
 
36
<tr>
 
37
<td>
 
38
 
 
39
<table width="100%" cellpadding="0" cellspacing="0">
 
40
 
 
41
<tr class="caltop">
 
42
    <td>
 
43
        <a class="prev" href="' . $globals['index_url'] . 'act=calendar&date=' . $prevyear . $prevmonth . '01"><img style="margin-bottom: 5px;" src="' . $theme['images'] . '/left.png" />  ' . $l['months'][$prevmonth] . ' ' . $prevyear . '</a>
 
44
    </td>
 
45
    <td>
 
46
        <a href="' . $globals['index_url'] . 'act=calendar&date=' . $year . $month . '01">' . $l['months'][$month] . ' ' . $year . '</a>
 
47
    </td>
 
48
    <td>
 
49
        <a class="next" href="' . $globals['index_url'] . 'act=calendar&date=' . $nextyear . $nextmonth . '01">' . $l['months'][$nextmonth] . ' ' . $nextyear . '  <img style="margin-bottom: 5px;" src="' . $theme['images'] . '/right.png" /></a>
 
50
    </td>
 
51
    </tr>
 
52
 
 
53
</table>
 
54
 
 
55
</td>
 
56
</tr>
 
57
 
 
58
<tr>
 
59
<td>
 
60
 
 
61
 
 
62
<table width="100%" cellpadding="1" cellspacing="0" align="center" class="cbgbor">
 
63
 
 
64
    <tr class="week_days">';
 
65
 
 
66
    //The calendar days
 
67
    for ($x = 0; $x < 7; $x++) {
 
68
 
 
69
        echo '<td width="14%">' . $l['days'][$x] . '</td>';
 
70
    }
 
71
 
 
72
    echo '</tr>
 
73
    <tr>';
 
74
 
 
75
    $offset = datify(mktime(0, 0, 0, $month, 1, $year), false, false, 'w');
 
76
 
 
77
    //$week = datify(mktime( 0, 0, 0, $month, 1, $year), false, false, 'W');
 
78
    //Empty Days in Previous Month
 
79
    for ($t = 0; $t < $offset; $t++) {
 
80
 
 
81
        echo '<td class="daybox">&nbsp;</td>';
 
82
    }
 
83
 
 
84
    //Loop through the days
 
85
    for ($d = 1; $d <= $days; $d++) {
 
86
 
 
87
        //Start a New row for a new week
 
88
        if ($offset == 0) {
 
89
 
 
90
            echo '<tr>';
 
91
        }
 
92
 
 
93
        $thisday = datify(mktime(0, 0, 0, $month, $d, $year), false, false, 'Ymd');
 
94
 
 
95
        echo '<td valign="top" class="' . ($thisday == $today ? 'todaybox' : 'daybox') . '">
 
96
            <div class="' . ($thisday == $today ? 'topdayon' : 'topday') . '">' . $d . '</div>';
 
97
 
 
98
        //Any Happy Birthdays on this day!!!
 
99
        if (!empty($birthdays[$d])) {
 
100
 
 
101
            echo '<div class="bdays">' . $l['birthdays'] . ' : ';
 
102
 
 
103
            foreach ($birthdays[$d] as $b => $bd) {
 
104
 
 
105
                echo '<a href="' . $globals['index_url'] . 'mid=' . $bd['id'] . '">' . $bd['username'] . '(' . $bd['age'] . ')</a><br />';
 
106
            }
 
107
 
 
108
            echo '</div>';
 
109
 
 
110
            //If there is nothing
 
111
        } else {
 
112
 
 
113
            echo '<br /><br />';
 
114
        }
 
115
 
 
116
        $offset++;
 
117
 
 
118
        //Is it the end of the week ?
 
119
        if ($offset > 6) {
 
120
 
 
121
            $offset = 0;
 
122
 
 
123
            if ($days != $d) {
 
124
 
 
125
                echo '</tr>';
 
126
            }
 
127
        }
 
128
    }//End of the loop
 
129
 
 
130
    if ($offset > 0) {
 
131
 
 
132
        $offset = 7 - $offset;
 
133
    }
 
134
 
 
135
 
 
136
    //The next month Rows
 
137
    for ($t = 0; $t < $offset; $t++) {
 
138
 
 
139
        echo '<td class="daybox">&nbsp;</td>';
 
140
    }
 
141
 
 
142
    echo '</tr>
 
143
    
 
144
    </table>
 
145
 
 
146
</td>
 
147
</tr>
 
148
<tr>
 
149
    <td class="currentmonth" colspan="7" align="center">
 
150
        <a href="' . $globals['index_url'] . 'act=calendar">' . $l['current_month'] . '</a>
 
151
    </td>
 
152
    </tr>
 
153
<tr>
 
154
<td><img src="' . $theme['images'] . '/cbot.png" height="15" width="100%"></td>
 
155
</tr>
 
156
 
 
157
</table>';
 
158
 
 
159
    //The defualt footers
 
160
    aeffooter();
 
161
}
 
162
 
 
163
?>
 
 
b'\\ No newline at end of file'