forked from extern/egroupware
A little more fixing to the calendar. Will try and get the search UI built.
This commit is contained in:
parent
300c84ea9a
commit
588ad423df
@ -45,14 +45,15 @@
|
|||||||
var $cat_id;
|
var $cat_id;
|
||||||
var $users_timeformat;
|
var $users_timeformat;
|
||||||
|
|
||||||
|
var $modified;
|
||||||
|
var $deleted;
|
||||||
|
var $added;
|
||||||
|
|
||||||
var $use_session = False;
|
var $use_session = False;
|
||||||
|
|
||||||
function bocalendar($session=0)
|
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');
|
$phpgw->nextmatchs = CreateObject('phpgwapi.nextmatchs');
|
||||||
|
|
||||||
@ -66,12 +67,17 @@
|
|||||||
$this->use_session = True;
|
$this->use_session = True;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->debug) { echo "BO Filter : (".$this->filter.")<br>\n"; }
|
if($this->debug)
|
||||||
|
{
|
||||||
|
echo "BO Filter : (".$this->filter.")<br>\n";
|
||||||
|
echo "Owner : ".$this->owner."<br>\n";
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($owner))
|
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'];
|
$this->owner = $phpgw_info['user']['account_id'];
|
||||||
}
|
}
|
||||||
@ -79,7 +85,6 @@
|
|||||||
$this->prefs['common'] = $phpgw_info['user']['preferences']['common'];
|
$this->prefs['common'] = $phpgw_info['user']['preferences']['common'];
|
||||||
$this->prefs['calendar'] = $phpgw_info['user']['preferences']['calendar'];
|
$this->prefs['calendar'] = $phpgw_info['user']['preferences']['calendar'];
|
||||||
|
|
||||||
|
|
||||||
if ($this->prefs['common']['timeformat'] == '12')
|
if ($this->prefs['common']['timeformat'] == '12')
|
||||||
{
|
{
|
||||||
$this->users_timeformat = 'h:i a';
|
$this->users_timeformat = 'h:i a';
|
||||||
@ -141,7 +146,11 @@
|
|||||||
$this->so = CreateObject('calendar.socalendar',$this->owner,$this->filter,$this->cat_id);
|
$this->so = CreateObject('calendar.socalendar',$this->owner,$this->filter,$this->cat_id);
|
||||||
$this->datetime = $this->so->datetime;
|
$this->datetime = $this->so->datetime;
|
||||||
|
|
||||||
if($this->debug) { echo "BO Filter : (".$this->filter.")<br>\n"; }
|
if($this->debug)
|
||||||
|
{
|
||||||
|
echo "BO Filter : (".$this->filter.")<br>\n";
|
||||||
|
echo "Owner : ".$this->owner."<br>\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function save_sessiondata($data)
|
function save_sessiondata($data)
|
||||||
@ -163,10 +172,10 @@
|
|||||||
|
|
||||||
$this->filter = $data['filter'];
|
$this->filter = $data['filter'];
|
||||||
$this->cat_id = $data['cat_id'];
|
$this->cat_id = $data['cat_id'];
|
||||||
$this->owner = $data['owner'];
|
$this->owner = intval($data['owner']);
|
||||||
$this->year = $data['year'];
|
$this->year = intval($data['year']);
|
||||||
$this->month = $data['month'];
|
$this->month = intval($data['month']);
|
||||||
$this->day = $data['day'];
|
$this->day = intval($data['day']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function read_entry($id)
|
function read_entry($id)
|
||||||
@ -182,6 +191,7 @@
|
|||||||
if($this->check_perms(PHPGW_ACL_ADD))
|
if($this->check_perms(PHPGW_ACL_ADD))
|
||||||
{
|
{
|
||||||
$this->so->add_entry($event);
|
$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($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);
|
$this->so->add_entry($event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -205,6 +221,12 @@
|
|||||||
{
|
{
|
||||||
if($this->check_perms(PHPGW_ACL_DELETE))
|
if($this->check_perms(PHPGW_ACL_DELETE))
|
||||||
{
|
{
|
||||||
|
for($i=0;$i<count($this->so->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();
|
$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)
|
function display_status($user_status)
|
||||||
{
|
{
|
||||||
global $phpgw_info;
|
if(@$this->prefs['calendar']['display_status'])
|
||||||
|
|
||||||
if(isset($this->prefs['calendar']['display_status']) && $this->prefs['calendar']['display_status'] == True)
|
|
||||||
{
|
{
|
||||||
return ' ('.$user_status.')';
|
return ' ('.$user_status.')';
|
||||||
}
|
}
|
||||||
@ -419,12 +468,12 @@
|
|||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
|
|
||||||
function is_private($event,$owner,$field='')
|
function is_private($event,$owner)
|
||||||
{
|
{
|
||||||
global $phpgw, $phpgw_info;
|
global $phpgw, $phpgw_info;
|
||||||
|
|
||||||
if($owner == 0) { $owner = $this->owner; }
|
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;
|
$is_private = False;
|
||||||
}
|
}
|
||||||
@ -704,7 +753,10 @@
|
|||||||
{
|
{
|
||||||
global $phpgw, $phpgw_info;
|
global $phpgw, $phpgw_info;
|
||||||
|
|
||||||
|
if($this->debug)
|
||||||
|
{
|
||||||
echo "Start Date : ".sprintf("%04d%02d%02d",$syear,$smonth,$sday)."<br>\n";
|
echo "Start Date : ".sprintf("%04d%02d%02d",$syear,$smonth,$sday)."<br>\n";
|
||||||
|
}
|
||||||
|
|
||||||
if(!$eyear && !$emonth && !$eday)
|
if(!$eyear && !$emonth && !$eday)
|
||||||
{
|
{
|
||||||
@ -736,6 +788,12 @@
|
|||||||
$c_cached_ids = count($cached_event_ids);
|
$c_cached_ids = count($cached_event_ids);
|
||||||
$c_cached_ids_repeating = count($cached_event_ids_repeating);
|
$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)."<br>\n";
|
||||||
|
echo "repeating events cached : $c_cached_ids_repeating : for : ".sprintf("%04d%02d%02d",$syear,$smonth,$sday)."<br>\n";
|
||||||
|
}
|
||||||
|
|
||||||
$this->cached_events = Array();
|
$this->cached_events = Array();
|
||||||
|
|
||||||
if($c_cached_ids == 0 && $c_cached_ids_repeating == 0)
|
if($c_cached_ids == 0 && $c_cached_ids_repeating == 0)
|
||||||
@ -949,10 +1007,323 @@
|
|||||||
'class' => $class
|
'class' => $class
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// $this->_debug_array($daily);
|
|
||||||
|
if($this->debug)
|
||||||
|
{
|
||||||
|
$this->_debug_array($daily);
|
||||||
|
}
|
||||||
|
|
||||||
return $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;$k<count($this->cached_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."<br>\n";
|
||||||
|
// echo "userid = ".$userid."<br>\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."<br>\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."<br>\n";
|
||||||
|
$this->modified[intval($old_userid)] = $new_status;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// echo "Deleting user ".$old_userid." from the event<br>\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."<br>\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)
|
function _debug_array($data)
|
||||||
{
|
{
|
||||||
echo '<br>UI:';
|
echo '<br>UI:';
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
function socalendar($owner=0,$filter='',$cat_id='')
|
function socalendar($owner=0,$filter='',$cat_id='')
|
||||||
{
|
{
|
||||||
global $phpgw;
|
global $phpgw, $phpgw_info;
|
||||||
|
|
||||||
$this->db = $phpgw->db;
|
$this->db = $phpgw->db;
|
||||||
$this->datetime = CreateObject('phpgwapi.datetime');
|
$this->datetime = CreateObject('phpgwapi.datetime');
|
||||||
@ -71,7 +71,7 @@
|
|||||||
return $this->cal->fetch_event($id);
|
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();
|
$this->makeobj();
|
||||||
|
|
||||||
@ -97,11 +97,14 @@
|
|||||||
return Array();
|
return Array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$starttime = mktime(0,0,0,$smonth,$sday,$syear);
|
$this->makeobj();
|
||||||
$endtime = mktime(23,59,59,$emonth,$eday,$eyear);
|
$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') "
|
$sql = "AND (phpgw_cal.cal_type='M') "
|
||||||
. 'AND (phpgw_cal_user.cal_login='.$this->owner.' '
|
. '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))) ';
|
. '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'))
|
if(strpos($this->filter,'private'))
|
||||||
@ -143,7 +146,7 @@
|
|||||||
return $this->cal->get_event_ids($include_repeats,$sql);
|
return $this->cal->get_event_ids($include_repeats,$sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_entry($event)
|
function add_entry(&$event)
|
||||||
{
|
{
|
||||||
$this->makeobj();
|
$this->makeobj();
|
||||||
$this->cal->store_event($event);
|
$this->cal->store_event($event);
|
||||||
@ -161,6 +164,11 @@
|
|||||||
$this->cal->expunge();
|
$this->cal->expunge();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function set_status($id,$status)
|
||||||
|
{
|
||||||
|
$this->makeobj();
|
||||||
|
$this->cal->set_status($id,$this->owner,$status);
|
||||||
|
}
|
||||||
|
|
||||||
function get_lastid()
|
function get_lastid()
|
||||||
{
|
{
|
||||||
|
@ -63,9 +63,6 @@ class socalendar__
|
|||||||
var $stream;
|
var $stream;
|
||||||
var $user;
|
var $user;
|
||||||
var $users_status;
|
var $users_status;
|
||||||
var $modified;
|
|
||||||
var $deleted;
|
|
||||||
var $added;
|
|
||||||
var $datetime;
|
var $datetime;
|
||||||
|
|
||||||
function socalendar__()
|
function socalendar__()
|
||||||
@ -73,215 +70,6 @@ class socalendar__
|
|||||||
$this->datetime = CreateObject('phpgwapi.datetime');
|
$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."<br>\n";
|
|
||||||
// echo "userid = ".$userid."<br>\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."<br>\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."<br>\n";
|
|
||||||
$this->modified[intval($old_userid)] = $new_status;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// echo "Deleting user ".$old_userid." from the event<br>\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."<br>\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()
|
function event_init()
|
||||||
{
|
{
|
||||||
CreateObject('calendar.calendar_item');
|
CreateObject('calendar.calendar_item');
|
||||||
|
@ -213,7 +213,7 @@ class socalendar_ extends socalendar__
|
|||||||
return $this->event;
|
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))
|
if(!isset($this->stream))
|
||||||
{
|
{
|
||||||
@ -224,7 +224,7 @@ class socalendar_ extends socalendar__
|
|||||||
$user_where = ' AND (phpgw_cal_user.cal_login = '.$this->user.') ';
|
$user_where = ' AND (phpgw_cal_user.cal_login = '.$this->user.') ';
|
||||||
$startDate = 'AND (phpgw_cal.datetime >= '.$datetime.') ';
|
$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;
|
$edatetime = mktime(23,59,59,intval($endMonth),intval($endDay),intval($endYear)) - $tz_offset;
|
||||||
$endDate = 'AND (phpgw_cal.edatetime <= '.$edatetime.') ';
|
$endDate = 'AND (phpgw_cal.edatetime <= '.$edatetime.') ';
|
||||||
@ -247,21 +247,6 @@ class socalendar_ extends socalendar__
|
|||||||
|
|
||||||
function store_event()
|
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);
|
return $this->save_event($this->event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,14 +289,9 @@ class socalendar_ extends socalendar__
|
|||||||
$this->stream->lock($locks);
|
$this->stream->lock($locks);
|
||||||
for($i=0;$i<count($this->deleted_events);$i++)
|
for($i=0;$i<count($this->deleted_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;$k<count($locks);$k++)
|
for($k=0;$k<count($locks);$k++)
|
||||||
{
|
{
|
||||||
$this->stream->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();
|
$this->stream->unlock();
|
||||||
@ -469,24 +449,8 @@ class socalendar_ extends socalendar__
|
|||||||
TENTATIVE => 'T',
|
TENTATIVE => 'T',
|
||||||
ACCEPTED => 'A'
|
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__);
|
$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;
|
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,11 @@
|
|||||||
'update' => True,
|
'update' => True,
|
||||||
'delete' => True,
|
'delete' => True,
|
||||||
'preferences' => True,
|
'preferences' => True,
|
||||||
'day' => True
|
'day' => True,
|
||||||
|
'edit_status' => True,
|
||||||
|
'set_action' => True,
|
||||||
|
'header' => True,
|
||||||
|
'footer' => True
|
||||||
);
|
);
|
||||||
|
|
||||||
function uicalendar()
|
function uicalendar()
|
||||||
@ -52,6 +56,12 @@
|
|||||||
|
|
||||||
$this->bo = CreateObject('calendar.bocalendar',1);
|
$this->bo = CreateObject('calendar.bocalendar',1);
|
||||||
|
|
||||||
|
if($this->debug)
|
||||||
|
{
|
||||||
|
echo "BO Owner : ".$this->bo->owner."<br>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->template = $phpgw->template;
|
$this->template = $phpgw->template;
|
||||||
$this->template_dir = $phpgw->common->get_tpl_dir('calendar');
|
$this->template_dir = $phpgw->common->get_tpl_dir('calendar');
|
||||||
$this->cat = CreateObject('phpgwapi.categories');
|
$this->cat = CreateObject('phpgwapi.categories');
|
||||||
@ -201,12 +211,13 @@
|
|||||||
global $phpgw;
|
global $phpgw;
|
||||||
|
|
||||||
Header('Location: '. $this->page());
|
Header('Location: '. $this->page());
|
||||||
|
$phpgw_info['flags']['nofooter'] = True;
|
||||||
$phpgw->common->phpgw_exit();
|
$phpgw->common->phpgw_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
function month()
|
function month()
|
||||||
{
|
{
|
||||||
global $phpgw;
|
global $phpgw, $phpgw_info;
|
||||||
|
|
||||||
$this->bo->read_holidays();
|
$this->bo->read_holidays();
|
||||||
|
|
||||||
@ -225,8 +236,6 @@
|
|||||||
{
|
{
|
||||||
$phpgw->common->phpgw_header();
|
$phpgw->common->phpgw_header();
|
||||||
echo parse_navbar();
|
echo parse_navbar();
|
||||||
$this->header();
|
|
||||||
|
|
||||||
$printer = '';
|
$printer = '';
|
||||||
$param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1';
|
$param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1';
|
||||||
$print = '<a href="'.$this->page('month'.$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = '".lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>';
|
$print = '<a href="'.$this->page('month'.$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = '".lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>';
|
||||||
@ -262,9 +271,9 @@
|
|||||||
|
|
||||||
$p->set_var($var);
|
$p->set_var($var);
|
||||||
$p->pparse('out','index_t');
|
$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)
|
if (!$this->bo->printer_friendly)
|
||||||
{
|
{
|
||||||
|
unset($phpgw_info['flags']['noheader']);
|
||||||
|
unset($phpgw_info['flags']['nonavbar']);
|
||||||
$phpgw->common->phpgw_header();
|
$phpgw->common->phpgw_header();
|
||||||
echo parse_navbar();
|
|
||||||
$this->header();
|
|
||||||
$printer = '';
|
$printer = '';
|
||||||
$prev_week_link = '<a href="'.$this->page('week','&year='.$prev['year'].'&month='.$prev['month'].'&day='.$prev['day']).'"><<</a>';
|
$prev_week_link = '<a href="'.$this->page('week','&year='.$prev['year'].'&month='.$prev['month'].'&day='.$prev['day']).'"><<</a>';
|
||||||
$next_week_link = '<a href="'.$this->page('week','&year='.$next['year'].'&month='.$next['month'].'&day='.$next['day']).'">>></a>';
|
$next_week_link = '<a href="'.$this->page('week','&year='.$next['year'].'&month='.$next['month'].'&day='.$next['day']).'">>></a>';
|
||||||
@ -357,11 +366,7 @@
|
|||||||
flush();
|
flush();
|
||||||
if($this->bo->printer_friendly)
|
if($this->bo->printer_friendly)
|
||||||
{
|
{
|
||||||
$phpgw->common->phpgw_exit();
|
$phpgw_info['flags']['nofooter'] = True;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->footer();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,9 +380,9 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
unset($phpgw_info['flags']['noheader']);
|
||||||
|
unset($phpgw_info['flags']['nonavbar']);
|
||||||
$phpgw->common->phpgw_header();
|
$phpgw->common->phpgw_header();
|
||||||
echo parse_navbar();
|
|
||||||
$this->header();
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@ -429,14 +434,13 @@
|
|||||||
<?php
|
<?php
|
||||||
if($this->bo->printer_friendly)
|
if($this->bo->printer_friendly)
|
||||||
{
|
{
|
||||||
$phpgw->common->phpgw_exit();
|
$phpgw_info['flags']['nofooter'] = True;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo ' <a href="'.$this->page('year','&friendly=1')
|
echo ' <a href="'.$this->page('year','&friendly=1')
|
||||||
.'" target="cal_printer_friendly" onMouseOver="window.status = '."'"
|
.'" target="cal_printer_friendly" onMouseOver="window.status = '."'"
|
||||||
.lang('Generate printer-friendly version')."'".'">['.lang('Printer Friendly').']</a>';
|
.lang('Generate printer-friendly version')."'".'">['.lang('Printer Friendly').']</a>';
|
||||||
$this->footer();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,9 +448,9 @@
|
|||||||
{
|
{
|
||||||
global $phpgw,$phpgw_info,$cal_id,$submit,$referer;
|
global $phpgw,$phpgw_info,$cal_id,$submit,$referer;
|
||||||
|
|
||||||
|
unset($phpgw_info['flags']['noheader']);
|
||||||
|
unset($phpgw_info['flags']['nonavbar']);
|
||||||
$phpgw->common->phpgw_header();
|
$phpgw->common->phpgw_header();
|
||||||
echo parse_navbar();
|
|
||||||
$this->header();
|
|
||||||
|
|
||||||
// First, make sure they have permission to this entry
|
// First, make sure they have permission to this entry
|
||||||
if ($cal_id < 1)
|
if ($cal_id < 1)
|
||||||
@ -511,7 +515,6 @@
|
|||||||
echo lang("Sorry, the owner has just deleted this event").'.';
|
echo lang("Sorry, the owner has just deleted this event").'.';
|
||||||
}
|
}
|
||||||
echo '</center>';
|
echo '</center>';
|
||||||
$this->footer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function edit()
|
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;
|
$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;
|
$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();
|
$phpgw->common->phpgw_header();
|
||||||
echo parse_navbar();
|
|
||||||
|
|
||||||
$p = CreateObject('phpgwapi.Template',$this->template_dir);
|
$p = CreateObject('phpgwapi.Template',$this->template_dir);
|
||||||
$templates = Array(
|
$templates = Array(
|
||||||
@ -799,14 +803,14 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
// I Participate
|
// I Participate
|
||||||
$str = '<input type="checkbox" name="participants[]" value="'.$owner.'"';
|
$str = '<input type="checkbox" name="participants[]" value="'.$this->bo->owner.'"';
|
||||||
if((($id > 0) && isset($event->participants[$owner])) || !isset($id))
|
if((($cal_id > 0) && isset($event->participants[$this->bo->owner])) || !isset($cal_id))
|
||||||
{
|
{
|
||||||
$str .= ' checked';
|
$str .= ' checked';
|
||||||
}
|
}
|
||||||
$str .= '>';
|
$str .= '>';
|
||||||
$var[] = Array(
|
$var[] = Array(
|
||||||
'field' => $phpgw->common->grab_owner_name($owner).' '.lang('Participates'),
|
'field' => $phpgw->common->grab_owner_name($this->bo->owner).' '.lang('Participates'),
|
||||||
'data' => $str
|
'data' => $str
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -922,7 +926,6 @@
|
|||||||
$p->set_var('delete_button','');
|
$p->set_var('delete_button','');
|
||||||
}
|
}
|
||||||
$p->pparse('out','edit_entry');
|
$p->pparse('out','edit_entry');
|
||||||
$this->footer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function update()
|
function update()
|
||||||
@ -1017,7 +1020,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
reset($participants);
|
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);
|
$this->bo->add_attribute('owner',$minparts);
|
||||||
}
|
}
|
||||||
@ -1049,8 +1053,9 @@
|
|||||||
|
|
||||||
if(count($overlapping_events) > 0 && $overlapping_events != False)
|
if(count($overlapping_events) > 0 && $overlapping_events != False)
|
||||||
{
|
{
|
||||||
|
unset($phpgw_info['flags']['noheader']);
|
||||||
|
unset($phpgw_info['flags']['nonavbar']);
|
||||||
$phpgw->common->phpgw_header();
|
$phpgw->common->phpgw_header();
|
||||||
echo parse_navbar();
|
|
||||||
|
|
||||||
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar'));
|
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar'));
|
||||||
$templates = Array(
|
$templates = Array(
|
||||||
@ -1107,9 +1112,6 @@
|
|||||||
$p->parse('reedit_button','form_button');
|
$p->parse('reedit_button','form_button');
|
||||||
|
|
||||||
$p->pparse('out','overlap');
|
$p->pparse('out','overlap');
|
||||||
// $phpgw_info['flags']['nofooter'] = False;
|
|
||||||
// $phpgw->common->phpgw_footer();
|
|
||||||
$this->footer();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1215,8 +1217,10 @@
|
|||||||
$phpgw->common->phpgw_exit();
|
$phpgw->common->phpgw_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unset($phpgw_info['flags']['noheader']);
|
||||||
|
unset($phpgw_info['flags']['nonavbar']);
|
||||||
|
$phpgw_info['flags']['noappheader'] = True;
|
||||||
$phpgw->common->phpgw_header();
|
$phpgw->common->phpgw_header();
|
||||||
echo parse_navbar();
|
|
||||||
|
|
||||||
$p = CreateObject('phpgwapi.Template',$this->template_dir);
|
$p = CreateObject('phpgwapi.Template',$this->template_dir);
|
||||||
$templates = Array(
|
$templates = Array(
|
||||||
@ -1348,27 +1352,20 @@
|
|||||||
$this->display_item($p,lang('Print calendars in black & white'),$str);
|
$this->display_item($p,lang('Print calendars in black & white'),$str);
|
||||||
|
|
||||||
$p->pparse('out','pref');
|
$p->pparse('out','pref');
|
||||||
$phpgw->common->phpgw_footer();
|
$phpgw_info['flags']['noappfooter'] = True;
|
||||||
}
|
}
|
||||||
|
|
||||||
function day()
|
function day()
|
||||||
{
|
{
|
||||||
global $phpgw;
|
global $phpgw, $phpgw_info;
|
||||||
|
|
||||||
$this->bo->read_holidays();
|
$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)
|
if (!$this->bo->printer_friendly)
|
||||||
{
|
{
|
||||||
|
unset($phpgw_info['flags']['noheader']);
|
||||||
|
unset($phpgw_info['flags']['nonavbar']);
|
||||||
$phpgw->common->phpgw_header();
|
$phpgw->common->phpgw_header();
|
||||||
echo parse_navbar();
|
|
||||||
$printer = '';
|
$printer = '';
|
||||||
$param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&day='.$this->bo->day.'&friendly=1';
|
$param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&day='.$this->bo->day.'&friendly=1';
|
||||||
$print = '<a href="'.$this->page('day'.$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = '".lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>';
|
$print = '<a href="'.$this->page('day'.$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = '".lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>';
|
||||||
@ -1393,6 +1390,12 @@
|
|||||||
$now['raw'] += $this->bo->datetime->tz_offset;
|
$now['raw'] += $this->bo->datetime->tz_offset;
|
||||||
$m = mktime(0,0,0,$this->bo->month,1,$this->bo->year);
|
$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(
|
$var = Array(
|
||||||
'printer_friendly' => $printer,
|
'printer_friendly' => $printer,
|
||||||
'bg_text' => $phpgw_info['themem']['bg_text'],
|
'bg_text' => $phpgw_info['themem']['bg_text'],
|
||||||
@ -1406,14 +1409,62 @@
|
|||||||
$p->set_var($var);
|
$p->set_var($var);
|
||||||
|
|
||||||
$p->pparse('out','day_t');
|
$p->pparse('out','day_t');
|
||||||
if(!$this->so->printer_friendly)
|
if($this->bo->printer_friendly)
|
||||||
{
|
{
|
||||||
$phpgw->common->phpgw_footer();
|
$phpgw_info['flags']['nofooter'] = True;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
|
||||||
|
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 '<center>The user '.$phpgw->common->grab_owner_name($this->bo->owner).' is not participating in this event!</center>';
|
||||||
|
$phpgw->common->footer();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$this->bo->check_perms(PHPGW_ACL_EDIT))
|
||||||
|
{
|
||||||
|
echo '<center>You do not have permission to edit this appointment!</center>';
|
||||||
|
$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 '<center>You do not have permission to edit this appointment!</center>';
|
||||||
$phpgw->common->phpgw_exit();
|
$phpgw->common->phpgw_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->bo->set_status(intval($cal_id),intval($action));
|
||||||
|
|
||||||
|
Header('Location: '.$this->page('',''));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Private functions */
|
/* Private functions */
|
||||||
@ -1483,10 +1534,7 @@
|
|||||||
|
|
||||||
function header()
|
function header()
|
||||||
{
|
{
|
||||||
if (floor(phpversion()) == 4)
|
global $phpgw, $cal_id, $date, $keywords, $matrixtype, $participants, $tpl, $menuaction;
|
||||||
{
|
|
||||||
global $phpgw, $cal_id, $date, $keywords, $matrixtype, $participants, $remainder, $tpl, $menuaction;
|
|
||||||
}
|
|
||||||
|
|
||||||
$cols = 8;
|
$cols = 8;
|
||||||
if($this->bo->check_perms(PHPGW_ACL_PRIVATE) == True)
|
if($this->bo->check_perms(PHPGW_ACL_PRIVATE) == True)
|
||||||
@ -1498,7 +1546,9 @@
|
|||||||
$tpl->set_unknowns('remove');
|
$tpl->set_unknowns('remove');
|
||||||
|
|
||||||
include($this->template_dir.'/header.inc.php');
|
include($this->template_dir.'/header.inc.php');
|
||||||
flush();
|
$header = $tpl->fp('out','head');
|
||||||
|
unset($tpl);
|
||||||
|
echo $header;
|
||||||
}
|
}
|
||||||
|
|
||||||
function footer()
|
function footer()
|
||||||
@ -2255,16 +2305,16 @@
|
|||||||
return $p->fp('out','view_event');
|
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);
|
$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;
|
$ind = 99;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isset($time[$ind]) || !$time[$ind])
|
if(!@$time[$ind])
|
||||||
{
|
{
|
||||||
$time[$ind] = '';
|
$time[$ind] = '';
|
||||||
}
|
}
|
||||||
@ -2295,7 +2345,7 @@
|
|||||||
{
|
{
|
||||||
global $phpgw, $phpgw_info;
|
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 = CreateObject('phpgwapi.Template',$this->template_dir);
|
||||||
$p->set_unknowns('keep');
|
$p->set_unknowns('keep');
|
||||||
@ -2355,9 +2405,6 @@
|
|||||||
|
|
||||||
$p->set_var($var);
|
$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++)
|
for ($i=0;$i<24;$i++)
|
||||||
{
|
{
|
||||||
$this->rowspan_arr[$i] = 0;
|
$this->rowspan_arr[$i] = 0;
|
||||||
@ -2367,13 +2414,6 @@
|
|||||||
CreateObject('calendar.calendar_item')
|
CreateObject('calendar.calendar_item')
|
||||||
);
|
);
|
||||||
$date_to_eval = sprintf("%04d%02d%02d",$year,$month,$day);
|
$date_to_eval = sprintf("%04d%02d%02d",$year,$month,$day);
|
||||||
echo "DATE TO EVAL : $date_to_eval<br>\n";
|
|
||||||
echo "ITEMS FOUND : ".count($this->bo->cached_events[$date_to_eval])."<br>\n";
|
|
||||||
|
|
||||||
while(list($cached_date,$event) = each($this->bo->cached_events))
|
|
||||||
{
|
|
||||||
echo "Cached Events for : $cached_date : ".count($event)."<br>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$time = Array();
|
$time = Array();
|
||||||
|
|
||||||
@ -2382,16 +2422,13 @@
|
|||||||
|
|
||||||
// $events = $this->bo->cached_events[$date_to_eval];
|
// $events = $this->bo->cached_events[$date_to_eval];
|
||||||
|
|
||||||
echo "Extra params for $date_to_eval : ".$daily[$date_to_eval]['extra']."<br>\n";
|
if($daily[$date_to_eval]['appts'])
|
||||||
|
|
||||||
if($this->bo->cached_events[$date_to_eval])
|
|
||||||
{
|
{
|
||||||
$events = $this->bo->cached_events[$date_to_eval];
|
$events = $this->bo->cached_events[$date_to_eval];
|
||||||
$c_events = count($events);
|
$c_events = count($events);
|
||||||
echo "Looping $c_events times<br>\n";
|
|
||||||
for($i=0;$i<$c_events;$i++)
|
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],
|
'event' => $time[99],
|
||||||
'bgcolor' => $bgcolor
|
'bgcolor' => $bgcolor
|
||||||
);
|
);
|
||||||
$p->set_var($var);
|
$this->output_template_array($p,'item','day_event',$var);
|
||||||
$p->parse('item','day_event',False);
|
|
||||||
|
|
||||||
$var = Array(
|
$var = Array(
|
||||||
'open_link' => '',
|
'open_link' => '',
|
||||||
'time' => ' ',
|
'time' => ' ',
|
||||||
'close_link' => ''
|
'close_link' => ''
|
||||||
);
|
);
|
||||||
$p->set_var($var);
|
$this->output_template_array($p,'item','day_time',$var);
|
||||||
|
|
||||||
$p->parse('item','day_time',True);
|
|
||||||
$p->parse('row','day_row',True);
|
$p->parse('row','day_row',True);
|
||||||
$p->set_var('item','');
|
$p->set_var('item','');
|
||||||
}
|
}
|
||||||
$rowspan = 0;
|
$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);
|
$dtime = $this->bo->build_time_for_display($i * 10000);
|
||||||
$p->set_var('extras','');
|
$p->set_var('extras','');
|
||||||
@ -2520,14 +2554,160 @@
|
|||||||
'close_link' => $close_link
|
'close_link' => $close_link
|
||||||
);
|
);
|
||||||
|
|
||||||
$p->set_var($var);
|
$this->output_template_array($p,'item','day_time',$var);
|
||||||
|
|
||||||
$p->parse('item','day_time',True);
|
|
||||||
$p->parse('row','day_row',True);
|
$p->parse('row','day_row',True);
|
||||||
$p->set_var('event','');
|
$p->set_var('event','');
|
||||||
$p->set_var('item','');
|
$p->set_var('item','');
|
||||||
} // end for
|
} // end for
|
||||||
return $p->fp('out','day');
|
return $p->fp('out','day');
|
||||||
} // end function
|
} // 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 = '<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>';
|
||||||
|
$str .= '<table width="85%" border="0" cellspacing="0" cellpadding="0" cols="'.((24 * $interval) + 1).'">';
|
||||||
|
$str .= '<tr><td height="1" colspan="'.((24 * $interval) + 1).'" bgcolor="black"><img src="'.$pix.'"></td></tr>';
|
||||||
|
$str .= '<tr><td width="15%"><font color="'.$phpgw_info['theme']['bg_text'].'" face="'.$phpgw_info['theme']['font'].'" size="-2">'.lang('Participant').'</font></td>';
|
||||||
|
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 .= '<td align="left" bgcolor="'.$phpgw_info['theme']['bg_color'].'"><font color="'.$phpgw_info['theme']['bg_text'].'" face="'.$phpgw_info['theme']['font'].'" size="-2">';
|
||||||
|
$str .= '<a href="'.$this->page('edit_entry','&date='.$date['full'].'&hour='.$i.'&minute='.(interval * $j))."\" onMouseOver=\"window.status='".$i.':'.(($increment * $j)<=9?'0':'').($increment * $j)."'; return true;\">";
|
||||||
|
$str .= $k.'</a></font></td>';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$str .= '<td align="left" bgcolor="'.$phpgw_info['theme']['bg_color'].'"><font color="'.$phpgw_info['theme']['bg_text'].'" face="'.$phpgw_info['theme']['font'].'" size="-2">';
|
||||||
|
$str .= '<a href="'.$this->page('edit_entry','&date='.$date['full'].'&hour='.$i.'&minute='.(interval * $j))."\" onMouseOver=\"window.status='".$i.':'.($increment * $j)."'; return true;\">";
|
||||||
|
$str .= ' </a></font></td>';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$str .= '</tr>';
|
||||||
|
$str .= '<tr><td height="1" colspan="'.((24 * $interval) + 1).'" bgcolor="black"><img src="'.$pix.'"></td></tr>';
|
||||||
|
if(!$endtime)
|
||||||
|
{
|
||||||
|
$endtime = $starttime;
|
||||||
|
}
|
||||||
|
$owner = $this->bo->owner;
|
||||||
|
while(list($part,$status) = each($participants))
|
||||||
|
{
|
||||||
|
$str .= '<tr>';
|
||||||
|
$str .= '<td width="15%"><font color="'.$phpgw_info['theme']['bg_text'].'" face="'.$phpgw_info['theme']['font'].'" size="-2">'.$this->bo->get_fullname($participants[$i]).'</font></td>';
|
||||||
|
|
||||||
|
$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 .= '<td height="1" align="left" bgcolor="'.$phpgw_info['theme']['bg_color'].'" color="#999999"> </td>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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 .= '<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>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$str .= '</tr>';
|
||||||
|
$str .= '<tr><td height="1" colspan="'.((24 * $interval) + 1).'" bgcolor="#999999"><img src="'.$pix.'"></td></tr>';
|
||||||
|
}
|
||||||
|
$str .= '</table></center>';
|
||||||
|
$this->bo->owner = $owner;
|
||||||
|
$this->so->owner = $owner;
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_response($cal_id)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
|
||||||
|
$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 .= '<td>'.$p->fp('out','form_button').'</td>'."\n";
|
||||||
|
}
|
||||||
|
$str .= '</tr></table>';
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
BIN
calendar/templates/default/images/planner.gif
Executable file
BIN
calendar/templates/default/images/planner.gif
Executable file
Binary file not shown.
After Width: | Height: | Size: 160 B |
BIN
calendar/templates/default/images/single.gif
Executable file
BIN
calendar/templates/default/images/single.gif
Executable file
Binary file not shown.
After Width: | Height: | Size: 97 B |
@ -175,7 +175,4 @@
|
|||||||
$button = $tpl->fp('out','form_button');
|
$button = $tpl->fp('out','form_button');
|
||||||
$tpl->set_var('str','<td align="right" valign="bottom">'.$button.'</td>');
|
$tpl->set_var('str','<td align="right" valign="bottom">'.$button.'</td>');
|
||||||
$tpl->parse('header_column','head_col',True);
|
$tpl->parse('header_column','head_col',True);
|
||||||
|
|
||||||
echo $tpl->fp('out','head');
|
|
||||||
unset($tpl);
|
|
||||||
?>
|
?>
|
||||||
|
@ -175,7 +175,4 @@
|
|||||||
$button = $tpl->fp('out','form_button');
|
$button = $tpl->fp('out','form_button');
|
||||||
$tpl->set_var('str','<td align="right" valign="bottom">'.$button.'</td>');
|
$tpl->set_var('str','<td align="right" valign="bottom">'.$button.'</td>');
|
||||||
$tpl->parse('header_column','head_col',True);
|
$tpl->parse('header_column','head_col',True);
|
||||||
|
|
||||||
echo $tpl->fp('out','head');
|
|
||||||
unset($tpl);
|
|
||||||
?>
|
?>
|
||||||
|
@ -175,7 +175,4 @@
|
|||||||
$button = $tpl->fp('out','form_button');
|
$button = $tpl->fp('out','form_button');
|
||||||
$tpl->set_var('str','<td align="right" valign="bottom">'.$button.'</td>');
|
$tpl->set_var('str','<td align="right" valign="bottom">'.$button.'</td>');
|
||||||
$tpl->parse('header_column','head_col',True);
|
$tpl->parse('header_column','head_col',True);
|
||||||
|
|
||||||
echo $tpl->fp('out','head');
|
|
||||||
unset($tpl);
|
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user