* * http://www.radix.net/~cknudsen * * Modified by Mark Peters * * -------------------------------------------- * * 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$ */ $phpgw_info['server']['calendar_type'] = 'sql'; include(PHPGW_INCLUDE_ROOT.'/calendar/inc/class.calendar_'.$phpgw_info['server']['calendar_type'].'.inc.php'); class calendar extends calendar_ { function calendar($params=False) { global $phpgw_info; if(gettype($params)=="array") { while(list($key,$value) = each($params)) { $this->$key = $value; } } else { $this->printer_friendly = $params; } if(!$this->owner) { $this->owner = $phpgw_info['user']['account_id']; } if(!isset($this->rights)) { $this->rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16; } $this->today = $this->localdates(time()); } 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; } $datetime = $this->gmtdate($date['raw']); $increment = $phpgw_info['user']['preferences']['calendar']['interval']; $interval = (int)(60 / $increment); $str = '
'.$phpgw->common->show_date($datetime['raw'],'l, F d, Y').'
'; $str .= ''; $str .= ''; $str .= ''; 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)); } $str .= ''; break; case 1: if($interval == 4) { $k = ($i<=9?substr($i,0,1):substr($i,1,2)); } $str .= ''; break; default: $str .= ''; break; } } } $str .= ''; $str .= ''; if(!$endtime) { $endtime = $starttime; } for($i=0;$iread_repeated_events($participants[$i]); $str .= ''; $str .= ''; $events = $this->get_sorted_by_date($datetime['raw'],$participants[$i]); if(!$this->sorted_re) { for($j=0;$j<24;$j++) { for($k=0;$k<$interval;$k++) { $str .= ''; } } } 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'] = ''; } } for($k=0;$k<$this->sorted_re;$k++) { $event = $events[$k]; $eventstart = $this->localdates($event->datetime); $eventend = $this->localdates($event->edatetime); $start = ($eventstart['hour'] * 10000) + ($eventstart['minute'] * 100); $starttemp = $this->splittime("$start"); $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); $endtemp = $this->splittime("$end"); $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; $starttemp = $this->splittime("$start"); $endtemp = $this->splittime("$end"); // 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']; $time_slice[$index]['description'] = $this->is_private($event,$participants[$i]); } } } } for($h=0;$h<24;$h++) { $hour = $h * 10000; for($m=0;$m<$interval;$m++) { $index = ($hour + (($m * $increment) * 100)); $str .= ''; } } } $str .= ''; $str .= ''; } $str .= '
Participant'; $str .= '"; $str .= $k.''; $str .= '"; $str .= $k.''; $str .= '"; $str .= ' 
'.$phpgw->common->grab_owner_name($participants[$i]).' ".$time_slice[$index]['marker'].'
'; return $str; } } ?>