diff --git a/calendar/day.php b/calendar/day.php index 1fd83d9480..1a1b487ab0 100644 --- a/calendar/day.php +++ b/calendar/day.php @@ -12,71 +12,70 @@ * option) any later version. * \**************************************************************************/ - /* $Id$ */ - - $phpgw_flags = Array ( - 'currentapp' => 'calendar', - 'enable_nextmatchs_class' => True - ); - - $phpgw_info['flags'] = $phpgw_flags; + /* $Id$ */ if (isset($friendly) && $friendly) { - $phpgw_info['flags']['noheader'] = True; - $phpgw_info['flags']['nonavbar'] = True; - $phpgw_info['flags']['noappheader'] = True; - $phpgw_info['flags']['noappfooter'] = True; - $phpgw_info['flags']['nofooter'] = True; + $phpgw_flags = Array( + 'currentapp' => 'calendar', + 'enable_nextmatchs_class' => True, + 'noheader' => True, + 'nonavbar' => True, + 'noappheader' => True, + 'noappfooter' => True, + 'nofooter' => True + ); } else { + $phpgw_flags = Array( + 'currentapp' => 'calendar', + 'enable_nextmatchs_class' => True + ); + $friendly = 0; } + $phpgw_info['flags'] = $phpgw_flags; include('../header.inc.php'); $view = 'day'; - $now = $phpgw->calendar->makegmttime(0, 0, 0, $thismonth, $thisday, $thisyear); - $p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar')); + $template = Array( 'day_t' => 'day.tpl' ); $p->set_file($template); -// $phpgw->template->set_block('day_t'); - - if ($friendly) - { - $p->set_var('printer_friendly','
'); - } - else - { - $p->set_var('printer_friendly',''); - } - - $p->set_var('bg_text',$phpgw_info['theme']['bg_text']); - - $m = mktime(0,0,0,$thismonth,1,$thisyear); - $p->set_var('date',lang(date('F',$m)).' '.$thisday.', '.$thisyear); - $p->set_var('username',$phpgw->common->grab_owner_name($owner)); - $p->set_var('daily_events',$phpgw->calendar->print_day_at_a_glance($now,$owner)); - $p->set_var('small_calendar',$phpgw->calendar->mini_calendar($thisday,$thismonth,$thisyear,'day.php')); - if ($friendly == 0) { + $printer = ''; $param = 'year='.$thisyear.'&month='.$thismonth.'&day='.$thisday.'&friendly=1&filter='.$filter.'&owner='.$owner; $print = '[".lang('Printer Friendly').']'; } else { + $printer = ''; $print = ''; } - $p->set_var('print',$print); + $now = $phpgw->calendar->makegmttime(0, 0, 0, $thismonth, $thisday, $thisyear); + + $m = mktime(0,0,0,$thismonth,1,$thisyear); + + $var = Array( + 'printer_friendly' => $printer, + 'bg_text' => $phpgw_info['themem']['bg_text'], + 'daily_events' => $phpgw->calendar->print_day_at_a_glance($now,$owner), + 'small_calendar' => $phpgw->calendar->mini_calendar($thisday,$thismonth,$thisyear,'day.php'), + 'date' => lang(date('F',$m)).' '.$thisday.', '.$thisyear, + 'username' => $phpgw->common->grab_owner_name($owner), + 'print' => $print + ); + + $p->set_var($var); $p->pparse('out','day_t'); $phpgw->common->phpgw_footer(); diff --git a/calendar/inc/functions.inc.php b/calendar/inc/functions.inc.php index f1e1ad3947..5c04752ee7 100755 --- a/calendar/inc/functions.inc.php +++ b/calendar/inc/functions.inc.php @@ -11,89 +11,91 @@ /* $Id$ */ - global $phpgw_info, $phpgw, $grants, $owner, $rights, $filter; - global $date, $year, $month, $day, $thisyear, $thismonth, $thisday; + global $phpgw_info, $phpgw, $grants, $owner, $rights, $filter; + global $date, $year, $month, $day, $thisyear, $thismonth, $thisday; - if(!isset($filter) || !$filter) - { - $filter = $phpgw_info["user"]["preferences"]["calendar"]["defaultfilter"]; - } + if(!isset($filter) || !$filter) + { + $filter = $phpgw_info["user"]["preferences"]["calendar"]["defaultfilter"]; + } - // This is the initialization of the ACL usage + // This is the initialization of the ACL usage - $grants = $phpgw->acl->get_grants('calendar'); + $grants = $phpgw->acl->get_grants('calendar'); - if(!isset($owner)) - { - $owner = 0; - } + if(!isset($owner)) + { + $owner = 0; + } - if(!isset($owner) || !$owner) - { - $owner = $phpgw_info['user']['account_id']; - $rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16; - } - else - { - if($grants[$owner]) - { - $rights = $grants[$owner]; - if ($rights == 0) - { - $owner = $phpgw_info['user']['account_id']; - $rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16; - } - } - } + if(!isset($owner) || !$owner) + { + $owner = $phpgw_info['user']['account_id']; + $rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16; + } + else + { + if($grants[$owner]) + { + $rights = $grants[$owner]; + if ($rights == 0) + { + $owner = $phpgw_info['user']['account_id']; + $rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16; + } + } + } - /* Load calendar class */ - $parameters = Array( - 'printer_friendly' => ((isset($friendly) && ($friendly==1))?True:False), - 'owner' => $owner, - 'rights' => $rights - ); + /* Load calendar class */ + $parameters = Array( + 'printer_friendly'=> ((isset($friendly) && ($friendly==1))?True:False), + 'owner' => $owner, + 'rights' => $rights + ); - $phpgw->calendar = CreateObject('calendar.calendar',$parameters); + $phpgw->calendar = CreateObject('calendar.calendar',$parameters); - if(!isset($phpgw_info['user']['preferences']['calendar']['weekdaystarts'])) - $phpgw_info['user']['preferences']['calendar']['weekdaystarts'] = 'Sunday'; + if(!isset($phpgw_info['user']['preferences']['calendar']['weekdaystarts'])) + { + $phpgw_info['user']['preferences']['calendar']['weekdaystarts'] = 'Sunday'; + } + + if (isset($date) && strlen($date) > 0) + { + $thisyear = intval(substr($date, 0, 4)); + $thismonth = intval(substr($date, 4, 2)); + $thisday = intval(substr($date, 6, 2)); + } + else + { + if (!isset($day) || !$day) + { + $thisday = $phpgw->calendar->today['day']; + } + else + { + $thisday = $day; + } - if (isset($date) && strlen($date) > 0) - { - $thisyear = intval(substr($date, 0, 4)); - $thismonth = intval(substr($date, 4, 2)); - $thisday = intval(substr($date, 6, 2)); - } - else - { - if (!isset($day) || !$day) - { - $thisday = $phpgw->calendar->today['day']; - } - else - { - $thisday = $day; - } + if (!isset($month) || !$month) + { + $thismonth = $phpgw->calendar->today['month']; + } + else + { + $thismonth = $month; + } - if (!isset($month) || !$month) - { - $thismonth = $phpgw->calendar->today['month']; - } - else - { - $thismonth = $month; - } - - if (!isset($year) || !$year) - { - $thisyear = $phpgw->calendar->today['year']; - } - else - { - $thisyear = $year; - } + if (!isset($year) || !$year) + { + $thisyear = $phpgw->calendar->today['year']; + } + else + { + $thisyear = $year; + } - } + } $phpgw->calendar->tempyear = $thisyear; $phpgw->calendar->tempmonth = $thismonth; diff --git a/calendar/month.php b/calendar/month.php index 1e6f28ee46..a36efe85c1 100755 --- a/calendar/month.php +++ b/calendar/month.php @@ -12,57 +12,69 @@ * option) any later version. * \**************************************************************************/ - /* $Id$ */ + /* $Id$ */ - $phpgw_info['flags'] = array('currentapp' => 'calendar', 'enable_nextmatchs_class' => True); + if (isset($friendly) && $friendly) + { + $phpgw_flags = Array( + 'currentapp' => 'calendar', + 'enable_nextmatchs_class' => True, + 'noheader' => True, + 'nonavbar' => True, + 'noappheader' => True, + 'noappfooter' => True, + 'nofooter' => True + ); + } + else + { + $phpgw_flags = Array( + 'currentapp' => 'calendar', + 'enable_nextmatchs_class' => True + ); + + $friendly = 0; + } - if (isset($friendly) && $friendly){ - $phpgw_info['flags']['noheader'] = True; - $phpgw_info['flags']['nonavbar'] = True; - $phpgw_info['flags']['noappheader'] = True; - $phpgw_info['flags']['noappfooter'] = True; - $phpgw_info['flags']['nofooter'] = True; - } else { - $friendly = 0; - } + $phpgw_info['flags'] = $phpgw_flags; + include('../header.inc.php'); - include('../header.inc.php'); + $view = "month"; - $view = "month"; + $p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar')); - $p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar')); + $templates = Array( + 'index_t' => 'index.tpl' + ); + + $p->set_file($templates); - $p->set_file(array('index_t' => 'index.tpl')); - - $p->set_block('index_t','index'); - - if ($friendly) { - $p->set_var('printer_friendly',''); - } else { - $p->set_var('printer_friendly',''); - } - - $p->set_var('bg_text',$phpgw_info['theme']['bg_text']); - - $p->set_var('small_calendar_prev',$phpgw->calendar->mini_calendar(1,$thismonth - 1,$thisyear,'day.php')); - - $m = mktime(0,0,0,$thismonth,1,$thisyear); - $p->set_var('month_identifier',lang(strftime("%B",$m)) . ' ' . $thisyear); - $p->set_var('username',$phpgw->common->grab_owner_name($owner)); - $p->set_var('small_calendar_next',$phpgw->calendar->mini_calendar(1,$thismonth + 1,$thisyear,'day.php')); - $p->set_var('large_month',$phpgw->calendar->display_large_month($thismonth,$thisyear,True,$owner)); + $m = mktime(0,0,0,$thismonth,1,$thisyear); if ($friendly == 0) { + $printer = ''; $param = 'year='.$thisyear.'&month='.$thismonth.'&friendly=1&filter='.$filter.'&owner='.$owner; $print = '[".lang('Printer Friendly').']'; } else { + $printer = ''; $print = ''; } - $p->set_var('print',$print); - $p->pparse('out','index_t'); - $phpgw->common->phpgw_footer(); + $var = Array( + 'printer_friendly' => $printer, + 'bg_text' => $phpgw_info['themem']['bg_text'], + 'small_calendar_prev' => $phpgw->calendar->mini_calendar(1,$thismonth - 1,$thisyear,'day.php'), + 'month_identifier' => lang(strftime("%B",$m)) . ' ' . $thisyear, + 'username' => $phpgw->common->grab_owner_name($owner), + 'small_calendar_next' => $phpgw->calendar->mini_calendar(1,$thismonth + 1,$thisyear,'day.php'), + 'large_month' => $phpgw->calendar->display_large_month($thismonth,$thisyear,True,$owner), + 'print' => $print + ); + + $p->set_var($var); + $p->pparse('out','index_t'); + $phpgw->common->phpgw_footer(); ?> diff --git a/calendar/week.php b/calendar/week.php index 11f0e0d98c..aa94f847d6 100755 --- a/calendar/week.php +++ b/calendar/week.php @@ -12,28 +12,31 @@ * option) any later version. * \**************************************************************************/ - /* $Id$ */ - - $phpgw_flags = Array( - 'currentapp' => 'calendar', - 'enable_nextmatchs_class' => True - ); + /* $Id$ */ - $phpgw_info['flags'] = $phpgw_flags; - if (isset($friendly) && $friendly) { - $phpgw_info['flags']['noheader'] = True; - $phpgw_info['flags']['nonavbar'] = True; - $phpgw_info['flags']['noappheader'] = True; - $phpgw_info['flags']['noappfooter'] = True; - $phpgw_info['flags']['nofooter'] = True; + $phpgw_flags = Array( + 'currentapp' => 'calendar', + 'enable_nextmatchs_class' => True, + 'noheader' => True, + 'nonavbar' => True, + 'noappheader' => True, + 'noappfooter' => True, + 'nofooter' => True + ); } else { + $phpgw_flags = Array( + 'currentapp' => 'calendar', + 'enable_nextmatchs_class' => True + ); + $friendly = 0; } - + + $phpgw_info['flags'] = $phpgw_flags; include('../header.inc.php'); $next = $phpgw->calendar->makegmttime(0,0,0,$thismonth,$thisday + 7,$thisyear); @@ -45,86 +48,57 @@ $first = $phpgw->calendar->gmtdate($phpgw->calendar->get_weekday_start($thisyear, $thismonth, $thisday)); $last = $phpgw->calendar->gmtdate($first['raw'] + 518400); - $p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar')); - $templates = Array( - 'week_t' => 'week.tpl' - ); - $p->set_file($templates); - - $p->set_block('week_t','week'); - - if ($friendly) - { - $p->set_var('printer_friendly',''); - } - else - { - $p->set_var('printer_friendly',''); - } - - $p->set_var('bg_text',$phpgw_info['theme']['bg_text']); - - $p->set_var('small_calendar_prev',$phpgw->calendar->mini_calendar($thisday,$thismonth - 1,$thisyear,'day.php')); - - if (!$friendly) - { - $p->set_var('prev_week_link','<<'); - } - else - { - $p->set_var('prev_week_link','<<'); - } - - $p->set_var('small_calendar_this',$phpgw->calendar->mini_calendar($thisday,$thismonth,$thisyear,'day.php')); - +// Week Label $week_id = lang(strftime("%B",$first['raw'])).' '.$first['day']; - if($first['month'] <> $last['month'] && $first['year'] <> $last['year']) { $week_id .= ', '.$first['year']; } - $week_id .= ' - '; - if($first['month'] <> $last['month']) { $week_id .= lang(strftime("%B",$last['raw'])).' '; } - $week_id .= $last['day'].', '.$last['year']; - $p->set_var('week_identifier',$week_id); + $p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar')); + $templates = Array( + 'week_t' => 'week.tpl' + ); - $p->set_var('username',$phpgw->common->grab_owner_name($owner)); + $p->set_file($templates); - if (!$friendly) + if ($friendly == 0) { - $p->set_var('next_week_link','>>'); + $printer = ''; + $prev_week_link = '<<'; + $next_week_link = '>>'; + $param = 'year='.$thisyear.'&month='.$thismonth.'&day='.$thisday.'&friendly=1&filter='.$filter.'&owner='.$owner; + $print = '[".lang('Printer Friendly').']'; } else { - $p->set_var('next_week_link','>>'); + $printer = ''; + $prev_week_link = '<<'; + $next_week_link = '>>'; + $print = ''; } - - $p->set_var('small_calendar_next',$phpgw->calendar->mini_calendar($thisday,$$thismonth + 1,$thisyear,'day.php')); - - $p->set_var('week_display',$phpgw->calendar->display_large_week($thisday,$thismonth,$thisyear,true,$owner)); - if (!$friendly) - { - $param = 'year='.$thisyear.'&month='.$thismonth.'&friendly=1&filter='.$filter; - $p->set_var('print','[". lang('Printer Friendly') . ']'); - $p->parse('out','week_t'); - $p->pparse('out','week_t'); - } - else - { - $p->set_var('print',''); - $p->parse('out','week_t'); - $p->pparse('out','week_t'); - } + $var = Array( + 'printer_friendly' => $printer, + 'bg_text' => $phpgw_info['themem']['bg_text'], + 'small_calendar_prev' => $phpgw->calendar->mini_calendar(1,$thismonth - 1,$thisyear,'day.php'), + 'prev_week_link' => $prev_week_link, + 'small_calendar_this' => $phpgw->calendar->mini_calendar($thisday,$thismonth,$thisyear,'day.php'), + 'week_identifier' => $week_id, + 'next_week_link' => $next_week_link, + 'username' => $phpgw->common->grab_owner_name($owner), + 'small_calendar_next' => $phpgw->calendar->mini_calendar(1,$thismonth + 1,$thisyear,'day.php'), + 'week_display' => $phpgw->calendar->display_large_week($thisday,$thismonth,$thisyear,true,$owner), + 'print' => $print + ); + + $p->set_var($var); + $p->pparse('out','week_t'); $phpgw->common->phpgw_footer(); ?>