diff --git a/calendar/edit_entry.php b/calendar/edit_entry.php index 1f227be84a..9bee4926ce 100755 --- a/calendar/edit_entry.php +++ b/calendar/edit_entry.php @@ -253,65 +253,62 @@ $str .= '>'; display_item($p,lang('Private'),$str); -// Participants - $accounts = $phpgw->acl->get_ids_for_location('run',1,'calendar'); - $users = Array(); - for($i=0;$icommon->grab_owner_name(intval($accounts[$i])); - if($phpgw->accounts->get_type(intval($accounts[$i])) == 'g') + return; + } + while(list($index,$id) = each($accounts)) + { + if(intval($id) == $owner) { - $group_members = $phpgw->acl->get_ids_for_location(intval($accounts[$i]),1,'phpgw_group'); - if($group_members != False) + continue; + } + if(!isset($users[intval($id)])) + { + $users[intval($id)] = $phpgw->common->grab_owner_name(intval($id)); + if($phpgw->accounts->get_type(intval($id)) == 'g') { - for($j=0;$jcommon->grab_owner_name($group_members[$j]); - } - } + build_part_list($users,$phpgw->acl->get_ids_for_location(intval($id),1,'phpgw_group'),$owner); } } } } - $str = "\n".' '."\n"; @asort($users); @reset($users); $user = Array(); - while ($user = each($users)) + while (list($id,$name) = each($users)) { - $userid = intval($user[0]); - if($userid != $owner && $phpgw->accounts->exists($userid) == True) + if(intval($id) == intval($owner)) { - $str .= ' '."\n"; + continue; + } + elseif($phpgw->accounts->exists($id) == True) + { + $str .= ' '."\n"; } } $str .= ' '; display_item($p,lang('Participants'),$str); // I Participate - $participate = False; - if($id) - { - for($i=0;$iparticipants);$i++) - { - if($event->participants[$i] == $owner) - { - $participate = True; - } - } - } $str = ' 0) && ($participate == True)) || !isset($id)) + if((($id > 0) && isset($event->participants[$owner])) || !isset($id)) { $str .= ' checked'; } diff --git a/calendar/edit_entry_handler.php b/calendar/edit_entry_handler.php index ee7a267011..0e8e7f4eab 100755 --- a/calendar/edit_entry_handler.php +++ b/calendar/edit_entry_handler.php @@ -179,14 +179,14 @@ } } - $participants = Array(); - while($parts = each($part)) +// $participants = Array(); + while(list($key,$value) = each($part)) { - $participants[] = $parts[0]; + $phpgw->calendar->add_attribute('participants['.$key.']','U'); } - reset($participants); - $phpgw->calendar->add_attribute('participants',$participants); +// reset($participants); +// $phpgw->calendar->add_attribute('participants',$participants); $phpgw->calendar->add_attribute('priority',$priority); $event = $phpgw->calendar->event; diff --git a/calendar/inc/class.calendar.inc.php b/calendar/inc/class.calendar.inc.php index 25fe1c7dd8..be92312a1f 100755 --- a/calendar/inc/class.calendar.inc.php +++ b/calendar/inc/class.calendar.inc.php @@ -640,37 +640,41 @@ class calendar extends calendar_ 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'); + $outer_stime = mktime($outer->start->hour,$outer->start->min,$outer->start->sec,$outer->start->month,$outer->start->mday,$outer->start->year) - $this->datetime->tz_offset; + $outer_etime = mktime($outer->end->hour,$outer->end->min,$outer->end->sec,$outer->end->month,$outer->end->mday,$outer->end->year) - $this->datetime->tz_offset; + $ostime = $phpgw->common->show_date($outer_stime,'Hi'); + $oetime = $phpgw->common->show_date($outer_etime,'Hi'); - if($outer->datetime < $datetime) + if($outer_stime < $datetime) { - $outer_time = 0; + $ostime = 0; } - if($outer->edatetime > $eod) + if($outer_etime > $eod) { - $outer_etime = 2359; + $oetime = 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'); + $inner_stime = mktime($inner->start->hour,$inner->start->min,$inner->start->sec,$inner->start->month,$inner->start->mday,$inner->start->year) - $this->datetime->tz_offset; + $inner_etime = mktime($inner->end->hour,$inner->end->min,$inner->end->sec,$inner->end->month,$inner->end->mday,$inner->end->year) - $this->datetime->tz_offset; + $istime = $phpgw->common->show_date($inner_stime,'Hi'); + $ietime = $phpgw->common->show_date($inner_etime,'Hi'); - if($inner->datetime < $datetime) + if($inner_stime < $datetime) { - $inner_time = 0; + $istime = 0; } - if($inner->edatetime > ($datetime + 86399)) + if($inner_etime > ($datetime + 86399)) { - $inner_etime = 2359; + $ietime = 2359; } - if(($outer_time > $inner_time) || - (($outer_time == $inner_time) && ($outer_etime > $inner_etime))) + if(($ostime > $istime) || + (($ostime == $istime) && ($oetime > $ietime))) { $temp = $events[$inner_loop]; $events[$inner_loop] = $events[$outer_loop]; @@ -714,11 +718,11 @@ class calendar extends calendar_ if($this->printer_friendly == False) { - $month = '' . lang($phpgw->common->show_date($date['raw'],'F')).' '.$year . ''; + $month = '' . lang($phpgw->common->show_date($date['raw'],'F')).' '.$phpgw->common->show_date($date['raw'],'Y').''; } else { - $month = lang($phpgw->common->show_date($date['raw'],'F')).' '.$year; + $month = lang($phpgw->common->show_date($date['raw'],'F')).' '.$phpgw->common->show_date($date['raw'],'Y'); } $var = Array( @@ -887,13 +891,13 @@ class calendar extends calendar_ $p_g = ''; if(count($participants)) { - for($i=0;$i 0) + if($p_g) { $p_g .= ' OR '; } - $p_g .= 'phpgw_cal_user.cal_login='.$participants[$i]; + $p_g .= 'phpgw_cal_user.cal_login='.$user; } } if($p_g) @@ -1160,7 +1164,7 @@ class calendar extends calendar_ $start = $this->datetime->get_weekday_start($year, $month, $day); - $this->end_repeat_day = $start + 604800; + $this->end_repeat_day = intval(date('Ymd',$start + 604800)); $cellcolor = $phpgw_info['theme']['row_off']; @@ -1527,14 +1531,19 @@ class calendar extends calendar_ reset($event->participants); $participating = False; - for($j=0;$jparticipants);$j++) + $participate = False; + while(list($part,$status) = each($event->participants)) { - if($event->participants[$j] == $this->owner) + if($part == $this->owner) { $participating = True; } + if($part == $phpgw_info['user']['account_id']) + { + $participate = True; + } } - + $p = CreateObject('phpgwapi.Template',$this->template_dir); $p->set_unknowns('keep'); @@ -1597,14 +1606,6 @@ class calendar extends calendar_ $p->set_var($var); $p->parse('row','list',True); - $participate = False; - for($i=0;$iparticipants);$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) @@ -1648,24 +1649,24 @@ class calendar extends calendar_ $str = ''; reset($event->participants); - while (list($key,$value) = each($event->participants)) + while (list($user,$short_status) = each($event->participants)) { if($str) { $str .= '
'; } - $status = $this->get_long_status($event->status[$key]); + $long_status = $this->get_long_status($short_status); - $str .= $phpgw->common->grab_owner_name($event->participants[$key]).' ('; + $str .= $phpgw->common->grab_owner_name($user).' ('; - if($event->participants[$key] == $this->owner && $this->check_perms(PHPGW_ACL_EDIT) == True) + if($user == $this->owner && $this->check_perms(PHPGW_ACL_EDIT) == True) { - $str .= ''.$status.''; + $str .= ''.$long_status.''; } else { - $str .= $status; + $str .= $long_status; } $str .= ')'."\n"; } diff --git a/calendar/inc/class.calendar__.inc.php b/calendar/inc/class.calendar__.inc.php index c3510dff7b..9c253b4c25 100755 --- a/calendar/inc/class.calendar__.inc.php +++ b/calendar/inc/class.calendar__.inc.php @@ -158,18 +158,21 @@ class calendar__ $new_event_datetime = mktime($new_event->start->hour,$new_event->start->min,$new_event->start->sec,$new_event->start->month,$new_event->start->mday,$new_event->start->year) - $this->datetime->tz_offset; } - for($i=0;$i\n"; +// echo "userid = ".$userid."
\n"; + $preferences = CreateObject('phpgwapi.preferences',intval($userid)); $part_prefs = $preferences->read_repository(); if(!isset($part_prefs['calendar']['send_updates']) || !$part_prefs['calendar']['send_updates']) { continue; } - $part_prefs = $phpgw->common->create_emailpreferences($part_prefs,$participants[$i]); + $part_prefs = $phpgw->common->create_emailpreferences($part_prefs,intval($userid)); $to = $part_prefs['email']['address']; +// echo "Email being sent to: ".$to."
\n"; $phpgw_info['user']['preferences']['common']['tz_offset'] = $part_prefs['common']['tz_offset']; $phpgw_info['user']['preferences']['common']['timeformat'] = $part_prefs['common']['timeformat']; @@ -227,41 +230,28 @@ class calendar__ function prepare_recipients(&$new_event,$old_event) { - $old_part_count = count($old_event->participants); - for($i=0;$i<$old_part_count;$i++) + // Find modified and deleted users..... + while(list($old_userid,$old_status) = each($old_event->participants)) { - $delete = True; - $new_part_count = count($new_event->participants); - for($k=0;$k<$new_part_count;$k++) + if(isset($new_event->participants[$old_userid])) { - if($new_event->participants[$k] == $old_event->participants[$i]) - { - $delete = False; - $this->modified[] = $new_event->participants[$k]; - $new_event->status[$k] = $old_event->status[$i]; - } +// echo "Modifying event for user ".$old_userid."
\n"; + $this->modified[intval($old_userid)] = $new_status; } - if($delete == True) + else { - $this->deleted[] = $old_event->participants[$i]; +// echo "Deleting user ".$old_userid." from the event
\n"; + $this->deleted[intval($old_userid)] = $old_status; } } - $new_part_count = count($new_event->participants); - for($i=0;$i<$new_part_count;$i++) + // Find new users..... + while(list($new_userid,$new_status) = each($new_event->participants)) { - $add = True; - $old_part_count = count($old_event->participants); - for($k=0;$k<$old_part_count;$k++) + if(!isset($old_event->participants[$new_userid])) { - if($new_event->participants[$i] == $old_event->participants[$k]) - { - $add = False; - } - } - if($add == True) - { - $this->added[] = $new_event->participants[$i]; - $new_event->status[$i] = 'U'; +// echo "Adding event for user ".$new_userid."
\n"; + $this->added[$new_userid] = 'U'; + $new_event->participants[$new_userid] = 'U'; } } @@ -399,12 +389,12 @@ class calendar__ return $this->fetch_event($this->event->id); } - function add_attribute($attribute,$value) + function add_attribute($attribute,$value,$element='') { if(is_array($value)) { reset($value); } - $this->event->$attribute = $value; + eval("\$this->event->".$attribute." = ".$value.";"); } } diff --git a/calendar/inc/class.calendar_icap.inc.php b/calendar/inc/class.calendar_icap.inc.php index 6bfb7389b8..b0afb25314 100755 --- a/calendar/inc/class.calendar_icap.inc.php +++ b/calendar/inc/class.calendar_icap.inc.php @@ -338,6 +338,7 @@ class calendar_ extends calendar__ TENTATIVE => 'T', ACCEPTED => 'A' ); + $this->add_attribute('status['.$owner.']',$status_code_short[$status]); // $this->stream->query("UPDATE calendar_entry_user SET cal_status='".$status_code_short[$status]."' WHERE cal_id=".$id." AND cal_login=".$owner,__LINE__,__FILE__); return True; } diff --git a/calendar/inc/class.calendar_sql.inc.php b/calendar/inc/class.calendar_sql.inc.php index f09bae612f..86b5a20f6d 100755 --- a/calendar/inc/class.calendar_sql.inc.php +++ b/calendar/inc/class.calendar_sql.inc.php @@ -200,8 +200,9 @@ class calendar_ extends calendar__ { $this->event->users_status = $this->stream->f('cal_status'); } - $this->event->participants[] = $this->stream->f('cal_login'); - $this->event->status[] = $this->stream->f('cal_status'); +// $this->event->participants[$this->stream->f('cal_login')] = $this->stream->f('cal_status'); +// $this->add_attribute('participants',$this->stream->f('cal_status'),intval($this->stream->f('cal_login'))); + $this->add_attribute('participants['.intval($this->stream->f('cal_login')).']',$this->stream->f('cal_status')); } } } @@ -256,10 +257,9 @@ class calendar_ extends calendar__ } else { - $part_count = count($this->event->participants); - for($i=0;$i<$part_count;$i++) + while(list($key,$value) = each($this->event->participants)) { - $this->event->status[$i] = 'U'; + $this->add_attribute('participants['.intval($key).']','U'); } $this->send_update(MSG_ADDED,$this->event->participants,'',$this->event); } @@ -290,7 +290,7 @@ class calendar_ extends calendar__ // return next_recurrence (int stream, int weekstart, array next); } - function expunge($stream) + function expunge() { if(count($this->deleted_events) <= 0) { @@ -307,7 +307,7 @@ class calendar_ extends calendar__ { $event_id = $this->deleted_events[$i]; - $event = $this->fetch_event($stream,$event_id); + $event = $this->fetch_event($event_id); $this->send_update(MSG_DELETED,$event->participants,$event); for($k=0;$kparticipants); while (list($key,$value) = each($event->participants)) { - if(intval($value) == intval($this->user)) + if(intval($key) == intval($this->user)) { - $status = 'A'; - } - else - { - $status = $event->status[$key]; + $value = 'A'; } $this->stream->query('INSERT INTO phpgw_cal_user(cal_id,cal_login,cal_status) ' - . 'VALUES('.$event->id.','.$value.",'".$status."')",__LINE__,__FILE__); + . 'VALUES('.$event->id.','.intval($key).",'".$value."')",__LINE__,__FILE__); } if($event->recur_type != RECUR_NONE) @@ -469,14 +465,6 @@ class calendar_ extends calendar__ return True; } - function event_set_participants($stream,$participants) - { - $this->event->participants = Array(); - reset($participants); - $this->event->participants = $participants; - return True; - } - function set_status($id,$owner,$status) { $status_code_short = Array( diff --git a/calendar/inc/hook_home.inc.php b/calendar/inc/hook_home.inc.php index d313768a3f..dabf15ed7a 100755 --- a/calendar/inc/hook_home.inc.php +++ b/calendar/inc/hook_home.inc.php @@ -35,6 +35,7 @@ . ''; // $phpgw->calendar->printer_friendly = True; $now = $phpgw->calendar->datetime->makegmttime(0,0,0,$phpgw->calendar->today['month'],$phpgw->calendar->today['day'],$phpgw->calendar->today['year']); + $now['raw'] += $phpgw->calendar->datetime->tz_offset; echo $phpgw->calendar->print_day_at_a_glance($now).''."\n"; // $phpgw->calendar->printer_friendly = False; echo "\n".''."\n"; diff --git a/calendar/templates/default/header.inc.php b/calendar/templates/default/header.inc.php index 843a12cde4..eeee49f371 100755 --- a/calendar/templates/default/header.inc.php +++ b/calendar/templates/default/header.inc.php @@ -99,7 +99,7 @@ 'button_value' => lang('Go!') ); $tpl->set_var($var); - $tpl->fp('header_column','form_button_dropdown',True); + $tpl->parse('header_column','form_button_dropdown',True); } if(count($grants) > 0) diff --git a/calendar/templates/idsociety/header.inc.php b/calendar/templates/idsociety/header.inc.php index 843a12cde4..eeee49f371 100755 --- a/calendar/templates/idsociety/header.inc.php +++ b/calendar/templates/idsociety/header.inc.php @@ -99,7 +99,7 @@ 'button_value' => lang('Go!') ); $tpl->set_var($var); - $tpl->fp('header_column','form_button_dropdown',True); + $tpl->parse('header_column','form_button_dropdown',True); } if(count($grants) > 0)