From 41a159d0e0fcc8155b240a1da13d2ed7c3bb8650 Mon Sep 17 00:00:00 2001 From: skeeter Date: Sat, 3 Mar 2001 03:55:01 +0000 Subject: [PATCH] fixes for the free/busy time matrix --- calendar/inc/class.calendar.inc.php | 30 ++++++++++---------- calendar/inc/class.calendar_sql.inc.php | 12 +++++--- calendar/inc/functions.inc.php | 7 +++-- calendar/viewmatrix.php | 37 +++++++++++++------------ 4 files changed, 48 insertions(+), 38 deletions(-) diff --git a/calendar/inc/class.calendar.inc.php b/calendar/inc/class.calendar.inc.php index 01615fe03f..2bdbb31961 100755 --- a/calendar/inc/class.calendar.inc.php +++ b/calendar/inc/class.calendar.inc.php @@ -14,7 +14,7 @@ /* $Id$ */ -if(extension_loaded("mcal") == False) +if(extension_loaded('mcal') == False) { define(RECUR_NONE,0); define(RECUR_DAILY,1); @@ -37,11 +37,12 @@ if(extension_loaded("mcal") == False) } CreateObject('calendar.calendar_item'); -$phpgw_info['server']['calendar_type'] = 'sql'; -if($phpgw_info['server']['calendar_type'] == 'mcal' && extension_loaded("mcal") == False) +if($phpgw_info['server']['calendar_type'] == 'mcal' && extension_loaded('mcal') == False) { $phpgw_info['server']['calendar_type'] = 'sql'; } +// The following line can be removed when vCalendar is implemented.... +$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_ @@ -1304,13 +1305,12 @@ class calendar extends calendar_ { $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 = '
'.$phpgw->common->show_date($date['raw'],'l, F d, Y').'
'; $str .= ''; - $str .= ''; + $str .= ''; $str .= ''; for($i=0;$i<24;$i++) { @@ -1324,7 +1324,7 @@ class calendar extends calendar_ $k = ($i<=9?'0':substr($i,0,1)); } $str .= ''; break; case 1: @@ -1333,19 +1333,19 @@ class calendar extends calendar_ $k = ($i<=9?substr($i,0,1):substr($i,1,2)); } $str .= ''; break; default: $str .= ''; break; } } } $str .= ''; - $str .= ''; + $str .= ''; if(!$endtime) { $endtime = $starttime; @@ -1355,8 +1355,8 @@ class calendar extends calendar_ $this->read_repeated_events($participants[$i]); $str .= ''; $str .= ''; - $events = $this->get_sorted_by_date($datetime['raw'],$participants[$i]); - if(!$this->sorted_re) + $events = $this->get_sorted_by_date($date['raw'],$participants[$i]); + if($this->sorted_events_matching == False) { for($j=0;$j<24;$j++) { @@ -1378,7 +1378,7 @@ class calendar extends calendar_ $time_slice[$index]['description'] = ''; } } - for($k=0;$k<$this->sorted_re;$k++) + for($k=0;$k<$this->sorted_events_matching;$k++) { $event = $events[$k]; $eventstart = $this->localdates($event->datetime); @@ -1433,7 +1433,7 @@ class calendar extends calendar_ $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]); + $time_slice[$index]['description'] = $this->is_private($event,$participants[$i],'title'); } } } @@ -1449,7 +1449,7 @@ class calendar extends calendar_ } } $str .= ''; - $str .= ''; + $str .= ''; } $str .= '
Participant'; - $str .= '"; + $str .= '"; $str .= $k.''; - $str .= '"; + $str .= '"; $str .= $k.''; - $str .= '"; + $str .= '"; $str .= ' 
'.$phpgw->common->grab_owner_name($participants[$i]).'
'; return $str; diff --git a/calendar/inc/class.calendar_sql.inc.php b/calendar/inc/class.calendar_sql.inc.php index 5cda470a47..f2f41f0336 100755 --- a/calendar/inc/class.calendar_sql.inc.php +++ b/calendar/inc/class.calendar_sql.inc.php @@ -599,13 +599,17 @@ class calendar_ $num_rows = $this->stream->f(0); if($num_rows == 0) { - $this->stream->query('INSERT INTO calendar_entry_repeats(cal_id,cal_type,cal_use_end,cal_end,cal_days,cal_frequency) ' - .'VALUES('.$event->id.",'".$event->rpt_type."',".$use_end.','.$end['raw'].",'$days',$freq)",__LINE__,__FILE__); + $this->stream->query('INSERT INTO calendar_entry_repeats(cal_id,' + .'cal_type,cal_use_end,cal_end,cal_days,cal_frequency) ' + .'VALUES('.$event->id.",'".$event->rpt_type."',".$use_end.',' + .$end['raw'].",'$days',$freq)",__LINE__,__FILE__); } else { - $this->stream->query("UPDATE calendar_entry_repeats SET cal_type='".$event->rpt_type."', cal_use_end=".$use_end.', ' - ."cal_end='".$end['raw']."', cal_days='".$days."', cal_frequency=".$freq.' ' + $this->stream->query('UPDATE calendar_entry_repeats ' + ."SET cal_type='".$event->rpt_type."', " + .'cal_use_end='.$use_end.", cal_end='".$end['raw']."', " + ."cal_days='".$days."', cal_frequency=".$freq.' ' .'WHERE cal_id='.$event->id,__LINE__,__FILE__); } } diff --git a/calendar/inc/functions.inc.php b/calendar/inc/functions.inc.php index 5c04752ee7..3c161e9d9b 100755 --- a/calendar/inc/functions.inc.php +++ b/calendar/inc/functions.inc.php @@ -11,8 +11,11 @@ /* $Id$ */ - global $phpgw_info, $phpgw, $grants, $owner, $rights, $filter; - global $date, $year, $month, $day, $thisyear, $thismonth, $thisday; + if (floor($PHP_VERSION ) == 4) + { + global $phpgw_info, $phpgw, $grants, $owner, $rights, $filter; + global $date, $year, $month, $day, $thisyear, $thismonth, $thisday; + } if(!isset($filter) || !$filter) { diff --git a/calendar/viewmatrix.php b/calendar/viewmatrix.php index 938aca8fc3..fee518c391 100755 --- a/calendar/viewmatrix.php +++ b/calendar/viewmatrix.php @@ -23,35 +23,35 @@ include('../header.inc.php'); - $date = $thisyear; - $date .= ($thismonth<=9?"0":"").$thismonth; - $date .= ($thisday<=9?"0":"").$thisday; +// $date = $thisyear; +// $date .= ($thismonth<=9?"0":"").$thismonth; +// $date .= ($thisday<=9?"0":"").$thisday; $parts = Array(); + $acct = CreateObject('phpgwapi.accounts'); for($i=0;$iaccounts->get_type($participants[$i])) { case 'g': - $acct = CreateObject('phpgwapi.accounts',$participants[$i]); $members = $acct->members(intval($participants[$i])); while($members != False && $member = each($members)) { - if(($grants[$member[1]['account_id']] & PHPGW_ACL_READ) && !isset($parts[$member[1]['account_id']])) + if(!!($grants[$member[1]['account_id']] & PHPGW_ACL_READ == True) && !isset($parts[$member[1]['account_id']])) { $parts[$member[1]['account_id']] = 1; } } - unset($acct); break; case 'u': - if(($grants[$participants[$i]] & PHPGW_ACL_READ) && !isset($parts[$participants[$i]])) + if(!!($grants[$participants[$i]] & PHPGW_ACL_READ == True) && !isset($parts[$participants[$i]])) { $parts[$participants[$i]] = 1; } break; } } + unset($acct); $participants = Array(); reset($parts); @@ -65,27 +65,30 @@ switch($matrixtype) { case 'free/busy': - echo $phpgw->calendar->timematrix($phpgw->calendar->date_to_epoch($date),$phpgw->calendar->splittime('000000'),0,$participants); + $freetime = $phpgw->calendar->makegmttime(0,0,0,$thismonth,$thisday,$thisyear); + echo $phpgw->calendar->timematrix($freetime,$phpgw->calendar->splittime('000000'),0,$participants); break; case 'weekly': echo $phpgw->calendar->display_large_week($thisday,$thismonth,$thisyear,true,$participants); break; } - echo '
'; - echo '
'; - echo ''; - echo ''; + echo "\n".'
'."\n"; + echo ' '."\n"; + echo ' '."\n"; + echo ' '."\n"; + echo ' '."\n"; + echo ' '."\n"; for ($i=0;$i'; + echo ' '."\n"; } if(isset($filter) && $filter) { - echo ''; + echo ' '."\n"; } - echo ''; - echo ''; - echo '
'; + echo ' '."\n"; + echo ' '."\n"; + echo '
'."\n"; $phpgw->common->phpgw_footer(); ?>