mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 00:54:50 +01:00
Fixed the problem with private entries always displaying. Start of vCalendar class
This commit is contained in:
parent
1b39b03c9c
commit
44527de79e
@ -21,7 +21,8 @@ if($phpgw_info['server']['calendar_type'] == 'mcal' && extension_loaded('mcal')
|
||||
}
|
||||
// The following line can be removed when vCalendar is implemented....
|
||||
$phpgw_info['server']['calendar_type'] = 'sql';
|
||||
include(PHPGW_INCLUDE_ROOT.'/calendar/inc/class.calendar__.inc.php');
|
||||
//CreateObject('calendar.vCalendar');
|
||||
CreateObject('calendar.calendar__');
|
||||
include(PHPGW_INCLUDE_ROOT.'/calendar/inc/class.calendar_'.$phpgw_info['server']['calendar_type'].'.inc.php');
|
||||
|
||||
class calendar extends calendar_
|
||||
@ -198,7 +199,7 @@ class calendar extends calendar_
|
||||
$p->set_unknowns('remove');
|
||||
$p->set_file(array('link_pict' => 'link_pict.tpl'));
|
||||
// $p->set_block('link_pict','link_pict');
|
||||
$p->set_var('link_link',$phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/view.php','id='.$id.'&owner='.$this->owner));
|
||||
$p->set_var('link_link',$phpgw->link('/calendar/view.php','id='.$id.'&owner='.$this->owner));
|
||||
$p->set_var('lang_view',lang('View this entry'));
|
||||
$p->set_var('pic_image',$this->image_dir.'/'.$pic);
|
||||
$p->set_var('description',$description);
|
||||
@ -246,7 +247,8 @@ class calendar extends calendar_
|
||||
$str = $event->$field;
|
||||
}
|
||||
|
||||
$str .= ' ('.$this->get_long_status($this->users_status).')';
|
||||
// $str .= ' ('.$this->get_long_status($this->users_status).')';
|
||||
// $str .= ' ('.$this->users_status.')';
|
||||
|
||||
return $str;
|
||||
}
|
||||
@ -875,7 +877,7 @@ class calendar extends calendar_
|
||||
'link_link' => $phpgw->link('/calendar/view.php','id='.$lr_events->id.'&owner='.$owner),
|
||||
'lang_view' => lang('View this entry'),
|
||||
'pic_image' => $this->image_dir.'/'.$pict,
|
||||
'description' => $description
|
||||
'description' => $description.(isset($phpgw_info['user']['preferences']['calendar']['display_status']) && $phpgw_info['user']['preferences']['calendar']['display_status'] == True?' ('.$lr_events->users_status.')':'')
|
||||
);
|
||||
$p->set_var($var);
|
||||
$p->parse('link_entry','link_pict');
|
||||
@ -935,7 +937,7 @@ class calendar extends calendar_
|
||||
'start_time' => $start_time,
|
||||
'end_time' => $end_time,
|
||||
'close_view_link' => $close_link,
|
||||
'name' => $this->is_private($lr_events,$owner,'name')
|
||||
'name' => $this->is_private($lr_events,$owner,'name').(isset($phpgw_info['user']['preferences']['calendar']['display_status']) && $phpgw_info['user']['preferences']['calendar']['display_status'] == True?' ('.$lr_events->users_status.')':'')
|
||||
);
|
||||
$p->set_var($var);
|
||||
$p->parse('events','week_day_event',True);
|
||||
@ -1142,7 +1144,7 @@ class calendar extends calendar_
|
||||
$time[$ind] .= '<font color="CC0000">';
|
||||
}
|
||||
|
||||
$time[$ind] .= $this->is_private($event,$this->owner,'name');
|
||||
$time[$ind] .= $this->is_private($event,$this->owner,'name').(isset($phpgw_info['user']['preferences']['calendar']['display_status']) && $phpgw_info['user']['preferences']['calendar']['display_status'] == True?' ('.$event->users_status.')':'');
|
||||
|
||||
if ($event->priority == 3)
|
||||
{
|
||||
@ -1746,6 +1748,10 @@ class calendar extends calendar_
|
||||
$time_slice[$index]['marker'] = '-';
|
||||
$time_slice[$index]['color'] = $phpgw_info['theme']['bg01'];
|
||||
$time_slice[$index]['description'] = $this->is_private($event,$participants[$i],'title');
|
||||
if(isset($phpgw_info['user']['preferences']['calendar']['display_status']) && $phpgw_info['user']['preferences']['calendar']['display_status'] == True)
|
||||
{
|
||||
$time_slice[$index]['description'] .= ' ('.$event->users_status.')';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,13 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
if ($phpgw_info['flags']['included_classes']['calendar_'] == True)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$phpgw_info['flags']['included_classes']['calendar_'] = True;
|
||||
|
||||
class calendar_ extends calendar__
|
||||
{
|
||||
function open($calendar='',$user='',$passwd='',$options='')
|
||||
|
@ -39,6 +39,7 @@
|
||||
var $recur_enddate;
|
||||
var $recur_data = 0;
|
||||
|
||||
var $users_status = 'U';
|
||||
// Legacy Support
|
||||
var $owner;
|
||||
var $name = "Unnamed Event";
|
||||
|
@ -14,6 +14,13 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
if ($phpgw_info['flags']['included_classes']['calendar_'] == True)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$phpgw_info['flags']['included_classes']['calendar_'] = True;
|
||||
|
||||
class calendar_ extends calendar__
|
||||
{
|
||||
var $deleted_events = Array();
|
||||
@ -348,7 +355,7 @@ class calendar_ extends calendar__
|
||||
{
|
||||
if($this->stream->f('cal_login') == $this->user)
|
||||
{
|
||||
$this->users_status = $this->stream->f('cal_status');
|
||||
$this->event->users_status = $this->stream->f('cal_status');
|
||||
}
|
||||
$this->event->participants[] = $this->stream->f('cal_login');
|
||||
$this->event->status[] = $this->stream->f('cal_status');
|
||||
|
192
calendar/inc/class.vCalendar.inc.php
Executable file
192
calendar/inc/class.vCalendar.inc.php
Executable file
@ -0,0 +1,192 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* phpGroupWare - vCalendar *
|
||||
* http://www.phpgroupware.org *
|
||||
* Modified by Mark Peters <skeeter@phpgroupware.org> *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
class mailto
|
||||
{
|
||||
var $user;
|
||||
var $host;
|
||||
}
|
||||
|
||||
class attendee
|
||||
{
|
||||
var $cn = 'Unknown';
|
||||
var $role = 0;
|
||||
var $rsvp = False;
|
||||
var $mailto;
|
||||
var $sent_by;
|
||||
}
|
||||
|
||||
class organizer
|
||||
{
|
||||
var $mailto;
|
||||
var $sent_by;
|
||||
}
|
||||
|
||||
class vCalendar_time {
|
||||
var $year;
|
||||
var $month;
|
||||
var $mday;
|
||||
var $hour;
|
||||
var $min;
|
||||
var $sec;
|
||||
var $date;
|
||||
var $allday = False;
|
||||
}
|
||||
|
||||
class vCalendar
|
||||
{
|
||||
var $prodid;
|
||||
var $version;
|
||||
var $method;
|
||||
var $type;
|
||||
var $attendee = Array();
|
||||
var $organizer;
|
||||
var $dtstart;
|
||||
var $dtend;
|
||||
var $location;
|
||||
var $transp;
|
||||
var $sequence;
|
||||
var $uid;
|
||||
var $dtstamp;
|
||||
var $description;
|
||||
var $summary;
|
||||
var $priority;
|
||||
var $class;
|
||||
|
||||
function read($vcal_text)
|
||||
{
|
||||
$role = Array(
|
||||
'NONE' => 0,
|
||||
'OPT-PARTICIPANT' => 1,
|
||||
'REQ-PARTICIPANT' => 2
|
||||
);
|
||||
|
||||
while(strtoupper($text) != 'END:VCALENDAR')
|
||||
{
|
||||
$element = strtolower($this->find_element($text,Array(':',';')));
|
||||
switch($element)
|
||||
{
|
||||
case 'begin':
|
||||
$value = strtolower($this->find_element(substr($text,7,strlen($text)),Array('')));
|
||||
if($value != 'VCALENDAR')
|
||||
{
|
||||
$this->type = $value;
|
||||
}
|
||||
break;
|
||||
case 'prodid':
|
||||
$this->prodid = strtolower($this->find_element(substr($text,7,strlen($text)),Array('')));
|
||||
break;
|
||||
case 'version':
|
||||
$this->version = strtolower($this->find_element(substr($text,8,strlen($text)),Array('')));
|
||||
break;
|
||||
case 'attendee':
|
||||
$attendee = new attendee;
|
||||
$i = 9;
|
||||
while($i < strlen($text))
|
||||
{
|
||||
$value = strtolower($this->find_element(substr($text,$i,strlen($text)),Array('=')));
|
||||
switch($value)
|
||||
{
|
||||
case 'cn':
|
||||
$i += 4;
|
||||
$data = strtolower($this->find_element(substr($text,$i,strlen($text)),Array(';')));
|
||||
if(substr($data,1,1) == '"')
|
||||
{
|
||||
$attendee->$value=substr($data,1,strlen($data) - 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
$attendee->$value=$data;
|
||||
}
|
||||
$i += strlen($data) + 1;
|
||||
break;
|
||||
case 'role':
|
||||
$data = strtolower($this->find_element(substr($text,$i,strlen($text)),Array(';')));
|
||||
$attendee->$value=$role[$data];
|
||||
$i += strlen($data) + 1;
|
||||
break;
|
||||
case 'rsvp':
|
||||
$data = strtolower($this->find_element(substr($text,$i,strlen($text)),Array(':')));
|
||||
$attendee->$value=$data;
|
||||
$i += strlen($data) + 1;
|
||||
$value = strtolower($this->find_element(substr($text,$i,strlen($text)),Array(':')));
|
||||
$i += strlen($value) + 1;
|
||||
$data = strtolower($this->find_element(substr($text,$i,strlen($text)),Array('')));
|
||||
$attendee->$value=$data;
|
||||
$i += strlen($data) + 1;
|
||||
break;
|
||||
case 'sent-by':
|
||||
$data = strtolower($this->find_element(substr($text,$i,strlen($text)),Array(':',';')));
|
||||
$organizer = each('@',$data);
|
||||
$attendee->sent_by->user = $organizer[0];
|
||||
$attendee->sent_by->host = $organizer[1];
|
||||
$i += strlen($data) + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->attendee[] = $attendee;
|
||||
unset($attendee);
|
||||
break;
|
||||
case 'organizer':
|
||||
$i = 10;
|
||||
$value = strtolower($this->find_element(substr($text,$i,strlen($text)),Array(':')));
|
||||
$i += strlen($value) + 1;
|
||||
switch($value)
|
||||
{
|
||||
case 'mailto':
|
||||
$data = strtolower($this->find_element(substr($text,$i,strlen($text)),Array(':')));
|
||||
$organizer = each('@',$data);
|
||||
$this->organizer->mailto->user = $organizer[0];
|
||||
$this->organizer->mailto->host = $organizer[1];
|
||||
break;
|
||||
case 'sent-by':
|
||||
$data = strtolower($this->find_element(substr($text,$i,strlen($text)),Array(':',';')));
|
||||
$organizer = each('@',$data);
|
||||
$this->organizer->sent_by->user = $organizer[0];
|
||||
$this->organizer->sent_by->host = $organizer[1];
|
||||
$i += strlen($data) + 1;
|
||||
break;
|
||||
otherwise:
|
||||
$data = $value;
|
||||
if(strpos(' '.$data.' ','@') > 0)
|
||||
{
|
||||
$organizer = each('@',$data);
|
||||
$this->organizer->mailto->user = $organizer[0];
|
||||
$this->organizer->mailto->host = $organizer[1];
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'dtstart':
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function find_element($text,$stop_chars)
|
||||
{
|
||||
$element = '';
|
||||
$i=0;
|
||||
$char = '';
|
||||
while(!ereg('['.explode($stop_chars,'').']',$char) && ($i<strlen($text)))
|
||||
{
|
||||
$char = substr($text,$i++,1);
|
||||
$element .= $char;
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user