forked from extern/egroupware
This will now allow events to care with the groups, if a group is assigned as a participant. If new users are added to the group, it will populate the datastore with those events when they view the event for the first time. This also adds a little more support for alarm management.
This commit is contained in:
parent
6ee13ea1aa
commit
551bfb8dbb
@ -204,6 +204,7 @@ class socalendar_ extends socalendar__
|
|||||||
while($this->stream->next_record())
|
while($this->stream->next_record())
|
||||||
{
|
{
|
||||||
$this->event['alarm'][] = Array(
|
$this->event['alarm'][] = Array(
|
||||||
|
'id' => intval($this->stream->f('alarm_id')),
|
||||||
'time' => intval($this->stream->f('cal_time')),
|
'time' => intval($this->stream->f('cal_time')),
|
||||||
'text' => $this->stream->f('cal_text'),
|
'text' => $this->stream->f('cal_text'),
|
||||||
'enabled' => intval($this->stream->f('alarm_enabled'))
|
'enabled' => intval($this->stream->f('alarm_enabled'))
|
||||||
@ -229,16 +230,28 @@ class socalendar_ extends socalendar__
|
|||||||
}
|
}
|
||||||
|
|
||||||
$datetime = mktime(0,0,0,$startMonth,$startDay,$startYear) - $tz_offset;
|
$datetime = mktime(0,0,0,$startMonth,$startDay,$startYear) - $tz_offset;
|
||||||
|
|
||||||
|
$user_where = ' AND (phpgw_cal_user.cal_login in (';
|
||||||
if($owner_id)
|
if($owner_id)
|
||||||
{
|
{
|
||||||
$user_where = ' AND (phpgw_cal_user.cal_login in ('.implode(',',$owner_id).')) ';
|
$user_where .= implode(',',$owner_id);
|
||||||
|
|
||||||
echo '<!-- owner_id in ('.implode(',',$owner_id).') -->'."\n";
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$user_where = ' AND (phpgw_cal_user.cal_login = '.$this->user.') ';
|
$user_where .= $this->user;
|
||||||
}
|
}
|
||||||
|
$member_groups = $GLOBALS['phpgw']->accounts->membership($this->user);
|
||||||
|
@reset($member_groups);
|
||||||
|
while(list($key,$group_info) = each($member_groups))
|
||||||
|
{
|
||||||
|
$member[] = $group_info['account_id'];
|
||||||
|
}
|
||||||
|
@reset($member);
|
||||||
|
$user_where .= ','.implode(',',$member);
|
||||||
|
$user_where .= ')) ';
|
||||||
|
|
||||||
|
echo '<!-- '.$user_where.' -->'."\n";
|
||||||
|
|
||||||
$startDate = 'AND ( ( (phpgw_cal.datetime >= '.$datetime.') ';
|
$startDate = 'AND ( ( (phpgw_cal.datetime >= '.$datetime.') ';
|
||||||
|
|
||||||
$enddate = '';
|
$enddate = '';
|
||||||
@ -447,6 +460,7 @@ class socalendar_ extends socalendar__
|
|||||||
. "title='".$this->stream->db_addslashes($event['title'])."', "
|
. "title='".$this->stream->db_addslashes($event['title'])."', "
|
||||||
. "description='".$this->stream->db_addslashes($event['description'])."', "
|
. "description='".$this->stream->db_addslashes($event['description'])."', "
|
||||||
. "location='".$event['location']."', "
|
. "location='".$event['location']."', "
|
||||||
|
. ($event['groups']?"groups='".(count($event['groups'])>1?implode(',',$event['groups']):','.$event['groups'][0].',')."', ":'')
|
||||||
. 'reference='.$event['reference'].' '
|
. 'reference='.$event['reference'].' '
|
||||||
. 'WHERE cal_id='.$event['id'];
|
. 'WHERE cal_id='.$event['id'];
|
||||||
|
|
||||||
|
@ -500,26 +500,32 @@
|
|||||||
$date = $date?$date:intval($GLOBALS['HTTP_GET_VARS']['date']);
|
$date = $date?$date:intval($GLOBALS['HTTP_GET_VARS']['date']);
|
||||||
|
|
||||||
// First, make sure they have permission to this entry
|
// First, make sure they have permission to this entry
|
||||||
|
$continue_ok = True;
|
||||||
if ($cal_id < 1)
|
if ($cal_id < 1)
|
||||||
{
|
{
|
||||||
echo lang('Invalid entry id.').'</center>';
|
echo lang('Invalid entry id.').'</center>'."\n";
|
||||||
return;
|
$continue_ok = False;
|
||||||
|
$GLOBALS['phpgw']->common->phpgw_exit(True);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$this->bo->check_perms(PHPGW_ACL_READ))
|
if(!$this->bo->check_perms(PHPGW_ACL_READ))
|
||||||
{
|
{
|
||||||
echo lang('You do not have permission to read this record!').'</center>';
|
echo lang('You do not have permission to read this record!').'</center>'."\n";
|
||||||
return;
|
$continue_ok = False;
|
||||||
|
$GLOBALS['phpgw']->common->phpgw_exit(True);
|
||||||
}
|
}
|
||||||
|
|
||||||
$event = $this->bo->read_entry($cal_id);
|
$event = $this->bo->read_entry($cal_id);
|
||||||
|
|
||||||
if(!isset($event['id']))
|
if(!isset($event['id']))
|
||||||
{
|
{
|
||||||
echo lang("Sorry, this event does not exist").'.'.'</center>';
|
echo lang("Sorry, this event does not exist").'.'.'</center>'."\n";
|
||||||
return;
|
$continue_ok = False;
|
||||||
|
$GLOBALS['phpgw']->common->phpgw_exit(True);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($continue_ok)
|
||||||
|
{
|
||||||
$this->bo->repeating_events = Array();
|
$this->bo->repeating_events = Array();
|
||||||
$this->bo->cached_events = Array();
|
$this->bo->cached_events = Array();
|
||||||
$this->bo->repeating_events[0] = $event;
|
$this->bo->repeating_events[0] = $event;
|
||||||
@ -539,7 +545,14 @@
|
|||||||
$event['end']['mday'] = date('d',$temp_end);
|
$event['end']['mday'] = date('d',$temp_end);
|
||||||
$event['end']['year'] = date('Y',$temp_end);
|
$event['end']['year'] = date('Y',$temp_end);
|
||||||
}
|
}
|
||||||
echo $this->view_event($event);
|
|
||||||
|
$ret_value = $this->view_event($event,True);
|
||||||
|
echo $ret_value;
|
||||||
|
|
||||||
|
if($ret_value == '<center>'.lang('You do not have permission to read this record!').'</center>')
|
||||||
|
{
|
||||||
|
$GLOBALS['phpgw']->common->phpgw_exit(True);
|
||||||
|
}
|
||||||
|
|
||||||
$p = CreateObject('phpgwapi.Template',$this->template_dir);
|
$p = CreateObject('phpgwapi.Template',$this->template_dir);
|
||||||
$p->set_file(
|
$p->set_file(
|
||||||
@ -560,7 +573,6 @@
|
|||||||
'action_confirm_button' => '',
|
'action_confirm_button' => '',
|
||||||
'action_extra_field' => '<input type="hidden" name="edit_type" value="single">'."\n"
|
'action_extra_field' => '<input type="hidden" name="edit_type" value="single">'."\n"
|
||||||
. '<input type="hidden" name="date" value="'.sprintf('%04d%02d%02d',$this->bo->year,$this->bo->month,$this->bo->day).'">'
|
. '<input type="hidden" name="date" value="'.sprintf('%04d%02d%02d',$this->bo->year,$this->bo->month,$this->bo->day).'">'
|
||||||
|
|
||||||
);
|
);
|
||||||
$p->set_var($var);
|
$p->set_var($var);
|
||||||
echo $p->fp('out','form_button');
|
echo $p->fp('out','form_button');
|
||||||
@ -618,6 +630,7 @@
|
|||||||
$p->set_var($var);
|
$p->set_var($var);
|
||||||
echo $p->fp('out','form_button').'</center>';
|
echo $p->fp('out','form_button').'</center>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function edit($params='')
|
function edit($params='')
|
||||||
{
|
{
|
||||||
@ -2146,7 +2159,7 @@
|
|||||||
$repeat_days .= $day.' ';
|
$repeat_days .= $day.' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
function view_event($event)
|
function view_event($event,$alarms=False)
|
||||||
{
|
{
|
||||||
if(!$event['participants'][$this->bo->owner])
|
if(!$event['participants'][$this->bo->owner])
|
||||||
{
|
{
|
||||||
@ -2370,7 +2383,7 @@
|
|||||||
$this->output_template_array($p,'row','list',$var[$i]);
|
$this->output_template_array($p,'row','list',$var[$i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(@isset($event['alarm']))
|
if($alarms && @isset($event['alarm']))
|
||||||
{
|
{
|
||||||
$p->set_var('hr_text','<hr>');
|
$p->set_var('hr_text','<hr>');
|
||||||
$p->parse('row','hr',True);
|
$p->parse('row','hr',True);
|
||||||
|
Loading…
Reference in New Issue
Block a user