Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
sectionbuilder.php
1
<?php
2
3
namespace
Bitrix\Calendar\Sync\Icloud
;
4
5
use Bitrix\Calendar\Core\Base\SingletonTrait;
6
use
Bitrix\Calendar\Core\Section\Section
;
7
use
Bitrix\Main\Localization\Loc
;
8
9
class
SectionBuilder
10
{
11
use
SingletonTrait
;
12
18
public
function
getCreateSectionContent
(
Section
$section): string
19
{
20
$xmlns =
" xmlns:A0=\"urn:ietf:params:xml:ns:caldav\""
;
21
$xmlns .=
" xmlns:A1=\"http://apple.com/ns/ical/\""
;
22
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>"
;
33
34
return
$body;
35
}
36
42
public
function
getUpdateSectionContent
(
Section
$section): string
43
{
44
$xmlns =
" xmlns:A0=\"urn:ietf:params:xml:ns:caldav\""
;
45
$xmlns .=
" xmlns:A1=\"http://apple.com/ns/ical/\""
;
46
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>"
;
53
54
return
$body;
55
}
56
63
private
function
getBodyProperties(
Section
$section,
string
$body): string
64
{
65
if
($section->getName())
66
{
67
IncludeModuleLangFile(
68
$_SERVER[
'DOCUMENT_ROOT'
] . BX_ROOT .
'/modules/calendar/classes/general/calendar.php'
69
);
70
$body .=
"\t\t\t<A:displayname>"
71
. ($section->getExternalType() ===
'local'
? (
Loc::getMessage
(
'EC_CALENDAR_BITRIX24_NAME'
) .
' '
) :
''
)
72
. $section->getName() .
"</A:displayname>\r\n"
;
73
}
74
if
($section->getColor())
75
{
76
$body .=
"\t\t\t<A1:calendar-color>"
. $section->getColor() .
"</A1:calendar-color>\r\n"
;
77
}
78
$body .=
"\t\t</A:prop>\r\n"
;
79
$body .=
"\t</A:set>\r\n"
;
80
81
return
$body;
82
}
83
}
Bitrix\Calendar\Core\Mappers\Section
Definition
section.php:21
Bitrix\Calendar\Core\Section\Section
Definition
section.php:11
Bitrix\Calendar\Sync\Icloud\SectionBuilder
Definition
sectionbuilder.php:10
Bitrix\Calendar\Sync\Icloud\SectionBuilder\getUpdateSectionContent
getUpdateSectionContent(Section $section)
Definition
sectionbuilder.php:42
Bitrix\Calendar\Sync\Icloud\SectionBuilder\getCreateSectionContent
getCreateSectionContent(Section $section)
Definition
sectionbuilder.php:18
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Calendar\Internals\SingletonTrait
trait SingletonTrait
Definition
singletontrait.php:8
Bitrix\Calendar\Sync\Icloud
Definition
abstractmanager.php:3
modules
calendar
lib
sync
icloud
sectionbuilder.php
Создано системой
1.10.0