3namespace Bitrix\Calendar\Sync\Icloud;
5use Bitrix\Calendar\Core\Base\SingletonTrait;
6use Bitrix\Calendar\Core\Section\Section;
7use Bitrix\Main\Localization\Loc;
20 $xmlns =
" xmlns:A0=\"urn:ietf:params:xml:ns:caldav\"";
21 $xmlns .=
" xmlns:A1=\"http://apple.com/ns/ical/\"";
23 $body =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
24 $body .=
"<A:mkcol xmlns:A=\"DAV:\"". $xmlns .
">\r\n";
25 $body .=
"\t<A:set>\r\n";
26 $body .=
"\t\t<A:prop>\r\n";
27 $body .=
"\t\t\t<A:resourcetype>\r\n";
28 $body .=
"\t\t\t\t<A:collection/>\r\n";
29 $body .=
"\t\t\t\t<A0:calendar/>\r\n";
30 $body .=
"\t\t\t</A:resourcetype>\r\n";
31 $body = $this->getBodyProperties($section, $body);
32 $body .=
"</A:mkcol>";
44 $xmlns =
" xmlns:A0=\"urn:ietf:params:xml:ns:caldav\"";
45 $xmlns .=
" xmlns:A1=\"http://apple.com/ns/ical/\"";
47 $body =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
48 $body .=
"<A:propertyupdate xmlns:A=\"DAV:\"". $xmlns .
">\r\n";
49 $body .=
"\t<A:set>\r\n";
50 $body .=
"\t\t<A:prop>\r\n";
51 $body = $this->getBodyProperties($section, $body);
52 $body .=
"</A:propertyupdate>";
63 private function getBodyProperties(
Section $section,
string $body): string
65 if ($section->getName())
68 $_SERVER[
'DOCUMENT_ROOT'] .
BX_ROOT .
'/modules/calendar/classes/general/calendar.php'
70 $body .=
"\t\t\t<A:displayname>"
71 . ($section->getExternalType() ===
'local' ? (Loc::getMessage(
'EC_CALENDAR_BITRIX24_NAME') .
' ') :
'')
72 . $section->getName() .
"</A:displayname>\r\n";
74 if ($section->getColor())
76 $body .=
"\t\t\t<A1:calendar-color>" . $section->getColor() .
"</A1:calendar-color>\r\n";
78 $body .=
"\t\t</A:prop>\r\n";
79 $body .=
"\t</A:set>\r\n";
getUpdateSectionContent(Section $section)
getCreateSectionContent(Section $section)
$_SERVER["DOCUMENT_ROOT"]
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)