public static function GetAttendees($arEventIds = array()) { global $DB; $arAttendees = array(); if (!is_array($arEventIds)) { $arEventIds = array($arEventIds); } $strMeetIds = ""; foreach ($arEventIds as $id) { if (intVal($id) > 0) { $strMeetIds .= ',' . intVal($id); } } $strMeetIds = trim($strMeetIds, ', '); if ($strMeetIds != '') { $strSql = "\n\t\t\tSELECT\n\t\t\t\tCA.*,\n\t\t\t\tU.LOGIN, U.NAME, U.LAST_NAME, U.SECOND_NAME, U.EMAIL, U.PERSONAL_PHOTO, U.WORK_POSITION,\n\t\t\t\tBUF.UF_DEPARTMENT\n\t\t\tFROM\n\t\t\t\tb_calendar_attendees CA\n\t\t\t\tLEFT JOIN b_user U ON (U.ID=CA.USER_ID)\n\t\t\t\tLEFT JOIN b_uts_user BUF ON (BUF.VALUE_ID = CA.USER_ID)\n\t\t\tWHERE\n\t\t\t\tU.ACTIVE = 'Y' AND\n\t\t\t\tCA.EVENT_ID in (" . $strMeetIds . ")"; $res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__); while ($attendee = $res->Fetch()) { if (!isset($arAttendees[$attendee['EVENT_ID']])) { $arAttendees[$attendee['EVENT_ID']] = array(); } $attendee["STATUS"] = trim($attendee["STATUS"]); $attendee["DESCRIPTION"] = trim($attendee["DESCRIPTION"]); $attendee["COLOR"] = trim($attendee["COLOR"]); $attendee["TEXT_COLOR"] = trim($attendee["TEXT_COLOR"]); $attendee["ACCESSIBILITY"] = trim($attendee["ACCESSIBILITY"]); if (empty($attendee["ACCESSIBILITY"])) { $attendee["ACCESSIBILITY"] = 'busy'; } CCalendar::SetUserDepartment($attendee["USER_ID"], empty($attendee['UF_DEPARTMENT']) ? array() : unserialize($attendee['UF_DEPARTMENT'])); $attendee['DISPLAY_NAME'] = CCalendar::GetUserName($attendee); $attendee['URL'] = CCalendar::GetUserUrl($attendee["USER_ID"]); $attendee['AVATAR'] = CCalendar::GetUserAvatarSrc($attendee); $arAttendees[$attendee['EVENT_ID']][] = $attendee; } } return $arAttendees; }
$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']), 'm' => array('users' => array(), 'count' => 4, 'countMax' => 8, 'title' => GetMessage('EC_ATT_M'), 'id' => "bxview-att-cont-m-" . $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"], $arParams["PATH_TO_USER"]); $status = strtolower($att['STATUS']) == 'h' || $att['STATUS'] == '' ? 'y' : $att['STATUS']; // ? $attendees[strtolower($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>
public static function Request($action = '') { global $APPLICATION; if ($_REQUEST['skip_unescape'] !== 'Y') { CUtil::JSPostUnEscape(); } // Export calendar if ($action == 'export') { // We don't need to check access couse we will check security SIGN from the URL $sectId = intVal($_GET['sec_id']); if ($_GET['check'] == 'Y') { $APPLICATION->RestartBuffer(); if (CCalendarSect::CheckSign($_GET['sign'], intVal($_GET['user']), $sectId > 0 ? $sectId : 'superposed_calendars')) { echo 'BEGIN:VCALENDAR'; } CMain::FinalActions(); die; } if (CCalendarSect::CheckAuthHash() && $sectId > 0) { // We don't need any warning in .ics file error_reporting(E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR | E_PARSE); CCalendarSect::ReturnICal(array('sectId' => $sectId, 'userId' => intVal($_GET['user']), 'sign' => $_GET['sign'], 'type' => $_GET['type'], 'ownerId' => intVal($_GET['owner']))); } } else { // // First of all - CHECK ACCESS if (!CCalendarType::CanDo('calendar_type_view', self::$type) || !check_bitrix_sessid()) { return $APPLICATION->ThrowException(GetMessage("EC_ACCESS_DENIED")); } $APPLICATION->ShowAjaxHead(); $APPLICATION->RestartBuffer(); $reqId = intVal($_REQUEST['reqId']); switch ($action) { // * * * * * Add and Edit event * * * * * case 'edit_event': if (self::$bReadOnly || !CCalendarType::CanDo('calendar_type_view', self::$type)) { return CCalendar::ThrowError(GetMessage('EC_ACCESS_DENIED')); } $id = intVal($_POST['id']); if (isset($_POST['section'])) { $sectId = intVal($_POST['section']); $_POST['sections'] = array($sectId); } else { $sectId = intVal($_POST['sections'][0]); } if (self::$type != 'user' || self::$ownerId != self::$userId) { if (!$id && !CCalendarSect::CanDo('calendar_add', $sectId, self::$userId)) { return CCalendar::ThrowError(GetMessage('EC_ACCESS_DENIED')); } if ($id && !CCalendarSect::CanDo('calendar_edit', $sectId, self::$userId)) { return CCalendar::ThrowError(GetMessage('EC_ACCESS_DENIED')); } } // Default name for events $_POST['name'] = trim($_POST['name']); if ($_POST['name'] == '') { $_POST['name'] = GetMessage('EC_DEFAULT_EVENT_NAME'); } $remind = array(); if (isset($_POST['remind']['checked']) && $_POST['remind']['checked'] == 'Y') { $remind[] = array('type' => $_POST['remind']['type'], 'count' => intval($_POST['remind']['count'])); } $rrule = isset($_POST['rrule_enabled']) ? $_POST['rrule'] : false; $from_ts = $_POST['from_ts']; $to_ts = $_POST['to_ts']; if (isset($_POST['skip_time']) && $_POST['skip_time'] == 'Y' || $rrule) { $from_ts = self::_fixTimestamp($from_ts); $to_ts = self::_fixTimestamp($to_ts); } $arFields = array("ID" => $id, "DT_FROM_TS" => $from_ts, "DT_TO_TS" => $to_ts, 'NAME' => $_POST['name'], 'DESCRIPTION' => trim($_POST['desc']), 'SECTIONS' => $_POST['sections'], 'COLOR' => $_POST['color'], 'TEXT_COLOR' => $_POST['text_color'], 'ACCESSIBILITY' => $_POST['accessibility'], 'IMPORTANCE' => $_POST['importance'], 'PRIVATE_EVENT' => $_POST['private_event'] == 'Y', 'RRULE' => $rrule, 'LOCATION' => is_array($_POST['location']) ? $_POST['location'] : array(), "REMIND" => $remind, "IS_MEETING" => !!$_POST['is_meeting'], "SKIP_TIME" => isset($_POST['skip_time']) && $_POST['skip_time'] == 'Y'); $arAccessCodes = array(); if (isset($_POST['EVENT_DESTINATION'])) { foreach ($_POST["EVENT_DESTINATION"] as $v => $k) { if (strlen($v) > 0 && is_array($k) && !empty($k)) { foreach ($k as $vv) { if (strlen($vv) > 0) { $arAccessCodes[] = $vv; } } } } if (!$arFields["ID"]) { $arAccessCodes[] = 'U' . self::$userId; } $arAccessCodes = array_unique($arAccessCodes); } $arFields['IS_MEETING'] = !empty($arAccessCodes) && $arAccessCodes != array('U' . self::$userId); if ($arFields['IS_MEETING']) { $arFields['ATTENDEES_CODES'] = $arAccessCodes; $arFields['ATTENDEES'] = CCalendar::GetDestinationUsers($arAccessCodes); $arFields['MEETING_HOST'] = self::$userId; $arFields['MEETING'] = array('HOST_NAME' => self::GetUserName($arFields['MEETING_HOST']), 'TEXT' => isset($_POST['meeting_text']) ? $_POST['meeting_text'] : '', 'OPEN' => $_POST['open_meeting'] === 'Y', 'NOTIFY' => $_POST['meeting_notify'] === 'Y', 'REINVITE' => $_POST['meeting_reinvite'] === 'Y'); } // Userfields for event $arUFFields = array(); foreach ($_POST as $field => $value) { if (substr($field, 0, 3) == "UF_") { $arUFFields[$field] = $value; } } $newId = self::SaveEvent(array('arFields' => $arFields, 'UF' => $arUFFields)); if ($newId) { $arFilter = array("ID" => $newId); $month = intVal($_REQUEST['month']); $year = intVal($_REQUEST['year']); $arFilter["FROM_LIMIT"] = self::Date(mktime(0, 0, 0, $month - 1, 20, $year), false); $arFilter["TO_LIMIT"] = self::Date(mktime(0, 0, 0, $month + 1, 10, $year), false); $arAttendees = array(); // List of attendees for event $arEvents = CCalendarEvent::GetList(array('arFilter' => $arFilter, 'parseRecursion' => true, 'fetchAttendees' => true, 'userId' => self::$userId)); } if ($arEvents && $arFields['IS_MEETING']) { $arAttendees = CCalendarEvent::GetLastAttendees(); } CCalendar::OutputJSRes($reqId, array('id' => $newId, 'events' => $arEvents, 'attendees' => $arAttendees, 'deletedEventId' => $id && $newId != $id ? $id : 0)); break; case 'move_event_to_date': if (self::$bReadOnly || !CCalendarType::CanDo('calendar_type_view', self::$type)) { return CCalendar::ThrowError(GetMessage('EC_ACCESS_DENIED')); } $id = intVal($_POST['id']); $sectId = intVal($_POST['section']); if (self::$type != 'user' || self::$ownerId != self::$userId) { if (!$id && !CCalendarSect::CanDo('calendar_add', $sectId, self::$userId)) { return CCalendar::ThrowError(GetMessage('EC_ACCESS_DENIED')); } if ($id && !CCalendarSect::CanDo('calendar_edit', $sectId, self::$userId)) { return CCalendar::ThrowError(GetMessage('EC_ACCESS_DENIED')); } } $from_ts = intVal($_POST['from_ts']); if (isset($_POST['skip_time']) && $_POST['skip_time'] == 'Y') { $from_ts = self::_fixTimestamp($from_ts); } $arFields = array("ID" => $id, "DT_FROM_TS" => $from_ts, "SKIP_TIME" => isset($_POST['skip_time']) && $_POST['skip_time'] == 'Y'); if (isset($_POST['to_ts']) && $_POST['to_ts'] > 0) { $arFields["DT_TO_TS"] = intVal($_POST['to_ts'], 10); } //SaveEvent $id = self::SaveEvent(array('arFields' => $arFields)); CCalendar::OutputJSRes($reqId, array('id' => $id)); break; // * * * * * Delete event * * * * * // * * * * * Delete event * * * * * case 'delete': if (self::$bReadOnly || !CCalendarType::CanDo('calendar_type_view', self::$type)) { return CCalendar::ThrowError(GetMessage('EC_ACCESS_DENIED')); } $res = self::DeleteEvent(intVal($_POST['id'])); if ($res !== true) { return CCalendar::ThrowError(strlen($res) > 0 ? $res : GetMessage('EC_EVENT_DEL_ERROR')); } CCalendar::OutputJSRes($reqId, true); break; // * * * * * Load events for some time limits * * * * * // * * * * * Load events for some time limits * * * * * case 'load_events': $arSect = array(); $arHiddenSect = array(); $month = intVal($_REQUEST['month']); $year = intVal($_REQUEST['year']); $fromLimit = self::Date(mktime(0, 0, 0, $month - 1, 20, $year), false); $toLimit = self::Date(mktime(0, 0, 0, $month + 1, 10, $year), false); if ($_REQUEST['cal_dav_data_sync'] == 'Y' && CCalendar::IsCalDAVEnabled()) { CDavGroupdavClientCalendar::DataSync("user", self::$ownerId); } $bGetTask = false; if (is_array($_REQUEST['sa'])) { foreach ($_REQUEST['sa'] as $sectId) { if ($sectId == 'tasks') { $bGetTask = true; } elseif (intval($sectId) > 0) { $arSect[] = intval($sectId); } } } if (is_array($_REQUEST['sh'])) { foreach ($_REQUEST['sh'] as $sectId) { if ($sectId == 'tasks') { $arHiddenSect[] = 'tasks'; } elseif (intval($sectId) > 0) { $arHiddenSect[] = intval($sectId); } } } $arAttendees = array(); // List of attendees for each event Array([ID] => Array(), ..,); $arEvents = array(); if (count($arSect) > 0) { // NOTICE: Attendees for meetings selected inside this method and returns as array by link '$arAttendees' $arEvents = self::GetEventList(array('type' => self::$type, 'section' => $arSect, 'fromLimit' => $fromLimit, 'toLimit' => $toLimit, 'additonalMeetingsId' => is_array($_REQUEST['ameetid']) ? $_REQUEST['ameetid'] : array()), $arAttendees); } // **** GET TASKS **** $arTaskIds = array(); if (self::$bTasks && $bGetTask) { $arTasks = self::GetTaskList(array('fromLimit' => $fromLimit, 'toLimit' => $toLimit), $arTaskIds); if (count($arTasks) > 0) { $arEvents = array_merge($arEvents, $arTasks); } } // Save hidden calendars CCalendarSect::Hidden(self::$userId, $arHiddenSect); CCalendar::OutputJSRes($reqId, array('events' => $arEvents, 'attendees' => $arAttendees)); break; // * * * * * Edit calendar * * * * * // * * * * * Edit calendar * * * * * case 'section_edit': $id = intVal($_POST['id']); $bNew = !isset($id) || $id == 0; if ($bNew) { if (self::$type == 'group') { // It's for groups if (!self::$perm['section_edit']) { return CCalendar::ThrowError('[se01]' . GetMessage('EC_ACCESS_DENIED')); } } else { if (self::$type == 'user') { if (!self::IsPersonal()) { // If it's not owner of the group. return CCalendar::ThrowError('[se02]' . GetMessage('EC_ACCESS_DENIED')); } } else { if (!CCalendarType::CanDo('calendar_type_edit_section')) { return CCalendar::ThrowError('[se03]' . GetMessage('EC_ACCESS_DENIED')); } } } } elseif (!self::IsPersonal() && !$bNew && !CCalendarSect::CanDo('calendar_edit_section', $id, self::$userId)) { return CCalendar::ThrowError(GetMessage('[se02]EC_ACCESS_DENIED')); } $arFields = array('CAL_TYPE' => self::$type, 'ID' => $id, 'NAME' => trim($_POST['name']), 'DESCRIPTION' => trim($_POST['desc']), 'COLOR' => $_POST['color'], 'TEXT_COLOR' => $_POST['text_color'], 'OWNER_ID' => self::$bOwner ? self::GetOwnerId() : '', 'EXPORT' => array('ALLOW' => isset($_POST['export']) && $_POST['export'] == 'Y', 'SET' => $_POST['exp_set']), 'ACCESS' => is_array($_POST['access']) ? $_POST['access'] : array()); if ($bNew) { $arFields['IS_EXCHANGE'] = $_POST['is_exchange'] == 'Y'; } $id = intVal(self::SaveSection(array('arFields' => $arFields))); if ($id > 0) { CCalendarSect::SetClearOperationCache(true); $oSect = CCalendarSect::GetById($id, true, true); if (!$oSect) { return CCalendar::ThrowError(GetMessage('EC_CALENDAR_SAVE_ERROR')); } if (self::$type == 'user' && isset($_POST['is_def_meet_calendar']) && $_POST['is_def_meet_calendar'] == 'Y') { $set = CCalendar::GetUserSettings(self::$ownerId); $set['meetSection'] = $id; CCalendar::SetUserSettings($set, self::$ownerId); } CCalendar::OutputJSRes($reqId, array('calendar' => $oSect, 'accessNames' => CCalendar::GetAccessNames())); } if ($id <= 0) { return CCalendar::ThrowError(GetMessage('EC_CALENDAR_SAVE_ERROR')); } break; // * * * * * Delete calendar * * * * * // * * * * * Delete calendar * * * * * case 'section_delete': $sectId = intVal($_REQUEST['id']); if (!self::IsPersonal() && !CCalendarSect::CanDo('calendar_edit_section', $sectId, self::$userId)) { return CCalendar::ThrowError(GetMessage('EC_ACCESS_DENIED')); } $res = self::DeleteSection($sectId); // if ($res !== true) // return CCalendar::ThrowError(strlen($res) > 0 ? $res : GetMessage('EC_CALENDAR_DEL_ERROR')); CCalendar::OutputJSRes($reqId, array('result' => true)); break; // * * * * * Save superposed sections * * * * * // * * * * * Save superposed sections * * * * * case 'set_superposed': $trackedUser = intVal($_REQUEST['trackedUser']); if ($trackedUser > 0) { $arUserIds = self::TrackingUsers(self::$userId); if (!in_array($trackedUser, $arUserIds)) { $arUserIds[] = $trackedUser; self::TrackingUsers(self::$userId, $arUserIds); } } if (CCalendar::SetDisplayedSuperposed(self::$userId, $_REQUEST['sect'])) { CCalendar::OutputJSRes($reqId, array('result' => true)); } else { CCalendar::ThrowError('Error! Cant save displayed superposed calendars'); } break; // * * * * * Fetch all available sections for superposing * * * * * // * * * * * Fetch all available sections for superposing * * * * * case 'get_superposed': CCalendar::OutputJSRes($reqId, array('sections' => CCalendar::GetSuperposed())); break; // * * * * * Return info about user, and user calendars * * * * * // * * * * * Return info about user, and user calendars * * * * * case 'spcal_user_cals': CCalendar::OutputJSRes($reqId, array('sections' => CCalendar::GetSuperposedForUsers($_REQUEST['users']))); break; // * * * * * Delete tracking user * * * * * // * * * * * Delete tracking user * * * * * case 'spcal_del_user': CCalendar::OutputJSRes($reqId, array('result' => CCalendar::DeleteTrackingUser(intVal($_REQUEST['userId'])))); break; // * * * * * Save user settings * * * * * // * * * * * Save user settings * * * * * case 'save_settings': if (isset($_POST['clear_all']) && $_POST['clear_all'] == true) { // Clear personal settings CCalendar::SetUserSettings(false); } else { // Personal CCalendar::SetUserSettings($_REQUEST['user_settings']); // Save access for type if (CCalendarType::CanDo('calendar_type_access', self::$type)) { // General $_REQUEST['settings']['week_holidays'] = implode('|', $_REQUEST['settings']['week_holidays']); CCalendar::SetSettings($_REQUEST['settings']); CCalendarType::Edit(array('arFields' => array('XML_ID' => self::$type, 'ACCESS' => $_REQUEST['type_access']))); } } CCalendar::OutputJSRes($reqId, array('result' => true)); break; // * * * * * Confirm user part in event * * * * * // * * * * * Confirm user part in event * * * * * case 'set_meeting_status': CCalendarEvent::SetMeetingStatus(self::$userId, intVal($_REQUEST['event_id']), in_array($_REQUEST['status'], array('Q', 'Y', 'N')) ? $_REQUEST['status'] : 'Q', $_REQUEST['status_comment']); CCalendar::OutputJSRes($reqId, true); break; case 'set_meeting_params': CCalendarEvent::SetMeetingParams(self::$userId, intVal($_REQUEST['event_id']), array('ACCESSIBILITY' => $_REQUEST['accessibility'], 'REMIND' => $_REQUEST['remind'])); CCalendar::OutputJSRes($reqId, true); break; // * * * * * Check users accessibility * * * * * // * * * * * Check users accessibility * * * * * case 'check_guests': CCalendar::OutputJSRes($reqId, array('data' => CCalendar::CheckUsersAccessibility(array('users' => $_REQUEST['attendees'], 'from' => self::Date($_POST['from']), 'to' => self::Date($_POST['to']), 'eventId' => intVal($_POST['event_id']))))); break; // * * * * * Get list of group members * * * * * // * * * * * Get list of group members * * * * * case 'get_group_members': if (self::$type == 'group') { CCalendar::OutputJSRes($reqId, array('users' => self::GetGroupMembers(self::$ownerId))); } break; // * * * * * Get Guests Accessibility * * * * * // * * * * * Get Guests Accessibility * * * * * case 'get_accessibility': $res = CCalendar::GetAccessibilityForUsers(array('users' => $_POST['users'], 'from' => self::Date(self::Timestamp($_POST['from'])), 'to' => self::Date(self::Timestamp($_POST['to'])), 'curEventId' => intVal($_POST['cur_event_id']), 'getFromHR' => true)); CCalendar::OutputJSRes($reqId, array('data' => $res)); break; // * * * * * Get meeting room accessibility * * * * * // * * * * * Get meeting room accessibility * * * * * case 'get_mr_accessibility': $res = CCalendar::GetAccessibilityForMeetingRoom(array('id' => intVal($_POST['id']), 'from' => self::Date(self::Timestamp($_POST['from'])), 'to' => self::Date(self::Timestamp($_POST['to'])), 'curEventId' => intVal($_POST['cur_event_id']))); CCalendar::OutputJSRes($reqId, array('data' => $res)); break; // * * * * * Get meeting room accessibility * * * * * // * * * * * Get meeting room accessibility * * * * * case 'check_meeting_room': $check = false; if (self::$allowReserveMeeting || self::$allowVideoMeeting) { $from = self::Date($_POST['from']); $to = self::Date($_POST['to']); $loc_old = $_POST['location_old'] ? CCalendar::ParseLocation(trim($_POST['location_old'])) : false; $loc_new = CCalendar::ParseLocation(trim($_POST['location_new'])); $Params = array('dateFrom' => self::CutZeroTime($from), 'dateTo' => self::CutZeroTime($to), 'regularity' => 'NONE', 'members' => isset($_POST['guest']) ? $_POST['guest'] : false); $tst = MakeTimeStamp($Params['dateTo']); if (date("H:i", $tst) == '00:00') { $Params['dateTo'] = CIBlockFormatProperties::DateFormat(self::DFormat(true), $tst + (23 * 60 + 59) * 60); } if (intVal($_POST['id']) > 0) { $Params['ID'] = intVal($_POST['id']); } if (self::$allowVideoMeeting && $loc_new['mrid'] == self::$settings['vr_iblock_id']) { $Params['VMiblockId'] = self::$settings['vr_iblock_id']; if ($loc_old['mrevid'] > 0) { $Params['ID'] = $loc_old['mrevid']; } $check = CCalendar::CheckVideoRoom($Params); } elseif (self::$allowReserveMeeting) { $Params['RMiblockId'] = self::$settings['rm_iblock_id']; $Params['mrid'] = $loc_new['mrid']; $Params['mrevid_old'] = $loc_old ? $loc_old['mrevid'] : 0; $check = CCalendar::CheckMeetingRoom($Params); } } CCalendar::OutputJSRes($reqId, array('check' => $check)); break; case 'connections_edit': if (self::$type == 'user' && CCalendar::IsCalDAVEnabled()) { $res = CCalendar::ManageConnections($_POST['connections']); if ($res !== true) { CCalendar::ThrowError($res == '' ? 'Edit connections error' : $res); } else { CCalendar::OutputJSRes($reqId, array('result' => true)); } } break; case 'exchange_sync': if (self::$type == 'user' && CCalendar::IsExchangeEnabled(self::$ownerId)) { $error = ""; $res = CDavExchangeCalendar::DoDataSync(self::$ownerId, $error); if ($res === true || $res === false) { CCalendar::OutputJSRes($reqId, array('result' => true)); } else { CCalendar::ThrowError($error); } } break; // case 'userfield_view': // CCalendarSceleton::GetUserfieldsViewHtml(intVal($_REQUEST['event_id'])); // CCalendar::OutputJSRes($reqId, array('result' => true)); // break; // case 'userfield_edit': // CCalendarSceleton::GetUserfieldsEditHtml(intVal($_REQUEST['event_id']), self::$actionUrl); // CCalendar::OutputJSRes($reqId, array('result' => true)); // break; // case 'userfield_save': // $arFields = array(); // $bRefresh = false; // foreach ($_POST as $field => $value) // if (substr($field, 0, 3) == "UF_") // { // $arFields[$field] = $value; // if ($field == 'UF_CRM_CAL_EVENT') // $bRefresh = true; // } // if (count($arFields) > 0) // CCalendarEvent::UpdateUserFields($_REQUEST['event_id'], $arFields); // // CCalendar::OutputJSRes($reqId, array('result' => true, 'refresh' => $bRefresh)); // break; // case 'userfield_view': // CCalendarSceleton::GetUserfieldsViewHtml(intVal($_REQUEST['event_id'])); // CCalendar::OutputJSRes($reqId, array('result' => true)); // break; // case 'userfield_edit': // CCalendarSceleton::GetUserfieldsEditHtml(intVal($_REQUEST['event_id']), self::$actionUrl); // CCalendar::OutputJSRes($reqId, array('result' => true)); // break; // case 'userfield_save': // $arFields = array(); // $bRefresh = false; // foreach ($_POST as $field => $value) // if (substr($field, 0, 3) == "UF_") // { // $arFields[$field] = $value; // if ($field == 'UF_CRM_CAL_EVENT') // $bRefresh = true; // } // if (count($arFields) > 0) // CCalendarEvent::UpdateUserFields($_REQUEST['event_id'], $arFields); // // CCalendar::OutputJSRes($reqId, array('result' => true, 'refresh' => $bRefresh)); // break; case 'get_view_event_dialog': $APPLICATION->ShowAjaxHead(); $jsId = $color = preg_replace('/[^\\d|\\w]/', '', $_REQUEST['js_id']); $event_id = intval($_REQUEST['event_id']); $Event = CCalendarEvent::GetList(array('arFilter' => array("ID" => $event_id), 'parseRecursion' => false, 'fetchAttendees' => true, 'checkPermissions' => true, 'setDefaultLimit' => false)); if ($Event && is_array($Event[0])) { CCalendarSceleton::DialogViewEvent(array('id' => $jsId, 'event' => $Event[0], 'sectionName' => $_REQUEST['section_name'], 'fromTs' => self::_fixTimestamp($_REQUEST['from_ts']), 'bIntranet' => self::IsIntranetEnabled(), 'bSocNet' => self::IsSocNet(), 'AVATAR_SIZE' => 21)); } require $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/epilog_after.php"; break; case 'get_edit_event_dialog': $APPLICATION->ShowAjaxHead(); $jsId = $color = preg_replace('/[^\\d|\\w]/', '', $_REQUEST['js_id']); $event_id = intval($_REQUEST['event_id']); if ($event_id > 0) { $Event = CCalendarEvent::GetList(array('arFilter' => array("ID" => $event_id), 'parseRecursion' => false, 'fetchAttendees' => true, 'checkPermissions' => true, 'setDefaultLimit' => false)); $Event = $Event && is_array($Event[0]) ? $Event[0] : false; } else { $Event = array(); } CCalendarSceleton::DialogEditEvent(array('id' => $jsId, 'event' => $Event, 'type' => self::$type, 'bIntranet' => self::IsIntranetEnabled(), 'bSocNet' => self::IsSocNet(), 'AVATAR_SIZE' => 21)); require $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/epilog_after.php"; break; case 'get_attendees_by_codes_planner': case 'get_attendees_by_codes': $bPlanner = $action == 'get_attendees_by_codes_planner'; $users = CCalendar::GetDestinationUsers($_REQUEST['codes'], true); $userIds = array(); $result = array(); foreach ($users as $user) { $userIds[] = $user['USER_ID']; $result[] = array('USER_ID' => $user['USER_ID'], 'DISPLAY_NAME' => CCalendar::GetUserName($user), 'AVATAR' => CCalendar::GetUserAvatarSrc($user), 'ACC' => '', 'URL' => CCalendar::GetUserUrl($user['USER_ID'], self::$pathToUser)); } if ($_REQUEST['event_from_ts'] && $_REQUEST['event_to_ts']) { $acc = CCalendar::CheckUsersAccessibility(array('users' => $userIds, 'from' => self::Date(self::_fixTimestamp($_REQUEST['event_from_ts'])), 'to' => self::Date(self::_fixTimestamp($_REQUEST['event_to_ts'])), 'eventId' => intVal($_REQUEST['cur_event_id']))); foreach ($result as $i => $user) { $result[$i]['ACC'] = $acc[$user['USER_ID']]; } } if ($bPlanner) { $accessibility = CCalendar::GetAccessibilityForUsers(array('users' => $userIds, 'from' => self::Date($_REQUEST['from_ts']), 'to' => self::Date($_REQUEST['to_ts']), 'curEventId' => intVal($_REQUEST['cur_event_id']), 'getFromHR' => true)); } else { $accessibility = array(); } CCalendar::OutputJSRes($reqId, array('users' => $result, 'accessibility' => $accessibility)); break; } } if ($ex = $APPLICATION->GetException()) { ShowError($ex->GetString()); } CMain::FinalActions(); die; }
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 }