footer is now a template

This commit is contained in:
skeeter 2001-03-04 14:15:32 +00:00
parent faab4e668e
commit 429878b180
6 changed files with 195 additions and 111 deletions

View File

@ -22,8 +22,6 @@ class calendar_
var $cal_event;
var $today = Array('raw','day','month','year','full','dow','dm','bd');
//this will be deleted once I delete the alternative mini-calendars
var $daysinweek = 7;
function open($calendar='',$user='',$passwd='',$options='')
{
@ -1255,7 +1253,7 @@ class calendar_
$str .= '</font></td></tr><tr>';
for($i=0;$i<$daysinweek;$i++)
for($i=0;$i<7;$i++)
{
$str .= '<td>'.lang($days[$i]).'</td>';
}
@ -1265,7 +1263,7 @@ class calendar_
for($i=$weekstarttime;date('Ymd',$i)<=$monthend['full'];$i+=604800)
{
$str .= '<tr>';
for($j=0;$j<$daysinweek;$j++)
for($j=0;$j<7;$j++)
{
$date = $this->localdates($i + ($j * 86400));

View File

@ -13,112 +13,156 @@
/* $Id$ */
if (isset($friendly) && $friendly){
$phpgw->common->phpgw_footer();
$phpgw->common->phpgw_exit();
}
if (isset($friendly) && $friendly)
{
$phpgw->common->phpgw_footer();
$phpgw->common->phpgw_exit();
}
$p = CreateObject('phpgwapi.Template',$phpgw->calendar->template_dir);
$templates = Array(
'footer' => 'footer.tpl',
'footer_column' => 'footer_column.tpl'
);
$p->set_file($templates);
if ($phpgw->calendar->tempyear && $phpgw->calendar->tempmonth)
{
$m = $phpgw->calendar->tempmonth;
$y = $phpgw->calendar->tempyear;
}
else
{
$m = date('m');
$y = date('Y');
}
$d_time = mktime(0,0,0,$m,1,$y);
$thisdate = date('Ymd', $d_time);
$y--;
$str = '';
for ($i = 0; $i < 25; $i++)
{
$m++;
if ($m > 12)
{
$m = 1;
$y++;
}
$d = mktime(0,0,0,$m,1,$y);
$str .= '<option value="' . date('Ymd', $d) . '"';
if (date('Ymd', $d) == $thisdate)
{
$str .= ' selected';
}
$str .= '>'.lang(date('F', $d)).strftime(' %Y', $d).'</option>'."\n";
}
$var = Array(
'action_url' => $phpgw->link('month.php','owner='.$owner),
'form_name' => 'SelectMonth',
'label' => lang('Month'),
'form_label' => 'date',
'form_onchange' => 'document.SelectMonth.submit()',
'row' => $str,
'go' => lang('Go!')
);
$p->set_var($var);
$p->parse('output','footer_column',True);
$str = '';
if ($phpgw->calendar->tempyear && $phpgw->calendar->tempmonth)
{
$m = $phpgw->calendar->tempmonth;
$y = $phpgw->calendar->tempyear;
}
else
{
$m = date('m');
$y = date('Y');
}
if ($thisday)
{
$d = $thisday;
}
else
{
$d = date ('d');
}
$thisdate = $phpgw->calendar->makegmttime(0,0,0,$m,$d,$y);
$sun = $phpgw->calendar->get_weekday_start($y,$m,$d) -
((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset']));
$str = '';
for ($i = -7; $i <= 7; $i++)
{
$begin = $sun + (3600 * 24 * 7 * $i);
$end = $begin + (3600 * 24 * 6);
$str .= '<option value="' . $phpgw->common->show_date($begin,'Ymd') . '"';
if ($begin <= $thisdate['raw'] && $end >= $thisdate['raw'])
{
$str .= ' selected';
}
$str .= '>' . lang($phpgw->common->show_date($begin,'F')) . ' ' . $phpgw->common->show_date($begin,'d') . '-'
. lang($phpgw->common->show_date($end,'F')) . ' ' . $phpgw->common->show_date($end,'d') . '</option>'."\n";
}
$var = Array(
'action_url' => $phpgw->link('week.php','owner='.$owner),
'form_name' => 'SelectWeek',
'label' => lang('Week'),
'form_label' => 'date',
'form_onchange' => 'document.SelectWeek.submit()',
'row' => $str,
'go' => lang('Go!')
);
$p->set_var($var);
$p->parse('output','footer_column',True);
if ($phpgw->calendar->tempyear)
{
$y = $phpgw->calendar->tempyear;
}
else
{
$y = date('Y');
}
$str = '';
for ($i = ($y - 3); $i < ($y + 3); $i++)
{
$str .= '<option value="'.$i.'"';
if ($i == $y)
{
$str .= ' selected';
}
$str .= '>'.$i.'</option>'."\n";
}
$var = Array(
'action_url' => $phpgw->link('year.php','owner='.$owner),
'form_name' => 'SelectYear',
'label' => lang('Year'),
'form_label' => 'year',
'form_onchange' => 'document.SelectYear.submit()',
'row' => $str,
'go' => lang('Go!')
);
$p->set_var($var);
$p->parse('output','footer_column',True);
$p->pparse('out','footer');
?>
<BR CLEAR="all">
<HR CLEAR="all">
<FONT SIZE="-1">
<TABLE BORDER=0 WIDTH=100% CELLPADDING=0 CELLSPACING=0>
<FORM ACTION="<?php echo $phpgw->link("month.php"); ?>" method="post" name="SelectMonth">
<TR>
<TD VALIGN="top" WIDTH=33%><FONT SIZE="-1">
<B><?php echo lang("Month"); ?>:</B>
<SELECT NAME="date" ONCHANGE="document.SelectMonth.submit()">
<?php
if ($phpgw->calendar->tempyear && $phpgw->calendar->tempmonth) {
$m = $phpgw->calendar->tempmonth;
$y = $phpgw->calendar->tempyear;
} else {
$m = date("m");
$y = date("Y");
}
$d_time = mktime(0,0,0,$m,1,$y);
$thisdate = date("Ymd", $d_time);
$y--;
for ($i = 0; $i < 25; $i++) {
$m++;
if ($m > 12) {
$m = 1;
$y++;
}
$d = mktime(0,0,0,$m,1,$y);
echo'"<option value="' . date("Ymd", $d) . '"';
if (date("Ymd", $d) == $thisdate)
echo " SELECTED";
echo ">" . lang(date("F", $d)) . strftime(" %Y", $d) . "</option>\n";
}
?>
</SELECT>
<NOSCRIPT><INPUT TYPE="submit" VALUE="<?php echo lang("Go!"); ?>"></NOSCRIPT></FONT>
</TD>
</FORM>
<FORM ACTION="<?php echo $phpgw->link("week.php"); ?>" method="post" name="SelectWeek">
<TD VALIGN="top" align="center" WIDTH=33%><FONT SIZE="-1"><B><?php echo lang("Week"); ?>:</B>
<SELECT NAME="date" ONCHANGE="document.SelectWeek.submit()">
<?php
if ($phpgw->calendar->tempyear && $phpgw->calendar->tempmonth) {
$m = $phpgw->calendar->tempmonth;
$y = $phpgw->calendar->tempyear;
} else {
$m = date("m");
$y = date("Y");
}
if ($thisday) {
$d = $thisday;
} else {
$d = date ("d");
}
$thisdate = $phpgw->calendar->makegmttime(0,0,0,$m,$d,$y);
$sun = $phpgw->calendar->get_weekday_start($y,$m,$d) -
((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset']));
for ($i = -7; $i <= 7; $i++) {
$begin = $sun + (3600 * 24 * 7 * $i);
$end = $begin + (3600 * 24 * 6);
echo "<OPTION VALUE=\"" . $phpgw->common->show_date($begin,"Ymd") . "\"";
if ($begin <= $thisdate['raw'] && $end >= $thisdate['raw'])
echo " SELECTED";
echo ">" . lang($phpgw->common->show_date($begin,"F")) . " " . $phpgw->common->show_date($begin,"d") . "-"
. lang($phpgw->common->show_date($end,"F")) . " " . $phpgw->common->show_date($end,"d");
echo "</option>\n";
}
?>
</SELECT>
<NOSCRIPT><INPUT TYPE="submit" VALUE="<?php echo lang("Go!"); ?>"></NOSCRIPT></FONT>
</TD>
</FORM>
<FONT SIZE="-1">
<FORM ACTION="<?php echo $phpgw->link("year.php"); ?>" method="post" name="SelectYear">
<TD VALIGN="top" align="right" WIDTH=33%><FONT SIZE="-1">
<B><?php echo lang("Year"); ?>:</B>
<SELECT NAME="year" ONCHANGE="document.SelectYear.submit()">
<?php
if ($phpgw->calendar->tempyear) {
$y = $phpgw->calendar->tempyear;
} else {
$y = date("Y");
}
for ($i = ($y - 3); $i < ($y + 3); $i++) {
echo "<OPTION VALUE=\"" . $i . "\"";
if ($i == $y)
echo " SELECTED";
echo ">" . $i . "</option>\n";
}
?>
</SELECT>
<NOSCRIPT><INPUT TYPE="submit" VALUE="<?php echo lang("Go!"); ?>"></NOSCRIPT>
</FONT></TD>
</FORM>
</TR>
</TABLE>

View File

@ -0,0 +1,8 @@
<br clear="all">
<hr clear="all">
<font size="-1">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
{output}
</tr>
</table>

View File

@ -0,0 +1,13 @@
<td valign="top" width="33%">
<font size="-1">
<form action="{action_url}" method="post" name="{form_name}">
<B>{label}:</B>
<select name="{form_label}" onchange="{form_onchange}">
{row}
</select>
<noscript><input type="submit" value="{go}"></noscript>
</form>
</font>
</td>

View File

@ -0,0 +1,8 @@
<br clear="all">
<hr clear="all">
<font size="-1">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
{output}
</tr>
</table>

View File

@ -0,0 +1,13 @@
<td valign="top" width="33%">
<font size="-1">
<form action="{action_url}" method="post" name="{form_name}">
<B>{label}:</B>
<select name="{form_label}" onchange="{form_onchange}">
{row}
</select>
<noscript><input type="submit" value="{go}"></noscript>
</form>
</font>
</td>