Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
1f4fd52d
Commit
1f4fd52d
authored
14 years ago
by
Juanjo Menent
Browse files
Options
Downloads
Patches
Plain Diff
task #9747: Can show content of external calendar (ical) into agenda
parent
8e25cb1a
Branches
Branches containing commit
Tags
6.0.1
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/comm/action/class/ical.class.php
+6
-6
6 additions, 6 deletions
htdocs/comm/action/class/ical.class.php
htdocs/comm/action/index.php
+72
-0
72 additions, 0 deletions
htdocs/comm/action/index.php
with
78 additions
and
6 deletions
htdocs/comm/action/class/ical.class.php
+
6
−
6
View file @
1f4fd52d
...
...
@@ -81,7 +81,7 @@ class ical
// read FILE text
$this
->
file_text
=
$this
->
read_file
(
$uri
);
$this
->
file_text
=
split
(
"[
\n
]"
,
$this
->
file_text
);
$this
->
file_text
=
preg_
split
(
"[
\n
]"
,
$this
->
file_text
);
// is this text vcalendar standart text ? on line 1 is BEGIN:VCALENDAR
if
(
!
stristr
(
$this
->
file_text
[
0
],
'BEGIN:VCALENDAR'
))
return
'error not VCALENDAR'
;
...
...
@@ -223,7 +223,7 @@ class ical
$ical_date
=
str_replace
(
'Z'
,
''
,
$ical_date
);
// TIME LIMITED EVENT
e
reg
(
'([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})([0-9]{0,2})'
,
$ical_date
,
$date
);
p
reg
_match
(
'
/
([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})([0-9]{0,2})
/
'
,
$ical_date
,
$date
);
// UNIX timestamps can't deal with pre 1970 dates
if
(
$date
[
1
]
<=
1970
)
...
...
@@ -244,15 +244,15 @@ class ical
{
$value
=
$this
->
ical_date_to_unix
(
$value
);
//
zjisteni
TZID
//
Analyse
TZID
$temp
=
explode
(
";"
,
$key
);
if
(
empty
(
$temp
[
1
]))
// n
eni
TZID
if
(
empty
(
$temp
[
1
]))
// n
ot
TZID
{
$
data
=
str_replace
(
'T'
,
''
,
$
data
);
$
value
=
str_replace
(
'T'
,
''
,
$
value
);
return
array
(
$key
,
$value
);
}
//
pridani
$value a $tzid
do pole
//
adding
$value a
nd
$tzid
$key
=
$temp
[
0
];
$temp
=
explode
(
"="
,
$temp
[
1
]);
$return_value
[
$temp
[
0
]]
=
$temp
[
1
];
...
...
This diff is collapsed.
Click to expand it.
htdocs/comm/action/index.php
+
72
−
0
View file @
1f4fd52d
...
...
@@ -484,6 +484,78 @@ if ($showbirthday)
}
}
//Exernal Calendars
if
(
$conf
->
global
->
MAIN_FEATURES_LEVEL
>=
2
)
if
(
$conf
->
global
->
ENABLE_AGENDA_EXT
==
1
&&
$conf
->
global
->
AGENDA_EXT_NB
>
0
)
{
require_once
(
DOL_DOCUMENT_ROOT
.
"/comm/action/class/ical.class.php"
);
$numcals
=
$conf
->
global
->
AGENDA_EXT_NB
;
$i
=
1
;
while
(
$i
<=
$numcals
)
{
$paramkey
=
'AGENDA_EXT_SRC'
.
$i
;
$url
=
$conf
->
global
->
$paramkey
;
$ical
=
new
ical
();
$ical
->
parse
(
$url
);
$icalevents
=
$ical
->
get_event_list
();
if
(
count
(
$icalevents
)
>
0
)
{
foreach
(
$icalevents
as
$icalevent
)
{
// Create a new object action
$event
=
new
ActionComm
(
$db
);
$event
->
id
=
$icalevent
->
UID
;
$event
->
datep
=
$icalevent
->
DTSTART
;
$event
->
datef
=
$icalevent
->
DTEND
;
$event
->
type_code
=
"ICALEVENT"
;
$event
->
libelle
=
$icalevent
->
SUMMARY
;
//$event->fulldayevent=$obj->fulldayevent;
$event
->
date_start_in_calendar
=
$event
->
datep
;
/*
if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
else $event->date_end_in_calendar=$event->datep;
// Define ponctual property
if ($event->date_start_in_calendar == $event->date_end_in_calendar)
{
$event->ponctuel=1;
}
// Check values
if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar > $lastdaytoshow)
{
// This record is out of visible range
}
else
{
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
if ($event->date_end_in_calendar > $lastdaytoshow) $event->date_end_in_calendar=$lastdaytoshow;
*/
// Add an entry in actionarray for each day
$daycursor
=
$event
->
date_start_in_calendar
;
$annee
=
date
(
'Y'
,
$daycursor
);
$mois
=
date
(
'm'
,
$daycursor
);
$jour
=
date
(
'd'
,
$daycursor
);
// Loop on each day covered by action to prepare an index to show on calendar
$loop
=
true
;
$j
=
0
;
$daykey
=
dol_mktime
(
0
,
0
,
0
,
$mois
,
$jour
,
$annee
);
do
{
$eventarray
[
$daykey
][]
=
$event
;
$daykey
+=
60
*
60
*
24
;
if
(
$daykey
>
$event
->
date_end_in_calendar
)
$loop
=
false
;
}
while
(
$loop
);
//}
}
}
$i
++
;
}
}
$maxlength
=
16
;
$cachethirdparties
=
array
();
$cachecontacts
=
array
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment