2001-01-13 04:37:22 +01:00
|
|
|
<?php
|
|
|
|
/**************************************************************************\
|
2001-01-17 13:35:43 +01:00
|
|
|
* phpGroupWare - Calendar *
|
2001-01-13 04:37:22 +01:00
|
|
|
* http://www.phpgroupware.org *
|
2001-01-17 13:35:43 +01:00
|
|
|
* Based on Webcalendar by Craig Knudsen <cknudsen@radix.net> *
|
|
|
|
* http://www.radix.net/~cknudsen *
|
|
|
|
* Modified by Mark Peters <skeeter@phpgroupware.org> *
|
2001-01-13 04:37:22 +01:00
|
|
|
* -------------------------------------------- *
|
|
|
|
* 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. *
|
|
|
|
\**************************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
2001-02-25 05:06:15 +01:00
|
|
|
CreateObject('calendar.calendar_item');
|
2001-05-14 05:54:40 +02:00
|
|
|
if(isset($phpgw_info['server']['calendar_type']) &&
|
|
|
|
$phpgw_info['server']['calendar_type'] == 'mcal' &&
|
|
|
|
extension_loaded('mcal') == False)
|
2001-02-27 05:42:18 +01:00
|
|
|
{
|
|
|
|
$phpgw_info['server']['calendar_type'] = 'sql';
|
|
|
|
}
|
2001-03-03 04:55:01 +01:00
|
|
|
// The following line can be removed when vCalendar is implemented....
|
|
|
|
$phpgw_info['server']['calendar_type'] = 'sql';
|
2001-03-17 20:39:56 +01:00
|
|
|
//CreateObject('calendar.vCalendar');
|
|
|
|
CreateObject('calendar.calendar__');
|
2001-02-20 04:48:39 +01:00
|
|
|
include(PHPGW_INCLUDE_ROOT.'/calendar/inc/class.calendar_'.$phpgw_info['server']['calendar_type'].'.inc.php');
|
2001-01-13 04:37:22 +01:00
|
|
|
|
2001-02-20 04:48:39 +01:00
|
|
|
class calendar extends calendar_
|
|
|
|
{
|
2001-02-26 13:23:48 +01:00
|
|
|
var $owner;
|
|
|
|
var $rights;
|
|
|
|
var $printer_friendly = False;
|
|
|
|
|
2001-02-24 16:56:52 +01:00
|
|
|
var $template_dir;
|
2001-02-25 05:06:15 +01:00
|
|
|
var $phpgwapi_template_dir;
|
2001-02-24 16:56:52 +01:00
|
|
|
var $image_dir;
|
2001-02-25 05:06:15 +01:00
|
|
|
|
2001-02-26 13:23:48 +01:00
|
|
|
var $filter;
|
|
|
|
var $repeating_events;
|
|
|
|
var $repeated_events = Array();
|
|
|
|
var $repeating_event_matches = 0;
|
|
|
|
var $sorted_events_matching = 0;
|
2001-04-01 22:49:49 +02:00
|
|
|
var $end_repeat_day = 0;
|
2001-02-26 13:23:48 +01:00
|
|
|
var $weekstarttime;
|
|
|
|
var $days = Array();
|
2001-04-01 22:49:49 +02:00
|
|
|
|
|
|
|
var $tz_offset;
|
2001-02-26 13:23:48 +01:00
|
|
|
|
|
|
|
var $tempyear;
|
|
|
|
var $tempmonth;
|
|
|
|
var $tempday;
|
|
|
|
|
2001-04-01 22:49:49 +02:00
|
|
|
var $users_timeformat;
|
|
|
|
|
2001-02-25 05:06:15 +01:00
|
|
|
var $rowspan_arr = Array();
|
|
|
|
var $rowspan;
|
|
|
|
|
2001-05-01 05:26:17 +02:00
|
|
|
var $holidays;
|
2001-05-13 05:48:17 +02:00
|
|
|
var $br;
|
2001-05-01 05:26:17 +02:00
|
|
|
|
2001-02-15 05:12:31 +01:00
|
|
|
function calendar($params=False)
|
2001-02-11 20:11:35 +01:00
|
|
|
{
|
2001-02-26 13:23:48 +01:00
|
|
|
global $phpgw, $phpgw_info;
|
2001-02-15 05:12:31 +01:00
|
|
|
|
2001-03-04 05:13:04 +01:00
|
|
|
if(gettype($params)=='array')
|
2001-02-26 13:23:48 +01:00
|
|
|
{
|
|
|
|
while(list($key,$value) = each($params))
|
|
|
|
{
|
|
|
|
$this->$key = $value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->printer_friendly = $params;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!$this->owner)
|
|
|
|
{
|
|
|
|
$this->owner = $phpgw_info['user']['account_id'];
|
|
|
|
}
|
2001-02-15 05:12:31 +01:00
|
|
|
|
2001-02-26 13:23:48 +01:00
|
|
|
if(!isset($this->rights))
|
|
|
|
{
|
2001-03-18 14:41:29 +01:00
|
|
|
$this->rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + PHPGW_ACL_PRIVATE;
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
2001-02-15 05:12:31 +01:00
|
|
|
|
2001-02-24 16:56:52 +01:00
|
|
|
$this->template_dir = $phpgw->common->get_tpl_dir('calendar');
|
2001-04-28 23:56:24 +02:00
|
|
|
$this->phpgwapi_template_dir = PHPGW_IMAGES_DIR;
|
2001-02-24 16:56:52 +01:00
|
|
|
$this->image_dir = $phpgw->common->get_image_path('calendar');
|
2001-02-26 13:23:48 +01:00
|
|
|
$this->today = $this->localdates(time());
|
|
|
|
|
2001-03-13 06:03:50 +01:00
|
|
|
$this->open('',intval($this->owner));
|
2001-02-26 13:23:48 +01:00
|
|
|
$this->set_filter();
|
2001-04-01 22:49:49 +02:00
|
|
|
$this->tz_offset = ((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset']));
|
|
|
|
|
|
|
|
if ($phpgw_info['user']['preferences']['common']['timeformat'] == '12')
|
|
|
|
{
|
|
|
|
$this->users_timeformat = 'h:i a';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->users_timeformat = 'H:i';
|
|
|
|
}
|
2001-05-01 05:26:17 +02:00
|
|
|
$this->holidays = CreateObject('calendar.calendar_holiday',$this->owner);
|
2001-05-13 05:48:17 +02:00
|
|
|
$browser = CreateObject('phpgwapi.browser');
|
|
|
|
$this->br = $browser->br;
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
|
|
|
|
2001-03-04 05:13:04 +01:00
|
|
|
// Generic functions that are derived from mcal functions.
|
|
|
|
// NOT PART OF THE ORIGINAL MCAL SPECS.
|
|
|
|
function time_compare($a_hour,$a_minute,$a_second,$b_hour,$b_minute,$b_second)
|
|
|
|
{
|
2001-04-18 20:19:26 +02:00
|
|
|
$a_time = mktime(intval($a_hour),intval($a_minute),intval($a_second),0,0,70);
|
|
|
|
$b_time = mktime(intval($b_hour),intval($b_minute),intval($b_second),0,0,70);
|
2001-03-04 05:13:04 +01:00
|
|
|
if($a_time == $b_time)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
elseif($a_time > $b_time)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
elseif($a_time < $b_time)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-26 13:23:48 +01:00
|
|
|
function set_filter()
|
|
|
|
{
|
|
|
|
global $phpgw_info, $phpgw, $filter;
|
|
|
|
if (!isset($this->filter) || !$this->filter)
|
|
|
|
{
|
|
|
|
if (isset($filter) && $filter)
|
|
|
|
{
|
|
|
|
$this->filter = ' '.$filter.' ';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!isset($phpgw_info['user']['preferences']['calendar']['defaultfilter']))
|
|
|
|
{
|
|
|
|
$phpgw->preferences->add('calendar','defaultfilter','all');
|
|
|
|
$phpgw->preferences->save_repository(True);
|
|
|
|
}
|
|
|
|
$this->filter = ' '.$phpgw_info['user']['preferences']['calendar']['defaultfilter'].' ';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function check_perms($needed)
|
|
|
|
{
|
2001-03-02 05:20:41 +01:00
|
|
|
return (!!($this->rights & $needed) == True);
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
|
|
|
|
2001-03-25 15:34:42 +02:00
|
|
|
function get_fullname($accountid)
|
|
|
|
{
|
|
|
|
global $phpgw;
|
|
|
|
|
|
|
|
$account_id = get_account_id($accountid);
|
|
|
|
if($phpgw->accounts->exists($account_id) == False)
|
|
|
|
{
|
|
|
|
return False;
|
|
|
|
}
|
|
|
|
$db = $phpgw->db;
|
|
|
|
$db->query('SELECT account_lid,account_lastname,account_firstname FROM phpgw_accounts WHERE account_id='.$account_id,__LINE__,__FILE__);
|
|
|
|
if($db->num_rows())
|
|
|
|
{
|
|
|
|
$db->next_record();
|
|
|
|
$fullname = $db->f('account_lid');
|
|
|
|
if($db->f('account_lastname') && $db->f('account_firstname'))
|
|
|
|
{
|
|
|
|
+ $fullname = $db->f('account_lastname').', '.$db->f('account_firstname');
|
|
|
|
}
|
|
|
|
return $fullname;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return False;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-03-12 05:30:15 +01:00
|
|
|
function get_long_status($status_short)
|
|
|
|
{
|
|
|
|
switch ($status_short)
|
|
|
|
{
|
|
|
|
case 'A':
|
2001-04-22 23:39:42 +02:00
|
|
|
$status = lang('Accepted');
|
2001-03-12 05:30:15 +01:00
|
|
|
break;
|
|
|
|
case 'R':
|
2001-04-22 23:39:42 +02:00
|
|
|
$status = lang('Rejected');
|
2001-03-12 05:30:15 +01:00
|
|
|
break;
|
|
|
|
case 'T':
|
2001-04-22 23:39:42 +02:00
|
|
|
$status = lang('Tentative');
|
2001-03-12 05:30:15 +01:00
|
|
|
break;
|
|
|
|
case 'U':
|
2001-04-22 23:39:42 +02:00
|
|
|
$status = lang('No Response');
|
2001-03-12 05:30:15 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return $status;
|
|
|
|
}
|
|
|
|
|
2001-04-01 22:49:49 +02:00
|
|
|
function display_status($user_status)
|
|
|
|
{
|
2001-05-13 05:48:17 +02:00
|
|
|
global $phpgw_info;
|
|
|
|
|
2001-04-01 22:49:49 +02:00
|
|
|
if(isset($phpgw_info['user']['preferences']['calendar']['display_status']) && $phpgw_info['user']['preferences']['calendar']['display_status'] == True)
|
|
|
|
{
|
2001-05-13 05:48:17 +02:00
|
|
|
return ' ('.$user_status.')';
|
2001-04-01 22:49:49 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-03-27 02:32:11 +02:00
|
|
|
function get_weekday_start($year,$month,$day)
|
|
|
|
{
|
2001-02-26 13:23:48 +01:00
|
|
|
global $phpgw_info;
|
|
|
|
|
2001-04-29 01:51:52 +02:00
|
|
|
$weekday = $this->day_of_week($year,$month,$day);
|
2001-05-17 02:26:36 +02:00
|
|
|
switch($phpgw_info['user']['preferences']['calendar']['weekdaystarts'])
|
2001-02-26 13:23:48 +01:00
|
|
|
{
|
2001-05-17 02:26:36 +02:00
|
|
|
case 'Monday':
|
|
|
|
$days = Array(
|
|
|
|
0 => 'Mon',
|
|
|
|
1 => 'Tue',
|
|
|
|
2 => 'Wed',
|
|
|
|
3 => 'Thu',
|
|
|
|
4 => 'Fri',
|
|
|
|
5 => 'Sat',
|
|
|
|
6 => 'Sun'
|
|
|
|
);
|
|
|
|
switch($weekday)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
$sday = mktime(2,0,0,$month,$day - 6,$year);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
$sday = mktime(2,0,0,$month,$day,$year);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$sday = mktime(2,0,0,$month,$day - ($weekday - 1),$year);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'Sunday':
|
|
|
|
$days = Array(
|
|
|
|
0 => 'Sun',
|
|
|
|
1 => 'Mon',
|
|
|
|
2 => 'Tue',
|
|
|
|
3 => 'Wed',
|
|
|
|
4 => 'Thu',
|
|
|
|
5 => 'Fri',
|
|
|
|
6 => 'Sat'
|
|
|
|
);
|
|
|
|
$sday = mktime(2,0,0,$month,$day - $weekday,$year);
|
|
|
|
break;
|
|
|
|
// The following is for Arabic support.....
|
|
|
|
case 'Saturday':
|
|
|
|
$days = Array(
|
|
|
|
0 => 'Sat',
|
|
|
|
1 => 'Sun',
|
|
|
|
2 => 'Mon',
|
|
|
|
3 => 'Tue',
|
|
|
|
4 => 'Wed',
|
|
|
|
5 => 'Thu',
|
|
|
|
6 => 'Fri'
|
|
|
|
);
|
|
|
|
switch($weekday)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
$sday = mktime(2,0,0,$month,$day - 1,$year);
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
$sday = mktime(2,0,0,$month,$day,$year);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$sday = mktime(2,0,0,$month,$day - ($weekday + 1),$year);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->days = $days;
|
2001-03-27 02:32:11 +02:00
|
|
|
return $sday;
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
|
|
|
|
2001-05-13 05:48:17 +02:00
|
|
|
function link_to_entry($event,$month,$day,$year)
|
2001-02-26 13:23:48 +01:00
|
|
|
{
|
|
|
|
global $phpgw, $phpgw_info;
|
|
|
|
|
|
|
|
$str = '';
|
2001-05-13 05:48:17 +02:00
|
|
|
$is_private = $this->is_private($event,$this->owner);
|
|
|
|
$editable = ((!$this->printer_friendly) || ((($is_private && (!!($grants[$this->owner] & PHPGW_ACL_PRIVATE) == True)) || !$is_private) && (!!($grants[$this->owner] & PHPGW_ACL_EDIT) == True)));
|
|
|
|
$p = CreateObject('phpgwapi.Template',$this->template_dir);
|
|
|
|
$p->set_unknowns('remove');
|
|
|
|
$templates = Array(
|
|
|
|
'link_picture' => 'link_pict.tpl',
|
|
|
|
);
|
|
|
|
$p->set_file($templates);
|
|
|
|
$p->set_block('link_picture','link_pict','link_pict');
|
|
|
|
$p->set_block('link_picture','pict','pict');
|
|
|
|
$p->set_block('link_picture','link_open','link_open');
|
|
|
|
$p->set_block('link_picture','link_close','link_close');
|
|
|
|
$p->set_block('link_picture','link_text','link_text');
|
|
|
|
$description = $this->get_short_field($event,$is_private,'description');
|
2001-05-06 02:11:12 +02:00
|
|
|
|
2001-05-13 05:48:17 +02:00
|
|
|
$starttime = mktime($event->start->hour,$event->start->min,$event->start->sec,$event->start->month,$event->start->mday,$event->start->year) - $this->tz_offset;
|
|
|
|
$endtime = mktime($event->end->hour,$event->end->min,$event->end->sec,$event->end->month,$event->end->mday,$event->end->year) - $this->tz_offset;
|
|
|
|
$rawdate = mktime(0,0,0,$month,$day,$year);
|
|
|
|
$rawdate_offset = $rawdate - $this->tz_offset;
|
|
|
|
$nextday = mktime(0,0,0,$month,$day + 1,$year) - $this->tz_offset;
|
|
|
|
if (intval($phpgw->common->show_date($starttime,'Hi')) && $starttime == $endtime)
|
|
|
|
{
|
|
|
|
$time = $phpgw->common->show_date($starttime,'Hi');
|
|
|
|
}
|
|
|
|
elseif ($starttime <= $rawdate_offset && $endtime >= $nextday - 60)
|
|
|
|
{
|
|
|
|
$time = '[ '.lang('All Day').' ]';
|
|
|
|
}
|
|
|
|
elseif (intval($phpgw->common->show_date($starttime,'Hi')) || $starttime != $endtime)
|
|
|
|
{
|
|
|
|
if($starttime < $rawdate_offset && $event->recur_type==RECUR_NONE)
|
|
|
|
{
|
|
|
|
$start_time = $phpgw->common->show_date($rawdate_offset,$this->users_timeformat);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$start_time = $phpgw->common->show_date($starttime,$this->users_timeformat);
|
|
|
|
}
|
2001-05-06 02:11:12 +02:00
|
|
|
|
2001-05-13 05:48:17 +02:00
|
|
|
if($endtime >= ($rawdate_offset + 86400))
|
|
|
|
{
|
|
|
|
$end_time = $phpgw->common->show_date(mktime(23,59,59,$month,$day,$year) - $this->tz_offset,$this->users_timeformat);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$end_time = $phpgw->common->show_date($endtime,$this->users_timeformat);
|
|
|
|
}
|
|
|
|
$time = $start_time.'-'.$end_time;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$time = '';
|
|
|
|
}
|
|
|
|
$text = '<font size="-2" face="'.$phpgw_info['theme']['font'].'"><nobr>'.$time.'</nobr> '.$this->get_short_field($event,$is_private,'title');
|
|
|
|
if(!$is_private)
|
|
|
|
{
|
|
|
|
$text .= $this->display_status($event->users_status);
|
|
|
|
}
|
|
|
|
$text .= '</font>'.$this->br;
|
2001-05-06 02:11:12 +02:00
|
|
|
|
2001-05-13 05:48:17 +02:00
|
|
|
|
|
|
|
if ($editable)
|
|
|
|
{
|
|
|
|
$p->set_var('link_link',$phpgw->link('/calendar/view.php','id='.$event->id.'&owner='.$this->owner));
|
|
|
|
$p->set_var('lang_view',lang('View this entry'));
|
|
|
|
$p->parse('picture','link_open',True);
|
|
|
|
|
|
|
|
if($event->priority == 3)
|
2001-05-06 02:11:12 +02:00
|
|
|
{
|
2001-05-13 05:48:17 +02:00
|
|
|
$picture[] = Array(
|
|
|
|
'pict' => $phpgw->common->image('calendar','high.gif'),
|
|
|
|
'width' => 8,
|
2001-05-15 06:14:30 +02:00
|
|
|
'height' => 17
|
2001-05-13 05:48:17 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
if($event->recur_type == RECUR_NONE)
|
|
|
|
{
|
|
|
|
$picture[] = Array(
|
|
|
|
'pict' => $phpgw->common->image('calendar','circle.gif'),
|
|
|
|
'width' => 5,
|
2001-05-15 06:14:30 +02:00
|
|
|
'height' => 7
|
2001-05-13 05:48:17 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$picture[] = Array(
|
|
|
|
'pict' => $phpgw->common->image('calendar','recur.gif'),
|
|
|
|
'width' => 12,
|
2001-05-15 06:14:30 +02:00
|
|
|
'height' => 12
|
2001-05-13 05:48:17 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
if(count($event->participants) > 1)
|
|
|
|
{
|
|
|
|
$picture[] = Array(
|
|
|
|
'pict' => $phpgw->common->image('calendar','multi_3.gif'),
|
|
|
|
'width' => 14,
|
2001-05-15 06:14:30 +02:00
|
|
|
'height' => 14
|
|
|
|
);
|
|
|
|
}
|
|
|
|
if($event->is_public == 0)
|
|
|
|
{
|
|
|
|
$picture[] = Array(
|
|
|
|
'pict' => $phpgw->common->image('calendar','private.gif'),
|
|
|
|
'width' => 13,
|
|
|
|
'height' => 13
|
2001-05-13 05:48:17 +02:00
|
|
|
);
|
2001-05-06 02:11:12 +02:00
|
|
|
}
|
|
|
|
|
2001-05-13 05:48:17 +02:00
|
|
|
for($i=0;$i<count($picture);$i++)
|
|
|
|
{
|
|
|
|
$var = Array(
|
|
|
|
'pic_image' => $picture[$i]['pict'],
|
|
|
|
'width' => $picture[$i]['width'],
|
|
|
|
'height' => $picture[$i]['height'],
|
|
|
|
'description' => $description
|
|
|
|
);
|
|
|
|
$p->set_var($var);
|
|
|
|
$p->parse('picture','pict',True);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($text)
|
|
|
|
{
|
|
|
|
$p->set_var('text',$text);
|
|
|
|
$p->parse('picture','link_text',True);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($editable)
|
|
|
|
{
|
|
|
|
$p->parse('picture','link_close',True);
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
2001-05-13 05:48:17 +02:00
|
|
|
$str = $p->fp('out','link_pict');
|
|
|
|
unset($p);
|
2001-02-26 13:23:48 +01:00
|
|
|
return $str;
|
|
|
|
}
|
|
|
|
|
2001-05-13 05:48:17 +02:00
|
|
|
function is_private($event,$owner,$field='')
|
2001-02-26 13:23:48 +01:00
|
|
|
{
|
2001-03-20 04:34:41 +01:00
|
|
|
global $phpgw, $phpgw_info, $grants;
|
2001-02-26 13:23:48 +01:00
|
|
|
|
2001-03-20 04:34:41 +01:00
|
|
|
if($owner == 0) { $owner = $phpgw_info['user']['account_id']; }
|
2001-05-13 05:48:17 +02:00
|
|
|
if ($owner == $phpgw_info['user']['account_id'] || (!!($grants[$owner] & PHPGW_ACL_PRIVATE) == True) || ($event->is_public == 1))
|
2001-02-26 13:23:48 +01:00
|
|
|
{
|
2001-04-27 04:20:55 +02:00
|
|
|
$is_private = False;
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
2001-05-13 05:48:17 +02:00
|
|
|
elseif($event->is_public == 0)
|
2001-02-26 13:23:48 +01:00
|
|
|
{
|
|
|
|
$is_private = True;
|
|
|
|
}
|
2001-05-13 05:48:17 +02:00
|
|
|
elseif($event->is_public == 2)
|
2001-02-26 13:23:48 +01:00
|
|
|
{
|
|
|
|
$is_private = True;
|
|
|
|
$groups = $phpgw->accounts->memberships($owner);
|
|
|
|
while ($group = each($groups))
|
|
|
|
{
|
2001-03-20 03:49:32 +01:00
|
|
|
if (strpos(' '.implode($event->groups,',').' ',$group[1]['account_id']))
|
2001-02-26 13:23:48 +01:00
|
|
|
{
|
|
|
|
$is_private = False;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-04-27 04:20:55 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
$is_private = False;
|
|
|
|
}
|
2001-02-26 13:23:48 +01:00
|
|
|
|
2001-05-13 05:48:17 +02:00
|
|
|
return $is_private;
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_short_field($event,$is_private=True,$field='')
|
|
|
|
{
|
2001-02-26 13:23:48 +01:00
|
|
|
if ($is_private)
|
|
|
|
{
|
|
|
|
$str = 'private';
|
|
|
|
}
|
2001-03-16 04:56:32 +01:00
|
|
|
elseif (strlen($event->$field) > 19)
|
2001-02-26 13:23:48 +01:00
|
|
|
{
|
2001-03-16 04:56:32 +01:00
|
|
|
$str = substr($event->$field, 0 , 19) . '...';
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-03-16 04:56:32 +01:00
|
|
|
$str = $event->$field;
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
2001-03-12 05:30:15 +01:00
|
|
|
|
2001-02-26 13:23:48 +01:00
|
|
|
return $str;
|
|
|
|
}
|
|
|
|
|
2001-03-31 16:32:50 +02:00
|
|
|
function change_owner($account_id,$new_owner)
|
|
|
|
{
|
|
|
|
if($phpgw_info['server']['calendar_type'] == 'sql')
|
|
|
|
{
|
2001-04-27 04:20:55 +02:00
|
|
|
$this->stream->query('UPDATE phpgw_cal SET owner='.$new_owner.' WHERE owner='.$account_id,__LINE__,__FILE__);
|
2001-04-27 19:37:59 +02:00
|
|
|
$this->stream->query('UPDATE phpgw_cal_user SET cal_login='.$new_owner.' WHERE cal_login='.$account_id);
|
2001-03-31 16:32:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-26 13:23:48 +01:00
|
|
|
function read_repeated_events($owner=0)
|
|
|
|
{
|
|
|
|
global $phpgw, $phpgw_info;
|
|
|
|
|
|
|
|
$this->set_filter();
|
|
|
|
$owner = $owner == 0?$phpgw_info['user']['account_id']:$owner;
|
2001-04-27 19:37:59 +02:00
|
|
|
$sql = "AND (phpgw_cal.cal_type='M') "
|
|
|
|
. 'AND (phpgw_cal_user.cal_login='.$owner.' '
|
2001-04-27 04:20:55 +02:00
|
|
|
. 'AND ((phpgw_cal_repeats.recur_enddate >= '.$this->end_repeat_day.') OR (phpgw_cal_repeats.recur_enddate=0))';
|
2001-02-26 13:23:48 +01:00
|
|
|
|
|
|
|
// Private
|
|
|
|
if(strpos($this->filter,'private'))
|
|
|
|
{
|
2001-04-27 04:47:54 +02:00
|
|
|
$sql .= " AND phpgw_cal.is_public=0";
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
|
|
|
|
2001-04-27 04:20:55 +02:00
|
|
|
$sql .= ') ORDER BY phpgw_cal.datetime ASC, phpgw_cal.edatetime ASC, phpgw_cal.priority ASC';
|
2001-02-26 13:23:48 +01:00
|
|
|
|
|
|
|
$events = $this->get_event_ids(True,$sql);
|
|
|
|
|
|
|
|
if($events == False)
|
|
|
|
{
|
|
|
|
$this->repeated_events = Null;
|
|
|
|
$this->repeating_events = False;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->repeated_events = $events;
|
2001-04-20 19:32:19 +02:00
|
|
|
$c_events = count($events);
|
|
|
|
for($i=0;$i<$c_events;$i++)
|
2001-02-27 05:42:18 +01:00
|
|
|
{
|
|
|
|
$this->repeating_events[] = $this->fetch_event($this->stream,$events[$i]);
|
|
|
|
}
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function check_repeating_entries($datetime)
|
|
|
|
{
|
|
|
|
global $phpgw, $phpgw_info;
|
|
|
|
|
|
|
|
$this->repeating_event_matches = 0;
|
|
|
|
|
|
|
|
if(count($this->repeated_events) <= 0)
|
|
|
|
{
|
|
|
|
return False;
|
|
|
|
}
|
|
|
|
|
|
|
|
$link = Array();
|
2001-03-06 13:07:33 +01:00
|
|
|
$search_date_full = date('Ymd',$datetime);
|
|
|
|
$search_date_year = date('Y',$datetime);
|
|
|
|
$search_date_month = date('m',$datetime);
|
|
|
|
$search_date_day = date('d',$datetime);
|
|
|
|
$search_date_dow = date('w',$datetime);
|
|
|
|
$search_beg_day = mktime(0,0,0,$search_date_month,$search_date_day,$search_date_year);
|
2001-04-20 19:32:19 +02:00
|
|
|
$r_events = count($this->repeated_events);
|
|
|
|
for ($i=0;$i<$r_events;$i++)
|
2001-02-26 13:23:48 +01:00
|
|
|
{
|
|
|
|
$rep_events = $this->repeating_events[$i];
|
|
|
|
$id = $rep_events->id;
|
2001-03-06 13:07:33 +01:00
|
|
|
$event_beg_day = mktime(0,0,0,$rep_events->start->month,$rep_events->start->mday,$rep_events->start->year);
|
|
|
|
$event_recur_time = mktime($rep_events->recur_enddate->hour,$rep_events->recur_enddate->min,$rep_events->recur_enddate->sec,$rep_events->recur_enddate->month,$rep_events->recur_enddate->mday,$rep_events->recur_enddate->year);
|
|
|
|
if($event_recur_time != 0)
|
2001-02-26 13:23:48 +01:00
|
|
|
{
|
2001-03-06 13:07:33 +01:00
|
|
|
$end_recur_date = date('Ymd',$event_recur_time);
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-03-06 13:07:33 +01:00
|
|
|
$end_recur_date = date('Ymd',mktime(0,0,0,1,1,2007));
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
2001-03-06 13:07:33 +01:00
|
|
|
$full_event_date = date('Ymd',$event_beg_day);
|
2001-02-26 13:23:48 +01:00
|
|
|
|
|
|
|
// only repeat after the beginning, and if there is an rpt_end before the end date
|
2001-05-03 01:23:48 +02:00
|
|
|
if ((($rep_events->recur_enddate->month && $rep_events->recur_enddate->mday && $rep_events->recur_enddate->year) &&
|
|
|
|
($search_date_full > $end_recur_date)) || ($search_date_full < $full_event_date))
|
2001-02-26 13:23:48 +01:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2001-03-06 13:07:33 +01:00
|
|
|
if ($search_date_full == $full_event_date)
|
2001-02-26 13:23:48 +01:00
|
|
|
{
|
|
|
|
$link[$this->repeating_event_matches++] = $id;
|
|
|
|
}
|
2001-03-05 05:33:00 +01:00
|
|
|
else
|
2001-02-26 13:23:48 +01:00
|
|
|
{
|
2001-03-05 05:33:00 +01:00
|
|
|
switch($rep_events->recur_type)
|
2001-02-26 13:23:48 +01:00
|
|
|
{
|
2001-03-05 05:33:00 +01:00
|
|
|
case RECUR_DAILY:
|
2001-03-06 13:07:33 +01:00
|
|
|
if (floor(($search_beg_day - $event_beg_day)/86400) % $rep_events->recur_interval)
|
2001-03-05 05:33:00 +01:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$link[$this->repeating_event_matches++] = $id;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RECUR_WEEKLY:
|
2001-04-27 04:20:55 +02:00
|
|
|
if (floor(($search_beg_day - $event_beg_day)/604800) % $rep_events->recur_interval)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2001-03-05 05:33:00 +01:00
|
|
|
$check = 0;
|
2001-03-06 13:07:33 +01:00
|
|
|
switch($search_date_dow)
|
2001-03-05 05:33:00 +01:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
$check = M_SUNDAY;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
$check = M_MONDAY;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
$check = M_TUESDAY;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
$check = M_WEDNESDAY;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
$check = M_THURSDAY;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
$check = M_FRIDAY;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
$check = M_SATURDAY;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ($rep_events->recur_data & $check)
|
|
|
|
{
|
|
|
|
$link[$this->repeating_event_matches++] = $id;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RECUR_MONTHLY_WDAY:
|
2001-03-06 13:07:33 +01:00
|
|
|
if ((($search_date_year - $rep_events->start->year) * 12 + $search_date_month - $rep_events->start->month) % $rep_events->recur_interval)
|
2001-03-05 05:33:00 +01:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2001-02-26 13:23:48 +01:00
|
|
|
|
2001-03-06 13:07:33 +01:00
|
|
|
if (($this->day_of_week($rep_events->start->year,$rep_events->start->month,$rep_events->start->mday) == $this->day_of_week($search_date_year,$search_date_month,$search_date_day)) &&
|
|
|
|
(ceil($rep_events->start->mday/7) == ceil($search_date_day/7)))
|
2001-03-05 05:33:00 +01:00
|
|
|
{
|
|
|
|
$link[$this->repeating_event_matches++] = $id;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RECUR_MONTHLY_MDAY:
|
2001-03-06 13:07:33 +01:00
|
|
|
if ((($search_date_year - $rep_events->start->year) * 12 + $search_date_month - $rep_events->start->month) % $rep_events->recur_interval)
|
2001-03-05 05:33:00 +01:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2001-02-26 13:23:48 +01:00
|
|
|
|
2001-03-06 13:07:33 +01:00
|
|
|
if ($search_date_day == $rep_events->start->mday)
|
2001-03-05 05:33:00 +01:00
|
|
|
{
|
|
|
|
$link[$this->repeating_event_matches++] = $id;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RECUR_YEARLY:
|
2001-03-06 13:07:33 +01:00
|
|
|
if (($search_date_year - $rep_events->start->year) % $rep_events->recur_interval)
|
2001-03-05 05:33:00 +01:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2001-02-26 13:23:48 +01:00
|
|
|
|
2001-03-06 13:07:33 +01:00
|
|
|
if (date('dm',$datetime) == date('dm',$event_beg_day))
|
2001-03-05 05:33:00 +01:00
|
|
|
{
|
|
|
|
$link[$this->repeating_event_matches++] = $id;
|
|
|
|
}
|
|
|
|
break;
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} // end for loop
|
|
|
|
|
|
|
|
if($this->repeating_event_matches > 0)
|
|
|
|
{
|
|
|
|
return $link;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return False;
|
|
|
|
}
|
|
|
|
} // end function
|
|
|
|
|
|
|
|
function get_sorted_by_date($datetime,$owner=0)
|
|
|
|
{
|
|
|
|
global $phpgw, $phpgw_info;
|
|
|
|
|
|
|
|
$this->sorted_events_matching = 0;
|
|
|
|
$this->set_filter();
|
|
|
|
$owner = !$owner?$phpgw_info['user']['account_id']:$owner;
|
2001-04-20 19:32:19 +02:00
|
|
|
$repeating_events_matched = $this->check_repeating_entries($datetime - $this->tz_offset);
|
2001-05-13 05:48:17 +02:00
|
|
|
$eod = $datetime + 86399;
|
2001-04-27 19:37:59 +02:00
|
|
|
$sql = "AND (phpgw_cal.cal_type != 'M') "
|
2001-05-13 05:48:17 +02:00
|
|
|
. 'AND ((phpgw_cal.datetime >= '.$datetime.' AND phpgw_cal.datetime <= '.$eod.') '
|
|
|
|
. 'OR (phpgw_cal.datetime <= '.$datetime.' AND phpgw_cal.edatetime >= '.$eod.') '
|
|
|
|
. 'OR (phpgw_cal.edatetime >= '.$datetime.' AND phpgw_cal.edatetime <= '.$eod.')) '
|
2001-04-27 19:37:59 +02:00
|
|
|
. 'AND (phpgw_cal_user.cal_login='.$owner;
|
2001-02-26 13:23:48 +01:00
|
|
|
|
|
|
|
// Private
|
|
|
|
if(strpos($this->filter,'private'))
|
|
|
|
{
|
2001-04-27 04:47:54 +02:00
|
|
|
$sql .= " AND phpgw_cal.is_public=0";
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
|
|
|
|
2001-04-27 04:20:55 +02:00
|
|
|
$sql .= ') ORDER BY phpgw_cal.datetime ASC, phpgw_cal.edatetime ASC, phpgw_cal.priority ASC';
|
2001-02-25 05:06:15 +01:00
|
|
|
|
2001-02-26 13:23:48 +01:00
|
|
|
$event = $this->get_event_ids(False,$sql);
|
|
|
|
|
|
|
|
if($this->repeating_event_matches == False && $event == False)
|
|
|
|
{
|
|
|
|
return False;
|
|
|
|
}
|
|
|
|
|
|
|
|
if($this->repeating_event_matches != False)
|
|
|
|
{
|
|
|
|
reset($repeating_events_matched);
|
|
|
|
while(list($key,$value) = each($repeating_events_matched))
|
|
|
|
{
|
|
|
|
$event[] = $value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->sorted_events_matching = count($event);
|
|
|
|
|
|
|
|
if($this->sorted_events_matching == 0)
|
|
|
|
{
|
|
|
|
return False;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-02-27 05:42:18 +01:00
|
|
|
for($i=0;$i<$this->sorted_events_matching;$i++)
|
|
|
|
{
|
|
|
|
$events[] = $this->fetch_event($this->stream,$event[$i]);
|
|
|
|
}
|
|
|
|
|
2001-02-26 13:23:48 +01:00
|
|
|
if($this->sorted_events_matching == 1)
|
|
|
|
{
|
|
|
|
return $events;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for($outer_loop=0;$outer_loop<($this->sorted_events_matching - 1);$outer_loop++)
|
|
|
|
{
|
|
|
|
$outer = $events[$outer_loop];
|
|
|
|
$outer_time = $phpgw->common->show_date($outer->datetime,'Hi');
|
|
|
|
$outer_etime = $phpgw->common->show_date($outer->edatetime,'Hi');
|
|
|
|
|
|
|
|
if($outer->datetime < $datetime)
|
|
|
|
{
|
|
|
|
$outer_time = 0;
|
|
|
|
}
|
|
|
|
|
2001-05-13 05:48:17 +02:00
|
|
|
if($outer->edatetime > $eod)
|
2001-02-26 13:23:48 +01:00
|
|
|
{
|
|
|
|
$outer_etime = 2359;
|
|
|
|
}
|
|
|
|
|
|
|
|
for($inner_loop=$outer_loop;$inner_loop<$this->sorted_events_matching;$inner_loop++)
|
|
|
|
{
|
|
|
|
$inner = $events[$inner_loop];
|
|
|
|
$inner_time = $phpgw->common->show_date($inner->datetime,'Hi');
|
|
|
|
$inner_etime = $phpgw->common->show_date($inner->edatetime,'Hi');
|
|
|
|
|
|
|
|
if($inner->datetime < $datetime)
|
|
|
|
{
|
|
|
|
$inner_time = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if($inner->edatetime > ($datetime + 86399))
|
|
|
|
{
|
|
|
|
$inner_etime = 2359;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(($outer_time > $inner_time) ||
|
|
|
|
(($outer_time == $inner_time) && ($outer_etime > $inner_etime)))
|
|
|
|
{
|
|
|
|
$temp = $events[$inner_loop];
|
|
|
|
$events[$inner_loop] = $events[$outer_loop];
|
|
|
|
$events[$outer_loop] = $temp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($events))
|
|
|
|
{
|
|
|
|
return $events;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return False;
|
|
|
|
}
|
|
|
|
}
|
2001-02-20 04:48:39 +01:00
|
|
|
|
2001-04-23 02:04:38 +02:00
|
|
|
function mini_calendar($day,$month,$year,$link='',$buttons="none",$outside_month=True)
|
2001-02-24 16:56:52 +01:00
|
|
|
{
|
|
|
|
global $phpgw, $phpgw_info, $view;
|
|
|
|
|
|
|
|
$date = $this->makegmttime(0,0,0,$month,$day,$year);
|
|
|
|
$month_ago = intval(date('Ymd',mktime(0,0,0,$month - 1,$day,$year)));
|
|
|
|
$month_ahead = intval(date('Ymd',mktime(0,0,0,$month + 1,$day,$year)));
|
|
|
|
$monthstart = intval(date('Ymd',mktime(0,0,0,$month,1,$year)));
|
|
|
|
$monthend = intval(date('Ymd',mktime(0,0,0,$month + 1,0,$year)));
|
|
|
|
|
|
|
|
$weekstarttime = $this->get_weekday_start($year,$month,1);
|
|
|
|
|
|
|
|
$p = CreateObject('phpgwapi.Template',$this->template_dir);
|
|
|
|
$p->set_unknowns('remove');
|
|
|
|
|
|
|
|
$templates = Array(
|
2001-05-13 05:48:17 +02:00
|
|
|
'mini_calendar' => 'mini_cal.tpl'
|
2001-02-24 16:56:52 +01:00
|
|
|
);
|
|
|
|
$p->set_file($templates);
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->set_block('mini_calendar','mini_cal','mini_cal');
|
|
|
|
$p->set_block('mini_calendar','mini_week','mini_week');
|
|
|
|
$p->set_block('mini_calendar','mini_day','mini_day');
|
2001-02-24 16:56:52 +01:00
|
|
|
|
|
|
|
if($this->printer_firendly == False)
|
|
|
|
{
|
2001-03-09 13:23:12 +01:00
|
|
|
$month = '<a href="' . $phpgw->link('/calendar/month.php','month='.date('m',$date['raw']).'&year='.date('Y',$date['raw']).'&owner='.$this->owner) . '" class="minicalendar">' . lang($phpgw->common->show_date($date['raw'],'F')).' '.$year . '</a>';
|
2001-02-24 16:56:52 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$month = lang($phpgw->common->show_date($date['raw'],'F')).' '.$year;
|
|
|
|
}
|
|
|
|
|
|
|
|
$var = Array(
|
|
|
|
'cal_img_root' => $this->image_dir,
|
|
|
|
'bgcolor' => $phpgw_info['theme']['bg_color'],
|
|
|
|
'bgcolor1' => $phpgw_info['theme']['bg_color'],
|
|
|
|
'month' => $month,
|
2001-05-01 21:29:38 +02:00
|
|
|
'bgcolor2' => $phpgw_info['theme']['cal_dayview'],
|
|
|
|
'holiday_color' => (substr($phpgw_info['theme']['bg07'],0,1)=='#'?'':'#').$phpgw_info['theme']['bg07']
|
2001-02-24 16:56:52 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
$p->set_var($var);
|
2001-04-18 19:27:02 +02:00
|
|
|
|
|
|
|
switch(strtolower($buttons))
|
|
|
|
{
|
|
|
|
case 'right':
|
|
|
|
$var = Array(
|
|
|
|
'nextmonth' => '<a href="'.$phpgw->link('/calendar/month.php','date='.$month_ahead.'&owner='.$this->owner).'"><img src="'.$this->phpgwapi_template_dir.'/right.gif" border="0"></a>'
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case 'left':
|
|
|
|
$var = Array(
|
|
|
|
'prevmonth' => '<a href="'.$phpgw->link('/calendar/month.php','date='.$month_ago.'&owner='.$this->owner).'"><img src="'.$this->phpgwapi_template_dir.'/left.gif" border="0"></a>'
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case 'both':
|
|
|
|
$var = Array(
|
|
|
|
'prevmonth' => '<a href="'.$phpgw->link('/calendar/month.php','date='.$month_ago.'&owner='.$this->owner).'"><img src="'.$this->phpgwapi_template_dir.'/left.gif" border="0"></a>',
|
|
|
|
'nextmonth' => '<a href="'.$phpgw->link('/calendar/month.php','date='.$month_ahead.'&owner='.$this->owner).'"><img src="'.$this->phpgwapi_template_dir.'/right.gif" border="0"></a>'
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case 'none':
|
|
|
|
default:
|
|
|
|
$var = Array(
|
|
|
|
'prevmonth' => '',
|
|
|
|
'nextmonth' => ''
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
$p->set_var($var);
|
|
|
|
|
2001-02-24 16:56:52 +01:00
|
|
|
for($i=0;$i<7;$i++)
|
|
|
|
{
|
|
|
|
$p->set_var('dayname','<b>' . substr(lang($this->days[$i]),0,2) . '</b>');
|
|
|
|
$p->parse('daynames','mini_day',True);
|
|
|
|
}
|
|
|
|
for($i=$weekstarttime;date('Ymd',$i)<=$monthend;$i += (24 * 3600 * 7))
|
|
|
|
{
|
|
|
|
for($j=0;$j<7;$j++)
|
|
|
|
{
|
|
|
|
$str = '';
|
|
|
|
$cal = $this->gmtdate($i + ($j * 24 * 3600));
|
2001-05-01 21:29:38 +02:00
|
|
|
$cal = $this->makegmttime(0,0,0,$cal['month'],$cal['day'],$cal['year']);
|
2001-02-24 16:56:52 +01:00
|
|
|
if($cal['full'] >= $monthstart && $cal['full'] <= $monthend)
|
|
|
|
{
|
2001-05-01 21:29:38 +02:00
|
|
|
$day_image = '';
|
2001-02-24 16:56:52 +01:00
|
|
|
if ($cal['full'] == $this->today['full'])
|
|
|
|
{
|
2001-05-01 21:29:38 +02:00
|
|
|
$day_image .= ' background="'.$this->image_dir.'/mini_day_block.gif"';
|
|
|
|
}
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// $p->set_var('bgcolor2','#FFFFFF');
|
|
|
|
// }
|
|
|
|
|
|
|
|
$p->set_var('day_image',$day_image);
|
|
|
|
|
|
|
|
|
|
|
|
$holiday_found = $this->holidays->find_date($cal['raw']);
|
|
|
|
if($holiday_found != False)
|
|
|
|
{
|
|
|
|
$class = 'minicalhol';
|
2001-02-24 16:56:52 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-05-01 21:29:38 +02:00
|
|
|
$class = 'minicalendar';
|
2001-02-24 16:56:52 +01:00
|
|
|
}
|
2001-05-01 21:29:38 +02:00
|
|
|
|
2001-02-24 16:56:52 +01:00
|
|
|
if(!$this->printer_friendly)
|
|
|
|
{
|
2001-05-01 21:29:38 +02:00
|
|
|
$str .= '<a href="'.$phpgw->link('/calendar/'.$link,'year='.$cal['year'].'&month='.$cal['month'].'&day='.$cal['day'].'&owner='.$this->owner).'" class="'.$class.'">';
|
2001-02-24 16:56:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$str .= $cal['day'];
|
|
|
|
|
|
|
|
if (!$this->printer_friendly)
|
|
|
|
{
|
|
|
|
$str .= '</a>';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($cal['full'] == $this->today['full'])
|
|
|
|
{
|
|
|
|
$p->set_var('dayname',"<b>$str</b>");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$p->set_var('dayname',$str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-05-01 21:29:38 +02:00
|
|
|
$holiday_found = $this->holidays->find_date($cal['raw']);
|
2001-04-23 02:04:38 +02:00
|
|
|
if($outside_month == True)
|
|
|
|
{
|
2001-05-01 21:29:38 +02:00
|
|
|
if($holiday_found == False)
|
|
|
|
{
|
|
|
|
$class = 'minicalendargrey';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$class = 'minicalgreyhol';
|
|
|
|
}
|
|
|
|
$p->set_var('day_image','');
|
|
|
|
$p->set_var('dayname','<a href="'.$phpgw->link('/calendar/'.$link,'year='.$cal['year'].'&month='.$cal['month'].'&day='.$cal['day']).'" class="'.$class.'">'.$cal['day'].'</a>');
|
2001-04-23 02:04:38 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$p->set_var('day_image','');
|
2001-05-01 21:29:38 +02:00
|
|
|
// $p->set_var('bgcolor2','#FEFEFE');
|
2001-04-23 02:04:38 +02:00
|
|
|
$p->set_var('dayname','');
|
|
|
|
}
|
2001-02-24 16:56:52 +01:00
|
|
|
}
|
|
|
|
$p->parse('monthweek_day','mini_day',True);
|
|
|
|
}
|
|
|
|
$p->parse('display_monthweek','mini_week',True);
|
|
|
|
$p->set_var('dayname','');
|
|
|
|
$p->set_var('monthweek_day','');
|
|
|
|
}
|
|
|
|
|
|
|
|
$return_value = $p->finish($p->parse('out','mini_cal'));
|
|
|
|
unset($p);
|
|
|
|
return $return_value;
|
|
|
|
}
|
|
|
|
|
2001-02-25 05:06:15 +01:00
|
|
|
function overlap($starttime,$endtime,$participants,$owner=0,$id=0)
|
|
|
|
{
|
|
|
|
global $phpgw, $phpgw_info;
|
|
|
|
|
|
|
|
$retval = Array();
|
|
|
|
$ok = False;
|
|
|
|
|
2001-04-01 22:49:49 +02:00
|
|
|
$starttime -= $this->tz_offset;
|
|
|
|
$endtime -= $this->tz_offset;
|
2001-02-25 05:06:15 +01:00
|
|
|
|
|
|
|
if($starttime == $endtime)
|
|
|
|
{
|
2001-04-01 22:49:49 +02:00
|
|
|
$endtime = mktime(0,0,0,$phpgw->common->show_date($starttime,'m'),$phpgw->common->show_date($starttime,'d') + 1,$phpgw->common->show_date($starttime,'Y')) - $this->tz_offset - 1;
|
2001-02-25 05:06:15 +01:00
|
|
|
}
|
|
|
|
|
2001-04-27 04:20:55 +02:00
|
|
|
$sql = 'AND ((('.$starttime.' <= phpgw_cal.datetime) AND ('.$endtime.' >= phpgw_cal.datetime) AND ('.$endtime.' <= phpgw_cal.edatetime)) '
|
|
|
|
. 'OR (('.$starttime.' >= phpgw_cal.datetime) AND ('.$starttime.' < phpgw_cal.edatetime) AND ('.$endtime.' >= phpgw_cal.edatetime)) '
|
|
|
|
. 'OR (('.$starttime.' <= phpgw_cal.datetime) AND ('.$endtime.' >= phpgw_cal.edatetime)) '
|
|
|
|
. 'OR (('.$starttime.' >= phpgw_cal.datetime) AND ('.$endtime.' <= phpgw_cal.edatetime))) ';
|
2001-02-25 05:06:15 +01:00
|
|
|
|
|
|
|
if(count($participants) > 0)
|
|
|
|
{
|
|
|
|
$p_g = '';
|
|
|
|
if(count($participants))
|
|
|
|
{
|
|
|
|
for($i=0;$i<count($participants);$i++)
|
|
|
|
{
|
|
|
|
if($i > 0)
|
|
|
|
{
|
|
|
|
$p_g .= ' OR ';
|
|
|
|
}
|
2001-04-27 19:37:59 +02:00
|
|
|
$p_g .= 'phpgw_cal_user.cal_login='.$participants[$i];
|
2001-02-25 05:06:15 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if($p_g)
|
|
|
|
{
|
|
|
|
$sql .= ' AND (' . $p_g . ')';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if($id)
|
|
|
|
{
|
2001-04-27 19:37:59 +02:00
|
|
|
$sql .= ' AND phpgw_cal.cal_id <> '.$id;
|
2001-02-25 05:06:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$db2 = $phpgw->db;
|
|
|
|
|
|
|
|
$events = $this->get_event_ids(False,$sql);
|
|
|
|
if($events == False)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
for($i=0;$i<count($events);$i++)
|
|
|
|
{
|
2001-04-27 19:37:59 +02:00
|
|
|
$db2->query('SELECT recur_type FROM phpgw_cal_repeats WHERE cal_id='.$events[$i],__LINE__,__FILE__);
|
2001-02-25 05:06:15 +01:00
|
|
|
if($db2->num_rows() == 0)
|
|
|
|
{
|
|
|
|
$retval[] = $events[$i];
|
|
|
|
$ok = True;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$db2->next_record();
|
2001-04-27 04:20:55 +02:00
|
|
|
if($db2->f('recur_type') <> RECUR_MONTHLY_MDAY)
|
2001-02-25 05:06:15 +01:00
|
|
|
{
|
|
|
|
$retval[] = $events[$i];
|
|
|
|
$ok = True;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($ok == True)
|
|
|
|
{
|
|
|
|
return $retval;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return False;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-26 13:23:48 +01:00
|
|
|
function large_month_header($month,$year,$display_name = False)
|
|
|
|
{
|
|
|
|
global $phpgw_info;
|
|
|
|
|
|
|
|
$this->weekstarttime = $this->get_weekday_start($year,$month,1);
|
|
|
|
|
|
|
|
$p = CreateObject('phpgwapi.Template',$this->template_dir);
|
|
|
|
$p->set_unknowns('remove');
|
|
|
|
$templates = Array (
|
2001-05-13 05:48:17 +02:00
|
|
|
'month_header' => 'month_header.tpl'
|
2001-02-26 13:23:48 +01:00
|
|
|
);
|
|
|
|
$p->set_file($templates);
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->set_block('month_header','monthly_header','monthly_header');
|
|
|
|
$p->set_block('month_header','column_title','column_title');
|
2001-02-26 13:23:48 +01:00
|
|
|
|
|
|
|
$var = Array(
|
|
|
|
'bgcolor' => $phpgw_info['theme']['th_bg'],
|
|
|
|
'font_color' => $phpgw_info['theme']['th_text']
|
|
|
|
);
|
|
|
|
$p->set_var($var);
|
|
|
|
|
2001-04-27 04:20:55 +02:00
|
|
|
$p->set_var('col_width','14');
|
2001-02-26 13:23:48 +01:00
|
|
|
if($display_name == True)
|
|
|
|
{
|
|
|
|
$p->set_var('col_title',lang('name'));
|
|
|
|
$p->parse('column_header','column_title',True);
|
2001-04-27 04:20:55 +02:00
|
|
|
$p->set_var('col_width','12');
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
for($i=0;$i<7;$i++)
|
|
|
|
{
|
|
|
|
$p->set_var('col_title',lang($this->days[$i]));
|
|
|
|
$p->parse('column_header','column_title',True);
|
|
|
|
}
|
|
|
|
|
2001-05-13 05:48:17 +02:00
|
|
|
return $p->finish($p->parse('out','monthly_header'));
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function display_week($startdate,$weekly,$cellcolor,$display_name = False,$owner=0,$monthstart=0,$monthend=0)
|
|
|
|
{
|
2001-03-20 04:34:41 +01:00
|
|
|
global $phpgw, $phpgw_info, $grants;
|
|
|
|
|
|
|
|
if($owner == 0) { $owner= $phpgw_info['user']['account_id']; }
|
2001-02-26 13:23:48 +01:00
|
|
|
|
2001-05-13 05:48:17 +02:00
|
|
|
$temp_owner = $this->owner;
|
|
|
|
$this->owner = $owner;
|
|
|
|
|
2001-02-26 13:23:48 +01:00
|
|
|
$str = '';
|
2001-05-13 05:48:17 +02:00
|
|
|
$browser = CreateObject('phpgwapi.browser');
|
2001-02-26 13:23:48 +01:00
|
|
|
$gr_events = CreateObject('calendar.calendar_item');
|
|
|
|
$lr_events = CreateObject('calendar.calendar_item');
|
|
|
|
$p = CreateObject('phpgwapi.Template',$this->template_dir);
|
2001-04-21 19:43:25 +02:00
|
|
|
$p->set_unknowns('keep');
|
2001-02-26 13:23:48 +01:00
|
|
|
|
|
|
|
$templates = Array (
|
|
|
|
'month_header' => 'month_header.tpl',
|
2001-05-13 05:48:17 +02:00
|
|
|
'month_day' => 'month_day.tpl'
|
2001-02-26 13:23:48 +01:00
|
|
|
);
|
|
|
|
$p->set_file($templates);
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->set_block('month_header','monthly_header','monthly_header');
|
|
|
|
$p->set_block('month_header','month_column','month_column');
|
|
|
|
$p->set_block('month_day','month_daily','month_daily');
|
|
|
|
$p->set_block('month_day','day_event','day_event');
|
|
|
|
$p->set_block('month_day','event','event');
|
|
|
|
|
2001-02-26 13:23:48 +01:00
|
|
|
$p->set_var('extra','');
|
2001-04-27 04:20:55 +02:00
|
|
|
|
|
|
|
$p->set_var('col_width','14');
|
2001-02-26 13:23:48 +01:00
|
|
|
if($display_name)
|
|
|
|
{
|
|
|
|
$p->set_var('column_data',$phpgw->common->grab_owner_name($owner));
|
|
|
|
$p->parse('column_header','month_column',True);
|
2001-04-27 04:20:55 +02:00
|
|
|
$p->set_var('col_width','12');
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
|
|
|
for ($j=0;$j<7;$j++)
|
|
|
|
{
|
2001-04-15 01:37:17 +02:00
|
|
|
$date = $this->gmtdate($startdate + ($j * 86400));
|
2001-03-05 05:33:00 +01:00
|
|
|
$var = Array(
|
|
|
|
'column_data' => '',
|
|
|
|
'extra' => ''
|
|
|
|
);
|
|
|
|
$p->set_var($var);
|
2001-02-26 13:23:48 +01:00
|
|
|
|
2001-05-01 05:26:17 +02:00
|
|
|
$day = $phpgw->common->show_date($date['raw'],'d');
|
|
|
|
$month = $phpgw->common->show_date($date['raw'],'m');
|
|
|
|
$year = $phpgw->common->show_date($date['raw'],'Y');
|
2001-05-03 01:23:48 +02:00
|
|
|
$date = $this->gmtdate(mktime(0,0,0,$date['month'],$date['day'],$date['year']));
|
|
|
|
|
2001-02-26 13:23:48 +01:00
|
|
|
if ($weekly || ($date['full'] >= $monthstart && $date['full'] <= $monthend))
|
|
|
|
{
|
|
|
|
if($weekly)
|
|
|
|
{
|
|
|
|
$cellcolor = $phpgw->nextmatchs->alternate_row_color($cellcolor);
|
|
|
|
}
|
|
|
|
|
2001-05-03 01:23:48 +02:00
|
|
|
// echo 'Date = '.$date['raw'].' '.date('Y.m.d H:i:s',$date['raw'])."<br>\n";
|
2001-04-15 01:37:17 +02:00
|
|
|
if ($date['full'] != $this->today['full'])
|
2001-02-26 13:23:48 +01:00
|
|
|
{
|
2001-04-15 01:37:17 +02:00
|
|
|
$extra = ' bgcolor="'.$cellcolor.'"';
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-04-15 01:37:17 +02:00
|
|
|
$extra = ' bgcolor="'.$phpgw_info['theme']['cal_today'].'"';
|
2001-05-01 05:26:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$holiday_found = $this->holidays->find_date($date['raw']);
|
|
|
|
if($holiday_found != False)
|
|
|
|
{
|
|
|
|
$extra = ' bgcolor="'.$phpgw_info['theme']['bg04'].'"';
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
|
|
|
|
2001-05-01 05:26:17 +02:00
|
|
|
// $day = $phpgw->common->show_date($date['raw'],'d');
|
|
|
|
// $month = $phpgw->common->show_date($date['raw'],'m');
|
|
|
|
// $year = $phpgw->common->show_date($date['raw'],'Y');
|
|
|
|
// $date = $this->gmtdate(mktime(0,0,0,$month,$day,$year));
|
2001-04-15 01:37:17 +02:00
|
|
|
$new_event_link = '';
|
2001-02-26 13:23:48 +01:00
|
|
|
if (!$this->printer_friendly)
|
|
|
|
{
|
2001-03-20 04:34:41 +01:00
|
|
|
if((!!($grants[$owner] & PHPGW_ACL_ADD) == True))
|
2001-02-26 13:23:48 +01:00
|
|
|
{
|
2001-05-06 02:11:12 +02:00
|
|
|
$new_event_link .= '<a href="'.$phpgw->link('/calendar/edit_entry.php','year='.$date['year'].'&month='.$date['month'].'&day='.$date['day'].'&owner='.$owner).'">';
|
2001-04-27 04:20:55 +02:00
|
|
|
$new_event_link .= '<img src="'.$this->image_dir.'/new.gif" width="10" height="10" alt="'.lang('New Entry').'" border="0" align="center">';
|
2001-03-05 05:33:00 +01:00
|
|
|
$new_event_link .= '</a>';
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
2001-04-01 22:49:49 +02:00
|
|
|
$day_number = '<a href="'.$phpgw->link('/calendar/day.php','month='.$month.'&day='.$day.'&year='.$year.'&owner='.$owner).'">'.$day.'</a>';
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-04-01 22:49:49 +02:00
|
|
|
$day_number = $day;
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
2001-03-05 05:33:00 +01:00
|
|
|
|
|
|
|
$var = Array(
|
|
|
|
'extra' => $extra,
|
|
|
|
'new_event_link' => $new_event_link,
|
|
|
|
'day_number' => $day_number
|
|
|
|
);
|
|
|
|
|
|
|
|
$p->set_var($var);
|
2001-02-26 13:23:48 +01:00
|
|
|
|
2001-05-01 05:26:17 +02:00
|
|
|
if($holiday_found != False)
|
|
|
|
{
|
|
|
|
while(list(,$value) = each($holiday_found))
|
|
|
|
{
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->set_var('day_events','<font face="'.$phpgw_info['theme']['font'].'" size="-1">'.$this->holidays->get_name($value).'</font>'.$browser->br);
|
|
|
|
$p->parse('daily_events','event',True);
|
2001-05-01 05:26:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-04-02 19:24:57 +02:00
|
|
|
$rep_events = $this->get_sorted_by_date($date['raw'],$owner);
|
2001-02-26 13:23:48 +01:00
|
|
|
|
|
|
|
if ($this->sorted_events_matching)
|
|
|
|
{
|
|
|
|
$lr_events = CreateObject('calendar.calendar_item');
|
2001-03-05 05:33:00 +01:00
|
|
|
$var = Array(
|
|
|
|
'week_day_font_size' => '2',
|
|
|
|
'events' => ''
|
|
|
|
);
|
|
|
|
$p->set_var($var);
|
2001-02-26 13:23:48 +01:00
|
|
|
for ($k=0;$k<$this->sorted_events_matching;$k++)
|
|
|
|
{
|
|
|
|
$lr_events = $rep_events[$k];
|
|
|
|
|
2001-05-13 05:48:17 +02:00
|
|
|
$is_private = $this->is_private($lr_events,$owner);
|
2001-02-26 13:23:48 +01:00
|
|
|
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->set_var('day_events',$this->link_to_entry($lr_events,$month,$day,$year));
|
|
|
|
unset($picture);
|
|
|
|
|
|
|
|
$p->parse('events','event',True);
|
|
|
|
$p->set_var('day_events','');
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
|
|
|
}
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->parse('daily_events','day_event',True);
|
|
|
|
$p->parse('column_data','month_daily',True);
|
|
|
|
// $p->parse('column_data','week_day_events',True);
|
|
|
|
$p->set_var('daily_events','');
|
2001-02-26 13:23:48 +01:00
|
|
|
$p->set_var('events','');
|
2001-03-05 05:33:00 +01:00
|
|
|
if (!$j || ($j && $date['full'] == $monthstart))
|
2001-02-26 13:23:48 +01:00
|
|
|
{
|
|
|
|
if(!$this->printer_friendly)
|
|
|
|
{
|
2001-03-09 13:23:12 +01:00
|
|
|
$str = '<a href="'.$phpgw->link('/calendar/week.php','date='.$date['full'].'&owner='.$this->owner).'">week ' .(int)((date('z',($startdate+(24*3600*4)))+7)/7).'</a>';
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$str = 'week ' .(int)((date('z',($startdate+(24*3600*4)))+7)/7);
|
|
|
|
}
|
|
|
|
$var = Array(
|
|
|
|
'week_day_font_size' => '-2',
|
|
|
|
'events' => $str
|
|
|
|
);
|
|
|
|
$p->set_var($var);
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->parse('column_data','day_event',True);
|
2001-02-26 13:23:48 +01:00
|
|
|
$p->set_var('events','');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$p->parse('column_header','month_column',True);
|
|
|
|
$p->set_var('column_data','');
|
|
|
|
}
|
2001-05-13 05:48:17 +02:00
|
|
|
$this->owner = $temp_owner;
|
|
|
|
return $p->fp('out','monthly_header');
|
2001-02-26 13:23:48 +01:00
|
|
|
}
|
|
|
|
|
2001-02-25 05:06:15 +01:00
|
|
|
function display_large_week($day,$month,$year,$showyear,$owners=0)
|
|
|
|
{
|
|
|
|
global $phpgw, $phpgw_info;
|
|
|
|
|
|
|
|
$p = CreateObject('phpgwapi.Template',$this->template_dir);
|
2001-04-21 19:43:25 +02:00
|
|
|
$p->set_unknowns('keep');
|
2001-02-25 05:06:15 +01:00
|
|
|
|
|
|
|
$templates = Array(
|
2001-05-13 05:48:17 +02:00
|
|
|
'week' => 'month_day.tpl'
|
2001-02-25 05:06:15 +01:00
|
|
|
);
|
|
|
|
$p->set_file($templates);
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->set_block('week','m_w_table','m_w_table');
|
|
|
|
$p->set_block('week','event','event');
|
2001-02-25 05:06:15 +01:00
|
|
|
|
|
|
|
$start = $this->get_weekday_start($year, $month, $day);
|
|
|
|
|
2001-04-01 22:49:49 +02:00
|
|
|
$this->end_repeat_day = $start + 604800;
|
|
|
|
|
2001-02-25 05:06:15 +01:00
|
|
|
$cellcolor = $phpgw_info['theme']['row_off'];
|
|
|
|
|
|
|
|
$true_printer_friendly = $this->printer_friendly;
|
|
|
|
|
|
|
|
if(is_array($owners))
|
|
|
|
{
|
|
|
|
$display_name = True;
|
|
|
|
$counter = count($owners);
|
|
|
|
$owners_array = $owners;
|
2001-04-27 04:20:55 +02:00
|
|
|
$p->set_var('cols','8');
|
2001-02-25 05:06:15 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$display_name = False;
|
|
|
|
$counter = 1;
|
|
|
|
$owners_array[0] = $owners;
|
2001-04-27 04:20:55 +02:00
|
|
|
$p->set_var('cols','7');
|
2001-02-25 05:06:15 +01:00
|
|
|
}
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->set_var('day_events',$this->large_month_header($month,$year,$display_name));
|
|
|
|
$p->parse('row','event',True);
|
2001-02-25 05:06:15 +01:00
|
|
|
|
|
|
|
for($i=0;$i<$counter;$i++)
|
|
|
|
{
|
|
|
|
$this->repeated_events = Null;
|
2001-03-20 05:15:04 +01:00
|
|
|
$this->repeating_events = Null;
|
2001-02-25 05:06:15 +01:00
|
|
|
$owner = $owners_array[$i];
|
|
|
|
$this->read_repeated_events($owner);
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->set_var('day_events',$this->display_week($start,True,$cellcolor,$display_name,$owner));
|
|
|
|
$p->parse('row','event',True);
|
2001-02-25 05:06:15 +01:00
|
|
|
}
|
|
|
|
$this->printer_friendly = $true_printer_friendly;
|
2001-05-13 05:48:17 +02:00
|
|
|
return $p->fp('out','m_w_table');
|
2001-02-25 05:06:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function display_large_month($month,$year,$showyear,$owner=0)
|
|
|
|
{
|
|
|
|
global $phpgw, $phpgw_info;
|
|
|
|
|
|
|
|
if($owner == $phpgw_info['user']['account_id'])
|
|
|
|
{
|
|
|
|
$owner = 0;
|
|
|
|
}
|
2001-04-01 22:49:49 +02:00
|
|
|
|
|
|
|
$monthstart = intval(date('Ymd',mktime(0,0,0,$month ,1,$year)));
|
|
|
|
$monthend = intval(date('Ymd',mktime(0,0,0,$month + 1,0,$year)));
|
|
|
|
|
|
|
|
$this->end_repeat_day = $monthend;
|
2001-02-25 05:06:15 +01:00
|
|
|
|
2001-04-15 01:37:17 +02:00
|
|
|
$start = $this->get_weekday_start($year, $month, 1);
|
2001-02-25 05:06:15 +01:00
|
|
|
|
2001-04-15 01:37:17 +02:00
|
|
|
$this->repeated_events = Null;
|
|
|
|
$this->repeating_events = Null;
|
|
|
|
$this->read_repeated_events($owner);
|
|
|
|
|
2001-02-25 05:06:15 +01:00
|
|
|
$p = CreateObject('phpgwapi.Template',$this->template_dir);
|
2001-04-21 19:43:25 +02:00
|
|
|
$p->set_unknowns('keep');
|
2001-05-13 05:48:17 +02:00
|
|
|
|
2001-02-25 05:06:15 +01:00
|
|
|
$templates = Array(
|
2001-05-13 05:48:17 +02:00
|
|
|
'week' => 'month_day.tpl'
|
2001-02-25 05:06:15 +01:00
|
|
|
);
|
|
|
|
$p->set_file($templates);
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->set_block('week','m_w_table','m_w_table');
|
|
|
|
$p->set_block('week','event','event');
|
2001-04-27 04:20:55 +02:00
|
|
|
|
|
|
|
$p->set_var('cols','7');
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->set_var('day_events',$this->large_month_header($month,$year,False));
|
|
|
|
$p->parse('row','event',True);
|
2001-02-25 05:06:15 +01:00
|
|
|
|
|
|
|
$cellcolor = $phpgw_info['theme']['row_on'];
|
|
|
|
|
2001-04-15 01:37:17 +02:00
|
|
|
for ($i=intval($start);intval(date('Ymd',$i)) <= $monthend;$i += 604800)
|
2001-02-25 05:06:15 +01:00
|
|
|
{
|
|
|
|
$cellcolor = $phpgw->nextmatchs->alternate_row_color($cellcolor);
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->set_var('day_events',$this->display_week($i,False,$cellcolor,False,$owner,$monthstart,$monthend));
|
|
|
|
$p->parse('row','event',True);
|
2001-02-25 05:06:15 +01:00
|
|
|
}
|
2001-05-13 05:48:17 +02:00
|
|
|
return $p->fp('out','m_w_table');
|
2001-02-25 05:06:15 +01:00
|
|
|
}
|
|
|
|
|
2001-04-01 22:49:49 +02:00
|
|
|
function html_for_event_day_at_a_glance ($event,$first_hour,$last_hour,&$time,$month,$day,$year)
|
2001-02-25 05:06:15 +01:00
|
|
|
{
|
2001-04-20 19:32:19 +02:00
|
|
|
$ind = intval($event->start->hour);
|
2001-02-25 05:06:15 +01:00
|
|
|
|
|
|
|
if($ind<$first_hour || $ind>$last_hour)
|
|
|
|
{
|
|
|
|
$ind = 99;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isset($time[$ind]) || !$time[$ind])
|
|
|
|
{
|
|
|
|
$time[$ind] = '';
|
|
|
|
}
|
|
|
|
|
2001-05-13 05:48:17 +02:00
|
|
|
$time[$ind] .= $this->link_to_entry($event,$month,$day,$year);
|
2001-02-25 05:06:15 +01:00
|
|
|
|
2001-04-01 22:49:49 +02:00
|
|
|
|
2001-05-13 05:48:17 +02:00
|
|
|
$starttime = mktime($event->start->hour,$event->start->min,$event->start->sec,$event->start->month,$event->start->mday,$event->start->year);
|
|
|
|
$endtime = mktime($event->end->hour,$event->end->min,$event->end->sec,$event->end->month,$event->end->mday,$event->end->year);
|
|
|
|
|
2001-04-01 22:49:49 +02:00
|
|
|
if ($starttime <> $endtime)
|
|
|
|
{
|
2001-05-13 05:48:17 +02:00
|
|
|
$this->rowspan = (int)(($endtime - $starttime) / 3600);
|
|
|
|
$mins = (int)((($endtime - $starttime) / 60) % 60);
|
2001-02-25 05:06:15 +01:00
|
|
|
|
2001-05-13 05:48:17 +02:00
|
|
|
if ($mins <> 0)
|
2001-02-25 05:06:15 +01:00
|
|
|
{
|
2001-03-20 03:34:39 +01:00
|
|
|
$this->rowspan += 1;
|
2001-02-25 05:06:15 +01:00
|
|
|
}
|
|
|
|
|
2001-05-13 05:48:17 +02:00
|
|
|
if ($this->rowspan > $this->rowspan_arr[$ind] && $this->rowspan > 1)
|
2001-02-25 05:06:15 +01:00
|
|
|
{
|
|
|
|
$this->rowspan_arr[$ind] = $this->rowspan;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-03-20 05:15:04 +01:00
|
|
|
function print_day_at_a_glance($date)
|
2001-02-25 05:06:15 +01:00
|
|
|
{
|
|
|
|
global $phpgw, $phpgw_info;
|
|
|
|
|
2001-04-20 19:32:19 +02:00
|
|
|
|
|
|
|
$this->end_repeat_day = intval(date('Ymd',$date['raw']));
|
2001-03-20 05:15:04 +01:00
|
|
|
$this->read_repeated_events($this->owner);
|
2001-02-25 05:06:15 +01:00
|
|
|
$p = CreateObject('phpgwapi.Template',$this->template_dir);
|
2001-04-21 19:43:25 +02:00
|
|
|
$p->set_unknowns('keep');
|
2001-02-25 05:06:15 +01:00
|
|
|
|
|
|
|
$templates = Array(
|
2001-05-13 05:48:17 +02:00
|
|
|
'day_cal' => 'day_cal.tpl'
|
2001-02-25 05:06:15 +01:00
|
|
|
);
|
|
|
|
$p->set_file($templates);
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->set_block('day_cal','day','day');
|
|
|
|
$p->set_block('day_cal','day_row','day_row');
|
|
|
|
$p->set_block('day_cal','day_event','day_event');
|
|
|
|
$p->set_block('day_cal','day_time','day_time');
|
2001-02-25 05:06:15 +01:00
|
|
|
|
|
|
|
if (! $phpgw_info['user']['preferences']['calendar']['workdaystarts'] &&
|
|
|
|
! $phpgw_info['user']['preferences']['calendar']['workdayends'])
|
|
|
|
{
|
|
|
|
$phpgw_info['user']['preferences']['calendar']['workdaystarts'] = 8;
|
|
|
|
$phpgw_info['user']['preferences']['calendar']['workdayends'] = 16;
|
2001-04-15 01:37:17 +02:00
|
|
|
$phpgw->preferences->save_repository();
|
|
|
|
}
|
|
|
|
|
2001-04-18 19:04:40 +02:00
|
|
|
$t_format = $phpgw_info['user']['preferences']['common']['time_format'];
|
|
|
|
$browser = CreateObject('phpgwapi.browser');
|
|
|
|
$browser->browser();
|
|
|
|
$browser_agent = $browser->get_agent();
|
|
|
|
if($browser_agent == 'MOZILLA')
|
2001-04-15 01:37:17 +02:00
|
|
|
{
|
2001-04-18 19:04:40 +02:00
|
|
|
if($t_format == '12')
|
|
|
|
{
|
2001-05-05 06:47:26 +02:00
|
|
|
$time_width=12;
|
2001-04-18 19:04:40 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-05-05 06:47:26 +02:00
|
|
|
$time_width=8;
|
2001-04-18 19:04:40 +02:00
|
|
|
}
|
2001-04-15 01:37:17 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-04-18 19:04:40 +02:00
|
|
|
if($t_format == '12')
|
|
|
|
{
|
2001-05-06 02:11:12 +02:00
|
|
|
$time_width=10;
|
2001-04-18 19:04:40 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-05-05 06:47:26 +02:00
|
|
|
$time_width=7;
|
2001-04-18 19:04:40 +02:00
|
|
|
}
|
2001-02-25 05:06:15 +01:00
|
|
|
}
|
2001-04-15 01:37:17 +02:00
|
|
|
$var = Array(
|
2001-04-18 19:04:40 +02:00
|
|
|
'time_width' => $time_width,
|
|
|
|
'time_bgcolor' => $phpgw_info['theme']['cal_dayview'],
|
|
|
|
'bg_time_image' => $this->phpgwapi_template_dir.'/navbar_filler.jpg',
|
|
|
|
'font_color' => $phpgw_info['theme']['bg_text'],
|
|
|
|
'font' => $phpgw_info['theme']['font']
|
2001-04-15 01:37:17 +02:00
|
|
|
);
|
2001-04-18 19:04:40 +02:00
|
|
|
|
2001-04-15 01:37:17 +02:00
|
|
|
$p->set_var($var);
|
2001-02-25 05:06:15 +01:00
|
|
|
|
2001-04-19 19:38:42 +02:00
|
|
|
$first_hour = (int)$phpgw_info['user']['preferences']['calendar']['workdaystarts'];
|
|
|
|
$last_hour = (int)$phpgw_info['user']['preferences']['calendar']['workdayends'];
|
2001-02-25 05:06:15 +01:00
|
|
|
|
2001-05-13 05:48:17 +02:00
|
|
|
for ($i=0;$i<24;$i++)
|
|
|
|
{
|
|
|
|
$this->rowspan_arr[$i] = 0;
|
|
|
|
}
|
|
|
|
|
2001-02-25 05:06:15 +01:00
|
|
|
$events = Array(
|
|
|
|
CreateObject('calendar.calendar_item')
|
|
|
|
);
|
|
|
|
|
|
|
|
$time = Array();
|
|
|
|
|
2001-05-01 21:29:38 +02:00
|
|
|
$date = $this->localdates($date['raw'] - $this->tz_offset);
|
|
|
|
|
|
|
|
// echo 'Searching for events on : '.$phpgw->common->show_date($date['raw'])."<br>\n";
|
|
|
|
|
2001-03-20 05:45:42 +01:00
|
|
|
$events = $this->get_sorted_by_date($date['raw'],$this->owner);
|
2001-02-25 05:06:15 +01:00
|
|
|
|
2001-05-13 05:48:17 +02:00
|
|
|
if($events)
|
2001-02-25 05:06:15 +01:00
|
|
|
{
|
2001-04-20 19:32:19 +02:00
|
|
|
$c_events = count($events);
|
|
|
|
for($i=0;$i<$c_events;$i++)
|
2001-02-25 05:06:15 +01:00
|
|
|
{
|
2001-04-01 22:49:49 +02:00
|
|
|
$this->html_for_event_day_at_a_glance($events[$i],$first_hour,$last_hour,$time,$date['month'],$date['day'],$date['year']);
|
2001-02-25 05:06:15 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// squish events that use the same cell into the same cell.
|
|
|
|
// For example, an event from 8:00-9:15 and another from 9:30-9:45 both
|
|
|
|
// want to show up in the 8:00-9:59 cell.
|
|
|
|
$this->rowspan = 0;
|
2001-05-13 05:48:17 +02:00
|
|
|
$last_row = -1;
|
2001-02-25 05:06:15 +01:00
|
|
|
for ($i=0;$i<24;$i++)
|
|
|
|
{
|
|
|
|
if ($this->rowspan > 1)
|
|
|
|
{
|
2001-05-13 05:48:17 +02:00
|
|
|
if (isset($time[$i]) && strlen($time[$i]) > 0)
|
2001-02-25 05:06:15 +01:00
|
|
|
{
|
2001-05-13 05:48:17 +02:00
|
|
|
$this->rowspan_arr[$last_row] += $this->rowspan_arr[$i];
|
|
|
|
if ($this->rowspan_arr[$i] <> 0)
|
2001-04-20 19:32:19 +02:00
|
|
|
{
|
2001-05-13 05:48:17 +02:00
|
|
|
$this->rowspan_arr[$last_row] -= 1;
|
2001-04-20 19:32:19 +02:00
|
|
|
}
|
2001-05-13 05:48:17 +02:00
|
|
|
$time[$last_row] .= $time[$i];
|
2001-02-25 05:06:15 +01:00
|
|
|
$time[$i] = '';
|
|
|
|
$this->rowspan_arr[$i] = 0;
|
|
|
|
}
|
|
|
|
$this->rowspan--;
|
|
|
|
}
|
2001-05-13 05:48:17 +02:00
|
|
|
elseif ($this->rowspan_arr[$i] > 1)
|
2001-02-25 05:06:15 +01:00
|
|
|
{
|
|
|
|
$this->rowspan = $this->rowspan_arr[$i];
|
2001-05-13 05:48:17 +02:00
|
|
|
$last_row = $i;
|
2001-02-25 05:06:15 +01:00
|
|
|
}
|
|
|
|
}
|
2001-05-13 05:48:17 +02:00
|
|
|
|
2001-05-01 21:29:38 +02:00
|
|
|
$holiday_found = $this->holidays->find_date($date['raw']);
|
|
|
|
if($holiday_found == False)
|
|
|
|
{
|
|
|
|
$bgcolor = $phpgw->nextmatchs->alternate_row_color();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$bgcolor = $phpgw_info['theme']['bg04'];
|
|
|
|
while(list(,$value) = each($holiday_found))
|
|
|
|
{
|
|
|
|
$time[99] = '<center>'.$this->holidays->get_name($value).'</center>'.$time[99];
|
|
|
|
}
|
|
|
|
}
|
2001-02-25 05:06:15 +01:00
|
|
|
|
|
|
|
if (isset($time[99]) && strlen($time[99]) > 0)
|
|
|
|
{
|
|
|
|
$var = Array(
|
|
|
|
'event' => $time[99],
|
2001-05-01 21:29:38 +02:00
|
|
|
'bgcolor' => $bgcolor
|
2001-02-25 05:06:15 +01:00
|
|
|
);
|
|
|
|
$p->set_var($var);
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->parse('item','day_event',False);
|
2001-02-25 05:06:15 +01:00
|
|
|
|
|
|
|
$var = Array(
|
|
|
|
'open_link' => '',
|
|
|
|
'time' => ' ',
|
|
|
|
'close_link' => ''
|
|
|
|
);
|
|
|
|
$p->set_var($var);
|
|
|
|
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->parse('item','day_time',True);
|
|
|
|
$p->parse('row','day_row',True);
|
|
|
|
$p->set_var('item','');
|
2001-02-25 05:06:15 +01:00
|
|
|
}
|
|
|
|
$this->rowspan = 0;
|
|
|
|
for ($i=$first_hour;$i<=$last_hour;$i++)
|
|
|
|
{
|
|
|
|
$dtime = $this->build_time_for_display($i * 10000);
|
|
|
|
$p->set_var('extras','');
|
|
|
|
$p->set_var('event',' ');
|
|
|
|
if ($this->rowspan > 1)
|
|
|
|
{
|
|
|
|
// this might mean there's an overlap, or it could mean one event
|
|
|
|
// ends at 11:15 and another starts at 11:30.
|
2001-05-13 05:48:17 +02:00
|
|
|
if (isset($time[$i]) && strlen($time[$i]))
|
2001-02-25 05:06:15 +01:00
|
|
|
{
|
|
|
|
$p->set_var('event',$time[$i]);
|
|
|
|
$p->set_var('bgcolor',$phpgw->nextmatchs->alternate_row_color());
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->parse('item','day_event',False);
|
2001-02-25 05:06:15 +01:00
|
|
|
}
|
|
|
|
$this->rowspan--;
|
|
|
|
}
|
2001-05-13 05:48:17 +02:00
|
|
|
elseif (!isset($time[$i]) || !strlen($time[$i]))
|
|
|
|
{
|
|
|
|
$p->set_var('event',' ');
|
|
|
|
$p->set_var('bgcolor',$phpgw->nextmatchs->alternate_row_color());
|
|
|
|
$p->parse('item','day_event',False);
|
|
|
|
}
|
2001-02-25 05:06:15 +01:00
|
|
|
else
|
|
|
|
{
|
2001-05-13 05:48:17 +02:00
|
|
|
$this->rowspan = intval($this->rowspan_arr[$i]);
|
|
|
|
if ($this->rowspan > 1)
|
2001-02-25 05:06:15 +01:00
|
|
|
{
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->set_var('extras',' rowspan="'.$this->rowspan.'"');
|
2001-02-25 05:06:15 +01:00
|
|
|
}
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->set_var('event',$time[$i]);
|
|
|
|
$p->set_var('bgcolor',$phpgw->nextmatchs->alternate_row_color());
|
|
|
|
$p->parse('item','day_event',False);
|
2001-02-25 05:06:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$open_link = ' - ';
|
|
|
|
$close_link = '';
|
|
|
|
|
2001-05-13 05:48:17 +02:00
|
|
|
if(($this->printer_friendly == False) && ($this->check_perms(PHPGW_ACL_ADD) == True))
|
2001-02-25 05:06:15 +01:00
|
|
|
{
|
2001-04-14 03:09:27 +02:00
|
|
|
$new_hour = intval(substr($dtime,0,strpos($dtime,':')));
|
2001-04-20 02:38:49 +02:00
|
|
|
if ($phpgw_info['user']['preferences']['common']['timeformat'] == '12' && $i >= 12)
|
2001-04-14 03:09:27 +02:00
|
|
|
{
|
|
|
|
$new_hour += 12;
|
|
|
|
}
|
|
|
|
|
|
|
|
$new_minute = substr($dtime,strpos($dtime,':')+1,2);
|
|
|
|
|
2001-03-09 13:23:12 +01:00
|
|
|
$open_link .= '<a href="'.$phpgw->link('/calendar/edit_entry.php',
|
|
|
|
'year='.$date['year'].'&month='.$date['month']
|
2001-05-06 02:11:12 +02:00
|
|
|
. '&day='.$date['day'].'&hour='.$new_hour
|
2001-04-14 03:09:27 +02:00
|
|
|
. '&minute='.$new_minute.'&owner='.$this->owner).'">';
|
2001-02-25 05:06:15 +01:00
|
|
|
|
|
|
|
$close_link = '</a>';
|
|
|
|
}
|
|
|
|
|
|
|
|
$var = Array(
|
|
|
|
'open_link' => $open_link,
|
|
|
|
'time' => (intval(substr($dtime,0,strpos($dtime,':'))) < 10 ? '0'.$dtime : $dtime),
|
|
|
|
'close_link' => $close_link
|
|
|
|
);
|
|
|
|
|
|
|
|
$p->set_var($var);
|
|
|
|
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->parse('item','day_time',True);
|
|
|
|
$p->parse('row','day_row',True);
|
|
|
|
$p->set_var('event','');
|
|
|
|
$p->set_var('item','');
|
2001-02-25 05:06:15 +01:00
|
|
|
} // end for
|
2001-05-13 05:48:17 +02:00
|
|
|
return $p->fp('out','day');
|
2001-02-25 05:06:15 +01:00
|
|
|
} // end function
|
|
|
|
|
2001-03-31 16:32:50 +02:00
|
|
|
function view_add_day($day,&$repeat_days)
|
2001-03-12 04:18:02 +01:00
|
|
|
{
|
|
|
|
if($repeat_days)
|
|
|
|
{
|
|
|
|
$repeat_days .= ', ';
|
|
|
|
}
|
2001-04-22 23:39:42 +02:00
|
|
|
$repeat_days .= $day.' ';
|
2001-03-12 04:18:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function view_event($event)
|
|
|
|
{
|
|
|
|
global $phpgw, $phpgw_info;
|
|
|
|
|
|
|
|
$pri = Array(
|
|
|
|
1 => lang('Low'),
|
|
|
|
2 => lang('Normal'),
|
|
|
|
3 => lang('High')
|
|
|
|
);
|
|
|
|
|
|
|
|
reset($event->participants);
|
|
|
|
$participating = False;
|
|
|
|
for($j=0;$j<count($event->participants);$j++)
|
|
|
|
{
|
2001-04-21 03:03:26 +02:00
|
|
|
if($event->participants[$j] == $this->owner)
|
2001-03-12 04:18:02 +01:00
|
|
|
{
|
|
|
|
$participating = True;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-04-28 23:56:24 +02:00
|
|
|
$p = CreateObject('phpgwapi.Template',$this->template_dir);
|
2001-03-12 04:18:02 +01:00
|
|
|
|
2001-04-21 19:43:25 +02:00
|
|
|
$p->set_unknowns('keep');
|
2001-03-12 04:18:02 +01:00
|
|
|
$templates = Array(
|
2001-05-13 05:48:17 +02:00
|
|
|
'view' => 'view.tpl'
|
2001-03-12 04:18:02 +01:00
|
|
|
);
|
|
|
|
$p->set_file($templates);
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->set_block('view','view_event','view_event');
|
|
|
|
$p->set_block('view','list','list');
|
2001-03-12 04:18:02 +01:00
|
|
|
|
|
|
|
$var = Array(
|
|
|
|
'bg_text' => $phpgw_info['theme']['bg_text'],
|
2001-04-27 04:20:55 +02:00
|
|
|
'name' => $event->title
|
2001-03-12 04:18:02 +01:00
|
|
|
);
|
|
|
|
$p->set_var($var);
|
|
|
|
|
|
|
|
// Some browser add a \n when its entered in the database. Not a big deal
|
|
|
|
// this will be printed even though its not needed.
|
|
|
|
if (nl2br($event->description))
|
|
|
|
{
|
|
|
|
$var = Array(
|
|
|
|
'field' => lang('Description'),
|
|
|
|
'data' => nl2br($event->description)
|
|
|
|
);
|
|
|
|
$p->set_var($var);
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->parse('row','list',True);
|
2001-03-12 04:18:02 +01:00
|
|
|
}
|
|
|
|
|
2001-04-27 04:20:55 +02:00
|
|
|
if ($event->category)
|
|
|
|
{
|
2001-04-28 23:56:24 +02:00
|
|
|
$cats = CreateObject('phpgwapi.categories');
|
|
|
|
$cats->categories($this->owner,'calendar');
|
|
|
|
$cat = $cats->return_single($event->category);
|
2001-04-27 04:20:55 +02:00
|
|
|
$var = Array(
|
|
|
|
'field' => lang('Category'),
|
2001-04-27 19:37:59 +02:00
|
|
|
'data' => $cat[0]['name']
|
2001-04-27 04:20:55 +02:00
|
|
|
);
|
|
|
|
$p->set_var($var);
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->parse('row','list',True);
|
2001-04-27 04:20:55 +02:00
|
|
|
}
|
|
|
|
|
2001-04-01 22:49:49 +02:00
|
|
|
$start = mktime($event->start->hour,$event->start->min,$event->start->sec,$event->start->month,$event->start->mday,$event->start->year) - $this->tz_offset;
|
2001-03-12 04:18:02 +01:00
|
|
|
$var = Array(
|
|
|
|
'field' => lang('Start Date/Time'),
|
|
|
|
'data' => $phpgw->common->show_date($start)
|
|
|
|
);
|
|
|
|
$p->set_var($var);
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->parse('row','list',True);
|
2001-03-12 04:18:02 +01:00
|
|
|
|
2001-04-01 22:49:49 +02:00
|
|
|
$end = mktime($event->end->hour,$event->end->min,$event->end->sec,$event->end->month,$event->end->mday,$event->end->year) - $this->tz_offset;
|
2001-03-12 04:18:02 +01:00
|
|
|
$var = Array(
|
|
|
|
'field' => lang('End Date/Time'),
|
|
|
|
'data' => $phpgw->common->show_date($end)
|
|
|
|
);
|
|
|
|
$p->set_var($var);
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->parse('row','list',True);
|
2001-03-12 04:18:02 +01:00
|
|
|
|
|
|
|
$var = Array(
|
|
|
|
'field' => lang('Priority'),
|
|
|
|
'data' => $pri[$event->priority]
|
|
|
|
);
|
|
|
|
$p->set_var($var);
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->parse('row','list',True);
|
2001-03-12 04:18:02 +01:00
|
|
|
|
|
|
|
$participate = False;
|
|
|
|
for($i=0;$i<count($event->participants);$i++)
|
|
|
|
{
|
|
|
|
if($event->participants[$i] == $phpgw_info['user']['account_id'])
|
|
|
|
{
|
|
|
|
$participate = True;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$var = Array(
|
|
|
|
'field' => lang('Created By'),
|
|
|
|
'data' => $phpgw->common->grab_owner_name($event->owner)
|
|
|
|
);
|
|
|
|
$p->set_var($var);
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->parse('row','list',True);
|
2001-03-12 04:18:02 +01:00
|
|
|
|
|
|
|
$var = Array(
|
|
|
|
'field' => lang('Updated'),
|
|
|
|
'data' => $phpgw->common->show_date($event->mdatetime)
|
|
|
|
);
|
|
|
|
$p->set_var($var);
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->parse('row','list',True);
|
2001-03-12 04:18:02 +01:00
|
|
|
|
2001-03-24 05:59:10 +01:00
|
|
|
$var = Array(
|
|
|
|
'field' => lang('Private'),
|
|
|
|
'data' => $event->public==True?'False':'True'
|
|
|
|
);
|
|
|
|
$p->set_var($var);
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->parse('row','list',True);
|
2001-03-24 05:59:10 +01:00
|
|
|
|
2001-03-12 04:18:02 +01:00
|
|
|
if($event->groups[0])
|
|
|
|
{
|
|
|
|
$cal_grps = '';
|
|
|
|
for($i=0;$i<count($event->groups);$i++)
|
|
|
|
{
|
|
|
|
if($i>0)
|
|
|
|
{
|
|
|
|
$cal_grps .= '<br>';
|
|
|
|
}
|
|
|
|
$cal_grps .= $phpgw->accounts->id2name($event->groups[$i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
$var = Array(
|
|
|
|
'field' => lang('Groups'),
|
|
|
|
'data' => $cal_grps
|
|
|
|
);
|
|
|
|
$p->set_var($var);
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->parse('row','list',True);
|
2001-03-12 04:18:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$str = '';
|
2001-04-19 19:38:42 +02:00
|
|
|
reset($event->participants);
|
|
|
|
while (list($key,$value) = each($event->participants))
|
2001-03-12 04:18:02 +01:00
|
|
|
{
|
2001-04-19 19:38:42 +02:00
|
|
|
if($str)
|
2001-03-12 04:18:02 +01:00
|
|
|
{
|
|
|
|
$str .= '<br>';
|
|
|
|
}
|
|
|
|
|
2001-04-19 19:38:42 +02:00
|
|
|
$status = $this->get_long_status($event->status[$key]);
|
2001-03-12 05:30:15 +01:00
|
|
|
|
2001-04-19 19:38:42 +02:00
|
|
|
$str .= $phpgw->common->grab_owner_name($event->participants[$key]).' (';
|
2001-03-12 04:18:02 +01:00
|
|
|
|
2001-04-19 19:38:42 +02:00
|
|
|
if($event->participants[$key] == $this->owner && $this->check_perms(PHPGW_ACL_EDIT) == True)
|
2001-03-12 04:18:02 +01:00
|
|
|
{
|
|
|
|
$str .= '<a href="'.$phpgw->link('/calendar/edit_status.php','owner='.$this->owner.'&id='.$event->id).'">'.$status.'</a>';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$str .= $status;
|
|
|
|
}
|
2001-04-19 19:38:42 +02:00
|
|
|
$str .= ')'."\n";
|
2001-03-12 04:18:02 +01:00
|
|
|
}
|
|
|
|
$var = Array(
|
|
|
|
'field' => lang('Participants'),
|
|
|
|
'data' => $str
|
|
|
|
);
|
|
|
|
$p->set_var($var);
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->parse('row','list',True);
|
2001-03-12 04:18:02 +01:00
|
|
|
|
|
|
|
// Repeated Events
|
2001-04-27 04:20:55 +02:00
|
|
|
$rpt_type = Array(
|
|
|
|
'none',
|
|
|
|
'daily',
|
|
|
|
'weekly',
|
|
|
|
'monthlybyday',
|
|
|
|
'monthlybydate',
|
|
|
|
'yearly'
|
|
|
|
);
|
|
|
|
$str = lang($rpt_type[$event->recur_type]);
|
2001-03-31 16:32:50 +02:00
|
|
|
if($event->recur_type <> RECUR_NONE)
|
2001-03-12 04:18:02 +01:00
|
|
|
{
|
|
|
|
$str .= ' (';
|
2001-03-31 16:32:50 +02:00
|
|
|
if ($event->recur_enddate->mday != 0 && $event->recur_enddate->month != 0 && $event->recur_enddate->year != 0)
|
2001-03-12 04:18:02 +01:00
|
|
|
{
|
2001-03-31 16:32:50 +02:00
|
|
|
$recur_end = mktime($event->recur_enddate->hour,$event->recur_enddate->min,$event->recur_enddate->sec,$event->recur_enddate->month,$event->recur_enddate->mday,$event->recur_enddate->year);
|
|
|
|
if($recur_end != 0)
|
|
|
|
{
|
2001-04-27 19:37:59 +02:00
|
|
|
$recur_end -= $this->tz_offset;
|
|
|
|
$str .= lang('ends').': '.lang($phpgw->common->show_date($recur_end,'l'));
|
|
|
|
$str .= ', '.lang($phpgw->common->show_date($recur_end,'F'));
|
|
|
|
$str .= ' '.$phpgw->common->show_date($recur_end,'d, Y').' ';
|
2001-03-31 16:32:50 +02:00
|
|
|
}
|
2001-03-12 04:18:02 +01:00
|
|
|
}
|
|
|
|
if($event->recur_type == RECUR_WEEKLY || $event->recur_type == RECUR_DAILY)
|
|
|
|
{
|
|
|
|
$repeat_days = '';
|
2001-04-22 23:39:42 +02:00
|
|
|
if($phpgw_info['user']['preferences']['calendar']['weekdaystarts'] == 'Sunday')
|
2001-03-12 04:18:02 +01:00
|
|
|
{
|
2001-04-22 23:39:42 +02:00
|
|
|
if (!!($event->recur_data & M_SUNDAY) == True)
|
|
|
|
{
|
|
|
|
$this->view_add_day(lang('Sunday'),$repeat_days);
|
|
|
|
}
|
2001-03-12 04:18:02 +01:00
|
|
|
}
|
2001-04-14 04:57:51 +02:00
|
|
|
if (!!($event->recur_data & M_MONDAY) == True)
|
2001-03-12 04:18:02 +01:00
|
|
|
{
|
2001-04-22 23:39:42 +02:00
|
|
|
$this->view_add_day(lang('Monday'),$repeat_days);
|
2001-03-12 04:18:02 +01:00
|
|
|
}
|
2001-04-14 04:57:51 +02:00
|
|
|
if (!!($event->recur_data & M_TUESDAY) == True)
|
2001-03-12 04:18:02 +01:00
|
|
|
{
|
2001-04-23 09:02:18 +02:00
|
|
|
$this->view_add_day(lang('Tuesday'),$repeat_days);
|
2001-03-12 04:18:02 +01:00
|
|
|
}
|
2001-04-14 04:57:51 +02:00
|
|
|
if (!!($event->recur_data & M_WEDNESDAY) == True)
|
2001-03-12 04:18:02 +01:00
|
|
|
{
|
2001-04-22 23:39:42 +02:00
|
|
|
$this->view_add_day(lang('Wednesday'),$repeat_days);
|
2001-03-12 04:18:02 +01:00
|
|
|
}
|
2001-04-14 04:57:51 +02:00
|
|
|
if (!!($event->recur_data & M_THURSDAY) == True)
|
2001-03-12 04:18:02 +01:00
|
|
|
{
|
2001-04-22 23:39:42 +02:00
|
|
|
$this->view_add_day(lang('Thursday'),$repeat_days);
|
2001-03-12 04:18:02 +01:00
|
|
|
}
|
2001-04-14 04:57:51 +02:00
|
|
|
if (!!($event->recur_data & M_FRIDAY) == True)
|
2001-03-12 04:18:02 +01:00
|
|
|
{
|
2001-04-22 23:39:42 +02:00
|
|
|
$this->view_add_day(lang('Friday'),$repeat_days);
|
2001-03-12 04:18:02 +01:00
|
|
|
}
|
2001-04-14 04:57:51 +02:00
|
|
|
if (!!($event->recur_data & M_SATURDAY) == True)
|
2001-03-12 04:18:02 +01:00
|
|
|
{
|
2001-04-22 23:39:42 +02:00
|
|
|
$this->view_add_day(lang('Saturday'),$repeat_days);
|
|
|
|
}
|
|
|
|
if($phpgw_info['user']['preferences']['calendar']['weekdaystarts'] == 'Monday')
|
|
|
|
{
|
|
|
|
if (!!($event->recur_data & M_SUNDAY) == True)
|
|
|
|
{
|
|
|
|
$this->view_add_day(lang('Sunday'),$repeat_days);
|
|
|
|
}
|
2001-03-31 16:32:50 +02:00
|
|
|
}
|
|
|
|
if($repeat_days <> '')
|
|
|
|
{
|
|
|
|
$str .= lang('days repeated').': '.$repeat_days;
|
2001-03-12 04:18:02 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if($event->recur_interval)
|
|
|
|
{
|
2001-05-13 05:48:17 +02:00
|
|
|
$str .= lang('Interval').': '.$event->recur_interval;
|
2001-03-12 04:18:02 +01:00
|
|
|
}
|
|
|
|
$str .= ')';
|
|
|
|
|
|
|
|
$var = Array(
|
2001-04-23 10:04:27 +02:00
|
|
|
'field' => lang('Repetition'),
|
2001-03-12 04:18:02 +01:00
|
|
|
'data' => $str
|
|
|
|
);
|
|
|
|
$p->set_var($var);
|
2001-05-13 05:48:17 +02:00
|
|
|
$p->parse('row','list',True);
|
2001-03-12 04:18:02 +01:00
|
|
|
}
|
|
|
|
|
2001-05-13 05:48:17 +02:00
|
|
|
return $p->fp('out','view_event');
|
2001-03-12 04:18:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function get_response()
|
|
|
|
{
|
|
|
|
global $phpgw;
|
|
|
|
|
|
|
|
$str = '<table width="100%" cols="4"><tr align="center">';
|
|
|
|
|
|
|
|
$p = CreateObject('phpgwapi.Template',$this->template_dir);
|
|
|
|
|
|
|
|
$templates = Array(
|
|
|
|
'form_button' => 'form_button_script.tpl'
|
|
|
|
);
|
|
|
|
$p->set_file($templates);
|
2001-04-28 23:56:24 +02:00
|
|
|
|
|
|
|
$var = Array(
|
|
|
|
'action_url_button' => $phpgw->link('/calendar/action.php','id='.$this->event->id.'&action='.ACCEPTED),
|
|
|
|
'action_text_button' => ' '.lang('Accept').' ',
|
|
|
|
'action_confirm_button' => '',
|
|
|
|
'action_extra_field' => ''
|
|
|
|
);
|
|
|
|
$p->set_var($var);
|
2001-03-12 04:18:02 +01:00
|
|
|
$str .= '<td>'.$p->finish($p->parse('out','form_button')).'</td>'."\n";
|
|
|
|
|
2001-04-28 23:56:24 +02:00
|
|
|
$var = Array(
|
|
|
|
'action_url_button' => $phpgw->link('/calendar/action.php','id='.$this->event->id.'&action='.REJECTED),
|
|
|
|
'action_text_button' => ' '.lang('Reject').' ',
|
|
|
|
'action_confirm_button' => '',
|
|
|
|
'action_extra_field' => ''
|
|
|
|
);
|
|
|
|
$p->set_var($var);
|
2001-03-12 04:18:02 +01:00
|
|
|
$str .= '<td>'.$p->finish($p->parse('out','form_button')).'</td>'."\n";
|
|
|
|
|
2001-04-28 23:56:24 +02:00
|
|
|
$var = Array(
|
|
|
|
'action_url_button' => $phpgw->link('/calendar/action.php','id='.$this->event->id.'&action='.TENTATIVE),
|
|
|
|
'action_text_button' => ' '.lang('Tentative').' ',
|
|
|
|
'action_confirm_button' => '',
|
|
|
|
'action_extra_field' => ''
|
|
|
|
);
|
|
|
|
$p->set_var($var);
|
2001-03-12 04:18:02 +01:00
|
|
|
$str .= '<td>'.$p->finish($p->parse('out','form_button')).'</td>'."\n";
|
|
|
|
|
2001-04-28 23:56:24 +02:00
|
|
|
$var = Array(
|
|
|
|
'action_url_button' => $phpgw->link('/calendar/action.php','id='.$this->event->id.'&action='.NO_RESPONSE),
|
|
|
|
'action_text_button' => ' '.lang('No Response').' ',
|
|
|
|
'action_confirm_button' => '',
|
|
|
|
'action_extra_field' => ''
|
|
|
|
);
|
|
|
|
$p->set_var($var);
|
2001-03-12 04:18:02 +01:00
|
|
|
$str .= '<td>'.$p->finish($p->parse('out','form_button')).'</td>'."\n";
|
|
|
|
|
|
|
|
$str .= '</tr></table>';
|
|
|
|
|
|
|
|
return $str;
|
|
|
|
}
|
|
|
|
|
2001-02-20 04:48:39 +01:00
|
|
|
function timematrix($date,$starttime,$endtime,$participants)
|
|
|
|
{
|
|
|
|
global $phpgw, $phpgw_info;
|
|
|
|
|
|
|
|
if(!isset($phpgw_info['user']['preferences']['calendar']['interval']) ||
|
|
|
|
!$phpgw_info['user']['preferences']['calendar']['interval'])
|
|
|
|
{
|
|
|
|
$phpgw_info['user']['preferences']['calendar']['interval'] = 15;
|
|
|
|
}
|
|
|
|
$increment = $phpgw_info['user']['preferences']['calendar']['interval'];
|
|
|
|
$interval = (int)(60 / $increment);
|
|
|
|
|
2001-04-22 23:39:42 +02:00
|
|
|
$str = '<center>'.lang($phpgw->common->show_date($date['raw'],'l'));
|
|
|
|
$str .= ', '.lang($phpgw->common->show_date($date['raw'],'F'));
|
|
|
|
$str .= ' '.$phpgw->common->show_date($date['raw'],'d, Y').'<br>';
|
2001-02-20 04:48:39 +01:00
|
|
|
$str .= '<table width="85%" border="0" cellspacing="0" cellpadding="0" cols="'.((24 * $interval) + 1).'">';
|
2001-03-03 04:55:01 +01:00
|
|
|
$str .= '<tr><td height="1" colspan="'.((24 * $interval) + 1).'" bgcolor="black"><img src="'.$this->image_dir.'/pix.gif"></td></tr>';
|
2001-05-08 19:54:44 +02:00
|
|
|
$str .= '<tr><td width="15%"><font color="'.$phpgw_info['theme']['bg_text'].'" face="'.$phpgw_info['theme']['font'].'" size="-2">'.lang('Participant').'</font></td>';
|
2001-02-20 04:48:39 +01:00
|
|
|
for($i=0;$i<24;$i++)
|
|
|
|
{
|
|
|
|
for($j=0;$j<$interval;$j++)
|
|
|
|
{
|
|
|
|
switch($j)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
if($interval == 4)
|
|
|
|
{
|
|
|
|
$k = ($i<=9?'0':substr($i,0,1));
|
|
|
|
}
|
2001-05-08 19:54:44 +02:00
|
|
|
$str .= '<td align="right" bgcolor="'.$phpgw_info['theme']['bg_color'].'"><font color="'.$phpgw_info['theme']['bg_text'].'" face="'.$phpgw_info['theme']['font'].'" size="-2">';
|
2001-03-18 19:34:14 +01:00
|
|
|
$str .= '<a href="'.$phpgw->link('/calendar/edit_entry.php','year='.$date['year'].'&month='.$date['month'].'&day='.$date['day'].'&hour='.$i.'&minute='.(interval * $j))."\" onMouseOver=\"window.status='".$i.':'.($increment * $j<=9?'0':'').($increment * $j)."'; return true;\">";
|
2001-02-20 04:48:39 +01:00
|
|
|
$str .= $k.'</a></font></td>';
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if($interval == 4)
|
|
|
|
{
|
|
|
|
$k = ($i<=9?substr($i,0,1):substr($i,1,2));
|
|
|
|
}
|
2001-05-08 19:54:44 +02:00
|
|
|
$str .= '<td align="right" bgcolor="'.$phpgw_info['theme']['bg_color'].'"><font color="'.$phpgw_info['theme']['bg_text'].'" face="'.$phpgw_info['theme']['font'].'" size="-2">';
|
2001-03-18 19:34:14 +01:00
|
|
|
$str .= '<a href="'.$phpgw->link('/calendar/edit_entry.php','year='.$date['year'].'&month='.$date['month'].'&day='.$date['day'].'&hour='.$i.'&minute='.(interval * $j))."\" onMouseOver=\"window.status='".$i.':'.($increment * $j)."'; return true;\">";
|
2001-02-20 04:48:39 +01:00
|
|
|
$str .= $k.'</a></font></td>';
|
|
|
|
break;
|
|
|
|
default:
|
2001-05-08 19:54:44 +02:00
|
|
|
$str .= '<td align="left" bgcolor="'.$phpgw_info['theme']['bg_color'].'"><font color="'.$phpgw_info['theme']['bg_text'].'" face="'.$phpgw_info['theme']['font'].'" size="-2">';
|
2001-03-18 19:34:14 +01:00
|
|
|
$str .= '<a href="'.$phpgw->link('/calendar/edit_entry.php','year='.$date['year'].'&month='.$date['month'].'&day='.$date['day'].'&hour='.$i.'&minute='.(interval * $j))."\" onMouseOver=\"window.status='".$i.':'.($increment * $j)."'; return true;\">";
|
2001-02-20 04:48:39 +01:00
|
|
|
$str .= ' </a></font></td>';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$str .= '</tr>';
|
2001-03-03 04:55:01 +01:00
|
|
|
$str .= '<tr><td height="1" colspan="'.((24 * $interval) + 1).'" bgcolor="black"><img src="'.$this->image_dir.'/pix.gif"></td></tr>';
|
2001-02-20 04:48:39 +01:00
|
|
|
if(!$endtime)
|
|
|
|
{
|
|
|
|
$endtime = $starttime;
|
|
|
|
}
|
2001-04-01 22:49:49 +02:00
|
|
|
$this->end_repeat_day = $date['raw'];
|
2001-02-20 04:48:39 +01:00
|
|
|
for($i=0;$i<count($participants);$i++)
|
|
|
|
{
|
|
|
|
$this->read_repeated_events($participants[$i]);
|
|
|
|
$str .= '<tr>';
|
2001-05-08 19:54:44 +02:00
|
|
|
$str .= '<td width="15%"><font color="'.$phpgw_info['theme']['bg_text'].'" face="'.$phpgw_info['theme']['font'].'" size="-2">'.$this->get_fullname($participants[$i]).'</font></td>';
|
2001-03-03 04:55:01 +01:00
|
|
|
$events = $this->get_sorted_by_date($date['raw'],$participants[$i]);
|
|
|
|
if($this->sorted_events_matching == False)
|
2001-02-20 04:48:39 +01:00
|
|
|
{
|
|
|
|
for($j=0;$j<24;$j++)
|
|
|
|
{
|
|
|
|
for($k=0;$k<$interval;$k++)
|
|
|
|
{
|
|
|
|
$str .= '<td height="1" align="left" bgcolor="'.$phpgw_info['theme']['bg_color'].'" color="#999999"> </td>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for($h=0;$h<24;$h++)
|
|
|
|
{
|
|
|
|
for($m=0;$m<$interval;$m++)
|
|
|
|
{
|
|
|
|
$index = (($h * 10000) + (($m * $increment) * 100));
|
|
|
|
$time_slice[$index]['marker'] = ' ';
|
|
|
|
$time_slice[$index]['color'] = $phpgw_info['theme']['bg_color'];
|
|
|
|
$time_slice[$index]['description'] = '';
|
|
|
|
}
|
|
|
|
}
|
2001-03-03 04:55:01 +01:00
|
|
|
for($k=0;$k<$this->sorted_events_matching;$k++)
|
2001-02-20 04:48:39 +01:00
|
|
|
{
|
|
|
|
$event = $events[$k];
|
|
|
|
$eventstart = $this->localdates($event->datetime);
|
|
|
|
$eventend = $this->localdates($event->edatetime);
|
|
|
|
$start = ($eventstart['hour'] * 10000) + ($eventstart['minute'] * 100);
|
2001-03-11 05:17:58 +01:00
|
|
|
$starttemp = $this->splittime("$start",False);
|
2001-02-20 04:48:39 +01:00
|
|
|
$subminute = 0;
|
|
|
|
for($m=0;$m<$interval;$m++)
|
|
|
|
{
|
|
|
|
$minutes = $increment * $m;
|
|
|
|
if(intval($starttemp['minute']) > $minutes && intval($starttemp['minute']) < ($minutes + $increment))
|
|
|
|
{
|
|
|
|
$subminute = ($starttemp['minute'] - $minutes) * 100;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$start -= $subminute;
|
|
|
|
$end = ($eventend['hour'] * 10000) + ($eventend['minute'] * 100);
|
2001-03-11 05:17:58 +01:00
|
|
|
$endtemp = $this->splittime("$end",False);
|
2001-02-20 04:48:39 +01:00
|
|
|
$addminute = 0;
|
|
|
|
for($m=0;$m<$interval;$m++)
|
|
|
|
{
|
|
|
|
$minutes = ($increment * $m);
|
|
|
|
if($endtemp['minute'] < ($minutes + $increment) && $endtemp['minute'] > $minutes)
|
|
|
|
{
|
|
|
|
$addminute = ($minutes + $increment - $endtemp['minute']) * 100;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$end += $addminute;
|
2001-03-11 05:17:58 +01:00
|
|
|
$starttemp = $this->splittime("$start",False);
|
|
|
|
$endtemp = $this->splittime("$end",False);
|
2001-02-20 04:48:39 +01:00
|
|
|
// Do not display All-Day events in this free/busy time
|
|
|
|
if((($starttemp['hour'] == 0) && ($starttemp['minute'] == 0)) && (($endtemp['hour'] == 23) && ($endtemp['minute'] == 59)))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for($h=$starttemp['hour'];$h<=$endtemp['hour'];$h++)
|
|
|
|
{
|
|
|
|
$startminute = 0;
|
|
|
|
$endminute = $interval;
|
|
|
|
$hour = $h * 10000;
|
|
|
|
if($h == intval($starttemp['hour']))
|
|
|
|
{
|
|
|
|
$startminute = ($starttemp['minute'] / $increment);
|
|
|
|
}
|
|
|
|
if($h == intval($endtemp['hour']))
|
|
|
|
{
|
|
|
|
$endminute = ($endtemp['minute'] / $increment);
|
|
|
|
}
|
|
|
|
for($m=$startminute;$m<=$endminute;$m++)
|
|
|
|
{
|
|
|
|
$index = ($hour + (($m * $increment) * 100));
|
|
|
|
$time_slice[$index]['marker'] = '-';
|
|
|
|
$time_slice[$index]['color'] = $phpgw_info['theme']['bg01'];
|
2001-04-27 19:37:59 +02:00
|
|
|
$time_display = $phpgw->common->show_date($eventstart['raw'],$this->users_timeformat).'-'.$phpgw->common->show_date($eventend['raw'],$this->user_timeformat);
|
2001-04-01 22:49:49 +02:00
|
|
|
$time_slice[$index]['description'] = '('.$time_display.') '.$this->is_private($event,$participants[$i],'title').$this->display_status($event->users_status);
|
2001-02-20 04:48:39 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for($h=0;$h<24;$h++)
|
|
|
|
{
|
|
|
|
$hour = $h * 10000;
|
|
|
|
for($m=0;$m<$interval;$m++)
|
|
|
|
{
|
|
|
|
$index = ($hour + (($m * $increment) * 100));
|
2001-05-08 19:54:44 +02:00
|
|
|
$str .= '<td height="1" align="left" bgcolor="'.$time_slice[$index]['color']."\" color=\"#999999\" onMouseOver=\"window.status='".$time_slice[$index]['description']."'; return true;\">".'<font color="'.$phpgw_info['theme']['bg_text'].'" face="'.$phpgw_info['theme']['font'].'" size="-2">'.$time_slice[$index]['marker'].'</font></td>';
|
2001-02-20 04:48:39 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$str .= '</tr>';
|
2001-03-03 04:55:01 +01:00
|
|
|
$str .= '<tr><td height="1" colspan="'.((24 * $interval) + 1).'" bgcolor="#999999"><img src="'.$this->image_dir.'/pix.gif"></td></tr>';
|
2001-02-20 04:48:39 +01:00
|
|
|
}
|
|
|
|
$str .= '</table></center>';
|
|
|
|
return $str;
|
|
|
|
}
|
|
|
|
}
|
2001-01-13 04:37:22 +01:00
|
|
|
?>
|