~ubuntu-branches/ubuntu/maverick/ilohamail/maverick

« back to all changes in this revision

Viewing changes to IlohaMail/include/display_monthly_calendar.inc

  • Committer: Bazaar Package Importer
  • Author(s): Joerg Jaspert
  • Date: 2004-02-04 13:44:37 UTC
  • Revision ID: james.westby@ubuntu.com-20040204134437-kz8j3ui2qa7oq8z2
Tags: upstream-0.8.12
ImportĀ upstreamĀ versionĀ 0.8.12

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/********************************************************
 
3
        include/display_monthly_calendar.inc
 
4
        
 
5
        (C)Copyright 2003 Ryo Chijiiwa <Ryo@IlohaMail.org>
 
6
 
 
7
        This file is part of IlohaMail, and released under GPL.
 
8
        See COPYING, or http://www.fsf.org/copyleft/gpl.html
 
9
        
 
10
        PURPOSE:
 
11
                Display monthly calendar
 
12
        PRE-CONDITIONS:
 
13
                $month
 
14
                $year
 
15
 
 
16
********************************************************/
 
17
 
 
18
//full english months, for generating date string (excessive?)
 
19
$eng_month_a = array("January", "February", "March", "April", "May", "June", "July",
 
20
                                        "August", "September", "October", "November", "December");
 
21
 
 
22
//generate string for first day of month
 
23
$month_str = $eng_month_a[$month-1];
 
24
$date_str = "1 $month_str $year";
 
25
 
 
26
//convert string to timestamp
 
27
$time = strtotime($date_str);
 
28
 
 
29
//day of week month starts on
 
30
$dow = date("w", $time);
 
31
 
 
32
//number of days in month
 
33
$num_days = date("t", $time);
 
34
 
 
35
//format heading
 
36
$heading = $lang_datetime["monthyear"];
 
37
$heading = str_replace("%m", $lang_months[$month], $heading);
 
38
$heading = str_replace("%y", $year, $heading);
 
39
 
 
40
if (($month < 10) && (strlen($month)==1)) $mon_str = "0".$month;
 
41
else $mon_str = $month;
 
42
?>
 
43
<center>
 
44
<!--
 
45
<table width="80%" border="0">
 
46
        <tr>
 
47
        <td width="15%" align="center"><a href=<?php echo "calendar.php?user=$user&month=$month&year=$prev_year"?>>&lt;&lt;</a></td>
 
48
        <td width="15%" align="center"><a href=<?php echo "calendar.php?user=$user&month=$prev_month&year=".($month==1?$prev_year:$year)?>>&lt;</a></td>
 
49
        <td width="40%" align="center"><h2><?php echo $heading?></h2></td>
 
50
        <td width="15%" align="center"><a href=<?php echo "calendar.php?user=$user&month=$next_month&year=".($month==12?$next_year:$year)?>>&gt;</a></td>
 
51
        <td width="15%" align="center"><a href=<?php echo "calendar.php?user=$user&month=$month&year=$next_year"?>>&gt;&gt;</a></td>
 
52
</table>
 
53
//-->
 
54
<?php
 
55
echo "<span class=mainLight><b>".$heading."</b></span>";
 
56
?>
 
57
<table border="0" cellspacing="1" cellpadding="3" bgcolor="<?php echo $my_colors["main_head_bg"]?>">
 
58
        <?php
 
59
        echo "<tr>";
 
60
        for ($x = 0; $x<7; $x++){
 
61
                echo "<td valign=\"top\" align=\"center\" bgcolor=\"".$my_colors["main_hilite"]."\" width=\"14%\">";
 
62
                echo $lang_datetime["dsow_short"][$x];
 
63
                echo "</td>";
 
64
        }
 
65
        echo "</tr>\n";
 
66
                
 
67
        if ($dow > 0){
 
68
                echo "<tr>";
 
69
                for ($x = 0; $x < $dow; $x++){
 
70
                        echo "<td valign=\"top\" bgcolor=\"".$my_colors["main_hilite"]."\" width=\"14%\">";
 
71
                        echo "</td>";
 
72
                }
 
73
        }
 
74
        for ($x = 1; $x <= $num_days; $x++){
 
75
                if (($x < 10) && (strlen($x)==1)) $day_str = "0".$x;
 
76
                else $day_str = $x;
 
77
                
 
78
                $disp_date = $year.$mon_str.$day_str;
 
79
                $url = "calendar.php?user=$user&date=$disp_date";
 
80
                
 
81
                if ($dow==0) echo "<tr>";
 
82
                echo "<td valign=\"top\" bgcolor=\"".$my_colors["main_bg"]."\" width=\"14%\">";
 
83
                echo "<a href=\"$url\">".($disp_date==$date?"<b>":"")."$x".($disp_date==$date?"<b>":"")."</a>";
 
84
                echo "</td>";
 
85
                //showCell($x, $my_colors["main_bg"]);
 
86
                if ($dow==6) echo "</tr>\n";
 
87
                $dow = ($dow + 1) % 7;
 
88
        }
 
89
        if ($dow > 0){
 
90
                for ($x = $dow; $x < 7; $x++){
 
91
                        echo "<td valign=\"top\" bgcolor=\"".$my_colors["main_hilite"]."\" width=\"14%\">";
 
92
                        echo "</td>";
 
93
                }
 
94
                echo "</tr>\n";
 
95
        }
 
96
        ?>
 
97
</table>