public function __getRow($event, $listName, &$last_change) { global $APPLICATION, $USER; $arStatusValues = $this->arStatusValues; $arPriorityValues = $this->arPriorityValues; $first_week_day = COption::GetOptionString('calendar', 'week_start', 'MO'); $first_week_day = strtolower($first_week_day); $change = MakeTimeStamp($event['TIMESTAMP_X']); if ($last_change < $change) $last_change = $change; $bRecurrent = (isset($event['RRULE']) && $event['RRULE'] != "") ? 1 : 0; $rrule = CCalendarEvent::ParseRRULE($event['RRULE']); $ts_start = $event['DT_FROM_TS']; $ts_finish = $event['DT_TO_TS']; $bAllDay = $event['DT_SKIP_TIME'] == 'Y' ? 1 : 0; $TZBias = intval(date('Z')); $TZBiasStart = intval(date('Z', $ts_start)); $duration = $event['DT_LENGTH']; if ($bAllDay) $duration -= 20; //$duration = $bRecurrent ? $event['DT_LENGTH'] : ($ts_finish - $ts_start); if (!$bAllDay || defined('OLD_OUTLOOK_VERSION')) { $ts_start -= $TZBiasStart; $ts_finish -= $TZBiasStart; } $obRow = new CXMLCreator('z:row'); $obRow->setAttribute('ows_ID', $event['ID']); $obRow->setAttribute('ows_Title', htmlspecialcharsback($event['NAME'])); // we have data htmlspecialchared yet $version = $event['VERSION'] ? $event['VERSION'] : 1; $obRow->setAttribute('ows_Attachments', 0); $obRow->setAttribute('ows_owshiddenversion', $version); $obRow->setAttribute('ows_MetaInfo_vti_versionhistory', md5($event['ID']).':'.$version); /* ows_MetaInfo_BusyStatus='2' - Editor ows_MetaInfo_IntendedBusyStatus='-1' - Creator values: -1 - Unspecified busy status. Protocol clients can choose to display one of the other values if BusyStatus is -1. 0 - Free - ACCESSIBILITY => 'free' 1 - Tentative - ACCESSIBILITY => 'quest' 2 - Busy - ACCESSIBILITY => 'busy' 3 - Out of Office - ACCESSIBILITY => 'absent' */ $status = $arStatusValues[$event['ACCESSIBILITY']]; $obRow->setAttribute('ows_MetaInfo_BusyStatus', $status === null ? -1 : $status); $obRow->setAttribute('ows_MetaInfo_Priority', intval($arPriorityValues[$event['IMPORTANCE']])); $obRow->setAttribute('ows_Created', $this->__makeDateTime(MakeTimeStamp($event['DATE_CREATE'])-$TZBias)); $obRow->setAttribute('ows_Modified', $this->__makeDateTime($change-$TZBias)); $obRow->setAttribute('ows_EventType', $bRecurrent ? 1 : 0); $obRow->setAttribute('ows_Location', CCalendar::GetTextLocation($event['LOCATION'])); $obRow->setAttribute('ows_Description', $event['~DESCRIPTION']); // Description parsed from BB-codes to HTML $obRow->setAttribute('ows_EventDate', $this->__makeDateTime($ts_start)); $obRow->setAttribute('ows_EndDate', $this->__makeDateTime($ts_start + $event['DT_LENGTH'])); //$obRow->setAttribute('ows_EndDate', $this->__makeDateTime(((false && $bRecurrent) ? $ts_start + $event['DT_LENGTH'] : $ts_finish) + ($bAllDay ? 86340 : 0))); //$obRow->setAttribute('ows_EndDate', $this->__makeDateTime(($bRecurrent ? $ts_start + $event['DT_LENGTH'] : $ts_finish) - ($bAllDay ? 20 : 0))); $obRow->setAttribute('ows_fAllDayEvent', $bAllDay); /* Recurrence */ $obRow->setAttribute('ows_fRecurrence', $bRecurrent); if ($bRecurrent) { $obRow->setAttribute('ows_UID', CIntranetUtils::makeGUID(md5($event['ID'].'_'.$change))); $tz_data = ''; $tz_data .= '<timeZoneRule>'; $tz_data .= '<standardBias>'.(-intval(($TZBias - (date('I') ? 3600 : 0)) /60)).'</standardBias>'; $tz_data .= '<additionalDaylightBias>-60</additionalDaylightBias>'; $bUseTransition = COption::GetOptionString('intranet', 'tz_transition', 'Y') == 'Y'; if ($bUseTransition) { $transition_standard = COption::GetOptionString('intranet', 'tz_transition_standard', ''); $transition_daylight = COption::GetOptionString('intranet', 'tz_transition_daylight', ''); if (!$transition_standard) $transition_standard = '<transitionRule month="10" day="su" weekdayOfMonth="last" /><transitionTime>3:0:0</transitionTime>'; if (!$transition_daylight) $transition_daylight = '<transitionRule month="3" day="su" weekdayOfMonth="last" /><transitionTime>2:0:0</transitionTime>'; $tz_data .= '<standardDate>'.$transition_standard.'</standardDate><daylightDate>'.$transition_daylight.'</daylightDate>'; } $tz_data .= '</timeZoneRule>'; $obRow->setAttribute('ows_XMLTZone', $tz_data); //$obRow->setAttribute('ows_TimeZone', 7); $recurence_data = ''; $recurence_data .= '<recurrence>'; $recurence_data .= '<rule>'; $recurence_data .= '<firstDayOfWeek>'.$first_week_day.'</firstDayOfWeek>'; $recurence_data .= '<repeat>'; switch($rrule['FREQ']) { case 'DAILY': $recurence_data .= '<daily dayFrequency="'.$rrule['INTERVAL'].'" />'; break; case 'WEEKLY': $days = ''; foreach ($rrule['BYDAY'] as $day) $days .= strtolower($day).'="TRUE" '; $recurence_data .= '<weekly '.$days.'weekFrequency="'.$rrule['INTERVAL'].'" />'; break; case 'MONTHLY': $recurence_data .= '<monthly monthFrequency="'.$rrule['INTERVAL'].'" day="'.date('d', $ts_start).'" />'; break; case 'YEARLY': $recurence_data .= '<yearly yearFrequency="'.$rrule['INTERVAL'].'" month="'.date('m', $ts_start).'" day="'.date('d', $ts_start).'" />'; break; } $recurence_data .= '</repeat>'; if (date('Y', $ts_finish) == '2038' || date('Y', $ts_finish) == '2037') $recurence_data .= '<repeatForever>FALSE</repeatForever>'; else $recurence_data .= '<windowEnd>'.$this->__makeDateTime($ts_finish).'</windowEnd>'; $recurence_data .= '</rule>'; $recurence_data .= '</recurrence>'; $obRow->setAttribute('ows_RecurrenceData', $recurence_data); //$obRow->setAttribute('ows_Duration', $event['DT_LENGTH'] + ($bAllDay ? 86340 : 0)); //$obRow->setAttribute('ows_Duration', $event['DT_LENGTH'] - ($bAllDay ? 20 : 0)); $obRow->setAttribute('ows_Duration', $duration); } else { //$obRow->setAttribute('ows_Duration', ($duration ? $duration : 86400) - 60); $obRow->setAttribute('ows_Duration', $duration); } $obRow->setAttribute('ows_UniqueId', $event['ID'].';#'.$listName); $obRow->setAttribute('ows_FSObjType', $event['ID'].';#0'); $obRow->setAttribute('ows_Editor', $event['CREATED_BY'].';#'.CCalendar::GetUserName($event['CREATED_BY'])); $obRow->setAttribute('ows_PermMask', '0x7fffffffffffffff'); $obRow->setAttribute('ows_ContentTypeId', '0x01020005CE290982A58C439E00342702139D1A'); return $obRow; }
?> " data-bx-hint="<?php echo $timezoneHint; ?> " class="bx-cal-view-timezon-icon feed-event-view-timezon-icon"></span> <?php } ?> </td> </tr> <?php if (isset($event['RRULE']) && $event['RRULE'] !== '') { ?> <?php $RRULE = CCalendarEvent::ParseRRULE($event['RRULE']); switch ($RRULE['FREQ']) { case 'DAILY': if ($RRULE['INTERVAL'] == 1) { $repeatHTML = GetMessage('EC_RRULE_EVERY_DAY'); } else { $repeatHTML = GetMessage('EC_RRULE_EVERY_DAY_1', array('#DAY#' => $RRULE['INTERVAL'])); } break; case 'WEEKLY': $daysList = array(); foreach ($RRULE['BYDAY'] as $day) { $daysList[] = GetMessage('EC_' . $day); } $daysList = implode(', ', $daysList); if ($RRULE['INTERVAL'] == 1) {
public static function GetDavCalendarEventsList($calendarId, $arFilter = array()) { global $USER; list($sectionId, $entityType, $entityId) = $calendarId; CCalendar::SetOffset(false, 0); $arFilter1 = array('OWNER_ID' => $entityId, 'DELETED' => 'N'); if (isset($arFilter['DATE_START'])) { $arFilter['FROM_LIMIT'] = $arFilter['DATE_START']; unset($arFilter['DATE_START']); } if (isset($arFilter['DATE_END'])) { $arFilter['TO_LIMIT'] = $arFilter['DATE_END']; unset($arFilter['DATE_END']); } $fetchMeetings = true; if ($sectionId > 0) { $arFilter['SECTION'] = $sectionId; $fetchMeetings = false; if ($entityType == 'user') { $fetchMeetings = self::GetMeetingSection($entityId) == $sectionId; } } $arFilter = array_merge($arFilter1, $arFilter); $arEvents = CCalendarEvent::GetList(array('arFilter' => $arFilter, 'getUserfields' => false, 'parseRecursion' => false, 'fetchAttendees' => false, 'fetchMeetings' => $fetchMeetings, 'userId' => CCalendar::GetCurUserId())); $result = array(); foreach ($arEvents as $event) { if ($event['IS_MEETING'] && is_array($event['USER_MEETING']) && $event['USER_MEETING']['STATUS'] == 'N') { continue; } // Skip events from where owner is host of the meeting and it's meeting from other section if ($entityType == 'user' && $event['IS_MEETING'] && $event['MEETING_HOST'] == $entityId && $event['SECT_ID'] != $sectionId) { continue; } $event['XML_ID'] = $event['DAV_XML_ID']; if ($event['LOCATION'] !== '') { $event['LOCATION'] = CCalendar::GetTextLocation($event['LOCATION']); } $event['RRULE'] = CCalendarEvent::ParseRRULE($event['RRULE']); $result[] = $event; } return $result; }
protected static function SaveCalendarEvent(&$arFields) { $responsibleID = isset($arFields['RESPONSIBLE_ID']) ? intval($arFields['RESPONSIBLE_ID']) : 0; $typeID = isset($arFields['TYPE_ID']) ? intval($arFields['TYPE_ID']) : CCrmActivityType::Undefined; if (!($responsibleID > 0 && ($typeID === CCrmActivityType::Call || $typeID === CCrmActivityType::Meeting))) { return false; } if (!(IsModuleInstalled('calendar') && CModule::IncludeModule('calendar'))) { return false; } $arCalEventFields = array('CAL_TYPE' => 'user', 'OWNER_ID' => $responsibleID, 'NAME' => isset($arFields['SUBJECT']) ? $arFields['SUBJECT'] : '', 'DT_FROM' => isset($arFields['START_TIME']) ? $arFields['START_TIME'] : '', 'DT_TO' => isset($arFields['END_TIME']) ? $arFields['END_TIME'] : '', 'IMPORTANCE' => CCrmActivityPriority::ToCalendarEventImportance(isset($arFields['PRIORITY']) ? intval($arFields['PRIORITY']) : CCrmActivityPriority::Low), 'DESCRIPTION' => isset($arFields['DESCRIPTION']) ? $arFields['DESCRIPTION'] : ''); $associatedEntityID = isset($arFields['ASSOCIATED_ENTITY_ID']) ? intval($arFields['ASSOCIATED_ENTITY_ID']) : 0; if ($associatedEntityID > 0) { $arCalEventFields['ID'] = $associatedEntityID; $arPresentEventFields = CCalendarEvent::GetById($associatedEntityID, false); if (is_array($arPresentEventFields)) { if (isset($arPresentEventFields['RRULE']) && $arPresentEventFields['RRULE'] != '') { $arCalEventFields['RRULE'] = CCalendarEvent::ParseRRULE($arPresentEventFields['RRULE']); } if (isset($arPresentEventFields['DT_LENGTH'])) { $arCalEventFields['DT_LENGTH'] = $arPresentEventFields['DT_LENGTH']; } } } if (isset($arFields['NOTIFY_TYPE']) && $arFields['NOTIFY_TYPE'] != CCrmActivityNotifyType::None) { $arCalEventFields['REMIND'] = array(array('type' => CCrmActivityNotifyType::ToCalendarEventRemind($arFields['NOTIFY_TYPE']), 'count' => isset($arFields['NOTIFY_VALUE']) ? intval($arFields['NOTIFY_VALUE']) : 15)); } self::$IGNORE_CALENDAR_EVENTS = true; // We must initialize CCalendar! $calendar = new CCalendar(); $calendar->Init(array('type' => 'user', 'userId' => $responsibleID, 'ownerId' => $responsibleID)); $result = $calendar->SaveEvent(array('arFields' => $arCalEventFields, 'userId' => $responsibleID, 'autoDetectSection' => true, 'autoCreateSection' => true)); $eventID = intval($result); $ownerID = intval($arFields['OWNER_ID']); $ownerTypeID = intval($arFields['OWNER_TYPE_ID']); $arBindings = isset($arFields['BINDINGS']) ? $arFields['BINDINGS'] : array(); if (empty($arBindings) && $ownerID > 0 && $ownerTypeID > 0) { $arBindings[] = array('OWNER_TYPE_ID' => $ownerTypeID, 'OWNER_ID' => $ownerID); } if ($eventID > 0 && !empty($arBindings)) { $arUserFields = array(); foreach ($arBindings as &$arBinding) { $arUserFields[] = CUserTypeCrm::GetShortEntityType(CCrmOwnerType::ResolveName($arBinding['OWNER_TYPE_ID'])) . '_' . $arBinding['OWNER_ID']; } unset($arBinding); CCalendarEvent::UpdateUserFields($eventID, array('UF_CRM_CAL_EVENT' => $arUserFields)); } self::$IGNORE_CALENDAR_EVENTS = false; return $result; }
private static function FormatICal($Section, $Events) { $res = 'BEGIN:VCALENDAR PRODID:-//Bitrix//Bitrix Calendar//EN VERSION:2.0 CALSCALE:GREGORIAN METHOD:PUBLISH X-WR-CALNAME:' . self::_ICalPaste($Section['NAME']) . ' X-WR-CALDESC:' . self::_ICalPaste($Section['DESCRIPTION']) . "\n"; $localTime = new DateTime(); $localOffset = $localTime->getOffset(); $h24 = CCalendar::GetDayLen(); foreach ($Events as $event) { //$fts = CCalendar::Timestamp($event['DT_FROM']); //$tts = CCalendar::Timestamp($event['DT_TO']); $fts = $event['DT_FROM_TS']; $tts = $event['DT_TO_TS']; if ($event['DT_SKIP_TIME'] == 'Y') { $dtStart = date("Ymd", $event['DT_FROM_TS']); if ($event['DT_LENGTH'] == $h24) { $dtEnd = $dtStart; } else { $dtEnd = date("Ymd", $event['DT_TO_TS'] - $h24); } } else { $dtStart = date("Ymd\\THis\\Z", $event['DT_FROM_TS'] - $localOffset); $dtEnd = date("Ymd\\THis\\Z", $event['DT_TO_TS'] - $localOffset); } $dtStamp = str_replace('T000000Z', '', date("Ymd\\THisZ", CCalendar::Timestamp($event['TIMESTAMP_X']) - $localOffset)); $uid = md5(uniqid(rand(), true) . $event['ID']) . '@bitrix'; $period = ''; $rrule = CCalendarEvent::ParseRRULE($event['RRULE']); if ($rrule && isset($rrule['FREQ']) && $rrule['FREQ'] != 'NONE') { $period = 'RRULE:FREQ=' . $rrule['FREQ'] . ';'; $period .= 'INTERVAL=' . $rrule['INTERVAL'] . ';'; if ($rrule['FREQ'] == 'WEEKLY') { $period .= 'BYDAY=' . implode(',', $rrule['BYDAY']) . ';'; } if ($event['DT_SKIP_TIME'] == 'Y') { if ($event['DT_LENGTH'] == $h24) { $dtEnd_ = $dtStart; } else { $dtEnd_ = date("Ymd", $event['DT_FROM_TS'] + $event['DT_LENGTH'] - $h24 - $localOffset); } } else { $dtEnd_ = date("Ymd\\THisZ", $event['DT_FROM_TS'] + $event['DT_LENGTH'] - $localOffset); } if (date("Ymd", $tts) != '20380101') { $period .= 'UNTIL=' . $dtEnd . ';'; } $period .= 'WKST=MO'; $dtEnd = $dtEnd_; $period .= "\n"; } $res .= 'BEGIN:VEVENT DTSTART;VALUE=DATE:' . $dtStart . ' DTEND;VALUE=DATE:' . $dtEnd . ' DTSTAMP:' . $dtStamp . ' UID:' . $uid . ' SUMMARY:' . self::_ICalPaste($event['NAME']) . ' DESCRIPTION:' . self::_ICalPaste($event['DESCRIPTION']) . "\n" . $period . ' CLASS:PRIVATE LOCATION:' . self::_ICalPaste(CCalendar::GetTextLocation($event['LOCATION'])) . ' SEQUENCE:0 STATUS:CONFIRMED TRANSP:TRANSPARENT END:VEVENT' . "\n"; } $res .= 'END:VCALENDAR'; if (!defined('BX_UTF') || BX_UTF !== true) { $res = $GLOBALS["APPLICATION"]->ConvertCharset($res, LANG_CHARSET, 'UTF-8'); } return $res; }
private static function FormatICal($section, $events) { global $APPLICATION; $res = 'BEGIN:VCALENDAR' . "\n" . 'PRODID:-//Bitrix//Bitrix Calendar//EN' . "\n" . 'VERSION:2.0' . "\n" . 'CALSCALE:GREGORIAN' . "\n" . 'METHOD:PUBLISH' . "\n" . 'X-WR-CALNAME:' . self::_ICalPaste($section['NAME']) . "\n" . 'X-WR-CALDESC:' . self::_ICalPaste($section['DESCRIPTION']) . "\n"; $localTime = new DateTime(); $localOffset = $localTime->getOffset(); foreach ($events as $event) { $fromTs = CCalendar::Timestamp($event['DATE_FROM']); $toTs = CCalendar::Timestamp($event['DATE_TO']); if ($event['DT_SKIP_TIME'] === "Y") { $dtStart = date("Ymd", $fromTs); $dtEnd = date("Ymd", $toTs + CCalendar::GetDayLen()); } else { $fromTsUTC = $fromTs - $event['TZ_OFFSET_FROM']; $toTsUTC = $toTs - $event['TZ_OFFSET_TO']; $dtStart = date("Ymd\\THis\\Z", $fromTsUTC); $dtEnd = date("Ymd\\THis\\Z", $toTsUTC); } $dtStamp = str_replace('T000000Z', '', date("Ymd\\THisZ", CCalendar::Timestamp($event['TIMESTAMP_X']) - $localOffset)); $uid = md5(uniqid(rand(), true) . $event['ID']) . '@bitrix'; $period = ''; $rrule = CCalendarEvent::ParseRRULE($event['RRULE']); if ($rrule && isset($rrule['FREQ']) && $rrule['FREQ'] != 'NONE') { $period = 'RRULE:FREQ=' . $rrule['FREQ'] . ';'; $period .= 'INTERVAL=' . $rrule['INTERVAL'] . ';'; if ($rrule['FREQ'] == 'WEEKLY') { $period .= 'BYDAY=' . implode(',', $rrule['BYDAY']) . ';'; } $until = date("Ymd", $event['DATE_TO_TS_UTC']); if ($until != '20380101') { $period .= 'UNTIL=' . $until . ';'; } $period .= 'WKST=MO'; $period .= "\n"; } $res .= 'BEGIN:VEVENT' . "\n"; if ($event['DT_SKIP_TIME'] === "Y") { $res .= 'DTSTART;VALUE=DATE:' . $dtStart . "\n" . 'DTEND;VALUE=DATE:' . $dtEnd . "\n"; } else { $res .= 'DTSTART;VALUE=DATE-TIME:' . $dtStart . "\n" . 'DTEND;VALUE=DATE-TIME:' . $dtEnd . "\n"; } $res .= 'DTSTAMP:' . $dtStamp . "\n" . 'UID:' . $uid . "\n" . 'SUMMARY:' . self::_ICalPaste($event['NAME']) . "\n" . 'DESCRIPTION:' . self::_ICalPaste($event['DESCRIPTION']) . "\n" . $period . "\n" . 'CLASS:PRIVATE' . "\n" . 'LOCATION:' . self::_ICalPaste(CCalendar::GetTextLocation($event['LOCATION'])) . "\n" . 'SEQUENCE:0' . "\n" . 'STATUS:CONFIRMED' . "\n" . 'TRANSP:TRANSPARENT' . "\n" . 'END:VEVENT' . "\n"; } $res .= 'END:VCALENDAR'; if (!defined('BX_UTF') || BX_UTF !== true) { $res = $APPLICATION->ConvertCharset($res, LANG_CHARSET, 'UTF-8'); } return $res; }
if ($arResult['NEW']) { } else { $Event = CCalendarEvent::GetList(array('arFilter' => array("ID" => $eventId, "OWNER_ID" => $userId, "DELETED" => "N"), 'parseRecursion' => false, 'fetchAttendees' => true, 'fetchMeetings' => true, 'checkPermissions' => true, 'setDefaultLimit' => false)); if ($Event && is_array($Event[0])) { $Event = $Event[0]; if ($Event['IS_MEETING']) { foreach ($Event['~ATTENDEES'] as $attendee) { $attendee['DISPLAY_NAME'] = CCalendar::GetUserName($attendee); $arAttendees[] = $attendee; } unset($Event['~ATTENDEES']); $arResult['ATTENDEES'] = $arAttendees; } $Event['~LOCATION'] = $Event['LOCATION'] !== '' ? CCalendar::GetTextLocation($Event["LOCATION"]) : ''; if ($Event['RRULE'] !== '') { $Event['RRULE'] = CCalendarEvent::ParseRRULE($Event['RRULE']); if (is_array($Event['RRULE']) && !isset($Event['RRULE']['UNTIL'])) { $Event['RRULE']['UNTIL'] = $Event['DT_TO_TS']; } $Event['DT_TO_TS'] = $Event['DT_FROM_TS'] + intval($Event['DT_LENGTH']); } $arResult['EVENT'] = $Event; $calType = $Event['CAL_TYPE']; $ownerId = $Event['OWNER_ID']; } else { $Event = array(); // Event is not found $arResult['DELETED'] = "Y"; $arResult['EVENT_ID'] = $eventId; } }
<tr> <td class="feed-calendar-view-text-cell-l"><?php echo GetMessage('ECLFV_EVENT_START'); ?> :</td> <td class="feed-calendar-view-text-cell-r" id="feed-event-view-from-<?php echo $id; ?> "></td> </tr> <?php if (isset($arResult['EVENT']['RRULE']) && $arResult['EVENT']['RRULE'] !== '') { ?> <?php $RRULE = CCalendarEvent::ParseRRULE($arResult['EVENT']['RRULE']); switch ($RRULE['FREQ']) { case 'DAILY': if ($RRULE['INTERVAL'] == 1) { $repeatHTML = GetMessage('EC_RRULE_EVERY_DAY'); } else { $repeatHTML = GetMessage('EC_RRULE_EVERY_DAY_1', array('#DAY#' => $RRULE['INTERVAL'])); } break; case 'WEEKLY': $daysList = array(); foreach ($RRULE['BYDAY'] as $day) { $daysList[] = GetMessage('EC_' . $day); } $daysList = implode(', ', $daysList); if ($RRULE['INTERVAL'] == 1) {
public static function DialogViewEvent($Params) { global $APPLICATION, $USER_FIELD_MANAGER; $id = $Params['id']; $event = $Params['event']; $event['~DT_FROM_TS'] = $event['DT_FROM_TS']; $event['~DT_TO_TS'] = $event['DT_TO_TS']; $event['DT_FROM_TS'] = $Params['fromTs']; $event['DT_TO_TS'] = $Params['fromTs'] + $event['DT_LENGTH']; $UF = $USER_FIELD_MANAGER->GetUserFields("CALENDAR_EVENT", $event['ID'], LANGUAGE_ID); $event['UF_CRM_CAL_EVENT'] = $UF['UF_CRM_CAL_EVENT']; if (empty($event['UF_CRM_CAL_EVENT']['VALUE'])) { $event['UF_CRM_CAL_EVENT'] = false; } $event['UF_WEBDAV_CAL_EVENT'] = $UF['UF_WEBDAV_CAL_EVENT']; if (empty($event['UF_WEBDAV_CAL_EVENT']['VALUE'])) { $event['UF_WEBDAV_CAL_EVENT'] = false; } $event['FROM_WEEK_DAY'] = FormatDate('D', $event['DT_FROM_TS']); $event['FROM_MONTH_DAY'] = FormatDate('j', $event['DT_FROM_TS']); $event['FROM_MONTH'] = FormatDate('n', $event['DT_FROM_TS']); $arHost = CCalendar::GetUser($event['MEETING_HOST'], true); $arHost['AVATAR_SRC'] = CCalendar::GetUserAvatarSrc($arHost); $arHost['URL'] = CCalendar::GetUserUrl($event['MEETING_HOST'], $Params["PATH_TO_USER"]); $arHost['DISPLAY_NAME'] = CCalendar::GetUserName($arHost); $curUserStatus = ''; $userId = CCalendar::GetCurUserId(); $viewComments = CCalendar::IsPersonal($event['CAL_TYPE'], $event['OWNER_ID'], $userId) || CCalendarSect::CanDo('calendar_view_full', $event['SECT_ID'], $userId); if ($event['IS_MEETING'] && empty($event['ATTENDEES_CODES'])) { $event['ATTENDEES_CODES'] = CCalendarEvent::CheckEndUpdateAttendeesCodes($event); } if ($event['IS_MEETING']) { $attendees = array('y' => array('users' => array(), 'count' => 4, 'countMax' => 8, 'title' => GetMessage('EC_ATT_Y'), 'id' => "bxview-att-cont-y-" . $event['ID']), 'n' => array('users' => array(), 'count' => 2, 'countMax' => 3, 'title' => GetMessage('EC_ATT_N'), 'id' => "bxview-att-cont-n-" . $event['ID']), 'q' => array('users' => array(), 'count' => 2, 'countMax' => 3, 'title' => GetMessage('EC_ATT_Q'), 'id' => "bxview-att-cont-q-" . $event['ID'])); if (is_array($event['~ATTENDEES'])) { foreach ($event['~ATTENDEES'] as $att) { if ($userId == $att["USER_ID"]) { $curUserStatus = $att['STATUS']; $viewComments = true; } $att['AVATAR_SRC'] = CCalendar::GetUserAvatarSrc($att); $att['URL'] = CCalendar::GetUserUrl($att["USER_ID"], $Params["PATH_TO_USER"]); $attendees[strtolower($att['STATUS'])]['users'][] = $att; } } } $arTabs = array(array('name' => GetMessage('EC_BASIC'), 'title' => GetMessage('EC_BASIC_TITLE'), 'id' => $id . "view-tab-0", 'active' => true), array('name' => GetMessage('EC_EDEV_ADD_TAB'), 'title' => GetMessage('EC_EDEV_ADD_TAB_TITLE'), 'id' => $id . "view-tab-1")); ?> <div id="bxec_view_ed_<?php echo $id; ?> " class="bxec-popup"> <div style="width: 700px; height: 1px;"></div> <div class="bxec-d-tabs" id="<?php echo $id; ?> _viewev_tabs"> <?php foreach ($arTabs as $tab) { ?> <div class="bxec-d-tab <?php if ($tab['active']) { echo 'bxec-d-tab-act'; } ?> " title="<?php echo isset($tab['title']) ? $tab['title'] : $tab['name']; ?> " id="<?php echo $tab['id']; ?> " <?php if ($tab['show'] === false) { echo 'style="display:none;"'; } ?> > <b></b><div><span><?php echo $tab['name']; ?> </span></div><i></i> </div> <?php } ?> </div> <div class="bxec-d-cont"> <?php /* ####### TAB 0 : BASIC ####### */ ?> <div id="<?php echo $id; ?> view-tab-0-cont" class="bxec-d-cont-div" style="display: block;"> <div class="bx-cal-view-icon"> <div class="bx-cal-view-icon-day"><?php echo $event['FROM_WEEK_DAY']; ?> </div> <div class="bx-cal-view-icon-date"><?php echo $event['FROM_MONTH_DAY']; ?> </div> </div> <div class="bx-cal-view-text"> <table> <tr> <td class="bx-cal-view-text-cell-l"><?php echo GetMessage('EC_T_NAME'); ?> :</td> <td class="bx-cal-view-text-cell-r"><span class="bx-cal-view-name"><?php echo htmlspecialcharsEx($event['NAME']); ?> </span></td> </tr> <tr> <td class="bx-cal-view-text-cell-l"><?php echo GetMessage('EC_DATE'); ?> :</td> <td class="bx-cal-view-text-cell-r bx-cal-view-from-to"> <?php echo CCalendar::GetFromToHtml($event['DT_FROM_TS'], $event['DT_TO_TS'], $event['DT_SKIP_TIME'] == 'Y', $event['DT_LENGTH']); ?> </td> </tr> <?php if ($event['RRULE']) { ?> <?php $event['RRULE'] = CCalendarEvent::ParseRRULE($event['RRULE']); switch ($event['RRULE']['FREQ']) { case 'DAILY': if ($event['RRULE']['INTERVAL'] == 1) { $repeatHTML = GetMessage('EC_RRULE_EVERY_DAY'); } else { $repeatHTML = GetMessage('EC_RRULE_EVERY_DAY_1', array('#DAY#' => $event['RRULE']['INTERVAL'])); } break; case 'WEEKLY': $daysList = array(); foreach ($event['RRULE']['BYDAY'] as $day) { $daysList[] = GetMessage('EC_' . $day); } $daysList = implode(', ', $daysList); if ($event['RRULE']['INTERVAL'] == 1) { $repeatHTML = GetMessage('EC_RRULE_EVERY_WEEK', array('#DAYS_LIST#' => $daysList)); } else { $repeatHTML = GetMessage('EC_RRULE_EVERY_WEEK_1', array('#WEEK#' => $event['RRULE']['INTERVAL'], '#DAYS_LIST#' => $daysList)); } break; case 'MONTHLY': if ($event['RRULE']['INTERVAL'] == 1) { $repeatHTML = GetMessage('EC_RRULE_EVERY_MONTH'); } else { $repeatHTML = GetMessage('EC_RRULE_EVERY_MONTH_1', array('#MONTH#' => $event['RRULE']['INTERVAL'])); } break; case 'YEARLY': if ($event['RRULE']['INTERVAL'] == 1) { $repeatHTML = GetMessage('EC_RRULE_EVERY_YEAR', array('#DAY#' => $event['FROM_MONTH_DAY'], '#MONTH#' => $event['FROM_MONTH'])); } else { $repeatHTML = GetMessage('EC_RRULE_EVERY_YEAR_1', array('#YEAR#' => $event['RRULE']['INTERVAL'], '#DAY#' => $event['FROM_MONTH_DAY'], '#MONTH#' => $event['FROM_MONTH'])); } break; } $repeatHTML .= '<br>' . GetMessage('EC_RRULE_FROM', array('#FROM_DATE#' => FormatDate(CCalendar::DFormat(false), $event['~DT_FROM_TS']))); if (date('dmY', $event['RRULE']['UNTIL']) != '01012038') { $repeatHTML .= ' ' . GetMessage('EC_RRULE_UNTIL', array('#UNTIL_DATE#' => FormatDate(CCalendar::DFormat(false), $event['RRULE']['UNTIL']))); } ?> <tr> <td class="bx-cal-view-text-cell-l"><?php echo GetMessage('EC_T_REPEAT'); ?> :</td> <td class="bx-cal-view-text-cell-r"><?php echo $repeatHTML; ?> </td> </tr> <?php } ?> <?php if (!empty($event['LOCATION'])) { ?> <tr> <td class="bx-cal-view-text-cell-l"><?php echo GetMessage('EC_LOCATION'); ?> :</td> <td class="bx-cal-view-text-cell-r"><span class="bx-cal-location"><?php echo htmlspecialcharsEx(CCalendar::GetTextLocation($event['LOCATION'])); ?> </span></td> </tr> <?php } ?> </table> </div> <?php if (!empty($event['~DESCRIPTION'])) { ?> <div class="bx-cal-view-description"> <div class="feed-cal-view-desc-title"><?php echo GetMessage('EC_T_DESC'); ?> :</div> <div class="bx-cal-view-desc-cont"><?php echo $event['~DESCRIPTION']; ?> </div> </div> <?php } ?> <?php if ($event['UF_WEBDAV_CAL_EVENT']) { ?> <div class="bx-cal-view-files" id="bx-cal-view-files-<?php echo $id; echo $event['ID']; ?> "> <?php $APPLICATION->IncludeComponent("bitrix:system.field.view", $event['UF_WEBDAV_CAL_EVENT']["USER_TYPE"]["USER_TYPE_ID"], array("arUserField" => $event['UF_WEBDAV_CAL_EVENT']), null, array("HIDE_ICONS" => "Y")); ?> </div> <?php } ?> <?php if ($event['UF_CRM_CAL_EVENT']) { ?> <div class="bx-cal-view-crm"> <div class="bxec-crm-title"><?php echo htmlspecialcharsbx($event['UF_CRM_CAL_EVENT']["EDIT_FORM_LABEL"]); ?> :</div> <?php $APPLICATION->IncludeComponent("bitrix:system.field.view", $event['UF_CRM_CAL_EVENT']["USER_TYPE"]["USER_TYPE_ID"], array("arUserField" => $event['UF_CRM_CAL_EVENT']), null, array("HIDE_ICONS" => "Y")); ?> </div> <?php } ?> <div id="<?php echo $id; ?> bxec_view_uf_group" class="bxec-popup-row" style="display: none;"> <div class="bxec-popup-row-title"><?php echo GetMessage('EC_EDEV_ADD_TAB'); ?> </div> <div id="<?php echo $id; ?> bxec_view_uf_cont"></div> </div> <?php if ($Params['bSocNet'] && $event['IS_MEETING']) { ?> <div class="bx-cal-view-meeting-cnt"> <table> <tr> <td class="bx-cal-view-att-cell-l bx-cal-bot-border"><span><?php echo GetMessage('EC_EDEV_HOST'); ?> :</span></td> <td class="bx-cal-view-att-cell-r bx-cal-bot-border"> <a title="<?php echo htmlspecialcharsbx($arHost['DISPLAY_NAME']); ?> " href="<?php echo $arHost['URL']; ?> " target="_blank" class="bxcal-att-popup-img bxcal-att-popup-att-full"><span class="bxcal-att-popup-avatar-outer"><span class="bxcal-att-popup-avatar"><img src="<?php echo $arHost['AVATAR_SRC']; ?> " width="<?php echo $Params['AVATAR_SIZE']; ?> " height="<?php echo $Params['AVATAR_SIZE']; ?> " /></span></span><span class="bxcal-att-name"><?php echo htmlspecialcharsbx($arHost['DISPLAY_NAME']); ?> </span></a> </td> </tr> <tr> <td class="bx-cal-view-att-cell-l"></td> <td class="bx-cal-view-att-cell-r" style="padding-top: 5px;"> <div class="bx-cal-view-title"><?php echo GetMessage('EC_EDEV_GUESTS'); ?> </div> <div class="bx-cal-att-dest-cont"> <?php $arDest = CCalendar::GetFormatedDestination($event['ATTENDEES_CODES']); $cnt = count($arDest); for ($i = 0; $i < $cnt; $i++) { $dest = $arDest[$i]; ?> <span class="bx-cal-att-dest-block"><?php echo $dest['TITLE']; ?> </span><?php if ($i < count($arDest) - 1) { echo ', '; } } ?> </div> </td> </tr> <?php foreach ($attendees as $arAtt) { if (empty($arAtt['users'])) { continue; } ?> <tr> <td class="bx-cal-view-att-cell-l"><?php echo $arAtt['title']; ?> :</td> <td class="bx-cal-view-att-cell-r"> <div class="bx-cal-view-att-cont" id="<?php echo $arAtt['id']; ?> "> <?php $cnt = 0; $bShowAll = count($arAtt['users']) <= $arAtt['countMax']; foreach ($arAtt['users'] as $att) { $cnt++; if (!$bShowAll && $cnt > $arAtt['count']) { ?> <a title="<?php echo htmlspecialcharsbx($att['DISPLAY_NAME']); ?> " href="<?php echo $att['URL']; ?> " target="_blank" class="bxcal-att-popup-img bxcal-att-popup-img-hidden"><span class="bxcal-att-popup-avatar-outer"><span class="bxcal-att-popup-avatar"><img src="<?php echo $att['AVATAR_SRC']; ?> " width="<?php echo $Params['AVATAR_SIZE']; ?> " height="<?php echo $Params['AVATAR_SIZE']; ?> " /></span></span><span class="bxcal-att-name"><?php echo htmlspecialcharsbx($att['DISPLAY_NAME']); ?> </span></a> <?php } else { ?> <a title="<?php echo htmlspecialcharsbx($att['DISPLAY_NAME']); ?> " href="<?php echo $att['URL']; ?> " target="_blank" class="bxcal-att-popup-img"><span class="bxcal-att-popup-avatar-outer"><span class="bxcal-att-popup-avatar"><img src="<?php echo $att['AVATAR_SRC']; ?> " width="<?php echo $Params['AVATAR_SIZE']; ?> " height="<?php echo $Params['AVATAR_SIZE']; ?> " /></span></span><span class="bxcal-att-name"><?php echo htmlspecialcharsbx($att['DISPLAY_NAME']); ?> </span></a> <?php } } if (!$bShowAll) { ?> <span data-bx-more-users="<?php echo $arAtt['id']; ?> " class="bxcal-more-attendees"><?php echo CCalendar::GetMoreAttendeesMessage(count($arAtt['users']) - $arAtt['count']); ?> </span> <?php } ?> </div> </td> </tr> <?php } /*foreach($attendees as $arAtt)*/ ?> <?php if (!empty($event['MEETING']['TEXT'])) { ?> <tr> <td class="bx-cal-view-att-cell-l" style="padding-top: 3px;"><?php echo GetMessage('EC_MEETING_TEXT2'); ?> :</td> <td class="bx-cal-view-att-cell-r"><pre><?php echo htmlspecialcharsEx($event['MEETING']['TEXT']); ?> </pre></td> </tr> <?php } /*if (!empty($event['MEETING']['TEXT']))*/ ?> </table> <div class="bxc-confirm-row"> <?php if ($curUserStatus == 'Q') { /* User still haven't take a decision*/ ?> <div id="<?php echo $id; ?> status-conf-cnt2" class="bxc-conf-cnt"> <span data-bx-set-status="Y" class="popup-window-button popup-window-button-accept" title="<?php echo GetMessage('EC_EDEV_CONF_Y_TITLE'); ?> "><span class="popup-window-button-left"></span><span class="popup-window-button-text"><?php echo GetMessage('EC_ACCEPT_MEETING'); ?> </span><span class="popup-window-button-right"></span></span> <a data-bx-set-status="N" class="bxc-decline-link" href="javascript:void(0)" title="<?php echo GetMessage('EC_EDEV_CONF_N_TITLE'); ?> " id="<?php echo $id; ?> decline-link-2"><?php echo GetMessage('EC_EDEV_CONF_N'); ?> </a> </div> <?php } elseif ($curUserStatus == 'Y') { /* User accepts inviting */ ?> <div id="<?php echo $id; ?> status-conf-cnt1" class="bxc-conf-cnt"> <span><?php echo GetMessage('EC_ACCEPTED_STATUS'); ?> </span> <a data-bx-set-status="N" class="bxc-decline-link" href="javascript:void(0)" title="<?php echo GetMessage('EC_EDEV_CONF_N_TITLE'); ?> "><?php echo GetMessage('EC_EDEV_CONF_N'); ?> </a> </div> <?php } elseif ($curUserStatus == 'N') { /* User declines inviting*/ ?> <div class="bxc-conf-cnt"> <span class="bxc-conf-label"><?php echo GetMessage('EC_DECLINE_INFO'); ?> </span>. <a data-bx-set-status="Y" href="javascript:void(0)" title="<?php echo GetMessage('EC_ACCEPT_MEETING_2'); ?> "><?php echo GetMessage('EC_ACCEPT_MEETING'); ?> </a> </div> <?php } elseif ($event['MEETING']['OPEN']) { /* it's open meeting*/ ?> <div class="bxc-conf-cnt"> <span class="bxc-conf-label" title="<?php echo GetMessage('EC_OPEN_MEETING_TITLE'); ?> "><?php echo GetMessage('EC_OPEN_MEETING'); ?> :</span> <span data-bx-set-status="Y" class="popup-window-button popup-window-button-accept" title="<?php echo GetMessage('EC_EDEV_CONF_Y_TITLE'); ?> "><span class="popup-window-button-left"></span><span class="popup-window-button-text"><?php echo GetMessage('EC_ACCEPT_MEETING'); ?> </span><span class="popup-window-button-right"></span></span> </div> <?php } ?> </div> </div> <?php } /*$event['IS_MEETING'])*/ ?> </div> <?php /* ####### END TAB 0 ####### */ ?> <?php /* ####### TAB 1 : ADDITIONAL ####### */ ?> <div id="<?php echo $id; ?> view-tab-1-cont" class="bxec-d-cont-div"> <div class="bx-cal-view-text-additional"> <table> <?php if ($Params['sectionName'] != '') { ?> <tr> <td class="bx-cal-view-text-cell-l"><?php echo GetMessage('EC_T_CALENDAR'); ?> :</td> <td class="bx-cal-view-text-cell-r"><?php echo htmlspecialcharsEx($Params['sectionName']); ?> </td> </tr> <?php } ?> <?php if ($event['IMPORTANCE'] != '') { ?> <tr> <td class="bx-cal-view-text-cell-l"><?php echo GetMessage('EC_IMPORTANCE_TITLE'); ?> :</td> <td class="bx-cal-view-text-cell-r"><?php echo GetMessage("EC_IMPORTANCE_" . strtoupper($event['IMPORTANCE'])); ?> </td> </tr> <?php } ?> <?php if ($event['ACCESSIBILITY'] != '' && $Params['bIntranet']) { ?> <tr> <td class="bx-cal-view-text-cell-l"><?php echo GetMessage('EC_ACCESSIBILITY_TITLE'); ?> :</td> <td class="bx-cal-view-text-cell-r"><?php echo GetMessage("EC_ACCESSIBILITY_" . strtoupper($event['ACCESSIBILITY'])); ?> </td> </tr> <?php } ?> <?php if ($event['PRIVATE_EVENT'] && $Params['bIntranet']) { ?> <tr> <td class="bx-cal-view-text-cell-l"><?php echo GetMessage('EC_EDDIV_SPECIAL_NOTES'); ?> :</td> <td class="bx-cal-view-text-cell-r"><?php echo GetMessage('EC_PRIVATE_EVENT'); ?> </td> </tr> <?php } ?> </table> </div> </div> <?php /* ####### END TAB 1 ####### */ ?> </div> <?php if ($viewComments) { ?> <div class="bxec-d-cont-comments-title"> <?php echo GetMessage('EC_COMMENTS'); ?> </div> <div class="bxec-d-cont bxec-d-cont-comments"> <?php if ($userId == $event['OWNER_ID']) { $permission = "Y"; } else { $permission = 'M'; } $set = CCalendar::GetSettings(); // A < E < I < M < Q < U < Y // A - NO ACCESS, E - READ, I - ANSWER // M - NEW TOPIC // Q - MODERATE, U - EDIT, Y - FULL_ACCESS $APPLICATION->IncludeComponent("bitrix:forum.comments", "bitrix24", array("FORUM_ID" => $set['forum_id'], "ENTITY_TYPE" => "EV", "ENTITY_ID" => $event['ID'], "ENTITY_XML_ID" => "EVENT_" . $event['ID'], "PERMISSION" => $permission, "URL_TEMPLATES_PROFILE_VIEW" => $set['path_to_user'], "SHOW_RATING" => "Y", "SHOW_LINK_TO_MESSAGE" => "N", "BIND_VIEWER" => "Y"), false, array('HIDE_ICONS' => 'Y')); ?> </div> <?php } ?> </div> <?php }