mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-09 06:50:35 +01:00
new parameter "ical" to calendar_uforms::edit, to create a new event based on an ical
This commit is contained in:
parent
b1427273d8
commit
547ec37257
@ -773,10 +773,16 @@ function load_cal(url,id) {
|
|||||||
'link' => False
|
'link' => False
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
$file[] = array(
|
||||||
|
'text' => lang('Import').': '.html::a_href(lang('iCal'),'calendar.calendar_uiforms.import').
|
||||||
|
' & '.html::a_href(lang('CSV'),'/calendar/csv_import.php'),
|
||||||
|
'no_lang' => True,
|
||||||
|
'link' => False,
|
||||||
|
);
|
||||||
|
|
||||||
// Merge print
|
// Merge print
|
||||||
if ($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir'])
|
if ($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir'])
|
||||||
{
|
{
|
||||||
$options = '';
|
$options = '';
|
||||||
$documents = calendar_merge::get_documents($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']);
|
$documents = calendar_merge::get_documents($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']);
|
||||||
|
|
||||||
@ -784,7 +790,7 @@ function load_cal(url,id) {
|
|||||||
$spreadsheets = importexport_admin_prefs_sidebox_hooks::get_spreadsheet_list('calendar');
|
$spreadsheets = importexport_admin_prefs_sidebox_hooks::get_spreadsheet_list('calendar');
|
||||||
foreach($spreadsheets as $file_info)
|
foreach($spreadsheets as $file_info)
|
||||||
{
|
{
|
||||||
if($key = array_search($file_info['name'], $documents))
|
if($key = array_search($file_info['name'], $documents))
|
||||||
{
|
{
|
||||||
unset($documents[$key]);
|
unset($documents[$key]);
|
||||||
}
|
}
|
||||||
@ -857,7 +863,7 @@ function load_cal(url,id) {
|
|||||||
if(!$timespan)
|
if(!$timespan)
|
||||||
{
|
{
|
||||||
$timespan = array(array(
|
$timespan = array(array(
|
||||||
'start' => is_array($this->first) ? $this->bo->date2ts($this->first) : $this->first,
|
'start' => is_array($this->first) ? $this->bo->date2ts($this->first) : $this->first,
|
||||||
'end' => is_array($this->last) ? $this->bo->date2ts($this->last) : $this->last
|
'end' => is_array($this->last) ? $this->bo->date2ts($this->last) : $this->last
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -1080,7 +1080,7 @@ class calendar_uiforms extends calendar_ui
|
|||||||
);
|
);
|
||||||
$cal_id = (int) $_GET['cal_id'];
|
$cal_id = (int) $_GET['cal_id'];
|
||||||
|
|
||||||
if (!$cal_id || $cal_id && !($event = $this->bo->read($cal_id)))
|
if (!$cal_id && empty($_GET['ical']) || $cal_id && !($event = $this->bo->read($cal_id)))
|
||||||
{
|
{
|
||||||
if ($cal_id)
|
if ($cal_id)
|
||||||
{
|
{
|
||||||
@ -1096,6 +1096,28 @@ class calendar_uiforms extends calendar_ui
|
|||||||
}
|
}
|
||||||
$event =& $this->default_add_event();
|
$event =& $this->default_add_event();
|
||||||
}
|
}
|
||||||
|
elseif (!empty($_GET['ical']))
|
||||||
|
{
|
||||||
|
$ical = new calendar_ical();
|
||||||
|
if (!($events = $ical->icaltoegw($_GET['ical'], '', 'utf-8')) || count($events) != 1)
|
||||||
|
{
|
||||||
|
error_log(__METHOD__."('$_GET[ical]') error parsing iCal!");
|
||||||
|
$msg = lang('Error: importing the iCal');
|
||||||
|
$event =& $this->default_add_event();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$event = array_shift($events);
|
||||||
|
$event['participant_types'] = array();
|
||||||
|
foreach($event['participants'] as $uid => $status)
|
||||||
|
{
|
||||||
|
calendar_so::split_user($uid, $user_type, $user_id);
|
||||||
|
$event['participant_types'][$user_type][$user_id] = $status;
|
||||||
|
}
|
||||||
|
//error_log(__METHOD__."(...) parsed as ".array2string($event));
|
||||||
|
}
|
||||||
|
unset($ical);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$preserv['actual_date'] = $event['start']; // remember the date clicked
|
$preserv['actual_date'] = $event['start']; // remember the date clicked
|
||||||
|
Loading…
Reference in New Issue
Block a user