diff --git a/calendar/inc/class.bocalendar.inc.php b/calendar/inc/class.bocalendar.inc.php index c243d1e24e..3c09b003b3 100755 --- a/calendar/inc/class.bocalendar.inc.php +++ b/calendar/inc/class.bocalendar.inc.php @@ -45,14 +45,15 @@ var $cat_id; var $users_timeformat; + var $modified; + var $deleted; + var $added; + var $use_session = False; function bocalendar($session=0) { -// if(floor(phpversion()) == 4) -// { - global $phpgw, $phpgw_info, $date, $year, $month, $day, $owner, $filter, $fcat_id, $friendly; -// } + global $phpgw, $phpgw_info, $date, $year, $month, $day, $owner, $filter, $fcat_id, $friendly; $phpgw->nextmatchs = CreateObject('phpgwapi.nextmatchs'); @@ -66,12 +67,17 @@ $this->use_session = True; } - if($this->debug) { echo "BO Filter : (".$this->filter.")
\n"; } + if($this->debug) + { + echo "BO Filter : (".$this->filter.")
\n"; + echo "Owner : ".$this->owner."
\n"; + } + if(isset($owner)) { - $this->owner = $owner; + $this->owner = intval($owner); } - elseif(!$this->owner) + elseif(!isset($this->owner) || !$this->owner) { $this->owner = $phpgw_info['user']['account_id']; } @@ -79,7 +85,6 @@ $this->prefs['common'] = $phpgw_info['user']['preferences']['common']; $this->prefs['calendar'] = $phpgw_info['user']['preferences']['calendar']; - if ($this->prefs['common']['timeformat'] == '12') { $this->users_timeformat = 'h:i a'; @@ -141,7 +146,11 @@ $this->so = CreateObject('calendar.socalendar',$this->owner,$this->filter,$this->cat_id); $this->datetime = $this->so->datetime; - if($this->debug) { echo "BO Filter : (".$this->filter.")
\n"; } + if($this->debug) + { + echo "BO Filter : (".$this->filter.")
\n"; + echo "Owner : ".$this->owner."
\n"; + } } function save_sessiondata($data) @@ -163,10 +172,10 @@ $this->filter = $data['filter']; $this->cat_id = $data['cat_id']; - $this->owner = $data['owner']; - $this->year = $data['year']; - $this->month = $data['month']; - $this->day = $data['day']; + $this->owner = intval($data['owner']); + $this->year = intval($data['year']); + $this->month = intval($data['month']); + $this->day = intval($data['day']); } function read_entry($id) @@ -182,6 +191,7 @@ if($this->check_perms(PHPGW_ACL_ADD)) { $this->so->add_entry($event); + $this->send_update(MSG_ADDED,$event->participants,'',$this->get_cached_event()); } } @@ -189,6 +199,12 @@ { if($this->check_perms(PHPGW_ACL_EDIT)) { + if($event->id != 0) + { + $new_event = $event; + $old_event = $this->read_entry($new_event->id); + $this->prepare_recipients($new_event,$old_event); + } $this->so->add_entry($event); } } @@ -205,6 +221,12 @@ { if($this->check_perms(PHPGW_ACL_DELETE)) { + for($i=0;$iso->cal->deleted_events);$i++) + { + $event_id = $this->so->cal->deleted_events[$i]; + $event = $this->so->read_entry($event_id); + $this->send_update(MSG_DELETED,$event->participants,$event); + } $this->so->expunge(); } } @@ -385,11 +407,38 @@ } } + 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'); + $lname = $db->f('account_lastname'); + $fname = $db->f('account_firstname'); + if($lname && $fname) + { + $fullname = $lname.', '.$fname; + } + return $fullname; + } + else + { + return False; + } + } + function display_status($user_status) { - global $phpgw_info; - - if(isset($this->prefs['calendar']['display_status']) && $this->prefs['calendar']['display_status'] == True) + if(@$this->prefs['calendar']['display_status']) { return ' ('.$user_status.')'; } @@ -419,12 +468,12 @@ return $status; } - function is_private($event,$owner,$field='') + function is_private($event,$owner) { global $phpgw, $phpgw_info; if($owner == 0) { $owner = $this->owner; } - if ($owner == $phpgw_info['user']['account_id'] || $this->check_perms(PHPGW_ACL_PRIVATE,$owner) || ($event->public == 1)) + if ($owner == $phpgw_info['user']['account_id'] || ($this->check_perms(PHPGW_ACL_PRIVATE,$owner) && $event->public==0) || ($event->public == 1)) { $is_private = False; } @@ -446,7 +495,7 @@ } else { - $is_private = False; + $is_private = False; } return $is_private; @@ -704,7 +753,10 @@ { global $phpgw, $phpgw_info; - echo "Start Date : ".sprintf("%04d%02d%02d",$syear,$smonth,$sday)."
\n"; + if($this->debug) + { + echo "Start Date : ".sprintf("%04d%02d%02d",$syear,$smonth,$sday)."
\n"; + } if(!$eyear && !$emonth && !$eday) { @@ -736,6 +788,12 @@ $c_cached_ids = count($cached_event_ids); $c_cached_ids_repeating = count($cached_event_ids_repeating); + if($this->debug) + { + echo "events cached : $c_cached_ids : for : ".sprintf("%04d%02d%02d",$syear,$smonth,$sday)."
\n"; + echo "repeating events cached : $c_cached_ids_repeating : for : ".sprintf("%04d%02d%02d",$syear,$smonth,$sday)."
\n"; + } + $this->cached_events = Array(); if($c_cached_ids == 0 && $c_cached_ids_repeating == 0) @@ -949,10 +1007,323 @@ 'class' => $class ); } -// $this->_debug_array($daily); + + if($this->debug) + { + $this->_debug_array($daily); + } + return $daily; } + function prepare_matrix($interval,$increment,$part,$status,$fulldate) + { + global $phpgw; + 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]['description'] = ''; + } + } + for($k=0;$kcached_events[$fulldate]);$k++) + { + $event = $this->cached_events[$fulldate][$k]; + $eventstart = $this->datetime->localdates($event->datetime); + $eventend = $this->datetime->localdates($event->edatetime); + $start = ($eventstart['hour'] * 10000) + ($eventstart['minute'] * 100); + $starttemp = $this->splittime("$start",False); + $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",False); + $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",False); + $endtemp = $this->splittime("$end",False); +// 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); + } + $private = $this->is_private($event,$part); + $time_display = $phpgw->common->show_date($eventstart['raw'],$this->users_timeformat).'-'.$phpgw->common->show_date($eventend['raw'],$this->users_timeformat); + $time_description = '('.$time_display.') '.$this->get_short_field($event,$private,'title').$this->display_status($event->participants[$part]); + for($m=$startminute;$m<=$endminute;$m++) + { + $index = ($hour + (($m * $increment) * 100)); + $time_slice[$index]['marker'] = '-'; + $time_slice[$index]['description'] = $time_description; + } + } + } + } + return $time_slice; + } + + function set_status($cal_id,$status) + { + $old_event = $this->so->read_entry($cal_id); + switch($status) + { + case REJECTED: + $this->send_update(MSG_REJECTED,$old_event->participants,$old_event); + $this->so->set_status($cal_id,$status); + break; + case TENTATIVE: + $this->send_update(MSG_TENTATIVE,$old_event->participants,$old_event); + $this->so->set_status($cal_id,$status); + break; + case ACCEPTED: + $this->send_update(MSG_ACCEPTED,$old_event->participants,$old_event); + $this->so->set_status($cal_id,$status); + break; + } + return True; + } + + function send_update($msg_type,$participants,$old_event=False,$new_event=False) + { + + global $phpgw, $phpgw_info; + + $db = $phpgw->db; + $db->query("SELECT app_version FROM phpgw_applications WHERE app_name='calendar'",__LINE__,__FILE__); + $db->next_record(); + $version = $db->f('app_version'); + unset($db); + + $phpgw_info['user']['preferences'] = $phpgw->common->create_emailpreferences($phpgw_info['user']['preferences']); + $sender = $phpgw_info['user']['preferences']['email']['address']; + + $temp_tz_offset = $this->prefs['common']['tz_offset']; + $temp_timeformat = $this->prefs['common']['timeformat']; + $temp_dateformat = $this->prefs['common']['dateformat']; + + $tz_offset = ((60 * 60) * intval($temp_tz_offset)); + + if($old_event != False) + { + $t_old_start_time = mktime($old_event->start->hour,$old_event->start->min,$old_event->start->sec,$old_event->start->month,$old_event->start->mday,$old_event->start->year); + if($t_old_start_time < (time() - 86400)) + { + return False; + } + } + + $temp_user = $phpgw_info['user']; + + if($this->owner != $temp_user['account_id']) + { + $user = $this->owner; + + $accounts = CreateObject('phpgwapi.accounts',$user); + $phpgw_info['user'] = $accounts->read_repository(); + + $pref = CreateObject('phpgwapi.preferences',$user); + $phpgw_info['user']['preferences'] = $pref->read_repository(); + } + else + { + $user = $phpgw_info['user']['account_id']; + } + + $phpgw_info['user']['preferences'] = $phpgw->common->create_emailpreferences($phpgw_info['user']['preferences'],$user); + + $send = CreateObject('phpgwapi.send'); + + switch($msg_type) + { + case MSG_DELETED: + $action = 'Deleted'; + $event_id = $old_event->id; + $msgtype = '"calendar";'; + break; + case MSG_MODIFIED: + $action = 'Modified'; + $event_id = $old_event->id; + $msgtype = '"calendar"; Version="'.$version.'"; Id="'.$new_event->id.'"'; + break; + case MSG_ADDED: + $action = 'Added'; + $event_id = $new_event->id; + $msgtype = '"calendar"; Version="'.$version.'"; Id="'.$new_event->id.'"'; + break; + case MSG_REJECTED: + $action = 'Rejected'; + $event_id = $old_event->id; + $msgtype = '"calendar";'; + break; + case MSG_TENTATIVE: + $action = 'Tentative'; + $event_id = $old_event->id; + $msgtype = '"calendar";'; + break; + case MSG_ACCEPTED: + $action = 'Tentative'; + $event_id = $old_event->id; + $msgtype = '"calendar";'; + break; + } + + if($old_event != False) + { + $old_event_datetime = $t_old_start_time - $this->datetime->tz_offset; + } + + if($new_event != False) + { + $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; + } + + while(list($userid,$statusid) = each($participants)) + { + if(intval($userid) != $phpgw_info['user']['account_id']) + { +// echo "Msg Type = ".$msg_type."
\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,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']; + $phpgw_info['user']['preferences']['common']['dateformat'] = $part_prefs['common']['dateformat']; + + $new_tz_offset = ((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset'])); + + if($old_event != False) + { + $old_event_date = $phpgw->common->show_date($old_event_datetime); + } + + if($new_event != False) + { + $new_event_date = $phpgw->common->show_date($new_event_datetime); + } + + switch($msg_type) + { + case MSG_DELETED: + $action_date = $old_event_date; + $body = 'Your meeting scehduled for '.$old_event_date.' has been canceled'; + break; + case MSG_MODIFIED: + $action_date = $new_event_date; + $body = 'Your meeting that had been scheduled for '.$old_event_date.' has been rescheduled to '.$new_event_date; + break; + case MSG_ADDED: + $action_date = $new_event_date; + $body = 'You have a meeting scheduled for '.$new_event_date; + break; + case MSG_REJECTED: + case MSG_TENTATIVE: + case MSG_ACCEPTED: + $action_date = $old_event_date; + $body = 'On '.$phpgw->common->show_date(time() - $new_tz_offset).' '.$phpgw->common->grab_owner_name($phpgw_info['user']['account_id']).' '.$action.' your meeting request for '.$old_event_date; + break; + } + $subject = 'Calendar Event ('.$action.') #'.$event_id.': '.$action_date.' (L)'; + $returncode = $send->msg('email',$to,$subject,$body,$msgtype,'','','',$sender); + } + } + unset($send); + + if((is_int($this->user) && $this->user != $temp_user['account_id']) || + (is_string($this->user) && $this->user != $temp_user['account_lid'])) + { + $phpgw_info['user'] = $temp_user; + } + + $phpgw_info['user']['preferences']['common']['tz_offset'] = $temp_tz_offset; + $phpgw_info['user']['preferences']['common']['timeformat'] = $temp_timeformat; + $phpgw_info['user']['preferences']['common']['dateformat'] = $temp_dateformat; + } + + function prepare_recipients(&$new_event,$old_event) + { + // Find modified and deleted users..... + while(list($old_userid,$old_status) = each($old_event->participants)) + { + if(isset($new_event->participants[$old_userid])) + { +// echo "Modifying event for user ".$old_userid."
\n"; + $this->modified[intval($old_userid)] = $new_status; + } + else + { +// echo "Deleting user ".$old_userid." from the event
\n"; + $this->deleted[intval($old_userid)] = $old_status; + } + } + // Find new users..... + while(list($new_userid,$new_status) = each($new_event->participants)) + { + if(!isset($old_event->participants[$new_userid])) + { +// echo "Adding event for user ".$new_userid."
\n"; + $this->added[$new_userid] = 'U'; + $new_event->participants[$new_userid] = 'U'; + } + } + + if(count($this->added) > 0 || count($this->modified) > 0 || count($this->deleted) > 0) + { + if(count($this->added) > 0) + { + $this->send_update(MSG_ADDED,$this->added,'',$new_event); + } + if(count($this->modified) > 0) + { + $this->send_update(MSG_MODIFIED,$this->modified,$old_event,$new_event); + } + if(count($this->deleted) > 0) + { + $this->send_update(MSG_DELETED,$this->deleted,$old_event); + } + } + } + + + function _debug_array($data) { echo '
UI:'; diff --git a/calendar/inc/class.socalendar.inc.php b/calendar/inc/class.socalendar.inc.php index 725a975f30..b9668014f7 100755 --- a/calendar/inc/class.socalendar.inc.php +++ b/calendar/inc/class.socalendar.inc.php @@ -26,7 +26,7 @@ function socalendar($owner=0,$filter='',$cat_id='') { - global $phpgw; + global $phpgw, $phpgw_info; $this->db = $phpgw->db; $this->datetime = CreateObject('phpgwapi.datetime'); @@ -71,7 +71,7 @@ return $this->cal->fetch_event($id); } - function list_events($startYear,$startMonth,$startDay,$endYear='',$endMonth='',$endDay='') + function list_events($startYear,$startMonth,$startDay,$endYear=0,$endMonth=0,$endDay=0) { $this->makeobj(); @@ -97,11 +97,14 @@ return Array(); } - $starttime = mktime(0,0,0,$smonth,$sday,$syear); - $endtime = mktime(23,59,59,$emonth,$eday,$eyear); + $this->makeobj(); + $starttime = mktime(0,0,0,$smonth,$sday,$syear) - $this->datetime->tz_offset; + $endtime = mktime(23,59,59,$emonth,$eday,$eyear) - $this->datetime->tz_offset; +// $starttime = mktime(0,0,0,$smonth,$sday,$syear); +// $endtime = mktime(23,59,59,$emonth,$eday,$eyear); $sql = "AND (phpgw_cal.cal_type='M') " . 'AND (phpgw_cal_user.cal_login='.$this->owner.' ' - . 'AND (phpgw_cal.datetime >= '.$starttime.') ' +// . 'AND (phpgw_cal.datetime <= '.$starttime.') ' . 'AND (((phpgw_cal_repeats.recur_enddate >= '.$starttime.') AND (phpgw_cal_repeats.recur_enddate <= '.$endtime.')) OR (phpgw_cal_repeats.recur_enddate=0))) '; if(strpos($this->filter,'private')) @@ -143,7 +146,7 @@ return $this->cal->get_event_ids($include_repeats,$sql); } - function add_entry($event) + function add_entry(&$event) { $this->makeobj(); $this->cal->store_event($event); @@ -161,6 +164,11 @@ $this->cal->expunge(); } + function set_status($id,$status) + { + $this->makeobj(); + $this->cal->set_status($id,$this->owner,$status); + } function get_lastid() { diff --git a/calendar/inc/class.socalendar__.inc.php b/calendar/inc/class.socalendar__.inc.php index 6c623dc970..0fd836747d 100755 --- a/calendar/inc/class.socalendar__.inc.php +++ b/calendar/inc/class.socalendar__.inc.php @@ -63,9 +63,6 @@ class socalendar__ var $stream; var $user; var $users_status; - var $modified; - var $deleted; - var $added; var $datetime; function socalendar__() @@ -73,215 +70,6 @@ class socalendar__ $this->datetime = CreateObject('phpgwapi.datetime'); } - function send_update($msg_type,$participants,$old_event=False,$new_event=False) - { - global $phpgw, $phpgw_info; - - $phpgw_info['user']['preferences'] = $phpgw->common->create_emailpreferences($phpgw_info['user']['preferences']); - $sender = $phpgw_info['user']['preferences']['email']['address']; - - $temp_tz_offset = $phpgw_info['user']['preferences']['common']['tz_offset']; - $temp_timeformat = $phpgw_info['user']['preferences']['common']['timeformat']; - $temp_dateformat = $phpgw_info['user']['preferences']['common']['dateformat']; - - $tz_offset = ((60 * 60) * intval($temp_tz_offset)); - - if($old_event != False) - { - $t_old_start_time = mktime($old_event->start->hour,$old_event->start->min,$old_event->start->sec,$old_event->start->month,$old_event->start->mday,$old_event->start->year); - if($t_old_start_time < (time() - 86400)) - { - return False; - } - } - - $temp_user = $phpgw_info['user']; - - if((is_int($this->user) && $this->user != $temp_user['account_id']) || - (is_string($this->user) && $this->user != $temp_user['account_lid'])) - { - if(is_string($this->user)) - { - $user = $phpgw->accounts->name2id($this->user); - } - elseif(is_int($this->user)) - { - $user = $this->user; - } - - $accounts = CreateObject('phpgwapi.accounts',$user); - $phpgw_info['user'] = $accounts->read_repository(); - - $pref = CreateObject('phpgwapi.preferences',$user); - $phpgw_info['user']['preferences'] = $pref->read_repository(); - } - else - { - $user = $phpgw_info['user']['account_id']; - } - - $phpgw_info['user']['preferences'] = $phpgw->common->create_emailpreferences($phpgw_info['user']['preferences'],$user); - - $send = CreateObject('phpgwapi.send'); - - switch($msg_type) - { - case MSG_DELETED: - $action = 'Deleted'; - $event_id = $old_event->id; - $msgtype = '"calendar";'; - break; - case MSG_MODIFIED: - $action = 'Modified'; - $event_id = $old_event->id; - $msgtype = '"calendar"; Version="'.$phpgw_info['server']['versions']['calendar'].'"; Id="'.$new_event->id.'"'; - break; - case MSG_ADDED: - $action = 'Added'; - $event_id = $old_event->id; - $msgtype = '"calendar"; Version="'.$phpgw_info['server']['versions']['calendar'].'"; Id="'.$new_event->id.'"'; - break; - case MSG_REJECTED: - $action = 'Rejected'; - $event_id = $old_event->id; - $msgtype = '"calendar";'; - break; - case MSG_TENTATIVE: - $action = 'Tentative'; - $event_id = $old_event->id; - $msgtype = '"calendar";'; - break; - case MSG_ACCEPTED: - $action = 'Tentative'; - $event_id = $old_event->id; - $msgtype = '"calendar";'; - break; - } - - if($old_event != False) - { - $old_event_datetime = $t_old_start_time - $this->datetime->tz_offset; - } - - if($new_event != False) - { - $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; - } - - while(list($userid,$statusid) = each($participants)) - { - if(intval($userid) != $phpgw_info['user']['account_id']) - { -// echo "Msg Type = ".$msg_type."
\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,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']; - $phpgw_info['user']['preferences']['common']['dateformat'] = $part_prefs['common']['dateformat']; - - $new_tz_offset = ((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset'])); - - if($old_event != False) - { - $old_event_date = $phpgw->common->show_date($old_event_datetime); - } - - if($new_event != False) - { - $new_event_date = $phpgw->common->show_date($new_event_datetime); - } - - switch($msg_type) - { - case MSG_DELETED: - $action_date = $old_event_date; - $body = 'Your meeting scehduled for '.$old_event_date.' has been canceled'; - break; - case MSG_MODIFIED: - $action_date = $new_event_date; - $body = 'Your meeting that had been scheduled for '.$old_event_date.' has been rescheduled to '.$new_event_date; - break; - case MSG_ADDED: - $action_date = $new_event_date; - $body = 'You have a meeting scheduled for '.$new_event_date; - break; - case MSG_REJECTED: - case MSG_TENTATIVE: - case MSG_ACCEPTED: - $action_date = $old_event_date; - $body = 'On '.$phpgw->common->show_date(time() - $new_tz_offset).' '.$phpgw->common->grab_owner_name($phpgw_info['user']['account_id']).' '.$action.' your meeting request for '.$old_event_date; - break; - } - $subject = 'Calendar Event ('.$action.') #'.$event_id.': '.$action_date.' (L)'; - $returncode = $send->msg('email',$to,$subject,$body,$msgtype,'','','',$sender); - } - } - unset($send); - - if((is_int($this->user) && $this->user != $temp_user['account_id']) || - (is_string($this->user) && $this->user != $temp_user['account_lid'])) - { - $phpgw_info['user'] = $temp_user; - } - - $phpgw_info['user']['preferences']['common']['tz_offset'] = $temp_tz_offset; - $phpgw_info['user']['preferences']['common']['timeformat'] = $temp_timeformat; - $phpgw_info['user']['preferences']['common']['dateformat'] = $temp_dateformat; - } - - function prepare_recipients(&$new_event,$old_event) - { - // Find modified and deleted users..... - while(list($old_userid,$old_status) = each($old_event->participants)) - { - if(isset($new_event->participants[$old_userid])) - { -// echo "Modifying event for user ".$old_userid."
\n"; - $this->modified[intval($old_userid)] = $new_status; - } - else - { -// echo "Deleting user ".$old_userid." from the event
\n"; - $this->deleted[intval($old_userid)] = $old_status; - } - } - // Find new users..... - while(list($new_userid,$new_status) = each($new_event->participants)) - { - if(!isset($old_event->participants[$new_userid])) - { -// echo "Adding event for user ".$new_userid."
\n"; - $this->added[$new_userid] = 'U'; - $new_event->participants[$new_userid] = 'U'; - } - } - - if(count($this->added) > 0 || count($this->modified) > 0 || count($this->deleted) > 0) - { - if(count($this->added) > 0) - { - $this->send_update(MSG_ADDED,$this->added,'',$new_event); - } - if(count($this->modified) > 0) - { - $this->send_update(MSG_MODIFIED,$this->modified,$old_event,$new_event); - } - if(count($this->deleted) > 0) - { - $this->send_update(MSG_DELETED,$this->deleted,$old_event); - } - } - } - function event_init() { CreateObject('calendar.calendar_item'); diff --git a/calendar/inc/class.socalendar_sql.inc.php b/calendar/inc/class.socalendar_sql.inc.php index 43c2783a69..f88ce87309 100755 --- a/calendar/inc/class.socalendar_sql.inc.php +++ b/calendar/inc/class.socalendar_sql.inc.php @@ -213,7 +213,7 @@ class socalendar_ extends socalendar__ return $this->event; } - function list_events($startYear,$startMonth,$startDay,$endYear='',$endMonth='',$endDay='',$extra='',$tz_offset=0) + function list_events($startYear,$startMonth,$startDay,$endYear=0,$endMonth=0,$endDay=0,$extra='',$tz_offset=0) { if(!isset($this->stream)) { @@ -224,7 +224,7 @@ class socalendar_ extends socalendar__ $user_where = ' AND (phpgw_cal_user.cal_login = '.$this->user.') '; $startDate = 'AND (phpgw_cal.datetime >= '.$datetime.') '; - if($endYear != '' && $endMonth != '' && $endDay != '') + if($endYear != 0 && $endMonth != 0 && $endDay != 0) { $edatetime = mktime(23,59,59,intval($endMonth),intval($endDay),intval($endYear)) - $tz_offset; $endDate = 'AND (phpgw_cal.edatetime <= '.$edatetime.') '; @@ -247,21 +247,6 @@ class socalendar_ extends socalendar__ function store_event() { - if($this->event->id != 0) - { - $new_event = $this->event; - $old_event = $this->fetch_event($new_event->id); - $this->prepare_recipients($new_event,$old_event); - $this->event = $new_event; - } - else - { - while(list($key,$value) = each($this->event->participants)) - { - $this->add_attribute('participants['.intval($key).']','U'); - } - $this->send_update(MSG_ADDED,$this->event->participants,'',$this->event); - } return $this->save_event($this->event); } @@ -304,14 +289,9 @@ class socalendar_ extends socalendar__ $this->stream->lock($locks); for($i=0;$ideleted_events);$i++) { - $event_id = $this->deleted_events[$i]; - - $event = $this->fetch_event($event_id); - $this->send_update(MSG_DELETED,$event->participants,$event); - for($k=0;$kstream->query('DELETE FROM '.$locks[$k].' WHERE cal_id='.$event_id,__LINE__,__FILE__); + $this->stream->query('DELETE FROM '.$locks[$k].' WHERE cal_id='.$this->deleted_events[$i],__LINE__,__FILE__); } } $this->stream->unlock(); @@ -469,24 +449,8 @@ class socalendar_ extends socalendar__ TENTATIVE => 'T', ACCEPTED => 'A' ); - $temp_event = $this->event; - $old_event = $this->fetch_event($id); - switch($status) - { - case REJECTED: - $this->send_update(MSG_REJECTED,$old_event->participants,$old_event); - $this->stream->query("DELETE FROM phpgw_cal_user WHERE cal_id=".$id." AND cal_login=".$owner,__LINE__,__FILE__); - break; - case TENTATIVE: - $this->send_update(MSG_TENTATIVE,$old_event->participants,$old_event); - $this->stream->query("UPDATE phpgw_cal_user SET cal_status='".$status_code_short[$status]."' WHERE cal_id=".$id." AND cal_login=".$owner,__LINE__,__FILE__); - break; - case ACCEPTED: - $this->send_update(MSG_ACCEPTED,$old_event->participants,$old_event); - $this->stream->query("UPDATE phpgw_cal_user SET cal_status='".$status_code_short[$status]."' WHERE cal_id=".$id." AND cal_login=".$owner,__LINE__,__FILE__); - break; - } - $this->event = $temp_event; + + $this->stream->query("UPDATE phpgw_cal_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.uicalendar.inc.php b/calendar/inc/class.uicalendar.inc.php index 9a2e0bcb4c..f371767d2c 100755 --- a/calendar/inc/class.uicalendar.inc.php +++ b/calendar/inc/class.uicalendar.inc.php @@ -41,7 +41,11 @@ 'update' => True, 'delete' => True, 'preferences' => True, - 'day' => True + 'day' => True, + 'edit_status' => True, + 'set_action' => True, + 'header' => True, + 'footer' => True ); function uicalendar() @@ -52,6 +56,12 @@ $this->bo = CreateObject('calendar.bocalendar',1); + if($this->debug) + { + echo "BO Owner : ".$this->bo->owner."
\n"; + } + + $this->template = $phpgw->template; $this->template_dir = $phpgw->common->get_tpl_dir('calendar'); $this->cat = CreateObject('phpgwapi.categories'); @@ -201,12 +211,13 @@ global $phpgw; Header('Location: '. $this->page()); + $phpgw_info['flags']['nofooter'] = True; $phpgw->common->phpgw_exit(); } function month() { - global $phpgw; + global $phpgw, $phpgw_info; $this->bo->read_holidays(); @@ -225,8 +236,6 @@ { $phpgw->common->phpgw_header(); echo parse_navbar(); - $this->header(); - $printer = ''; $param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1'; $print = '[".lang('Printer Friendly').']'; @@ -262,9 +271,9 @@ $p->set_var($var); $p->pparse('out','index_t'); - if(!$this->bo->printer_friendly) + if($this->bo->printer_friendly) { - $this->footer(); + $phpgw_info['flags']['nofooter'] = True; } } @@ -306,9 +315,9 @@ if (!$this->bo->printer_friendly) { + unset($phpgw_info['flags']['noheader']); + unset($phpgw_info['flags']['nonavbar']); $phpgw->common->phpgw_header(); - echo parse_navbar(); - $this->header(); $printer = ''; $prev_week_link = '<<'; $next_week_link = '>>'; @@ -357,11 +366,7 @@ flush(); if($this->bo->printer_friendly) { - $phpgw->common->phpgw_exit(); - } - else - { - $this->footer(); + $phpgw_info['flags']['nofooter'] = True; } } @@ -375,9 +380,9 @@ } else { + unset($phpgw_info['flags']['noheader']); + unset($phpgw_info['flags']['nonavbar']); $phpgw->common->phpgw_header(); - echo parse_navbar(); - $this->header(); } ?> @@ -429,14 +434,13 @@ bo->printer_friendly) { - $phpgw->common->phpgw_exit(); + $phpgw_info['flags']['nofooter'] = True; } else { echo ' ['.lang('Printer Friendly').']'; - $this->footer(); } } @@ -444,9 +448,9 @@ { global $phpgw,$phpgw_info,$cal_id,$submit,$referer; + unset($phpgw_info['flags']['noheader']); + unset($phpgw_info['flags']['nonavbar']); $phpgw->common->phpgw_header(); - echo parse_navbar(); - $this->header(); // First, make sure they have permission to this entry if ($cal_id < 1) @@ -511,7 +515,6 @@ echo lang("Sorry, the owner has just deleted this event").'.'; } echo ''; - $this->footer(); } function edit() @@ -601,8 +604,9 @@ $start = mktime($event->start->hour,$event->start->min,$event->start->sec,$event->start->month,$event->start->mday,$event->start->year) - $this->bo->datetime->tz_offset; $end = mktime($event->end->hour,$event->end->min,$event->end->sec,$event->end->month,$event->end->mday,$event->end->year) - $this->bo->datetime->tz_offset; + unset($phpgw_info['flags']['noheader']); + unset($phpgw_info['flags']['nonavbar']); $phpgw->common->phpgw_header(); - echo parse_navbar(); $p = CreateObject('phpgwapi.Template',$this->template_dir); $templates = Array( @@ -799,14 +803,14 @@ ); // I Participate - $str = ' 0) && isset($event->participants[$owner])) || !isset($id)) + $str = ' 0) && isset($event->participants[$this->bo->owner])) || !isset($cal_id)) { $str .= ' checked'; } $str .= '>'; $var[] = Array( - 'field' => $phpgw->common->grab_owner_name($owner).' '.lang('Participates'), + 'field' => $phpgw->common->grab_owner_name($this->bo->owner).' '.lang('Participates'), 'data' => $str ); @@ -922,7 +926,6 @@ $p->set_var('delete_button',''); } $p->pparse('out','edit_entry'); - $this->footer(); } function update() @@ -1017,7 +1020,8 @@ } reset($participants); - if(!@$phpgw->calendar->event->participants[$cal[owner]]) + $event = $this->bo->get_cached_event(); + if(!@$event->participants[$cal[owner]]) { $this->bo->add_attribute('owner',$minparts); } @@ -1049,8 +1053,9 @@ if(count($overlapping_events) > 0 && $overlapping_events != False) { + unset($phpgw_info['flags']['noheader']); + unset($phpgw_info['flags']['nonavbar']); $phpgw->common->phpgw_header(); - echo parse_navbar(); $p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar')); $templates = Array( @@ -1107,9 +1112,6 @@ $p->parse('reedit_button','form_button'); $p->pparse('out','overlap'); -// $phpgw_info['flags']['nofooter'] = False; -// $phpgw->common->phpgw_footer(); - $this->footer(); } else { @@ -1215,8 +1217,10 @@ $phpgw->common->phpgw_exit(); } + unset($phpgw_info['flags']['noheader']); + unset($phpgw_info['flags']['nonavbar']); + $phpgw_info['flags']['noappheader'] = True; $phpgw->common->phpgw_header(); - echo parse_navbar(); $p = CreateObject('phpgwapi.Template',$this->template_dir); $templates = Array( @@ -1348,27 +1352,20 @@ $this->display_item($p,lang('Print calendars in black & white'),$str); $p->pparse('out','pref'); - $phpgw->common->phpgw_footer(); + $phpgw_info['flags']['noappfooter'] = True; } function day() { - global $phpgw; + global $phpgw, $phpgw_info; $this->bo->read_holidays(); - $p = CreateObject('phpgwapi.Template',$this->template_dir); - - $template = Array( - 'day_t' => 'day.tpl' - ); - - $p->set_file($template); - if (!$this->bo->printer_friendly) { + unset($phpgw_info['flags']['noheader']); + unset($phpgw_info['flags']['nonavbar']); $phpgw->common->phpgw_header(); - echo parse_navbar(); $printer = ''; $param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&day='.$this->bo->day.'&friendly=1'; $print = '[".lang('Printer Friendly').']'; @@ -1392,7 +1389,13 @@ $now = $this->bo->datetime->makegmttime(0, 0, 0, $this->bo->month, $this->bo->day, $this->bo->year); $now['raw'] += $this->bo->datetime->tz_offset; $m = mktime(0,0,0,$this->bo->month,1,$this->bo->year); - + + $p = CreateObject('phpgwapi.Template',$this->template_dir); + $template = Array( + 'day_t' => 'day.tpl' + ); + $p->set_file($template); + $var = Array( 'printer_friendly' => $printer, 'bg_text' => $phpgw_info['themem']['bg_text'], @@ -1406,16 +1409,64 @@ $p->set_var($var); $p->pparse('out','day_t'); - if(!$this->so->printer_friendly) + if($this->bo->printer_friendly) { - $phpgw->common->phpgw_footer(); - } - else - { - $phpgw->common->phpgw_exit(); + $phpgw_info['flags']['nofooter'] = True; } } - + + function edit_status() + { + global $phpgw, $phpgw_info, $cal_id; + + unset($phpgw_info['flags']['noheader']); + unset($phpgw_info['flags']['nonavbar']); + $phpgw_info['flags']['noappheader'] = True; + $phpgw->common->phpgw_header(); + + $event = $this->bo->read_entry($cal_id); + + reset($event->participants); + + if(!$event->participants[$this->bo->owner]) + { + echo '
The user '.$phpgw->common->grab_owner_name($this->bo->owner).' is not participating in this event!
'; + $phpgw->common->footer(); + } + + if(!$this->bo->check_perms(PHPGW_ACL_EDIT)) + { + echo '
You do not have permission to edit this appointment!
'; + $phpgw->common->footer(); + } + + $freetime = $this->bo->datetime->localdates(mktime(0,0,0,$event->start->month,$event->start->mday,$event->start->year) - $this->bo->datetime->tz_offset); + echo $this->timematrix($freetime,$this->bo->splittime('000000',False),0,$event->participants); + + echo $this->view_event($event); + + echo $this->get_response($event->id); + $phpgw_info['flags']['noappfooter'] = True; + } + + function set_action() + { + global $phpgw, $cal_id, $action; + + if(!$this->bo->check_perms(PHPGW_ACL_EDIT)) + { + unset($phpgw_info['flags']['noheader']); + unset($phpgw_info['flags']['nonavbar']); + $phpgw->common->phpgw_header(); + echo '
You do not have permission to edit this appointment!
'; + $phpgw->common->phpgw_exit(); + } + + $this->bo->set_status(intval($cal_id),intval($action)); + + Header('Location: '.$this->page('','')); + } + /* Private functions */ function _debug_sqsof() { @@ -1483,10 +1534,7 @@ function header() { - if (floor(phpversion()) == 4) - { - global $phpgw, $cal_id, $date, $keywords, $matrixtype, $participants, $remainder, $tpl, $menuaction; - } + global $phpgw, $cal_id, $date, $keywords, $matrixtype, $participants, $tpl, $menuaction; $cols = 8; if($this->bo->check_perms(PHPGW_ACL_PRIVATE) == True) @@ -1498,7 +1546,9 @@ $tpl->set_unknowns('remove'); include($this->template_dir.'/header.inc.php'); - flush(); + $header = $tpl->fp('out','head'); + unset($tpl); + echo $header; } function footer() @@ -2255,16 +2305,16 @@ return $p->fp('out','view_event'); } - function html_for_day($event,$first_hour,$last_hour,&$time,$month,$day,$year,&$rowspan,&$rowspan_arr) + function html_for_day($event,&$time,$month,$day,$year,&$rowspan,&$rowspan_arr) { $ind = intval($event->start->hour); - if($ind<$first_hour || $ind>$last_hour) + if($ind < (int)$this->bo->prefs['calendar']['workdaystarts'] || $ind > (int)$this->bo->prefs['calendar']['workdayends']) { $ind = 99; } - if(!isset($time[$ind]) || !$time[$ind]) + if(!@$time[$ind]) { $time[$ind] = ''; } @@ -2295,7 +2345,7 @@ { global $phpgw, $phpgw_info; - $this->bo->store_to_cache($year,$month,$day); + $this->bo->store_to_cache($year,$month,$day,$year,$month,$day + 1); $p = CreateObject('phpgwapi.Template',$this->template_dir); $p->set_unknowns('keep'); @@ -2355,9 +2405,6 @@ $p->set_var($var); - $first_hour = (int)$this->bo->prefs['calendar']['workdaystarts']; - $last_hour = (int)$this->bo->prefs['calendar']['workdayends']; - for ($i=0;$i<24;$i++) { $this->rowspan_arr[$i] = 0; @@ -2367,13 +2414,6 @@ CreateObject('calendar.calendar_item') ); $date_to_eval = sprintf("%04d%02d%02d",$year,$month,$day); - echo "DATE TO EVAL : $date_to_eval
\n"; - echo "ITEMS FOUND : ".count($this->bo->cached_events[$date_to_eval])."
\n"; - - while(list($cached_date,$event) = each($this->bo->cached_events)) - { - echo "Cached Events for : $cached_date : ".count($event)."
\n"; - } $time = Array(); @@ -2382,16 +2422,13 @@ // $events = $this->bo->cached_events[$date_to_eval]; - echo "Extra params for $date_to_eval : ".$daily[$date_to_eval]['extra']."
\n"; - - if($this->bo->cached_events[$date_to_eval]) + if($daily[$date_to_eval]['appts']) { $events = $this->bo->cached_events[$date_to_eval]; $c_events = count($events); - echo "Looping $c_events times
\n"; for($i=0;$i<$c_events;$i++) { - $this->html_for_day($events[$i],$first_hour,$last_hour,$time,$month,$day,$year,$rowspan,$rowspan_arr); + $this->html_for_day($events[$i],$time,$month,$day,$year,$rowspan,$rowspan_arr); } } @@ -2444,22 +2481,19 @@ 'event' => $time[99], 'bgcolor' => $bgcolor ); - $p->set_var($var); - $p->parse('item','day_event',False); + $this->output_template_array($p,'item','day_event',$var); $var = Array( 'open_link' => '', 'time' => ' ', 'close_link' => '' ); - $p->set_var($var); - - $p->parse('item','day_time',True); + $this->output_template_array($p,'item','day_time',$var); $p->parse('row','day_row',True); $p->set_var('item',''); } $rowspan = 0; - for ($i=$first_hour;$i<=$last_hour;$i++) + for ($i=(int)$this->bo->prefs['calendar']['workdaystarts'];$i<=(int)$this->bo->prefs['calendar']['workdayends'];$i++) { $dtime = $this->bo->build_time_for_display($i * 10000); $p->set_var('extras',''); @@ -2520,14 +2554,160 @@ 'close_link' => $close_link ); - $p->set_var($var); - - $p->parse('item','day_time',True); + $this->output_template_array($p,'item','day_time',$var); $p->parse('row','day_row',True); $p->set_var('event',''); $p->set_var('item',''); } // end for return $p->fp('out','day'); } // end function + + function timematrix($date,$starttime,$endtime,$participants) + { + global $phpgw, $phpgw_info; + + if(!isset($this->bo->prefs['calendar']['interval'])) + { + $this->bo->prefs['calendar']['interval'] = 15; + $phpgw->preferences->add('calendar','interval',15); + $phpgw->preferences->save_repository(); + } +// $increment = $this->bo->prefs['calendar']['interval']; + $increment = 15; + $interval = (int)(60 / $increment); + + $pix = $phpgw->common->image('calendar','pix.gif'); + $str = '
'.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').'
'; + $str .= ''; + $str .= ''; + $str .= ''; + for($i=0;$i<24;$i++) + { + for($j=0;$j<$interval;$j++) + { + switch($j) + { + case 0: + case 1: + switch($j) + { + case 0: + $pre = '0'; + break; + case 1: + $pre = substr(strval($i),0,1); + break; + } + + $k = ($i<=9?$pre:substr($i,$j,$j+1)); + if($increment == 60) + { + $k .= substr(strval($i),strlen(strval($i)) - 1,1); + } + $str .= ''; + break; + default: + $str .= ''; + break; + } + } + } + $str .= ''; + $str .= ''; + if(!$endtime) + { + $endtime = $starttime; + } + $owner = $this->bo->owner; + while(list($part,$status) = each($participants)) + { + $str .= ''; + $str .= ''; + + $this->bo->cached_events = Array(); + $this->bo->owner = $part; + $this->so->owner = $part; + $this->bo->store_to_cache($date['year'],$date['month'],$date['day'],0,0,$date['day'] + 1); + + if(!$this->bo->cached_events[$date['full']]) + { + for($j=0;$j<24;$j++) + { + for($k=0;$k<$interval;$k++) + { + $str .= ''; + } + } + } + else + { + $time_slice = $this->bo->prepare_matrix($interval,$increment,$part,$status,$date['full']); + for($h=0;$h<24;$h++) + { + $hour = $h * 10000; + for($m=0;$m<$interval;$m++) + { + $index = ($hour + (($m * $increment) * 100)); + switch($time_slice[$index]['marker']) + { + case ' ': + $time_slice[$index]['color'] = $phpgw_info['theme']['bg_color']; + break; + case '-': + $time_slice[$index]['color'] = $phpgw_info['theme']['bg01']; + break; + } + $str .= ''; + } + } + } + $str .= ''; + $str .= ''; + } + $str .= '
'.lang('Participant').''; + $str .= '"; + $str .= $k.''; + $str .= '"; + $str .= ' 
'.$this->bo->get_fullname($participants[$i]).' ".''.$time_slice[$index]['marker'].'
'; + $this->bo->owner = $owner; + $this->so->owner = $owner; + return $str; + } + + function get_response($cal_id) + { + global $phpgw; + + $str = ''; + + $p = CreateObject('phpgwapi.Template',$this->template_dir); + + $templates = Array( + 'form_button' => 'form_button_script.tpl' + ); + $p->set_file($templates); + + $response_choices = Array( + ACCEPTED => lang('Accept'), + REJECTED => lang('Reject'), + TENTATIVE => lang('Tentative'), + NO_RESPONSE => lang('No Response') + ); + while(list($param,$text) = each($response_choices)) + { + $var = Array( + 'action_url_button' => $this->page('set_action','&cal_id='.$cal_id.'&action='.$param), + 'action_text_button' => ' '.$text.' ', + 'action_confirm_button' => '', + 'action_extra_field' => '' + ); + $p->set_var($var); + $str .= ''."\n"; + } + $str .= '
'.$p->fp('out','form_button').'
'; + return $str; + } } ?> diff --git a/calendar/templates/default/images/planner.gif b/calendar/templates/default/images/planner.gif new file mode 100755 index 0000000000..c9d1efdcbb Binary files /dev/null and b/calendar/templates/default/images/planner.gif differ diff --git a/calendar/templates/default/images/single.gif b/calendar/templates/default/images/single.gif new file mode 100755 index 0000000000..8afcce952d Binary files /dev/null and b/calendar/templates/default/images/single.gif differ diff --git a/calendar/templates/idsociety/header.inc.php b/calendar/templates/idsociety/header.inc.php index 9bf787286e..a5a5d9fd1e 100755 --- a/calendar/templates/idsociety/header.inc.php +++ b/calendar/templates/idsociety/header.inc.php @@ -175,7 +175,4 @@ $button = $tpl->fp('out','form_button'); $tpl->set_var('str',''.$button.''); $tpl->parse('header_column','head_col',True); - - echo $tpl->fp('out','head'); - unset($tpl); ?> diff --git a/calendar/templates/justweb/header.inc.php b/calendar/templates/justweb/header.inc.php index 9bf787286e..a5a5d9fd1e 100755 --- a/calendar/templates/justweb/header.inc.php +++ b/calendar/templates/justweb/header.inc.php @@ -175,7 +175,4 @@ $button = $tpl->fp('out','form_button'); $tpl->set_var('str',''.$button.''); $tpl->parse('header_column','head_col',True); - - echo $tpl->fp('out','head'); - unset($tpl); ?> diff --git a/calendar/templates/verdilak/header.inc.php b/calendar/templates/verdilak/header.inc.php index 9bf787286e..a5a5d9fd1e 100755 --- a/calendar/templates/verdilak/header.inc.php +++ b/calendar/templates/verdilak/header.inc.php @@ -175,7 +175,4 @@ $button = $tpl->fp('out','form_button'); $tpl->set_var('str',''.$button.''); $tpl->parse('header_column','head_col',True); - - echo $tpl->fp('out','head'); - unset($tpl); ?>