Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/ilovecveti.ru/bitrix/modules/calendar/lib/sync/icloud/ |
Upload File : |
<?php namespace Bitrix\Calendar\Sync\Icloud; use Bitrix\Calendar\Core\Base\SingletonTrait; use Bitrix\Calendar\Core\Section\Section; use Bitrix\Main\Localization\Loc; class SectionBuilder { use SingletonTrait; /** * @param Section $section * * @return string */ public function getCreateSectionContent(Section $section): string { $xmlns = " xmlns:A0=\"urn:ietf:params:xml:ns:caldav\""; $xmlns .= " xmlns:A1=\"http://apple.com/ns/ical/\""; $body = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; $body .= "<A:mkcol xmlns:A=\"DAV:\"". $xmlns .">\r\n"; $body .= "\t<A:set>\r\n"; $body .= "\t\t<A:prop>\r\n"; $body .= "\t\t\t<A:resourcetype>\r\n"; $body .= "\t\t\t\t<A:collection/>\r\n"; $body .= "\t\t\t\t<A0:calendar/>\r\n"; $body .= "\t\t\t</A:resourcetype>\r\n"; $body = $this->getBodyProperties($section, $body); $body .= "</A:mkcol>"; return $body; } /** * @param Section $section * * @return string */ public function getUpdateSectionContent(Section $section): string { $xmlns = " xmlns:A0=\"urn:ietf:params:xml:ns:caldav\""; $xmlns .= " xmlns:A1=\"http://apple.com/ns/ical/\""; $body = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; $body .= "<A:propertyupdate xmlns:A=\"DAV:\"". $xmlns .">\r\n"; $body .= "\t<A:set>\r\n"; $body .= "\t\t<A:prop>\r\n"; $body = $this->getBodyProperties($section, $body); $body .= "</A:propertyupdate>"; return $body; } /** * @param Section $section * @param string $body * * @return string */ private function getBodyProperties(Section $section, string $body): string { if ($section->getName()) { IncludeModuleLangFile( $_SERVER['DOCUMENT_ROOT'] . BX_ROOT . '/modules/calendar/classes/general/calendar.php' ); $body .= "\t\t\t<A:displayname>" . ($section->getExternalType() === 'local' ? (Loc::getMessage('EC_CALENDAR_BITRIX24_NAME') . ' ') : '') . $section->getName() . "</A:displayname>\r\n"; } if ($section->getColor()) { $body .= "\t\t\t<A1:calendar-color>" . $section->getColor() . "</A1:calendar-color>\r\n"; } $body .= "\t\t</A:prop>\r\n"; $body .= "\t</A:set>\r\n"; return $body; } }