protected static function getEvent($arParams)
 {
     global $USER;
     $arEvents = CCalendarEvent::GetList(array('arFilter' => array("ID" => $arParams['ID'], "DELETED" => "N"), 'parseRecursion' => true, 'fetchAttendees' => true, 'checkPermissions' => true));
     if (is_array($arEvents) && count($arEvents) > 0) {
         $arEvent = $arEvents[0];
         if ($arEvent['IS_MEETING']) {
             $arGuests = $arEvent['~ATTENDEES'];
             $arEvent['GUESTS'] = array();
             foreach ($arGuests as $guest) {
                 $arEvent['GUESTS'][] = array('id' => $guest['USER_ID'], 'name' => CUser::FormatName(CSite::GetNameFormat(null, $arParams['SITE_ID']), $guest, true), 'status' => $guest['STATUS'], 'accessibility' => $guest['ACCESSIBILITY'], 'bHost' => $guest['USER_ID'] == $arEvent['MEETING_HOST']);
                 if ($guest['USER_ID'] == $USER->GetID()) {
                     $arEvent['STATUS'] = $guest['STATUS'];
                 }
             }
         }
         $set = CCalendar::GetSettings();
         $url = str_replace('#user_id#', $arEvent['CREATED_BY'], $set['path_to_user_calendar']) . '?EVENT_ID=' . $arEvent['ID'];
         return array('ID' => $arEvent['ID'], 'NAME' => $arEvent['NAME'], 'DETAIL_TEXT' => $arEvent['DESCRIPTION'], 'DATE_FROM' => $arEvent['DT_FROM'], 'DATE_TO' => $arEvent['DT_TO'], 'ACCESSIBILITY' => $arEvent['ACCESSIBILITY'], 'IMPORTANCE' => $arEvent['IMPORTANCE'], 'STATUS' => $arEvent['STATUS'], 'IS_MEETING' => $arEvent['IS_MEETING'] ? 'Y' : 'N', 'GUESTS' => $arEvent['GUESTS'], 'UF_WEBDAV_CAL_EVENT' => $arEvent['UF_WEBDAV_CAL_EVENT'], 'URL' => $url);
     }
 }
Beispiel #2
0
 public static function GetAbsent($users = false, $Params = array())
 {
     global $DB;
     // Can be called from agent... So we have to create $USER if it is not exists
     $tempUser = CCalendar::TempUser(false, true);
     $curUserId = isset($Params['userId']) ? intVal($Params['userId']) : CCalendar::GetCurUserId();
     $arUsers = array();
     if ($users !== false && is_array($users)) {
         foreach ($users as $id) {
             if ($id > 0) {
                 $arUsers[] = intVal($id);
             }
         }
     }
     if (!count($arUsers)) {
         $users = false;
     }
     // Part 1: select ordinary events
     $arFilter = array('CAL_TYPE' => 'user', 'DELETED' => 'N', 'ACCESSIBILITY' => 'absent');
     if (isset($Params['fromLimit'])) {
         $arFilter['FROM_LIMIT'] = CCalendar::Date(CCalendar::Timestamp($Params['fromLimit'], false), true, false);
     }
     if (isset($Params['toLimit'])) {
         $arFilter['TO_LIMIT'] = CCalendar::Date(CCalendar::Timestamp($Params['toLimit'], false), true, false);
     }
     $arEvents = CCalendarEvent::GetList(array('arFilter' => $arFilter, 'getUserfields' => false, 'parseRecursion' => true, 'fetchAttendees' => false, 'fetchMeetings' => true, 'userId' => $curUserId, 'checkPermissions' => false, 'preciseLimits' => true));
     // Part 2: select attendees
     CTimeZone::Disable();
     if (count($arUsers) > 0) {
         $userQ = ' AND CA.USER_ID in (' . implode(',', $arUsers) . ')';
     } else {
         $userQ = '';
     }
     $strSql = "\n\t\t\tSELECT\n\t\t\t\tCA.EVENT_ID as ID, CA.USER_ID, CA.STATUS, CA.ACCESSIBILITY,\n\t\t\t\tCE.CAL_TYPE,CE.OWNER_ID,CE.NAME," . $DB->DateToCharFunction("CE.DT_FROM") . " as DT_FROM," . $DB->DateToCharFunction("CE.DT_TO") . " as DT_TO, CE.DT_LENGTH, CE.PRIVATE_EVENT, CE.ACCESSIBILITY, CE.IMPORTANCE, CE.IS_MEETING, CE.MEETING_HOST, CE.MEETING, CE.LOCATION, CE.RRULE, CE.EXRULE, CE.RDATE, CE.EXDATE,\n\t\t\t\tCES.SECT_ID\n\t\t\tFROM b_calendar_attendees CA\n\t\t\tLEFT JOIN\n\t\t\t\tb_calendar_event CE ON(CA.EVENT_ID=CE.ID)\n\t\t\tLEFT JOIN\n\t\t\t\tb_calendar_event_sect CES ON (CA.EVENT_ID=CES.EVENT_ID)\n\t\t\tWHERE\n\t\t\t\t\tCE.ID IS NOT NULL\n\t\t\t\tAND\n\t\t\t\t\tCE.DELETED='N'\n\t\t\t\tAND\n\t\t\t\t\tSTATUS='Y'\n\t\t\t\tAND\n\t\t\t\t\tCA.ACCESSIBILITY='absent'\n\t\t\t\t{$userQ}\n\t\t\t";
     if (isset($arFilter['FROM_LIMIT'])) {
         $strSql .= "AND ";
         if (strtoupper($DB->type) == "MYSQL") {
             $strSql .= "CE.DT_TO>=FROM_UNIXTIME('" . MkDateTime(FmtDate($arFilter['FROM_LIMIT'], "D.M.Y"), "d.m.Y") . "')";
         } elseif (strtoupper($DB->type) == "MSSQL") {
             $strSql .= "CE.DT_TO>=" . $DB->CharToDateFunction($arFilter['FROM_LIMIT'], "SHORT");
         } elseif (strtoupper($DB->type) == "ORACLE") {
             $strSql .= "CE.DT_TO>=TO_DATE('" . FmtDate($arFilter['FROM_LIMIT'], "D.M.Y") . " 00:00:00','dd.mm.yyyy hh24:mi:ss')";
         }
     }
     if ($arFilter['TO_LIMIT']) {
         $strSql .= "AND ";
         if (strtoupper($DB->type) == "MYSQL") {
             $strSql .= "CE.DT_FROM<=FROM_UNIXTIME('" . MkDateTime(FmtDate($arFilter['TO_LIMIT'], "D.M.Y") . " 23:59:59", "d.m.Y H:i:s") . "')";
         } elseif (strtoupper($DB->type) == "MSSQL") {
             $strSql .= "CE.DT_FROM<=dateadd(day, 1, " . $DB->CharToDateFunction($arFilter['TO_LIMIT'], "SHORT") . ")";
         } elseif (strtoupper($DB->type) == "ORACLE") {
             $strSql .= "CE.DT_FROM<=TO_DATE('" . FmtDate($arFilter['TO_LIMIT'], "D.M.Y") . " 23:59:59','dd.mm.yyyy hh24:mi:ss')";
         }
     }
     $res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     $arEvents2 = array();
     while ($event = $res->Fetch()) {
         $event = self::PreHandleEvent($event);
         if ($event['CAL_TYPE'] == 'user' && $event['IS_MEETING'] && $event['OWNER_ID'] == $event['USER_ID']) {
             continue;
         }
         if (self::CheckRecurcion($event)) {
             self::ParseRecursion($arEvents2, $event, array('fromLimit' => $arFilter["FROM_LIMIT"], 'toLimit' => $arFilter["TO_LIMIT"]));
         } else {
             self::HandleEvent($arEvents2, $event);
         }
     }
     CTimeZone::Enable();
     $arEvents = array_merge($arEvents, $arEvents2);
     $bSocNet = CModule::IncludeModule("socialnetwork");
     $result = array();
     $settings = CCalendar::GetSettings(array('request' => false));
     foreach ($arEvents as $event) {
         $userId = isset($event['USER_ID']) ? $event['USER_ID'] : $event['OWNER_ID'];
         if ($users !== false && !in_array($userId, $arUsers)) {
             continue;
         }
         if ($bSocNet && !CSocNetFeatures::IsActiveFeature(SONET_ENTITY_USER, $userId, "calendar")) {
             continue;
         }
         if ((!$event['CAL_TYPE'] != 'user' || $curUserId != $event['OWNER_ID']) && $curUserId != $event['CREATED_BY'] && !isset($arUserMeeting[$event['ID']])) {
             $sectId = $event['SECT_ID'];
             if (!$event['ACCESSIBILITY']) {
                 $event['ACCESSIBILITY'] = 'busy';
             }
             $private = $event['PRIVATE_EVENT'] && $event['CAL_TYPE'] == 'user';
             $bManager = false;
             if (!$private && CCalendar::IsIntranetEnabled() && CModule::IncludeModule('intranet') && $event['CAL_TYPE'] == 'user' && $settings['dep_manager_sub']) {
                 $bManager = in_array($curUserId, CCalendar::GetUserManagers($event['OWNER_ID'], true));
             }
             if ($private || !CCalendarSect::CanDo('calendar_view_full', $sectId) && !$bManager) {
                 if ($private) {
                     $event['NAME'] = '[' . GetMessage('EC_ACCESSIBILITY_' . strtoupper($event['ACCESSIBILITY'])) . ']';
                 } else {
                     if (!CCalendarSect::CanDo('calendar_view_title', $sectId)) {
                         $event['NAME'] = '[' . GetMessage('EC_ACCESSIBILITY_' . strtoupper($event['ACCESSIBILITY'])) . ']';
                     } else {
                         $event['NAME'] = $event['NAME'] . ' [' . GetMessage('EC_ACCESSIBILITY_' . strtoupper($event['ACCESSIBILITY'])) . ']';
                     }
                 }
             }
         }
         $result[] = array('ID' => $event['ID'], 'NAME' => $event['NAME'], 'DATE_FROM' => $event['DT_FROM'], 'DATE_TO' => $event['DT_TO'], 'DT_FROM_TS' => $event['DT_FROM_TS'], 'DT_TO_TS' => $event['DT_TO_TS'], 'CREATED_BY' => $userId, 'DETAIL_TEXT' => '', 'USER_ID' => $userId);
     }
     // Sort by DT_FROM_TS
     usort($result, array('CCalendar', '_NearestSort'));
     CCalendar::TempUser($tempUser, false);
     return $result;
 }
Beispiel #3
0
 public static function ReleaseLocation($loc)
 {
     $set = CCalendar::GetSettings(array('request' => false));
     if ($loc['mrid'] == $set['vr_iblock_id']) {
         CCalendar::ReleaseVideoRoom(array('mrevid' => $loc['mrevid'], 'mrid' => $loc['mrid'], 'VMiblockId' => $set['vr_iblock_id']));
     } elseif ($set['rm_iblock_id']) {
         CCalendar::ReleaseMeetingRoom(array('mrevid' => $loc['mrevid'], 'mrid' => $loc['mrid'], 'RMiblockId' => $set['rm_iblock_id']));
     }
 }
Beispiel #4
0
?>
</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['CREATED_BY'] && ($event['PARENT_ID'] == $event['ID'] || !$event['PARENT_ID'])) {
        $permission = "Y";
    } else {
        $permission = 'M';
    }
    $set = CCalendar::GetSettings();
    $eventCommentId = $event['PARENT_ID'] ? $event['PARENT_ID'] : $event['ID'];
    // 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" => $eventCommentId, "ENTITY_XML_ID" => "EVENT_" . $eventCommentId, "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>
 public static function GetList($Params = array())
 {
     global $DB, $USER;
     $arFilter = $Params['arFilter'];
     $arOrder = isset($Params['arOrder']) ? $Params['arOrder'] : array('SORT' => 'asc');
     $Params['joinTypeInfo'] = !!$Params['joinTypeInfo'];
     $checkPermissions = $Params['checkPermissions'] !== false;
     $bCache = CCalendar::CacheTime() > 0;
     if ($bCache) {
         $cache = new CPHPCache();
         $cacheId = serialize(array('section_list', $arFilter, $arOrder, $Params['joinTypeInfo'], CCalendar::IsIntranetEnabled()));
         $cachePath = CCalendar::CachePath() . 'section_list';
         if ($cache->InitCache(CCalendar::CacheTime(), $cacheId, $cachePath)) {
             $res = $cache->GetVars();
             $arResult = $res["arResult"];
             $arSectionIds = $res["arSectionIds"];
         }
     }
     if (!$bCache || !isset($arSectionIds)) {
         $arFields = self::GetFields();
         $arSqlSearch = array();
         if (is_array($arFilter)) {
             $filter_keys = array_keys($arFilter);
             for ($i = 0, $l = count($filter_keys); $i < $l; $i++) {
                 $n = strtoupper($filter_keys[$i]);
                 $val = $arFilter[$filter_keys[$i]];
                 if (is_string($val) && strlen($val) <= 0 || strval($val) == "NOT_REF") {
                     continue;
                 }
                 if ($n == 'ID' || $n == 'XML_ID' || $n == 'OWNER_ID') {
                     $arSqlSearch[] = GetFilterQuery("CS." . $n, $val, 'N');
                 } elseif ($n == 'CAL_TYPE' && is_array($val)) {
                     $strType = "";
                     foreach ($val as $type) {
                         $strType .= ",'" . CDatabase::ForSql($type) . "'";
                     }
                     $arSqlSearch[] = "CS.CAL_TYPE in (" . trim($strType, ", ") . ")";
                     $arSqlSearch[] = "CT.ACTIVE='Y'";
                 } elseif (isset($arFields[$n])) {
                     $arSqlSearch[] = GetFilterQuery($arFields[$n]["FIELD_NAME"], $val, isset($arFields[$n]["PROCENT"]) && $arFields[$n]["PROCENT"] == "N" ? "N" : "Y");
                 }
             }
         }
         $strOrderBy = '';
         foreach ($arOrder as $by => $order) {
             if (isset($arFields[strtoupper($by)])) {
                 $strOrderBy .= $arFields[strtoupper($by)]["FIELD_NAME"] . ' ' . (strtolower($order) == 'desc' ? 'desc' . (strtoupper($DB->type) == "ORACLE" ? " NULLS LAST" : "") : 'asc' . (strtoupper($DB->type) == "ORACLE" ? " NULLS FIRST" : "")) . ',';
             }
         }
         if (strlen($strOrderBy) > 0) {
             $strOrderBy = "ORDER BY " . rtrim($strOrderBy, ",");
         }
         $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
         if (isset($arFilter['ADDITIONAL_IDS']) && is_array($arFilter['ADDITIONAL_IDS']) && count($arFilter['ADDITIONAL_IDS']) > 0) {
             $strTypes = "";
             foreach ($arFilter['ADDITIONAL_IDS'] as $adid) {
                 $strTypes .= "," . IntVal($adid);
             }
             $strSqlSearch = '(' . $strSqlSearch . ') OR ID in(' . trim($strTypes, ', ') . ')';
         }
         $select = 'CS.*';
         $from = 'b_calendar_section CS';
         // Fetch types info into selection
         if ($Params['joinTypeInfo']) {
             $select .= ", CT.NAME AS TYPE_NAME, CT.DESCRIPTION AS TYPE_DESC";
             $from .= "\n INNER JOIN b_calendar_type CT ON (CS.CAL_TYPE=CT.XML_ID)";
         }
         $strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\t{$select}\n\t\t\t\tFROM\n\t\t\t\t\t{$from}\n\t\t\t\tWHERE\n\t\t\t\t\t{$strSqlSearch}\n\t\t\t\t{$strOrderBy}";
         $res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $arResult = array();
         $arSectionIds = array();
         $isExchangeEnabled = CCalendar::IsExchangeEnabled();
         $isCalDAVEnabled = CCalendar::IsCalDAVEnabled();
         while ($arRes = $res->Fetch()) {
             $arRes['COLOR'] = CCalendar::Color($arRes['COLOR'], true);
             $arSectionIds[] = $arRes['ID'];
             if (isset($arRes['EXPORT']) && $arRes['EXPORT'] != "") {
                 $arRes['EXPORT'] = unserialize($arRes['EXPORT']);
                 if (is_array($arRes['EXPORT']) && $arRes['EXPORT']['ALLOW']) {
                     $arRes['EXPORT']['LINK'] = self::GetExportLink($arRes['ID'], $arRes['CAL_TYPE'], $arRes['OWNER_ID']);
                 }
             }
             if (!is_array($arRes['EXPORT'])) {
                 $arRes['EXPORT'] = array('ALLOW' => false, 'SET' => false, 'LINK' => false);
             }
             // Outlook js
             if (CCalendar::IsIntranetEnabled()) {
                 $arRes['OUTLOOK_JS'] = CCalendarSect::GetOutlookLink(array('ID' => intVal($arRes['ID']), 'XML_ID' => $arRes['XML_ID'], 'TYPE' => $arRes['CAL_TYPE'], 'NAME' => $arRes['NAME'], 'PREFIX' => CCalendar::GetOwnerName($arRes['CAL_TYPE'], $arRes['OWNER_ID']), 'LINK_URL' => CCalendar::GetOuterUrl()));
             }
             if ($arRes['CAL_TYPE'] == 'user') {
                 $arRes['IS_EXCHANGE'] = strlen($arRes["DAV_EXCH_CAL"]) > 0 && $isExchangeEnabled;
                 if ($arRes["CAL_DAV_CON"] && $isCalDAVEnabled) {
                     $arRes["CAL_DAV_CON"] = intVal($arRes["CAL_DAV_CON"]);
                     $resCon = CDavConnection::GetList(array("ID" => "ASC"), array("ID" => $arRes["CAL_DAV_CON"]));
                     if ($con = $resCon->Fetch()) {
                         $arRes['CAL_DAV_CON'] = $arRes["CAL_DAV_CON"];
                     } else {
                         $arRes['CAL_DAV_CON'] = false;
                     }
                 }
             } else {
                 $arRes['IS_EXCHANGE'] = false;
                 $arRes['CAL_DAV_CON'] = false;
             }
             $arResult[] = $arRes;
         }
         if ($bCache) {
             $cache->StartDataCache(CCalendar::CacheTime(), $cacheId, $cachePath);
             $cache->EndDataCache(array("arResult" => $arResult, "arSectionIds" => $arSectionIds));
         }
     }
     if ($checkPermissions && count($arSectionIds) > 0) {
         $userId = $Params['userId'] ? intVal($Params['userId']) : $USER->GetID();
         $arPerm = CCalendarSect::GetArrayPermissions($arSectionIds);
         $res = array();
         $arAccessCodes = array();
         $settings = CCalendar::GetSettings(array('request' => false));
         foreach ($arResult as $sect) {
             $sectId = $sect['ID'];
             $bOwner = $sect['CAL_TYPE'] == 'user' && $sect['OWNER_ID'] == $userId;
             $bManager = false;
             if (CModule::IncludeModule('intranet') && $sect['CAL_TYPE'] == 'user' && $settings['dep_manager_sub']) {
                 if (!$userId) {
                     $userId = CCalendar::GetUserId();
                 }
                 $bManager = in_array($userId, CCalendar::GetUserManagers($sect['OWNER_ID'], true));
             }
             if ($bOwner || $bManager || self::CanDo('calendar_view_time', $sectId)) {
                 $sect['PERM'] = array('view_time' => $bManager || $bOwner || self::CanDo('calendar_view_time', $sectId, $userId), 'view_title' => $bManager || $bOwner || self::CanDo('calendar_view_title', $sectId, $userId), 'view_full' => $bManager || $bOwner || self::CanDo('calendar_view_full', $sectId, $userId), 'add' => $bOwner || self::CanDo('calendar_add', $sectId, $userId), 'edit' => $bOwner || self::CanDo('calendar_edit', $sectId, $userId), 'edit_section' => $bOwner || self::CanDo('calendar_edit_section', $sectId, $userId), 'access' => $bOwner || self::CanDo('calendar_edit_access', $sectId, $userId));
                 if ($bOwner || self::CanDo('calendar_edit_access', $sectId, $userId)) {
                     $sect['ACCESS'] = array();
                     if (count($arPerm[$sectId]) > 0) {
                         // Add codes to get they full names for interface
                         $arAccessCodes = array_merge($arAccessCodes, array_keys($arPerm[$sectId]));
                         $sect['ACCESS'] = $arPerm[$sectId];
                     }
                 }
                 $res[] = $sect;
             }
         }
         CCalendar::PushAccessNames($arAccessCodes);
         $arResult = $res;
     }
     return $arResult;
 }
    }
    if (!isset($_POST["convert"]) && !isset($_POST["parse_public"])) {
        if (!isset($_GET["content_parsed"])) {
            CCalendarConvert::SetOption('__convert_types', false);
        } else {
            $types = CCalendarConvert::GetOption('__convert_types');
            if (is_array($types)) {
                $RES = array('TYPES' => $types);
            }
            $IB = CCalendarConvert::GetIblockTypes();
        }
    }
    require $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/prolog_admin_after.php";
    CUtil::InitJSCore(array('ajax'));
    $SET = CCalendarConvert::GetSettings();
    $CUR_SET = CCalendar::GetSettings();
    foreach ($CUR_SET as $key => $value) {
        if (!isset($SET[$key]) && !empty($value)) {
            $SET[$key] = $value;
        }
    }
    $arDays = array('MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU');
    $arWorTimeList = array();
    for ($i = 0; $i < 24; $i++) {
        $arWorTimeList[strval($i)] = strval($i) . '.00';
        $arWorTimeList[strval($i) . '.30'] = strval($i) . '.30';
    }
}
?>
	<form style="border: 2px solid #B8C1DD; padding: 10px; background: #F8F8F8;" method="post" name="calendar_form" action="/bitrix/admin/calendar_convert.php" enctype="multipart/form-data" encoding="multipart/form-data">
		<?php 
Beispiel #7
0
 public static function AddComment_Calendar($arFields)
 {
     global $DB;
     if (!CModule::IncludeModule("forum")) {
         return false;
     }
     $ufFileID = array();
     $ufDocID = array();
     $dbResult = CSocNetLog::GetList(array(), array("ID" => $arFields["LOG_ID"]), false, false, array("ID", "SOURCE_ID", "SITE_ID"));
     if ($arLog = $dbResult->Fetch()) {
         $arCalendarEvent = CCalendarEvent::GetById($arLog["SOURCE_ID"]);
         if ($arCalendarEvent) {
             $arCalendarSettings = CCalendar::GetSettings();
             $forumID = $arCalendarSettings["forum_id"];
             if ($forumID) {
                 $arFilter = array("FORUM_ID" => $forumID, "XML_ID" => "EVENT_" . $arLog["SOURCE_ID"]);
                 $dbTopic = CForumTopic::GetList(null, $arFilter);
                 if ($dbTopic && ($arTopic = $dbTopic->Fetch())) {
                     $topicID = $arTopic["ID"];
                 } else {
                     $topicID = 0;
                 }
                 $currentUserId = CCalendar::GetCurUserId();
                 $strPermission = $currentUserId == $arCalendarEvent["OWNER_ID"] ? "Y" : "M";
                 $arFieldsMessage = array("POST_MESSAGE" => $arFields["TEXT_MESSAGE"], "USE_SMILES" => "Y", "PERMISSION_EXTERNAL" => "Q", "PERMISSION" => $strPermission, "APPROVED" => "Y");
                 if ($topicID === 0) {
                     $arFieldsMessage["TITLE"] = "EVENT_" . $arLog["SOURCE_ID"];
                     $arFieldsMessage["TOPIC_XML_ID"] = "EVENT_" . $arLog["SOURCE_ID"];
                 }
                 $arTmp = false;
                 $GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("SONET_COMMENT", $arTmp);
                 if (is_array($arTmp)) {
                     if (array_key_exists("UF_SONET_COM_DOC", $arTmp)) {
                         $GLOBALS["UF_FORUM_MESSAGE_DOC"] = $arTmp["UF_SONET_COM_DOC"];
                     } elseif (array_key_exists("UF_SONET_COM_FILE", $arTmp)) {
                         $arFieldsMessage["FILES"] = array();
                         foreach ($arTmp["UF_SONET_COM_FILE"] as $file_id) {
                             $arFieldsMessage["FILES"][] = array("FILE_ID" => $file_id);
                         }
                     }
                 }
                 $messageID = ForumAddMessage($topicID > 0 ? "REPLY" : "NEW", $forumID, $topicID, 0, $arFieldsMessage, $sError, $sNote);
                 // get UF DOC value and FILE_ID there
                 if ($messageID > 0) {
                     $messageUrl = CCalendar::GetPath("user", $arCalendarEvent["OWNER_ID"]);
                     $messageUrl = $messageUrl . (strpos($messageUrl, "?") === false ? "?" : "&") . "EVENT_ID=" . $arCalendarEvent["ID"] . "&MID=" . $messageID;
                     $dbAddedMessageFiles = CForumFiles::GetList(array("ID" => "ASC"), array("MESSAGE_ID" => $messageID));
                     while ($arAddedMessageFiles = $dbAddedMessageFiles->Fetch()) {
                         $ufFileID[] = $arAddedMessageFiles["FILE_ID"];
                     }
                     $ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("FORUM_MESSAGE", "UF_FORUM_MESSAGE_DOC", $messageID, LANGUAGE_ID);
                 }
             }
         }
     }
     if (!$messageID) {
         $sError = GetMessage("EC_LF_ADD_COMMENT_SOURCE_ERROR");
     }
     return array("SOURCE_ID" => $messageID, "MESSAGE" => $arFieldsMessage ? $arFieldsMessage["POST_MESSAGE"] : false, "RATING_TYPE_ID" => "FORUM_POST", "RATING_ENTITY_ID" => $messageID, "ERROR" => $sError, "NOTES" => $sNote, "UF" => array("FILE" => $ufFileID, "DOC" => $ufDocID), "URL" => $messageUrl);
 }
Beispiel #8
0
}
$arSelect[] = 'UF_CRM_CAL_EVENT';
if (!in_array('ID', $arSelect)) {
    $arSelect[] = 'ID';
}
$obRes = CCrmActivityCalendar::GetList($arResult['SORT'], $arFilter, $arSelect, $nPageTop);
if ($arResult['GADGET'] != 'Y') {
    $obRes->NavStart($arNav['nPageSize'], false);
    $arResult['DB_LIST'] = $obRes;
}
$obRes->bShowAll = false;
$arResult['ROWS_COUNT'] = $obRes->NavRecordCount;
$arResult['CAL'] = array();
$arCalList = array();
$i = 0;
$arCalendarConf = CCalendar::GetSettings();
$arParams['PATH_TO_CAL_SHOW'] = $arCalendarConf['path_to_user_calendar'];
while ($arCal = $obRes->GetNext()) {
    if (!isset($arCal['~UF_CRM_CAL_EVENT']) || !is_array($arCal['~UF_CRM_CAL_EVENT'])) {
        continue;
    }
    $iAddTask = -1;
    foreach ($arCal['~UF_CRM_CAL_EVENT'] as $sCalRel) {
        if ($nPageTop !== false && $i >= $nPageTop) {
            break 2;
        }
        $arCal['REL_ID'] = $sCalRel;
        $arCalEntityData = CCrmActivityCalendar::GetEntityDataByCalRel($sCalRel);
        if (isset($arResult['CAL'][$arCal['ID'] . '_' . $sCalRel])) {
            continue;
        }
	public static function FixForumCommentURL($arData)
	{
		if(
			in_array($arData["MODULE_ID"], array("forum", "FORUM"))
			&& $arData['ENTITY_TYPE_ID'] === 'FORUM_POST'
			&& intval($arData['PARAM1']) > 0
			&& preg_match('/^EVENT_([0-9]+)/', $arData["TITLE"], $match)
		)
		{
			$arCalendarSettings = CCalendar::GetSettings();
			$forumID = $arCalendarSettings["forum_id"];
			$eventID = intval($match[1]);

			if (
				intval($arData['PARAM1']) == $forumID
				&& $eventID > 0
				&& !empty($arCalendarSettings["pathes"])
				&& ($arCalendarEvent = CCalendarEvent::GetById($eventID))
				&& strlen($arCalendarEvent["CAL_TYPE"]) > 0
				&& in_array($arCalendarEvent["CAL_TYPE"], array("user", "group"))
				&& intval($arCalendarEvent["OWNER_ID"]) > 0
			)
			{
				foreach ($arData['LID'] as $siteId => $value)
				{
					$messageUrl = false;

					if (
						array_key_exists($siteId, $arCalendarSettings["pathes"])
						&& is_array($arCalendarSettings["pathes"][$siteId])
						&& !empty($arCalendarSettings["pathes"][$siteId])
					)
					{
						if ($arCalendarEvent["CAL_TYPE"] == "user")
						{
							if (
								array_key_exists("path_to_user_calendar", $arCalendarSettings["pathes"][$siteId])
								&& !empty($arCalendarSettings["pathes"][$siteId]["path_to_user_calendar"])
							)
							{
								$messageUrl = CComponentEngine::MakePathFromTemplate(
									$arCalendarSettings["pathes"][$siteId]["path_to_user_calendar"],
									array(
										"user_id" => $arCalendarEvent['OWNER_ID'],
									)
								);
							}
						}
						else
						{
							if (
								array_key_exists("path_to_group_calendar", $arCalendarSettings["pathes"][$siteId])
								&& !empty($arCalendarSettings["pathes"][$siteId]["path_to_group_calendar"])
							)
							{
								$messageUrl = CComponentEngine::MakePathFromTemplate(
									$arCalendarSettings["pathes"][$siteId]["path_to_group_calendar"],
									array(
										"group_id" => $arCalendarEvent['OWNER_ID'],
									)
								);
							}
						}
					}

					$arData['LID'][$siteId] = ($messageUrl ? $messageUrl."?EVENT_ID=".$arCalendarEvent["ID"]."&MID=".$arData['ENTITY_ID']."#message".$arData['ENTITY_ID'] : "");
				}

				return $arData;
			}

			return array(
				"TITLE" => "",
				"BODY" => ""
			);
		}
	}
Beispiel #10
0
    }
}
$dbIBlockType = CIBlockType::GetList();
$arIBTypes = array();
$arIB = array();
while ($arIBType = $dbIBlockType->Fetch()) {
    if ($arIBTypeData = CIBlockType::GetByIDLang($arIBType["ID"], LANG)) {
        $arIB[$arIBType['ID']] = array();
        $arIBTypes[$arIBType['ID']] = '[' . $arIBType['ID'] . '] ' . $arIBTypeData['NAME'];
    }
}
$dbIBlock = CIBlock::GetList(array('SORT' => 'ASC'), array('ACTIVE' => 'Y'));
while ($arIBlock = $dbIBlock->Fetch()) {
    $arIB[$arIBlock['IBLOCK_TYPE_ID']][$arIBlock['ID']] = ($arIBlock['CODE'] ? '[' . $arIBlock['CODE'] . '] ' : '') . $arIBlock['NAME'];
}
$SET = CCalendar::GetSettings(array('getDefaultForEmpty' => false));
$tabControl->Begin();
?>
<form method="post" name="cal_opt_form" action="<?php 
echo $APPLICATION->GetCurPage();
?>
?mid=<?php 
echo urlencode($mid);
?>
&amp;lang=<?php 
echo LANGUAGE_ID;
?>
">
<?php 
echo bitrix_sessid_post();
$arDays = array('MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU');
 public static function SettingsGet($arParams = array(), $nav = null, $server = null)
 {
     $userId = CCalendar::GetCurUserId();
     $methodName = "calendar.settings.get";
     $settings = CCalendar::GetSettings();
     return $settings;
 }
Beispiel #12
0
 public static function GetAbsent($users = false, $Params = array())
 {
     // Can be called from agent... So we have to create $USER if it is not exists
     $tempUser = CCalendar::TempUser(false, true);
     $curUserId = isset($Params['userId']) ? intVal($Params['userId']) : CCalendar::GetCurUserId();
     $arUsers = array();
     if ($users !== false && is_array($users)) {
         foreach ($users as $id) {
             if ($id > 0) {
                 $arUsers[] = intVal($id);
             }
         }
     }
     if (!count($arUsers)) {
         $users = false;
     }
     $arFilter = array('DELETED' => 'N', 'ACCESSIBILITY' => 'absent');
     if ($users) {
         $arFilter['CREATED_BY'] = $users;
     }
     if (isset($Params['fromLimit'])) {
         $arFilter['FROM_LIMIT'] = CCalendar::Date(CCalendar::Timestamp($Params['fromLimit'], false), true, false);
     }
     if (isset($Params['toLimit'])) {
         $arFilter['TO_LIMIT'] = CCalendar::Date(CCalendar::Timestamp($Params['toLimit'], false), true, false);
     }
     $arEvents = CCalendarEvent::GetList(array('arFilter' => $arFilter, 'parseRecursion' => true, 'getUserfields' => false, 'userId' => $curUserId, 'preciseLimits' => true, 'checkPermissions' => false, 'skipDeclined' => true));
     $bSocNet = CModule::IncludeModule("socialnetwork");
     $result = array();
     $settings = CCalendar::GetSettings(array('request' => false));
     foreach ($arEvents as $event) {
         $userId = isset($event['USER_ID']) ? $event['USER_ID'] : $event['CREATED_BY'];
         if ($users !== false && !in_array($userId, $arUsers)) {
             continue;
         }
         if ($bSocNet && !CSocNetFeatures::IsActiveFeature(SONET_ENTITY_USER, $userId, "calendar")) {
             continue;
         }
         if ((!$event['CAL_TYPE'] != 'user' || $curUserId != $event['OWNER_ID']) && $curUserId != $event['CREATED_BY'] && !isset($arUserMeeting[$event['ID']])) {
             $sectId = $event['SECT_ID'];
             if (!$event['ACCESSIBILITY']) {
                 $event['ACCESSIBILITY'] = 'busy';
             }
             $private = $event['PRIVATE_EVENT'] && $event['CAL_TYPE'] == 'user';
             $bManager = false;
             if (!$private && CCalendar::IsIntranetEnabled() && CModule::IncludeModule('intranet') && $event['CAL_TYPE'] == 'user' && $settings['dep_manager_sub']) {
                 $bManager = in_array($curUserId, CCalendar::GetUserManagers($event['OWNER_ID'], true));
             }
             if ($private || !CCalendarSect::CanDo('calendar_view_full', $sectId) && !$bManager) {
                 $event = self::ApplyAccessRestrictions($event, $userId);
             }
         }
         $skipTime = $event['DT_SKIP_TIME'] === 'Y';
         $fromTs = CCalendar::Timestamp($event['DATE_FROM'], false, !$skipTime);
         $toTs = CCalendar::Timestamp($event['DATE_TO'], false, !$skipTime);
         if ($event['DT_SKIP_TIME'] !== 'Y') {
             $fromTs -= $event['~USER_OFFSET_FROM'];
             $toTs -= $event['~USER_OFFSET_TO'];
         }
         $result[] = array('ID' => $event['ID'], 'NAME' => $event['NAME'], 'DATE_FROM' => CCalendar::Date($fromTs, !$skipTime, false), 'DATE_TO' => CCalendar::Date($toTs, !$skipTime, false), 'DT_FROM_TS' => $fromTs, 'DT_TO_TS' => $toTs, 'CREATED_BY' => $userId, 'DETAIL_TEXT' => '', 'USER_ID' => $userId);
     }
     // Sort by DATE_FROM_TS_UTC
     usort($result, array('CCalendar', '_NearestSort'));
     CCalendar::TempUser($tempUser, false);
     return $result;
 }
Beispiel #13
0
    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 
    }
Beispiel #14
0
 public static function getSettings($siteId = false)
 {
     $result = static::getDefaultSettings();
     if ($siteId === false) {
         $siteId = SITE_ID;
     }
     $site = \CSite::GetByID($siteId)->fetch();
     $weekDay = $site['WEEK_START'];
     $weekDaysMap = array('SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA');
     if ((string) $weekDay != '' && isset($weekDaysMap[$weekDay])) {
         $result['WEEK_START'] = $weekDaysMap[$weekDay];
     }
     if (Loader::includeModule('calendar')) {
         $calendarSettings = \CCalendar::GetSettings(array('getDefaultForEmpty' => false));
         if (is_array($calendarSettings['week_holidays'])) {
             $result['WEEKEND'] = $calendarSettings['week_holidays'];
         }
         /*
         if((string) $calendarSettings['week_start'] != '')
         {
         	$result['WEEK_START'] = $calendarSettings['week_start'];
         }
         */
         if ((string) $calendarSettings['year_holidays'] != '') {
             $holidays = explode(',', $calendarSettings['year_holidays']);
             if (is_array($holidays) && !empty($holidays)) {
                 foreach ($holidays as $day) {
                     $day = trim($day);
                     list($day, $month) = explode('.', $day);
                     $day = intval($day);
                     $month = intval($month);
                     if ($day && $month) {
                         $result['HOLIDAYS'][] = array('M' => $month, 'D' => $day);
                     }
                 }
             }
         }
         $time = explode('.', (string) $calendarSettings['work_time_start']);
         if (intval($time[0])) {
             $result['HOURS']['START']['H'] = intval($time[0]);
         }
         if (intval($time[1])) {
             $result['HOURS']['START']['M'] = intval($time[1]);
         }
         $time = explode('.', (string) $calendarSettings['work_time_end']);
         if (intval($time[0])) {
             $result['HOURS']['END']['H'] = intval($time[0]);
         }
         if (intval($time[1])) {
             $result['HOURS']['END']['M'] = intval($time[1]);
         }
     }
     return $result;
 }