mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 16:44:20 +01:00
Whole bunch of new code. Skeleton alarm management stuff. Importing of iCal file data (semi-working). New data fields (uid/location). New tables (phpgw_cal_alarm).
This commit is contained in:
parent
79dc225381
commit
8cfde64d54
@ -425,8 +425,14 @@
|
||||
$l_cal['private'] = 'public';
|
||||
}
|
||||
|
||||
if(!isset($l_cal['category']))
|
||||
{
|
||||
$l_cal['category'] = 0;
|
||||
}
|
||||
|
||||
$is_public = ($l_cal['private'] == 'public'?1:0);
|
||||
$this->so->event_init();
|
||||
$this->add_attribute('uid',$l_cal['uid']);
|
||||
$this->so->set_category($l_cal['category']);
|
||||
$this->so->set_title($l_cal['title']);
|
||||
$this->so->set_description($l_cal['description']);
|
||||
@ -434,6 +440,7 @@
|
||||
$this->so->set_end($l_end['year'],$l_end['month'],$l_end['mday'],$l_end['hour'],$l_end['min'],0);
|
||||
$this->so->set_class($is_public);
|
||||
$this->so->add_attribute('reference',($l_cal['reference']?$l_cal['reference']:0));
|
||||
$this->so->add_attribute('location',($l_cal['location']?$l_cal['location']:''));
|
||||
if($l_cal['id'])
|
||||
{
|
||||
$this->so->add_attribute('id',$l_cal['id']);
|
||||
@ -1672,7 +1679,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
function export_event($l_event_id=0)
|
||||
function export_ical($l_event_id=0)
|
||||
{
|
||||
$event_id = ($l_event_id?$l_event_id:$GLOBALS['HTTP_GET_VARS']['cal_id']);
|
||||
|
||||
@ -1703,12 +1710,18 @@
|
||||
$ical_event['class'] = intval($event['public']);
|
||||
$icalendar->set_var($ical_event['description'],'value',$event['title']);
|
||||
$icalendar->set_var($ical_event['summary'],'value',$event['description']);
|
||||
$icalendar->set_var($ical_event['location'],'value',$event['location']);
|
||||
$icalendar->set_var($ical_event['uid'],'value',$event['uid']);
|
||||
$dtstart_mktime = $this->maketime($event['start']) - $this->datetime->tz_offset;
|
||||
$icalendar->parse_value($ical_event,'dtstart',date('Ymd\THis\Z',$dtstart_mktime),'vevent');
|
||||
$dtend_mktime = $this->maketime($event['end']) - $this->datetime->tz_offset;
|
||||
$icalendar->parse_value($ical_event,'dtend',date('Ymd\THis\Z',$dtend_mktime),'vevent');
|
||||
$mod_mktime = $this->maketime($event['modtime']) - $this->datetime->tz_offset;
|
||||
$icalendar->parse_value($ical_event,'last_modified',date('Ymd\THis\Z',$mod_mktime),'vevent');
|
||||
if($event['location'])
|
||||
{
|
||||
$icalendar->set_var($ical_event['location'],'value',$event['location']);
|
||||
}
|
||||
if(count($event['participants']) > 1)
|
||||
{
|
||||
$db = $GLOBALS['phpgw']->db;
|
||||
|
@ -79,6 +79,12 @@ define('OTHER',99);
|
||||
|
||||
class boicalendar
|
||||
{
|
||||
|
||||
var $public_functions = array(
|
||||
'import' => True
|
||||
);
|
||||
|
||||
|
||||
var $ical;
|
||||
var $line = 0;
|
||||
var $event = Array();
|
||||
@ -1606,12 +1612,10 @@ class boicalendar
|
||||
$str .= ';'.str_replace('_','-',strtoupper($key)).'='.$quote.$this->to_dir($value).$quote;
|
||||
break;
|
||||
case 'function':
|
||||
// $this->debug_str = True;
|
||||
$str .= ';'.str_replace('_','-',strtoupper($key)).'=';
|
||||
$function = $this->parameter[$key]['function'];
|
||||
$this->debug($key.' Function Param : '.$value);
|
||||
$str .= $quote.$this->$function($value).$quote;
|
||||
// $this->debug_str = False;
|
||||
break;
|
||||
case 'text':
|
||||
case 'string':
|
||||
@ -1619,6 +1623,7 @@ class boicalendar
|
||||
break;
|
||||
case 'date-time':
|
||||
$str .= ($key=='until'?':':';UNTIL=').date('Ymd\THis',mktime($event['hour'],$event['min'],$event['sec'],$event['month'],$event['mday'],$event['year'])).(!@isset($event['tzid'])?'Z':'');
|
||||
break;
|
||||
|
||||
}
|
||||
unset($value);
|
||||
@ -2029,6 +2034,16 @@ class boicalendar
|
||||
if($this->api)
|
||||
{
|
||||
$dtime['hour'] -= $GLOBALS['phpgw_info']['users']['common']['tz_offset'];
|
||||
if($dtime['hour'] < 0)
|
||||
{
|
||||
$dtime['mday'] -= 1;
|
||||
$dtime['hour'] = 24 - $dtime['hour'];
|
||||
}
|
||||
elseif($dtime['hour'] >= 24)
|
||||
{
|
||||
$dtime['mday'] += 1;
|
||||
$dtime['hour'] = $dtime['hour'] - 24;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->debug('DATETIME : '._debug_array($dtime));
|
||||
@ -2768,6 +2783,171 @@ class boicalendar
|
||||
return $str;
|
||||
}
|
||||
|
||||
function import()
|
||||
{
|
||||
if($GLOBALS['uploadedfile'] == 'none' || $GLOBALS['uploadedfile'] == '')
|
||||
{
|
||||
Header('Location: ' . $GLOBALS['phpgw']->link('/index.php',
|
||||
Array(
|
||||
'menuaction' => 'calendar.uiicalendar.import',
|
||||
'action' => 'GetFile'
|
||||
)
|
||||
)
|
||||
);
|
||||
$GLOBALS['phpwg']->common->phpgw_exit();
|
||||
}
|
||||
$uploaddir = $GLOBALS['phpgw_info']['server']['temp_dir'] . SEP;
|
||||
|
||||
srand((double)microtime()*1000000);
|
||||
$random_number = rand(100000000,999999999);
|
||||
$newfilename = md5($GLOBALS['uploadedfile'].", ".$uploadedfile_name.", "
|
||||
. time() . getenv("REMOTE_ADDR") . $random_number );
|
||||
|
||||
copy($GLOBALS['uploadedfile'], $uploaddir . $newfilename);
|
||||
// $ftp = fopen($uploaddir . $newfilename . '.info','wb');
|
||||
// fputs($ftp,$uploadedfile_type."\n".$uploadedfile_name."\n");
|
||||
// fclose($ftp);
|
||||
|
||||
$filename = $uploaddir . $newfilename;
|
||||
$fp=fopen($filename,'rt');
|
||||
$mime_msg = explode("\n",fread($fp, filesize($filename)));
|
||||
fclose($fp);
|
||||
|
||||
$so_event = createobject('calendar.socalendar',
|
||||
Array(
|
||||
'owner' => 0,
|
||||
'filter' => '',
|
||||
'category' => ''
|
||||
)
|
||||
);
|
||||
|
||||
unlink($filename);
|
||||
|
||||
$datetime_vars = Array(
|
||||
'start' => 'dtstart',
|
||||
'end' => 'dtend',
|
||||
'modtime' => 'dtstamp',
|
||||
'modtime' => 'last_modified'
|
||||
);
|
||||
|
||||
$date_array = Array(
|
||||
'Y' => 'year',
|
||||
'm' => 'month',
|
||||
'd' => 'mday',
|
||||
'H' => 'hour',
|
||||
'i' => 'min',
|
||||
's' => 'sec'
|
||||
);
|
||||
|
||||
$ical = $this->parse($mime_msg);
|
||||
$c_events = count($ical['event']);
|
||||
for($i=0;$i<$c_events;$i++)
|
||||
{
|
||||
if($ical['event'][$i]['uid']['value'])
|
||||
{
|
||||
$uid_exists = $so_event->find_uid($ical['event'][$i]['uid']['value']);
|
||||
}
|
||||
|
||||
if($uid_exists)
|
||||
{
|
||||
$event = $so_event->read_entry($uid_exists[0]);
|
||||
if(!isset($event['participant'][$GLOBALS['phpgw_info']['user']['account_id']]))
|
||||
{
|
||||
|
||||
$so_event->add_attribute('participants','A',$GLOBALS['phpgw_info']['user']['account_id']);
|
||||
$event = $so_event->get_cached_event();
|
||||
$so_event->add_entry($event);
|
||||
$event = $so_event->get_cached_event();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$so_event->event_init();
|
||||
$so_event->add_attribute('id',0);
|
||||
$so_event->add_attribute('reference',0);
|
||||
if($ical['event'][$i]['uid']['value'])
|
||||
{
|
||||
$so_event->add_attribute('uid',$ical['event'][$i]['uid']['value']);
|
||||
}
|
||||
if($ical['event'][$i]['summary']['value'])
|
||||
{
|
||||
$so_event->set_title($ical['event'][$i]['summary']['value']);
|
||||
}
|
||||
if($ical['event'][$i]['description']['value'])
|
||||
{
|
||||
$so_event->set_description($ical['event'][$i]['description']['value']);
|
||||
}
|
||||
if($ical['event'][$i]['location']['value'])
|
||||
{
|
||||
$so_event->add_attribute('location',$ical['event'][$i]['location']['value']);
|
||||
}
|
||||
if(isset($ical['event'][$i]['priority']))
|
||||
{
|
||||
$so_event->add_attribute('priority',$ical['event'][$i]['priority']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$so_event->add_attribute('priority',2);
|
||||
}
|
||||
if(!isset($ical['event'][$i]['class']))
|
||||
{
|
||||
$ical['event'][$i]['class'] = 1;
|
||||
}
|
||||
$so_event->set_class($ical['event'][$i]['class']);
|
||||
|
||||
@reset($datetime_vars);
|
||||
while(list($e_datevar,$i_datevar) = each($datetime_vars))
|
||||
{
|
||||
if(isset($ical['event'][$i][$i_datevar]))
|
||||
{
|
||||
$temp_time = $so_event->maketime($ical['event'][$i][$i_datevar]) + $so_event->datetime->tz_offset;
|
||||
@reset($date_array);
|
||||
while(list($key,$var) = each($date_array))
|
||||
{
|
||||
$event[$e_datevar][$var] = intval(date($key,$temp_time));
|
||||
}
|
||||
$so_event->set_date($e_datevar,$event[$e_datevar]['year'],$event[$e_datevar]['month'],$event[$e_datevar]['mday'],$event[$e_datevar]['hour'],$event[$e_datevar]['min'],$event[$e_datevar]['sec']);
|
||||
}
|
||||
}
|
||||
if(!isset($ical['event'][$i]['category']['value']) || !$ical['event'][$i]['category']['value'])
|
||||
{
|
||||
$so_event->add_attribute('category',0);
|
||||
}
|
||||
else
|
||||
{
|
||||
//categories -- with value
|
||||
}
|
||||
|
||||
if(isset($ical['event'][$i]['rrule']))
|
||||
{
|
||||
//rrule
|
||||
}
|
||||
|
||||
if(!isset($ical['event'][$i]['organizer']))
|
||||
{
|
||||
$so_event->add_attribute('owner',$GLOBALS['phpgw_info']['user']['account_id']);
|
||||
$so_event->add_attribute('participants','A',$GLOBALS['phpgw_info']['user']['account_id']);
|
||||
}
|
||||
else
|
||||
{
|
||||
//owner
|
||||
}
|
||||
|
||||
$event = $so_event->get_cached_event();
|
||||
$so_event->add_entry($event);
|
||||
$event = $so_event->get_cached_event();
|
||||
}
|
||||
}
|
||||
Header('Location: '.$GLOBALS['phpgw']->link('/index.php',
|
||||
Array(
|
||||
'menuaction' => 'calendar.uicalendar.view',
|
||||
'cal_id' => $event['id']
|
||||
)
|
||||
)
|
||||
);
|
||||
$GLOBALS['phpgw']->common->phpgw_exit();
|
||||
}
|
||||
|
||||
function debug($str='')
|
||||
{
|
||||
if($this->debug_str)
|
||||
|
@ -41,6 +41,11 @@
|
||||
$this->cal->open('INBOX',intval($this->owner));
|
||||
}
|
||||
|
||||
function maketime($time)
|
||||
{
|
||||
return mktime($time['hour'],$time['min'],$time['sec'],$time['month'],$time['mday'],$time['year']);
|
||||
}
|
||||
|
||||
function makeobj()
|
||||
{
|
||||
if (!is_object($this->cal))
|
||||
@ -131,6 +136,19 @@
|
||||
return $this->cal->get_event_ids($include_repeats,$sql);
|
||||
}
|
||||
|
||||
function find_uid($uid)
|
||||
{
|
||||
$sql = " AND (phpgw_cal.uid = '".$uid."') ";
|
||||
|
||||
$found = $this->cal->get_event_ids(False,$sql);
|
||||
if(!$found)
|
||||
{
|
||||
$found = $this->cal->get_event_ids(True,$sql);
|
||||
}
|
||||
|
||||
return $found;
|
||||
}
|
||||
|
||||
function add_entry(&$event)
|
||||
{
|
||||
$this->cal->store_event($event);
|
||||
@ -192,6 +210,11 @@
|
||||
$this->cal->event_init();
|
||||
}
|
||||
|
||||
function set_date($element,$year,$month,$day=0,$hour=0,$min=0,$sec=0)
|
||||
{
|
||||
$this->cal->set_date($element,$year,$month,$day,$hour,$min,$sec);
|
||||
}
|
||||
|
||||
function set_start($year,$month,$day=0,$hour=0,$min=0,$sec=0)
|
||||
{
|
||||
$this->cal->set_start($year,$month,$day,$hour,$min,$sec);
|
||||
|
@ -19,12 +19,11 @@
|
||||
{
|
||||
$GLOBALS['phpgw_info']['server']['calendar_type'] = 'sql';
|
||||
}
|
||||
// This will be elminated when ical is fully implemented
|
||||
/* This will be elminated when ical is fully implemented */
|
||||
else
|
||||
{
|
||||
$GLOBALS['phpgw_info']['server']['calendar_type'] = 'sql';
|
||||
}
|
||||
include(PHPGW_INCLUDE_ROOT.'/calendar/inc/class.socalendar__.inc.php');
|
||||
include(PHPGW_INCLUDE_ROOT.'/calendar/inc/class.socalendar_'.$GLOBALS['phpgw_info']['server']['calendar_type'].'.inc.php');
|
||||
return new socalendar_;
|
||||
?>
|
||||
|
@ -71,6 +71,16 @@ class socalendar__
|
||||
$this->datetime = CreateObject('phpgwapi.datetime');
|
||||
}
|
||||
|
||||
function maketime($time)
|
||||
{
|
||||
return mktime($time['hour'],$time['min'],$time['sec'],$time['month'],$time['mday'],$time['year']);
|
||||
}
|
||||
|
||||
function get_cached_event()
|
||||
{
|
||||
return $this->event;
|
||||
}
|
||||
|
||||
function event_init()
|
||||
{
|
||||
$this->event = Array();
|
||||
|
@ -37,7 +37,7 @@ class socalendar_ extends socalendar__
|
||||
{
|
||||
if($user=='')
|
||||
{
|
||||
settype($user,'integer');
|
||||
// settype($user,'integer');
|
||||
$this->user = $GLOBALS['phpgw_info']['user']['account_id'];
|
||||
}
|
||||
elseif(is_int($user))
|
||||
@ -103,7 +103,7 @@ class socalendar_ extends socalendar__
|
||||
return False;
|
||||
}
|
||||
|
||||
$this->stream->lock(array('phpgw_cal','phpgw_cal_user','phpgw_cal_repeats'));
|
||||
$this->stream->lock(array('phpgw_cal','phpgw_cal_user','phpgw_cal_repeats','phpgw_cal_alarm'));
|
||||
|
||||
$this->stream->query('SELECT * FROM phpgw_cal WHERE cal_id='.$event_id,__LINE__,__FILE__);
|
||||
|
||||
@ -120,6 +120,8 @@ class socalendar_ extends socalendar__
|
||||
$this->set_category(intval($this->stream->f('category')));
|
||||
$this->set_title($GLOBALS['phpgw']->strip_html($this->stream->f('title')));
|
||||
$this->set_description($GLOBALS['phpgw']->strip_html($this->stream->f('description')));
|
||||
$this->add_attribute('uid',$GLOBALS['phpgw']->strip_html($this->stream->f('uid')));
|
||||
$this->add_attribute('location',$GLOBALS['phpgw']->strip_html($this->stream->f('location')));
|
||||
$this->add_attribute('reference',intval($this->stream->f('reference')));
|
||||
|
||||
// This is the preferred method once everything is normalized...
|
||||
@ -198,6 +200,15 @@ class socalendar_ extends socalendar__
|
||||
$this->add_attribute('participants',$this->stream->f('cal_status'),intval($this->stream->f('cal_login')));
|
||||
}
|
||||
}
|
||||
|
||||
$this->stream->query('SELECT * FROM phpgw_cal_alarm WHERE cal_id='.$event_id.' AND cal_owner='.$this->user,__LINE__,__FILE__);
|
||||
if($this->stream->num_rows())
|
||||
{
|
||||
while($this->stream->next_record())
|
||||
{
|
||||
$this->add_attribute('alarm',$this->stream->f('cal_text'),intval($this->stream->f('cal_time')));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -253,7 +264,7 @@ class socalendar_ extends socalendar__
|
||||
|
||||
function store_event()
|
||||
{
|
||||
return $this->save_event($this->event);
|
||||
return $this->save_event(&$this->event);
|
||||
}
|
||||
|
||||
function delete_event($event_id)
|
||||
@ -367,9 +378,27 @@ class socalendar_ extends socalendar__
|
||||
$this->stream->lock($locks);
|
||||
if($event['id'] == 0)
|
||||
{
|
||||
if ($GLOBALS['phpgw_info']['server']['hostname'] != '')
|
||||
{
|
||||
$id_suffix = $GLOBALS['phpgw_info']['server']['hostname'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$id_suffix = $GLOBALS['phpgw']->common->randomstring(3).'local';
|
||||
}
|
||||
$parts = Array(
|
||||
'title',
|
||||
'description'
|
||||
);
|
||||
@reset($parts);
|
||||
while(list($key,$field) = each($parts))
|
||||
{
|
||||
$part[$key] = substr($GLOBALS['phpgw']->crypto->encrypt($event[$field]),0,20);
|
||||
}
|
||||
$event['uid'] = $part[0].'-'.$part[1].'@'.$id_suffix;
|
||||
$temp_name = tempnam($GLOBALS['phpgw_info']['server']['temp_dir'],'cal');
|
||||
$this->stream->query('INSERT INTO phpgw_cal(title,owner,priority,is_public) '
|
||||
. "values('".$temp_name."',".$event['owner'].",".$event['priority'].",".$event['public'].")");
|
||||
$this->stream->query('INSERT INTO phpgw_cal(uid,title,owner,priority,is_public) '
|
||||
. "values('".$event['uid']."','".$temp_name."',".$event['owner'].",".$event['priority'].",".$event['public'].")");
|
||||
$this->stream->query("SELECT cal_id FROM phpgw_cal WHERE title='".$temp_name."'");
|
||||
$this->stream->next_record();
|
||||
$event['id'] = $this->stream->f('cal_id');
|
||||
@ -399,6 +428,7 @@ class socalendar_ extends socalendar__
|
||||
. 'is_public='.$event['public'].', '
|
||||
. "title='".addslashes($event['title'])."', "
|
||||
. "description='".addslashes($event['description'])."', "
|
||||
. "location='".$event['location']."', "
|
||||
. 'reference='.$event['reference'].' '
|
||||
. 'WHERE cal_id='.$event['id'];
|
||||
|
||||
@ -406,8 +436,8 @@ class socalendar_ extends socalendar__
|
||||
|
||||
$this->stream->query('DELETE FROM phpgw_cal_user WHERE cal_id='.$event['id'],__LINE__,__FILE__);
|
||||
|
||||
reset($event['participants']);
|
||||
while (list($key,$value) = each($event['participants']))
|
||||
@reset($event['participants']);
|
||||
while (list($key,$value) = @each($event['participants']))
|
||||
{
|
||||
if(intval($key) == intval($this->user))
|
||||
{
|
||||
@ -456,7 +486,7 @@ class socalendar_ extends socalendar__
|
||||
|
||||
function get_alarm($id)
|
||||
{
|
||||
$this->stream->query('SELECT cal_time, cal_text FROM phpgw_cal_alarm WHERE cal_id='.$id,__LINE__,__FILE__);
|
||||
$this->stream->query('SELECT cal_time, cal_text FROM phpgw_cal_alarm WHERE cal_id='.$id.' AND cal_owner='.$this->user,__LINE__,__FILE__);
|
||||
if($this->stream->num_rows())
|
||||
{
|
||||
while($this->stream->next_record())
|
||||
@ -487,11 +517,6 @@ class socalendar_ extends socalendar__
|
||||
|
||||
// End of ICal style support.......
|
||||
|
||||
function maketime($time)
|
||||
{
|
||||
return mktime($time['hour'],$time['min'],$time['sec'],$time['month'],$time['mday'],$time['year']);
|
||||
}
|
||||
|
||||
function group_search($owner=0)
|
||||
{
|
||||
$owner = ($owner==$GLOBALS['phpgw_info']['user']['account_id']?0:$owner);
|
||||
@ -526,4 +551,3 @@ class socalendar_ extends socalendar__
|
||||
return $this->localdates(mktime(0,0,0,intval(substr($d,4,2)),intval(substr($d,6,2)),intval(substr($d,0,4))));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -551,6 +551,15 @@
|
||||
$p->set_var($var);
|
||||
echo $p->fp('out','form_button');
|
||||
}
|
||||
|
||||
$var = Array(
|
||||
'action_url_button' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uialarm.manager'),
|
||||
'action_text_button' => lang('Alarm Management'),
|
||||
'action_confirm_button' => '',
|
||||
'action_extra_field' => '<input type="hidden" name="cal_id" value="'.$cal_id.'">'
|
||||
);
|
||||
$p->set_var($var);
|
||||
echo $p->fp('out','form_button');
|
||||
}
|
||||
|
||||
if ($this->bo->check_perms(PHPGW_ACL_DELETE))
|
||||
@ -637,7 +646,7 @@
|
||||
unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
||||
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
|
||||
$GLOBALS['phpgw']->common->phpgw_header();
|
||||
echo nl2br($this->bo->export_event($cal_id));
|
||||
echo nl2br($this->bo->export_ical($cal_id));
|
||||
}
|
||||
|
||||
function add($cd=0,$readsess=0)
|
||||
@ -671,6 +680,8 @@
|
||||
$this->bo->set_end($this->bo->year,$this->bo->month,$this->bo->day,$thishour,$thisminute,0);
|
||||
$this->bo->set_title('');
|
||||
$this->bo->set_description('');
|
||||
$this->bo->add_attribute('location','');
|
||||
$this->bo->add_attribute('uid','');
|
||||
$this->bo->add_attribute('priority',2);
|
||||
if(@$this->bo->prefs['calendar']['default_private'])
|
||||
{
|
||||
@ -845,12 +856,17 @@
|
||||
|
||||
function planner()
|
||||
{
|
||||
unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
||||
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
|
||||
$GLOBALS['phpgw']->common->phpgw_header();
|
||||
|
||||
if(floor(phpversion()) == 4)
|
||||
{
|
||||
eval('
|
||||
|
||||
unset($GLOBALS[\'phpgw_info\'][\'flags\'][\'noheader\']);
|
||||
unset($GLOBALS[\'phpgw_info\'][\'flags\'][\'nonavbar\']);
|
||||
$GLOBALS[\'phpgw\']->common->phpgw_header();
|
||||
|
||||
$html = CreateObject('infolog.html');
|
||||
$sbox = CreateObject('phpgwapi.sbox');
|
||||
$html = CreateObject(\'infolog.html\');
|
||||
$sbox = CreateObject(\'phpgwapi.sbox\');
|
||||
|
||||
$intervals_per_day = 3; // this should be configurable
|
||||
$interval = Array(
|
||||
@ -870,33 +886,33 @@
|
||||
$days = $this->bo->datetime->days_in_month($this->bo->month,$this->bo->year);
|
||||
$enddate = mktime(23,59,59,$this->bo->month,$this->bo->days,$this->bo->year) - $this->tz_offset;
|
||||
|
||||
$header[] = lang('Category');
|
||||
$header[] = lang(\'Category\');
|
||||
for ($d = 1; $d <= $days; $d++)
|
||||
{
|
||||
$dayname = substr(lang(date('D',mktime(0,0,0,$this->bo->month,$d,$this->bo->year))),0,2);
|
||||
$dayname = substr(lang(date(\'D\',mktime(0,0,0,$this->bo->month,$d,$this->bo->year))),0,2);
|
||||
|
||||
$header['.'.$d] = 'colspan="'.$intervals_per_day.'" align="center"';
|
||||
$header[$d] = '<a href="'.$html->link('/index.php',
|
||||
$header[\'.\'.$d] = \'colspan="\'.$intervals_per_day.\'" align="center"\';
|
||||
$header[$d] = \'<a href="\'.$html->link(\'/index.php\',
|
||||
array(
|
||||
'menuaction' => 'calendar.uicalendar.add',
|
||||
'date' => sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$d)
|
||||
\'menuaction\' => \'calendar.uicalendar.add\',
|
||||
\'date\' => sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$d)
|
||||
)
|
||||
).'">'.$dayname.'<br>'.$d.'</a>';
|
||||
).\'">\'.$dayname.\'<br>\'.$d.\'</a>\';
|
||||
}
|
||||
$last_cell = $intervals_per_day * $days - 1;
|
||||
|
||||
$this->bo->store_to_cache(
|
||||
Array(
|
||||
'syear' => $this->bo->year,
|
||||
'smonth' => $this->bo->month,
|
||||
'sday' => 1,
|
||||
'eyear' => $this->bo->year,
|
||||
'emonth' => $this->bo->month,
|
||||
'eday' => $days
|
||||
\'syear\' => $this->bo->year,
|
||||
\'smonth\' => $this->bo->month,
|
||||
\'sday\' => 1,
|
||||
\'eyear\' => $this->bo->year,
|
||||
\'emonth\' => $this->bo->month,
|
||||
\'eday\' => $days
|
||||
)
|
||||
);
|
||||
$firstday = intval(date('Ymd',mktime(0,0,0,$this->bo->month,1,$this->bo->year)));
|
||||
$lastday = intval(date('Ymd',mktime(0,0,0,$this->bo->month,$days,$this->bo->year)));
|
||||
$firstday = intval(date(\'Ymd\',mktime(0,0,0,$this->bo->month,1,$this->bo->year)));
|
||||
$lastday = intval(date(\'Ymd\',mktime(0,0,0,$this->bo->month,$days,$this->bo->year)));
|
||||
|
||||
$this->bo->remove_doubles_in_cache($firstday,$lastday);
|
||||
|
||||
@ -913,28 +929,28 @@
|
||||
{
|
||||
$event = $daily[$g];
|
||||
|
||||
$view = $html->link('/index.php',
|
||||
$view = $html->link(\'/index.php\',
|
||||
array(
|
||||
'menuaction' => 'calendar.uicalendar.view',
|
||||
'cal_id' => $event['id']
|
||||
\'menuaction\' => \'calendar.uicalendar.view\',
|
||||
\'cal_id\' => $event[\'id\']
|
||||
)
|
||||
);
|
||||
|
||||
$start_cell = $intervals_per_day * ($event['start']['mday'] - 1);
|
||||
$start_cell += $interval[$event['start']['hour']];
|
||||
$start_cell = $intervals_per_day * ($event[\'start\'][\'mday\'] - 1);
|
||||
$start_cell += $interval[$event[\'start\'][\'hour\']];
|
||||
|
||||
$end_cell = $intervals_per_day * ($event['end']['mday'] - 1);
|
||||
$end_cell += $interval[$event['end']['hour']];
|
||||
$end_cell = $intervals_per_day * ($event[\'end\'][\'mday\'] - 1);
|
||||
$end_cell += $interval[$event[\'end\'][\'hour\']];
|
||||
|
||||
$i = 0; // search for row of parent category
|
||||
do {
|
||||
++$i;
|
||||
if ($c = $event['category'])
|
||||
if ($c = $event[\'category\'])
|
||||
{
|
||||
$cat = $this->planner_category($event['category']);
|
||||
if ($cat['parent'])
|
||||
$cat = $this->planner_category($event[\'category\']);
|
||||
if ($cat[\'parent\'])
|
||||
{
|
||||
$pcat = $this->planner_category($c = $cat['parent']);
|
||||
$pcat = $this->planner_category($c = $cat[\'parent\']);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -943,20 +959,20 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
$cat = $pcat = array( 'name' => lang('none'));
|
||||
$cat = $pcat = array( \'name\' => lang(\'none\'));
|
||||
}
|
||||
$k = $c.'_'.$i;
|
||||
$ka = '.nr_'.$k;
|
||||
$k = $c.\'_\'.$i;
|
||||
$ka = \'.nr_\'.$k;
|
||||
if (!isset($rows[$k]))
|
||||
{
|
||||
if ($i > 1) // further line - no name
|
||||
{
|
||||
$rows[$k] = array();
|
||||
$rows[$c.'_1']['._name'] = 'rowspan="'.$i.'"';
|
||||
$rows[$c.\'_1\'][\'._name\'] = \'rowspan="\'.$i.\'"\';
|
||||
}
|
||||
else
|
||||
{
|
||||
$rows[$k]['_name'] = $pcat['name'];
|
||||
$rows[$k][\'_name\'] = $pcat[\'name\'];
|
||||
}
|
||||
$rows[$ka] = 0;
|
||||
}
|
||||
@ -966,34 +982,34 @@
|
||||
|
||||
if ($akt_cell < $start_cell)
|
||||
{
|
||||
$row[$event->id.'_1'] = ' ';
|
||||
$row['.'.$event['id'].'_1'] = 'colspan="'.($start_cell-$akt_cell).'"';
|
||||
$row[$event->id.\'_1\'] = \' \';
|
||||
$row[\'.\'.$event[\'id\'].\'_1\'] = \'colspan="\'.($start_cell-$akt_cell).\'"\';
|
||||
}
|
||||
|
||||
$opt = &$row['.'.$event['id'].'_2'];
|
||||
$cel = &$row[$event['id'].'_2'];
|
||||
$opt = &$row[\'.\'.$event[\'id\'].\'_2\'];
|
||||
$cel = &$row[$event[\'id\'].\'_2\'];
|
||||
if ($start_cell < $end_cell)
|
||||
{
|
||||
$opt .= "colspan=".(1 + $end_cell - $start_cell);
|
||||
}
|
||||
|
||||
if ($bgcolor=$cat['color'])
|
||||
if ($bgcolor=$cat[\'color\'])
|
||||
{
|
||||
$opt .= ' bgcolor="'.$bgcolor.'"';
|
||||
$opt .= \' bgcolor="\'.$bgcolor.\'"\';
|
||||
}
|
||||
$opt .= ' title="'.$event['title'];
|
||||
if ($event['description'])
|
||||
$opt .= \' title="\'.$event[\'title\'];
|
||||
if ($event[\'description\'])
|
||||
{
|
||||
$opt .= " \n".$event['description'];
|
||||
$opt .= " \n".$event[\'description\'];
|
||||
}
|
||||
$opt .= '" onClick="location=\''.$view.'\'"';
|
||||
$cel = '<a href="'.$view.'">';
|
||||
if ($event['priority'] == 3)
|
||||
$opt .= \'" onClick="location=\\\'\'.$view.\'\\\'"\';
|
||||
$cel = \'<a href="\'.$view.\'">\';
|
||||
if ($event[\'priority\'] == 3)
|
||||
{
|
||||
$cel .= $html->image('calendar','mini-calendar-bar.gif','','border="0"');
|
||||
$cel .= $html->image(\'calendar\',\'mini-calendar-bar.gif\',\'\',\'border="0"\');
|
||||
}
|
||||
$cel .= $html->image('calendar',count($event['participants'])>1?'multi_3.gif':'single.gif',$this->planner_participants($event['participants']),'border="0"');
|
||||
$cel .= '</a>';
|
||||
$cel .= $html->image(\'calendar\',count($event[\'participants\'])>1?\'multi_3.gif\':\'single.gif\',$this->planner_participants($event[\'participants\']),\'border="0"\');
|
||||
$cel .= \'</a>\';
|
||||
|
||||
$akt_cell = $end_cell + 1;
|
||||
}
|
||||
@ -1002,25 +1018,28 @@
|
||||
{
|
||||
if (is_array($r))
|
||||
{
|
||||
$rows['.'.$k] = 'bgcolor="'.$GLOBALS['phpgw']->nextmatchs->alternate_row_color().'"';
|
||||
$rows[\'.\'.$k] = \'bgcolor="\'.$GLOBALS[\'phpgw\']->nextmatchs->alternate_row_color().\'"\';
|
||||
$row = &$rows[$k];
|
||||
$akt_cell = &$rows['.nr_'.$k];
|
||||
$akt_cell = &$rows[\'.nr_\'.$k];
|
||||
if ($akt_cell <= $last_cell)
|
||||
{
|
||||
$row['3'] = ' ';
|
||||
$row['.3'] = 'colspan="'.(1+$last_cell-$akt_cell).'"';
|
||||
$row[\'3\'] = \' \';
|
||||
$row[\'.3\'] = \'colspan="\'.(1+$last_cell-$akt_cell).\'"\';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$bgcolor = 'bgcolor="'.$this->theme['th_bg'].'"';
|
||||
$bgcolor = \'bgcolor="\'.$this->theme[\'th_bg\'].\'"\';
|
||||
echo $html->table(
|
||||
array(
|
||||
'_h' => $header,
|
||||
'._h' => $bgcolor
|
||||
\'_h\' => $header,
|
||||
\'._h\' => $bgcolor
|
||||
)+$rows,
|
||||
'width="100%" cols="'.(1+$days*$intervals_per_day).'"'
|
||||
\'width="100%" cols="\'.(1+$days*$intervals_per_day).\'"\'
|
||||
);
|
||||
');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function matrixselect()
|
||||
@ -1418,11 +1437,13 @@
|
||||
|
||||
$p->set_file(
|
||||
Array(
|
||||
'footer' => 'footer.tpl'
|
||||
'footer' => 'footer.tpl',
|
||||
'form_button' => 'form_button_script.tpl'
|
||||
)
|
||||
);
|
||||
$p->set_block('footer','footer_table','footer_table');
|
||||
$p->set_block('footer','footer_row','footer_row');
|
||||
$p->set_block('footer','blank_row','blank_row');
|
||||
|
||||
$m = $this->bo->month;
|
||||
$y = $this->bo->year;
|
||||
@ -1501,6 +1522,16 @@
|
||||
);
|
||||
$this->output_template_array($p,'table_row','footer_row',$var);
|
||||
|
||||
$var = Array(
|
||||
'submit_button' => lang('Submit'),
|
||||
'action_url_button' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uiicalendar.import'),
|
||||
'action_text_button' => lang('Import'),
|
||||
'action_confirm_button' => '',
|
||||
'action_extra_field' => ''
|
||||
);
|
||||
$this->output_template_array($p,'b_row','form_button',$var);
|
||||
$p->parse('table_row','blank_row',True);
|
||||
|
||||
$p->pparse('out','footer_table');
|
||||
unset($p);
|
||||
}
|
||||
@ -1887,7 +1918,6 @@
|
||||
|
||||
if($day_params['appts'])
|
||||
{
|
||||
$lr_events = CreateObject('calendar.calendar_item');
|
||||
$var = Array(
|
||||
'week_day_font_size' => '2',
|
||||
'events' => ''
|
||||
@ -2100,6 +2130,13 @@
|
||||
);
|
||||
}
|
||||
|
||||
if ($event['location'])
|
||||
{
|
||||
$var[] = Array(
|
||||
'field' => lang('Location'),
|
||||
'data' => $event['location']
|
||||
);
|
||||
}
|
||||
$var[] = Array(
|
||||
'field' => lang('Start Date/Time'),
|
||||
'data' => $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['start']) - $this->tz_offset)
|
||||
@ -2784,6 +2821,7 @@
|
||||
'action_url' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.bocalendar.update')),
|
||||
'common_hidden' => '<input type="hidden" name="cal[id]" value="'.$event['id'].'">'."\n"
|
||||
. '<input type="hidden" name="cal[owner]" value="'.$this->bo->owner.'">'."\n"
|
||||
. '<input type="hidden" name="cal[uid]" value="'.$event['uid'].'">'."\n"
|
||||
. ($GLOBALS['HTTP_GET_VARS']['cal_id'] && $event['id'] == 0?'<input type="hidden" name="cal[reference]" value="'.$GLOBALS['HTTP_GET_VARS']['cal_id'].'">'."\n":
|
||||
($event['reference']?'<input type="hidden" name="cal[reference]" value="'.$event['reference'].'">'."\n":'')),
|
||||
'errormsg' => ($params['cd']?$GLOBALS['phpgw']->common->check_code($params['cd']):'')
|
||||
@ -2805,7 +2843,13 @@
|
||||
// Display Categories
|
||||
$var[] = Array(
|
||||
'field' => lang('Category'),
|
||||
'data' => '<select name="cal[category]"><option value="">'.lang('Choose the category').'</option>'.$this->cat->formated_list('select','all',$event['category'],True).'</select>'
|
||||
'data' => '<select name="cal[category]"><option value="0">'.lang('Choose the category').'</option>'.$this->cat->formated_list('select','all',$event['category'],True).'</select>'
|
||||
);
|
||||
|
||||
// Location
|
||||
$var[] = Array(
|
||||
'field' => lang('Location'),
|
||||
'data' => '<input name="cal[location]" size="25" maxlength="80" value="'.$event['location'].'">'
|
||||
);
|
||||
|
||||
// Date
|
||||
@ -2867,7 +2911,7 @@
|
||||
// Participants
|
||||
$accounts = $GLOBALS['phpgw']->acl->get_ids_for_location('run',1,'calendar');
|
||||
$users = Array();
|
||||
$this->build_part_list($users,$accounts,$event['owner']);
|
||||
$this->build_part_list($users,$accounts,$this->bo->owner);
|
||||
|
||||
$str = '';
|
||||
@asort($users);
|
||||
@ -3004,13 +3048,14 @@
|
||||
{
|
||||
return;
|
||||
}
|
||||
@reset($accounts);
|
||||
while(list($index,$id) = each($accounts))
|
||||
{
|
||||
if(intval($id) == $owner)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(!isset($users[intval($id)]))
|
||||
elseif(!isset($users[intval($id)]))
|
||||
{
|
||||
if($GLOBALS['phpgw']->accounts->exists(intval($id)) == True)
|
||||
{
|
||||
|
@ -18,9 +18,11 @@
|
||||
{
|
||||
var $bo;
|
||||
var $datetime;
|
||||
var $template;
|
||||
|
||||
var $public_functions = array(
|
||||
'test' => True
|
||||
'test' => True,
|
||||
'import' => True
|
||||
);
|
||||
|
||||
|
||||
@ -29,6 +31,7 @@
|
||||
{
|
||||
$this->bo = CreateObject('calendar.boicalendar');
|
||||
$this->datetime = CreateObject('phpgwapi.datetime');
|
||||
$this->template = $GLOBALS['phpgw']->template;
|
||||
}
|
||||
|
||||
|
||||
@ -161,5 +164,39 @@
|
||||
echo nl2br($this->bo->build_ical($vcalendar));
|
||||
echo "End Time : ".$GLOBALS['phpgw']->common->show_date()."<br>\n";
|
||||
}
|
||||
|
||||
function import()
|
||||
{
|
||||
unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
||||
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
|
||||
$GLOBALS['phpgw_info']['flags']['nonappheader'] = True;
|
||||
$GLOBALS['phpgw_info']['flags']['nonappfooter'] = True;
|
||||
$GLOBALS['phpgw']->common->phpgw_header();
|
||||
|
||||
echo '<body bgcolor="' . $GLOBALS['phpgw_info']['theme']['bg_color'] . '">';
|
||||
|
||||
if ($GLOBALS['HTTP_GET_VARS']['action'] == 'GetFile')
|
||||
{
|
||||
echo '<b><center>' . lang('You must select a [iv]Cal. (*.[iv]cs)') . '</b></center><br><br>';
|
||||
}
|
||||
|
||||
$this->template->set_file(
|
||||
Array(
|
||||
'vcalimport' => 'vcal_import.tpl'
|
||||
)
|
||||
);
|
||||
|
||||
$var = Array(
|
||||
'vcal_header' => '<p> <b>' . lang('Calendar - [iv]Cal Importer') . '</b><hr><p>',
|
||||
'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.boicalendar.import'),
|
||||
'lang_access' => lang('Access'),
|
||||
'lang_groups' => lang('Which groups'),
|
||||
'access_option'=> $access_option,
|
||||
'group_option' => $group_option,
|
||||
'load_vcal' => lang('Load [iv]Cal')
|
||||
);
|
||||
$this->template->set_var($var);
|
||||
$this->template->pparse('out','vcalimport');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -2,6 +2,8 @@
|
||||
a calendar en a
|
||||
accept calendar en Accept
|
||||
accepted calendar en Accepted
|
||||
add alarm calendar en Add Alarm
|
||||
alarm management calendar en Alarm Management
|
||||
all day calendar en All Day
|
||||
are you sure\nyou want to\ndelete this entry ? calendar en Are you sure\nyou want to\ndelete this entry ?
|
||||
are you sure\nyou want to\ndelete this entry ?\n\nthis will delete\nthis entry for all users. calendar en Are you sure\nyou want to\ndelete this entry ?\n\nThis will delete\nthis entry for all users.
|
||||
@ -39,6 +41,7 @@ grant calendar access common en Grant Calendar Access
|
||||
group public only calendar en Group Public Only
|
||||
ignore conflict calendar en Ignore Conflict
|
||||
i participate calendar en I Participate
|
||||
location calendar en Location
|
||||
minutes calendar en minutes
|
||||
mo calendar en M
|
||||
mon calendar en Mon
|
||||
|
@ -15,6 +15,7 @@
|
||||
'phpgw_cal' => array(
|
||||
'fd' => array(
|
||||
'cal_id' => array('type' => 'auto','nullable' => False),
|
||||
'uid' => array('type' => 'varchar', 'precision' => 255,'nullable' => False),
|
||||
'owner' => array('type' => 'int', 'precision' => 8,'nullable' => False),
|
||||
'category' => array('type' => 'int', 'precision' => 8,'nullable' => True),
|
||||
'groups' => array('type' => 'varchar', 'precision' => 255,'nullable' => True),
|
||||
@ -26,6 +27,7 @@
|
||||
'is_public' => array('type' => 'int', 'precision' => 8,'nullable' => False,'default' => 1),
|
||||
'title' => array('type' => 'varchar', 'precision' => 80,'nullable' => False,'default' => '1'),
|
||||
'description' => array('type' => 'text','nullable' => True),
|
||||
'location' => array('type' => 'varchar', 'precision' => 255,'nullable' => True),
|
||||
'reference' => array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => 0)
|
||||
),
|
||||
'pk' => array('cal_id'),
|
||||
@ -78,6 +80,7 @@
|
||||
'fd' => array(
|
||||
'alarm_id' => array('type' => 'auto','nullable' => False),
|
||||
'cal_id' => array('type' => 'int', 'precision' => 8, 'nullable' => False),
|
||||
'cal_owner' => array('type' => 'int', 'precision' => 8, 'nullable' => False),
|
||||
'cal_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False),
|
||||
'cal_text' => array('type' => 'varchar', 'precision' => 50, 'nullable' => False)
|
||||
),
|
||||
|
@ -851,6 +851,7 @@
|
||||
'fd' => array(
|
||||
'alarm_id' => array('type' => 'auto','nullable' => False),
|
||||
'cal_id' => array('type' => 'int', 'precision' => 8, 'nullable' => False),
|
||||
'cal_owner' => array('type' => 'int', 'precision' => 8, 'nullable' => False),
|
||||
'cal_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False),
|
||||
'cal_text' => array('type' => 'varchar', 'precision' => 50, 'nullable' => False)
|
||||
),
|
||||
@ -861,6 +862,9 @@
|
||||
)
|
||||
);
|
||||
|
||||
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_cal','uid',array('type' => 'varchar', 'precision' => 255,'nullable' => False));
|
||||
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_cal','location',array('type' => 'varchar', 'precision' => 255,'nullable' => True));
|
||||
|
||||
$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.004';
|
||||
return $GLOBALS['setup_info']['calendar']['currentver'];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user