egroupware/calendar/inc/footer.inc.php

201 lines
4.5 KiB
PHP
Raw Normal View History

2000-08-18 05:24:22 +02:00
<?php
/**************************************************************************\
* phpGroupWare - Calendar *
* http://www.phpgroupware.org *
* Based on Webcalendar by Craig Knudsen <cknudsen@radix.net> *
* http://www.radix.net/~cknudsen *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
2000-12-24 04:37:10 +01:00
/* $Id$ */
2001-03-04 15:15:32 +01:00
if (isset($friendly) && $friendly)
{
$phpgw->common->phpgw_footer();
$phpgw->common->phpgw_exit();
}
2001-04-21 14:43:00 +02:00
if(floor(phpversion()) == 4)
{
global $phpgw_info, $thisday, $thismonth, $thisyear;
}
2001-03-04 15:15:32 +01:00
$p = CreateObject('phpgwapi.Template',$phpgw->calendar->template_dir);
$templates = Array(
'footer' => 'footer.tpl'
2001-03-04 15:15:32 +01:00
);
$p->set_file($templates);
$p->set_block('footer','footer_table','footer_table');
$p->set_block('footer','footer_row','footer_row');
2001-03-04 15:15:32 +01:00
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";
}
2000-08-18 05:24:22 +02:00
2001-03-04 15:15:32 +01:00
$var = Array(
'action_url' => $phpgw->link('/calendar/month.php','owner='.$owner),
2001-03-04 15:15:32 +01:00
'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('table_row','footer_row',True);
2001-03-04 15:15:32 +01:00
$str = '';
if ($phpgw->calendar->tempyear)
2001-03-04 15:15:32 +01:00
{
$y = $phpgw->calendar->tempyear;
}
else
{
$y = date('Y');
}
if ($phpgw->calendar->tempmonth)
2001-03-04 15:15:32 +01:00
{
$m = $phpgw->calendar->tempmonth;
2001-03-04 15:15:32 +01:00
}
else
{
$m = date('m');
2001-03-04 15:15:32 +01:00
}
if ($phpgw->calendar->tempday)
{
$d = $phpgw->calendar->tempday;
}
else
{
$d = date('d');
}
// 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');
// }
unset($thisdate);
2001-03-04 15:15:32 +01:00
$thisdate = $phpgw->calendar->makegmttime(0,0,0,$m,$d,$y);
$sun = $phpgw->calendar->get_weekday_start($y,$m,$d) - $phpgw->calendar->tz_offset - 7200;
2001-03-04 15:15:32 +01:00
$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('/calendar/week.php','owner='.$owner),
2001-03-04 15:15:32 +01:00
'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('table_row','footer_row',True);
2001-03-04 15:15:32 +01:00
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('/calendar/year.php','owner='.$owner),
2001-03-04 15:15:32 +01:00
'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('table_row','footer_row',True);
2001-03-04 15:15:32 +01:00
$p->pparse('out','footer_table');
2001-03-04 15:15:32 +01:00
?>
2000-08-18 05:24:22 +02:00