} } else { $arResult["strMessage"] = GetMessage("SONET_LOG_COMMENT_EMPTY"); } } else { $arResult["strMessage"] = GetMessage("SONET_LOG_COMMENT_NO_PERMISSIONS"); } } } } elseif ($action == "get_comment") { $comment_id = $_REQUEST["cid"]; if ($arComment = CSocNetLogComments::GetByID($comment_id)) { $arResult["arComment"] = $arComment; $dateFormated = FormatDate($GLOBALS['DB']->DateFormatToPHP(FORMAT_DATE), MakeTimeStamp(array_key_exists("LOG_DATE_FORMAT", $arComment) ? $arComment["LOG_DATE_FORMAT"] : $arComment["LOG_DATE"])); $timeFormat = isset($_REQUEST["dtf"]) ? $_REQUEST["dtf"] : CSite::GetTimeFormat(); $timeFormated = FormatDateFromDB(array_key_exists("LOG_DATE_FORMAT", $arComment) ? $arComment["LOG_DATE_FORMAT"] : $arComment["LOG_DATE"], stripos($timeFormat, 'a') || ($timeFormat == 'FULL' && IsAmPmMode()) !== false ? 'H:MI T' : 'HH:MI'); if (intval($arComment["USER_ID"]) > 0) { $arParams = array("PATH_TO_USER" => $_REQUEST["p_user"], "NAME_TEMPLATE" => $_REQUEST["nt"], "SHOW_LOGIN" => $_REQUEST["sl"], "AVATAR_SIZE" => $_REQUEST["as"], "PATH_TO_SMILE" => $_REQUEST["p_smile"]); $arUser = array("ID" => $arComment["USER_ID"], "NAME" => $arComment["~CREATED_BY_NAME"], "LAST_NAME" => $arComment["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arComment["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arComment["~CREATED_BY_LOGIN"], "PERSONAL_PHOTO" => $arComment["~CREATED_BY_PERSONAL_PHOTO"], "PERSONAL_GENDER" => $arComment["~CREATED_BY_PERSONAL_GENDER"]); $bUseLogin = $arParams["SHOW_LOGIN"] != "N" ? true : false; $arCreatedBy = array("FORMATTED" => CUser::FormatName($arParams["NAME_TEMPLATE"], $arUser, $bUseLogin), "URL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComment["USER_ID"], "id" => $arComment["USER_ID"]))); } else { $arCreatedBy = array("FORMATTED" => GetMessage("SONET_C73_CREATED_BY_ANONYMOUS")); } $arTmpCommentEvent = array("LOG_DATE" => $arComment["LOG_DATE"], "LOG_DATE_FORMAT" => $arComment["LOG_DATE_FORMAT"], "LOG_DATE_DAY" => ConvertTimeStamp(MakeTimeStamp($arComment["LOG_DATE"]), "SHORT"), "LOG_TIME_FORMAT" => $timeFormated, "MESSAGE" => $arComment["MESSAGE"], "MESSAGE_FORMAT" => $arComment["~MESSAGE"], "CREATED_BY" => $arCreatedBy, "AVATAR_SRC" => CSocNetLogTools::FormatEvent_CreateAvatar($arUser, $arParams, ""), "USER_ID" => $arComment["USER_ID"]); $arEventTmp = CSocNetLogTools::FindLogCommentEventByID($arComment["EVENT_ID"]); if ($arEventTmp && array_key_exists("CLASS_FORMAT", $arEventTmp) && array_key_exists("METHOD_FORMAT", $arEventTmp)) { $arFIELDS_FORMATTED = call_user_func(array($arEventTmp["CLASS_FORMAT"], $arEventTmp["METHOD_FORMAT"]), $arComment, $arParams); $arTmpCommentEvent["MESSAGE_FORMAT"] = htmlspecialcharsback($arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"]); } $arResult["arCommentFormatted"] = $arTmpCommentEvent;
} }); (function() { var BX = window.BX; function ViewEventManager(data) { this.Init(data); } ViewEventManager.prototype.Init = function(data) { var _this = this; this.bAmPm = <?php echo IsAmPmMode() ? 'true' : 'false'; ?> ; this.userId = data.USER_ID; this.oEvent = data.EVENT; this.bDeleted = data.DELETED == 'Y'; this.oAttendees = this.oEvent.IS_MEETING ? data.ATTENDEES : {}; this.importance = { high: '<?php echo GetMessageJS('MBCAL_VIEWEV_IMP_HIGH'); ?> ', normal: '<?php echo GetMessageJS('MBCAL_VIEWEV_IMP_NORMAL'); ?>
echo "{error: 'access denied', type: 'fatal'}"; die; } } } else { $arAccessUsers = CTimeMan::GetAccess(); $bCanEditAll = in_array('*', $arAccessUsers['WRITE']); $bCanReadAll = in_array('*', $arAccessUsers['READ']); if (!$bCanReadAll && !in_array($ID, $arAccessUsers["READ"])) { echo "{error: 'access denied', type: 'fatal'}"; die; } } $arFields = array(); foreach ($arNeededSettings as $key) { if (IsAmPmMode() && ($key == 'UF_TM_MAX_START' || $key == 'UF_TM_MIN_FINISH')) { $v = trim($_REQUEST[$key]); if (strlen($v) > 0) { if (preg_match_all('/^(\\d+):(\\d+)\\s*(am|pm)$/i', $v, $matches)) { $v = intval($matches[1][0]) + (strtolower($matches[3][0]) == 'pm' ? 12 : 0) . ':' . $matches[2][0]; } } $arFields[$key] = $v; } else { $arFields[$key] = $_REQUEST[$key]; } } if ($arFields['UF_TM_ALLOWED_DELTA']) { $arFields['UF_TM_ALLOWED_DELTA'] = CTimeMan::FormatTime($arFields['UF_TM_ALLOWED_DELTA'], true); } $arAllFields = $USER_FIELD_MANAGER->GetUserFields($source == 'department' ? 'IBLOCK_' . COption::GetOptionInt('intranet', 'iblock_structure') . '_SECTION' : 'USER');
public static function FormatTime($h = 0, $m = 0) { $m = intVal($m); if ($m > 59) { $m = 59; } elseif ($m < 0) { $m = 0; } if ($m < 10) { $m = '0' . $m; } $h = intVal($h); if ($h > 24) { $h = 24; } if ($h < 0) { $h = 0; } if (IsAmPmMode()) { $ampm = 'am'; if ($h == 0) { $h = 12; } else { if ($h == 12) { $ampm = 'pm'; } else { if ($h > 12) { $ampm = 'pm'; $h -= 12; } } } $res = $h . ':' . $m . ' ' . $ampm; } else { $res = ($h < 10 ? '0' : '') . $h . ':' . $m; } return $res; }
</span><span class="finder-box-tab-right"></span></span><span class="finder-box-tab" onclick="switchTab('search'); BX('findex_box_text').focus()" id="meeting_selector_tab_search"><span class="finder-box-tab-left"></span><span class="finder-box-tab-text"><?php echo GetMessage('ME_MS_TAB_SEARCH'); ?> </span><span class="finder-box-tab-right"></span></span> </div> <div class="popup-window-hr popup-window-buttons-hr"><i></i></div> <div class="finder-box-tabs-content" id="meeting_selector_list"> <div id="meeting_selector_last" style="display: block;"> <?php foreach ($arResult['MEETINGS'] as $arMeeting) { ?> <a class="finder-box-item finder-box-item-text" href="<?php echo htmlspecialcharsbx($arMeeting['URL']); ?> "><span class="finder-box-item-date"><?php echo FormatDate($DB->DateFormatToPhp(FORMAT_DATE) . (IsAmPmMode() ? ' h:i a' : ' H:i'), MakeTimeStamp($arMeeting['DATE_START'])); ?> </span> <?php echo $arMeeting['TITLE']; ?> </a> <?php } ?> </div> <div id="meeting_selector_search" style="display: none;"></div> </div> </td> <td class="finder-box-right-column"> <div class="finder-box-selected-items" id="meeting_selector_agenda"></div> </td>
$arComment["DateFormated"] = ToLower($arComment["DateFormated"]); $arComment["DATE_CREATE_DATE"] = ToLower($arComment["DATE_CREATE_DATE"]); } // strip current year if (!empty($arParams['DATE_TIME_FORMAT_S']) && ($arParams['DATE_TIME_FORMAT_S'] == 'j F Y G:i' || $arParams['DATE_TIME_FORMAT_S'] == 'j F Y g:i a')) { $arComment["DateFormated"] = ltrim($arComment["DateFormated"], '0'); $arComment["DATE_CREATE_DATE"] = ltrim($arComment["DATE_CREATE_DATE"], '0'); $curYear = date('Y'); $arComment["DateFormated"] = str_replace(array('-' . $curYear, '/' . $curYear, ' ' . $curYear, '.' . $curYear), '', $arComment["DateFormated"]); $arComment["DATE_CREATE_DATE"] = str_replace(array('-' . $curYear, '/' . $curYear, ' ' . $curYear, '.' . $curYear), '', $arComment["DATE_CREATE_DATE"]); } if ($arParams["MOBILE"] == "Y") { $timestamp = MakeTimeStamp($arComment["DATE_CREATE"]); $arComment["DATE_CREATE_TIME"] = FormatDate(GetMessage("SONET_SBPC_MOBILE_FORMAT_TIME"), $timestamp); } else { $arComment["DATE_CREATE_TIME"] = FormatDateFromDB($arComment["DATE_CREATE"], strpos($arParams["DATE_TIME_FORMAT_S"], 'a') !== false || ($arParams["DATE_TIME_FORMAT_S"] == 'FULL' && IsAmPmMode()) !== false ? strpos(FORMAT_DATETIME, 'TT') !== false ? 'G:MI TT' : 'G:MI T' : 'GG:MI'); } $arResult["CommentsResult"][] = $arComment; $arResult["IDS"][] = $arComment["ID"]; $arFieldsHave = array(); if ($arComment["HAS_PROPS"] == "") { $arFieldsHave["HAS_PROPS"] = $bHasProps ? "Y" : "N"; } if (!empty($arFieldsHave)) { CBlogComment::Update($arComment["ID"], $arFieldsHave, false); } $i++; } while ($i < count($arCommentsAll) && ($arComment = $arCommentsAll[$i])); } unset($arResult["MESSAGE"]); unset($arResult["ERROR_MESSAGE"]);
public static function Show($arParams) { global $APPLICATION; CClock::Init($arParams); $APPLICATION->AddHeadScript('/bitrix/js/main/utils.js'); // Show input switch ($arParams['view']) { case 'label': ?> <input type="hidden" id="<?php echo $arParams['inputId']; ?> " name="<?php echo $arParams['inputName']; ?> " value="<?php echo $arParams['initTime']; ?> "> <div id=class="bx-clock-label" onmouseover="this.className='bx-clock-label-over';" onmouseout="this.className='bx-clock-label';" onclick=""><?php echo $arParams['initTime'] ? $arParams['initTime'] : 'Time'; ?> </div><?php break; case 'select': ?> <select id="<?php echo $arParams['inputId']; ?> " name="<?php echo $arParams['inputName']; ?> "> <?php for ($i = 0; $i < 24; $i++) { $h = $i < 10 ? '0' . $i : $i; ?> <option value="<?php echo $h; ?> :00"><?php echo $h; ?> :00</option><?php if ($arParams['step']) { ?> <option value="<?php echo $h; ?> :30"><?php echo $h; ?> :30</option><?php } } ?> </select> <?php break; case 'inline': ?> <input type="hidden" id="<?php echo $arParams['inputId']; ?> " name="<?php echo $arParams['inputName']; ?> " value="<?php echo $arParams['initTime']; ?> " /> <div id="<?php echo $arParams['inputId']; ?> _clock"></div> <script type="text/javascript"> if (!window.bxClockLoaders) { window.bxClockLoaders = []; window.onload = function() { for (var i=0; i<window.bxClockLoaders.length; i++) setTimeout(window.bxClockLoaders[i], 20*i + 20); window.bxClockLoaders = null; } } window.bxClockLoaders.push("bxShowClock_<?php echo $arParams['inputId']; ?> ('<?php echo $arParams['inputId']; ?> _clock');"); </script> <?php break; default: //input ?> <input id="<?php echo $arParams['inputId']; ?> " name="<?php echo $arParams['inputName']; ?> " type="text" value="<?php echo $arParams['initTime']; ?> " size="<?php echo IsAmPmMode() ? 6 : 4; ?> " title="<?php echo $arParams['inputTitle']; ?> " /><?php break; } // Show icon if ($arParams['showIcon'] !== false) { ?> <a href="javascript:void(0);" onclick="bxShowClock_<?php echo $arParams['inputId']; ?> ()" title="<?php echo GetMessage('BX_CLOCK_TITLE'); ?> " onmouseover="this.className='bxc-icon-hover';" onmouseout="this.className='';"><img id="<?php echo $arParams['inputId']; ?> _icon" src="/bitrix/images/1.gif" class="bx-clock-icon bxc-iconkit-c"></a><?php } //Init JS and append CSS ?> <script> function bxLoadClock_<?php echo $arParams['inputId']; ?> (callback) { <?php if ($arParams['view'] != 'inline') { ?> if (!window.JCClock && !window.jsUtils) { return setTimeout(function(){bxLoadClock_<?php echo $arParams['inputId']; ?> (callback);}, 50); } <?php } ?> if (!window.JCClock) { if(!!window.bClockLoading) { return setTimeout(function(){bxLoadClock_<?php echo $arParams['inputId']; ?> (callback);}, 50); } else { window.bClockLoading = true; return BX.load( [ '<?php echo CUtil::GetAdditionalFileURL("/bitrix/js/main/clock.js"); ?> ', '<?php echo CUtil::GetAdditionalFileURL("/bitrix/themes/.default/clock.css"); ?> ' ], function() {bxLoadClock_<?php echo $arParams['inputId']; ?> (callback)} ); } } window.bClockLoading = false; var obId = 'bxClock_<?php echo $arParams['inputId']; ?> '; window[obId] = new JCClock({ step: <?php echo $arParams['step']; ?> , initTime: '<?php echo $arParams['initTime']; ?> ', showIcon: <?php echo $arParams['showIcon'] ? 'true' : 'false'; ?> , inputId: '<?php echo $arParams['inputId']; ?> ', iconId: '<?php echo $arParams['inputId'] . '_icon'; ?> ', zIndex: <?php echo isset($arParams['zIndex']) ? intval($arParams['zIndex']) : 0; ?> , AmPmMode: <?php echo $arParams['am_pm_mode'] ? 'true' : 'false'; ?> , MESS: { Insert: '<?php echo GetMessageJS('BX_CLOCK_INSERT'); ?> ', Close: '<?php echo GetMessageJS('BX_CLOCK_CLOSE'); ?> ', Hours: '<?php echo GetMessageJS('BX_CLOCK_HOURS'); ?> ', Minutes: '<?php echo GetMessageJS('BX_CLOCK_MINUTES'); ?> ', Up: '<?php echo GetMessageJS('BX_CLOCK_UP'); ?> ', Down: '<?php echo GetMessageJS('BX_CLOCK_DOWN'); ?> ' } }); return callback.apply(window, [window[obId]]); } function bxShowClock_<?php echo $arParams['inputId']; ?> (id) { bxLoadClock_<?php echo $arParams['inputId']; ?> (function(obClock) { obClock.Show(id); }); } </script><?php }
public static function DialogEditEvent($Params) { require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/tools/clock.php"; 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; } $userId = CCalendar::GetCurUserId(); $arHost = CCalendar::GetUser($userId, true); $arHost['AVATAR_SRC'] = CCalendar::GetUserAvatarSrc($arHost); $arHost['URL'] = CCalendar::GetUserUrl($event['MEETING_HOST'], $Params["PATH_TO_USER"]); $arHost['DISPLAY_NAME'] = CCalendar::GetUserName($arHost); $Params['host'] = $arHost; 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'])); $userIds = array(); if (is_array($event['~ATTENDEES']) && count($event['~ATTENDEES']) > 0) { foreach ($event['~ATTENDEES'] as $i => $att) { $userIds[] = $att["USER_ID"]; if ($userId == $att["USER_ID"]) { $curUserStatus = $att['STATUS']; } $att['AVATAR_SRC'] = CCalendar::GetUserAvatarSrc($att); $att['URL'] = CCalendar::GetUserUrl($att["USER_ID"], $Params["PATH_TO_USER"]); $attendees[strtolower($att['STATUS'])]['users'][] = $att; } $acc = CCalendar::CheckUsersAccessibility(array('users' => $userIds, 'from' => $event['DT_FROM'], 'to' => $event['DT_TO'], 'eventId' => $event['ID'])); foreach ($event['~ATTENDEES'] as $i => $att) { $event['~ATTENDEES'][$i]['ACC'] = $acc[$att['USER_ID']]; } } } if ($event['IS_MEETING'] && empty($event['ATTENDEES_CODES'])) { $event['ATTENDEES_CODES'] = CCalendarEvent::CheckEndUpdateAttendeesCodes($event); } $Params['event'] = $event; $Params['UF'] = $UF; $arTabs = array(array('name' => GetMessage('EC_EDEV_EVENT'), 'title' => GetMessage('EC_EDEV_EVENT_TITLE'), 'id' => $id . "ed-tab-0", 'active' => true), array('name' => GetMessage('EC_T_DESC'), 'title' => GetMessage('EC_T_DESC_TITLE'), 'id' => $id . "ed-tab-1"), array('name' => GetMessage('EC_EDEV_GUESTS'), 'title' => GetMessage('EC_EDEV_GUESTS_TITLE'), 'id' => $id . "ed-tab-2", "show" => !!$Params['bSocNet']), array('name' => GetMessage('EC_EDEV_ADD_TAB'), 'title' => GetMessage('EC_EDEV_ADD_TAB_TITLE'), 'id' => $id . "ed-tab-3")); $addWidthStyle = IsAmPmMode() ? ' ampm-width' : ''; ?> <script> window.__ATTENDEES_ACC = null; <?php if ($event['IS_MEETING'] && is_array($event['~ATTENDEES'])) { ?> window.__ATTENDEES_ACC = <?php echo CUtil::PhpToJSObject($event['~ATTENDEES']); ?> ; <?php } ?> </script> <form enctype="multipart/form-data" method="POST" name="event_edit_form" id="<?php echo $id; ?> _form"> <input type="hidden" value="Y" name="skip_unescape"/> <input id="event-id<?php echo $id; ?> " type="hidden" value="0" name="id"/> <input id="event-month<?php echo $id; ?> " type="hidden" value="0" name="month"/> <input id="event-year<?php echo $id; ?> " type="hidden" value="0" name="year"/> <div id="bxec_edit_ed_<?php echo $id; ?> " class="bxec-popup"> <div style="width: 610px; height: 1px;"></div> <div class="bxec-d-tabs" id="<?php echo $id; ?> _edit_tabs"> <?php foreach ($arTabs as $tab) { ?> <div class="bxec-d-tab <?php if ($tab['active']) { echo 'bxec-d-tab-act'; } ?> " title="<?php echo $tab['title']; ?> " 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" id="<?php echo $id; ?> _edit_ed_d_tabcont"> <?php /* ####### TAB 0 : MAIN ####### */ ?> <div id="<?php echo $id; ?> ed-tab-0-cont" class="bxec-d-cont-div" style="display: block;"> <div class="bxc-meeting-edit-note"><?php echo GetMessage('EC_EDIT_MEETING_NOTE'); ?> </div> <div class="bxec-from-to-reminder" id="feed-cal-from-to-cont<?php echo $id; ?> "> <input id="event-from-ts<?php echo $id; ?> " type="hidden" value="" name="from_ts"/> <input id="event-to-ts<?php echo $id; ?> " type="hidden" value="" name="to_ts"/> <div class="bxec-from-to-reminder-inner"> <span class="bxec-date"> <label class="bxec-date-label" for="<?php echo $id; ?> edev-from"><?php echo GetMessage('EC_EDEV_FROM_DATE_TIME'); ?> </label> <label class="bxec-date-label-full-day" for="<?php echo $id; ?> edev-from"><?php echo GetMessage('EC_EDEV_DATE_FROM'); ?> </label> <input id="feed-cal-event-from<?php echo $id; ?> " type="text" class="calendar-inp calendar-inp-cal"/> </span> <span class="bxec-time<?php echo $addWidthStyle; ?> "><?php CClock::Show(array('inputId' => 'feed_cal_event_from_time' . $id, 'inputTitle' => GetMessage('EC_EDEV_TIME_FROM'), 'showIcon' => false)); ?> </span> <span class="bxec-mdash">—</span> <span class="bxec-date"> <label class="bxec-date-label" for="<?php echo $id; ?> edev-from"><?php echo GetMessage('EC_EDEV_TO_DATE_TIME'); ?> </label> <label class="bxec-date-label-full-day" for="<?php echo $id; ?> edev-from"><?php echo GetMessage('EC_EDEV_DATE_TO'); ?> </label> <input id="feed-cal-event-to<?php echo $id; ?> " type="text" class="calendar-inp calendar-inp-cal"/> </span> <span class="bxec-time<?php echo $addWidthStyle; ?> "><?php CClock::Show(array('inputId' => 'feed_cal_event_to_time' . $id, 'inputTitle' => GetMessage('EC_EDEV_TIME_TO'), 'showIcon' => false)); ?> </span> <div class="bxec-reminder-collapsed" id="feed-cal-reminder-cont<?php echo $id; ?> "> <input class="bxec-check" type="checkbox" id="event-reminder<?php echo $id; ?> " value="Y" name="remind[checked]"/> <label class="bxec-rem-lbl" for="event-reminder<?php echo $id; ?> "><?php echo GetMessage('EC_EDEV_REMIND_EVENT'); ?> </label> <label class="bxec-rem-lbl-for" for="event-reminder<?php echo $id; ?> "><?php echo GetMessage('EC_EDEV_REMIND_FOR'); ?> :</label> <span class="bxec-rem-value"> <input class="calendar-inp" id="event_remind_count<?php echo $id; ?> " type="text" style="width: 30px" size="2" name="remind[count]"> <select id="event_remind_type<?php echo $id; ?> " class="calendar-select" name="remind[type]" style="width: 106px;"> <option value="min" selected="true"><?php echo GetMessage('EC_EDEV_REM_MIN'); ?> </option> <option value="hour"><?php echo GetMessage('EC_EDEV_REM_HOUR'); ?> </option> <option value="day"><?php echo GetMessage('EC_EDEV_REM_DAY'); ?> </option> </select> <?php echo GetMessage('ECLF_REM_DE_VORHER'); ?> </span> </div> <div style="display:none;"><?php $APPLICATION->IncludeComponent("bitrix:main.calendar", "", array("FORM_NAME" => "", "INPUT_NAME" => "", "INPUT_VALUE" => "", "SHOW_TIME" => "N", "HIDE_TIMEBAR" => "Y", "SHOW_INPUT" => "N"), false, array("HIDE_ICONS" => "Y")); ?> </div> </div> <div class="bxec-full-day"> <input type="checkbox" id="event-full-day<?php echo $id; ?> " value="Y" name="skip_time"/> <label style="display: inline-block;" for="event-full-day<?php echo $id; ?> "><?php echo GetMessage('EC_FULL_DAY'); ?> </label> </div> </div> <div class="bxec-popup-row"> <input name="name" placeholder="<?php echo GetMessage('EC_T_EVENT_NAME'); ?> " type="text" id="<?php echo $id; ?> _edit_ed_name" class="calendar-inp bxec-inp-active" style="width: 500px; font-size: 18px!important;"/> </div> <div class="bxec-popup-row" id="<?php echo $id; ?> _location_cnt"> <span class="bxec-field-label-edev"><label for="<?php echo $id; ?> _planner_location1"><?php echo GetMessage('EC_LOCATION'); ?> :</label></span> <span class="bxec-field-val-2 bxecpl-loc-cont" > <input class="calendar-inp" style="width: 272px;" id="<?php echo $id; ?> _planner_location1" type="text" title="<?php echo GetMessage('EC_LOCATION_TITLE'); ?> " value="<?php echo GetMessage('EC_PL_SEL_MEET_ROOM'); ?> " class="ec-label" /> </span> <input id="event-location-old<?php echo $id; ?> " type="hidden" value="" name="location[OLD]"/> <input id="event-location-new<?php echo $id; ?> " type="hidden" value="" name="location[NEW]"/> </div> <?php if ($Params['bIntranet']) { ?> <div class="bxec-popup-row bxec-ed-meeting-vis"> <span class="bxec-field-label-edev"><label for="<?php echo $id; ?> _bxec_accessibility"><?php echo GetMessage('EC_ACCESSIBILITY'); ?> :</label></span> <span class="bxec-field-val-2" > <select class="calendar-select" id="<?php echo $id; ?> _bxec_accessibility" name="accessibility" style="width: 310px;"> <option value="busy" title="<?php echo GetMessage('EC_ACCESSIBILITY_B'); ?> "><?php echo GetMessage('EC_ACCESSIBILITY_B'); ?> </option> <option value="quest" title="<?php echo GetMessage('EC_ACCESSIBILITY_Q'); ?> "><?php echo GetMessage('EC_ACCESSIBILITY_Q'); ?> </option> <option value="free" title="<?php echo GetMessage('EC_ACCESSIBILITY_F'); ?> "><?php echo GetMessage('EC_ACCESSIBILITY_F'); ?> </option> <option value="absent" title="<?php echo GetMessage('EC_ACCESSIBILITY_A'); ?> (<?php echo GetMessage('EC_ACC_EX'); ?> )"><?php echo GetMessage('EC_ACCESSIBILITY_A'); ?> (<?php echo GetMessage('EC_ACC_EX'); ?> )</option> </select> </span> </div> <?php } ?> <div class="bxec-popup-row" id="<?php echo $id; ?> _sect_cnt"> <span class="bxec-field-label-edev"><label for="<?php echo $id; ?> _edit_ed_calend_sel"><?php echo GetMessage('EC_T_CALENDAR'); ?> :</label></span> <span class="bxec-field-val-2" > <select name="section" id="<?php echo $id; ?> _edit_ed_calend_sel" class="calendar-select" style="width: 310px;"></select><span id="<?php echo $id; ?> _edit_sect_sel_warn" class="bxec-warn" style="display: none;"><?php echo GetMessage('EC_T_CALEN_DIS_WARNING'); ?> </span> </span> </div> </div> <?php /* ####### END TAB 0 ####### */ ?> <?php /* ####### TAB 1 : DESCRIPTION - LHE ####### */ ?> <div id="<?php echo $id; ?> ed-tab-1-cont" class="bxec-d-cont-div bxec-d-cont-div-lhe"> <!-- Description + files --> <?php $APPLICATION->IncludeComponent("bitrix:main.post.form", "", array("FORM_ID" => "event_edit_form", "SHOW_MORE" => "Y", "PARSER" => array("Bold", "Italic", "Underline", "Strike", "ForeColor", "FontList", "FontSizeList", "RemoveFormat", "Quote", "Code", "CreateLink", "Image", "UploadFile", "InputVideo", "Table", "Justify", "InsertOrderedList", "InsertUnorderedList", "Source", "MentionUser", "Spoiler"), "BUTTONS" => array("UploadFile", "CreateLink", "InputVideo", "Quote"), "TEXT" => array("ID" => $id . '_edit_ed_desc', "NAME" => "desc", "VALUE" => $Params['event']['DESCRIPTION'], "HEIGHT" => "280px"), "UPLOAD_WEBDAV_ELEMENT" => $Params['UF']['UF_WEBDAV_CAL_EVENT'], "UPLOAD_FILE_PARAMS" => array("width" => 400, "height" => 400), "FILES" => array("VALUE" => array(), "DEL_LINK" => '', "SHOW" => "N"), "SMILES" => array("VALUE" => array()), "LHE" => array("id" => $Params['id'] . '_event_editor', "documentCSS" => "", "jsObjName" => $Params['id'] . '_event_editor', "fontFamily" => "'Helvetica Neue', Helvetica, Arial, sans-serif", "fontSize" => "12px", "lazyLoad" => false, "setFocusAfterShow" => false)), false, array("HIDE_ICONS" => "Y")); ?> </div> <?php /* ####### END TAB 1 ####### */ ?> <?php /* ####### TAB 2 : GUESTS ####### */ if ($Params['bSocNet']) { ?> <div id="<?php echo $id; ?> ed-tab-2-cont" class="bxec-d-cont-div"> <a id="<?php echo $id; ?> _planner_link" href="javascript:void(0);" title="<?php echo GetMessage('EC_PLANNER_TITLE'); ?> " class="bxex-planner-link"><i></i><?php echo GetMessage('EC_PLANNER2'); ?> </a> <?php CCalendarSceleton::__ShowAttendeesDestinationHtml($Params); ?> <div class="bxc-att-cont-cont"> <span class="bxc-add-guest-link" id="<?php echo $id; ?> _user_control_link"></span> <div id="<?php echo $id; ?> _attendees_cont" class="bxc-attendees-cont" style="display: none;"> <div class="bxc-owner-cont"> <div class="bxc-owner-cont"> <span class="bxc-owner-title"><span><?php echo GetMessage('EC_EDEV_HOST'); ?> :</span></span> <span class="bxc-owner-value"><a id="<?php echo $id; ?> edit_host_link" href="javascript:void(0);"></a></span> </div> </div> <div class="bxc-no-att-notice"> - <?php echo GetMessage('EC_NO_ATTENDEES'); ?> - </div> <div class="bxc-att-title"> <span><?php echo GetMessage('EC_EDEV_GUESTS'); ?> :</span> <div id="<?php echo $id; ?> _att_summary"></div> </div> <div class="bxc-att-cont" id="<?php echo $id; ?> _attendees_list" style="height: 200px;"></div> </div> </div> </div> <?php /* ####### END TAB 2 ####### */ ?> <?php } /* bSocNet */ ?> <?php /* ####### TAB 3 : ADDITIONAL INFO ####### */ ?> <div id="<?php echo $id; ?> ed-tab-3-cont" class="bxec-d-cont-div"> <div class="bxec-popup-row-title"><?php echo GetMessage('EC_T_REPEATING'); ?> </div> <div class="bxec-popup-row-repeat" id="<?php echo $id; ?> _edit_ed_rep_cont"> <div class="bxec-popup-row-2" id="<?php echo $id; ?> _edit_ed_rep_tr"> <input id="event-rrule-byday<?php echo $id; ?> " type="hidden" value="0" name="rrule[BYDAY]"/> <input id="event-rrule-until<?php echo $id; ?> " type="hidden" value="0" name="rrule[UNTIL]"/> <input id="<?php echo $id; ?> _edit_ed_rep_check" type="checkbox" value="Y" name="rrule_enabled"/> <label for="<?php echo $id; ?> _edit_ed_rep_check" style="display: inline-block; margin: 3px 0 0 0; vertical-align:top;"><?php echo GetMessage('EC_T_REPEAT_CHECK_LABEL'); ?> </label> </div> <div class="bxec-popup-row-bordered bxec-popup-repeat-details"> <label for="<?php echo $id; ?> _edit_ed_rep_sel" class="event-grid-repeat-label"><?php echo GetMessage('EC_T_REPEAT'); ?> :</label> <select id="<?php echo $id; ?> _edit_ed_rep_sel" class="calendar-select" name="rrule[FREQ]" style="width: 175px;"> <option value="DAILY"><?php echo GetMessage('EC_T_REPEAT_DAILY'); ?> </option> <option value="WEEKLY"><?php echo GetMessage('EC_T_REPEAT_WEEKLY'); ?> </option> <option value="MONTHLY"><?php echo GetMessage('EC_T_REPEAT_MONTHLY'); ?> </option> <option value="YEARLY"><?php echo GetMessage('EC_T_REPEAT_YEARLY'); ?> </option> </select> <span class="event-grid-repeat-cont"> <span class="event-grid-rep-phrases" id="<?php echo $id; ?> _edit_ed_rep_phrase1"></span> <select id="<?php echo $id; ?> _edit_ed_rep_count" class="calendar-select" name="rrule[INTERVAL]"> <?php for ($i = 1; $i < 36; $i++) { ?> <option value="<?php echo $i; ?> "><?php echo $i; ?> </option> <?php } ?> </select> <span class="event-grid-rep-phrases" id="<?php echo $id; ?> _edit_ed_rep_phrase2"></span> <span id="<?php echo $id; ?> _edit_ed_rep_week_days" class="bxec-rep-week-days"> <?php $week_days = CCalendarSceleton::GetWeekDays(); for ($i = 0; $i < 7; $i++) { $id_ = $id . 'bxec_week_day_' . $i; ?> <input id="<?php echo $id_; ?> " type="checkbox" value="<?php echo $week_days[$i][2]; ?> "> <label for="<?php echo $id_; ?> " title="<?php echo $week_days[$i][0]; ?> "><?php echo $week_days[$i][1]; ?> </label> <?php if ($i == 2) { echo '<br>'; } ?> <?php } ?> </span> </span> </div> <div class="bxec-popup-row-bordered bxec-popup-repeat-details"> <label for="<?php echo $id_; ?> edit-ev-rep-diap-to" style="display: inline-block; margin: 8px 3px 0 0; vertical-align:top;"><?php echo GetMessage('EC_T_DIALOG_STOP_REPEAT'); ?> :</label> <input class="calendar-inp calendar-inp-cal" id="<?php echo $id; ?> edit-ev-rep-diap-to" type="text" style="width: 150px;"/> </div> </div> <div class="bxec-popup-row-title"><?php echo GetMessage('EC_EDEV_ADD_TAB'); ?> </div> <div class="bxec-popup-row-2"> <?php echo GetMessage('EC_IMPORTANCE_TITLE'); ?> : <select id="<?php echo $id; ?> _bxec_importance" class="calendar-select" name="importance" style="width: 250px;"> <option value="high" style="font-weight: bold;"><?php echo GetMessage('EC_IMPORTANCE_H'); ?> </option> <option value="normal" selected="true"><?php echo GetMessage('EC_IMPORTANCE_N'); ?> </option> <option value="low" style="color: #909090;"><?php echo GetMessage('EC_IMPORTANCE_L'); ?> </option> </select> </div> <?php if ($Params['type'] == 'user') { ?> <div class="bxec-popup-row-bordered bxec-popup-row-private"> <input id="<?php echo $id; ?> _bxec_private" type="checkbox" value="Y" title="<?php echo GetMessage('EC_PRIVATE_NOTICE'); ?> " name="private_event"> <label for="<?php echo $id; ?> _bxec_private" title="<?php echo GetMessage('EC_PRIVATE_NOTICE'); ?> "><?php echo GetMessage('EC_PRIVATE_EVENT'); ?> </label> <div><?php echo GetMessage('EC_PRIVATE_NOTICE'); ?> </div> </div> <?php } ?> <!-- Color --> <div class="bxec-popup-row-bordered bxec-popup-row-color"> <input id="<?php echo $id; ?> _bxec_color" type="hidden" value="" name="color" /> <input id="<?php echo $id; ?> _bxec_text_color" type="hidden" value="" name="text_color" /> <label class="bxec-color-label" for="<?php echo $id; ?> -event-color-inp"><?php echo GetMessage('EC_T_COLOR'); ?> :</label> <div class="bxec-color-selector-cont"> <?php CCalendarSceleton::DisplayColorSelector($id, 'event'); ?> </div> </div> <!-- Userfields --> <?php if (isset($UF['UF_CRM_CAL_EVENT'])) { ?> <div id="<?php echo $id; ?> bxec_uf_group" class="bxec-popup-row-bordered"> <?php $crmUF = $UF['UF_CRM_CAL_EVENT']; ?> <label for="event-crm<?php echo $id; ?> " class="bxec-uf-crm-label"><?php echo htmlspecialcharsbx($crmUF["EDIT_FORM_LABEL"]); ?> :</label> <div class="bxec-uf-crm-cont"> <?php $APPLICATION->IncludeComponent("bitrix:system.field.edit", $crmUF["USER_TYPE"]["USER_TYPE_ID"], array("bVarsFromForm" => false, "arUserField" => $crmUF, "form_name" => 'event_edit_form'), null, array("HIDE_ICONS" => "Y")); ?> </div> </div> <?php } ?> </div> <?php /* ####### END TAB 3 ####### */ ?> </div> </div> </form> <?php }
$regularityV = $_REQUEST["regularity"]; $regularityCountV = $_REQUEST["regularity_count"]; $regularityEndV = $_REQUEST["regularity_end"]; $regularityAdditionalV = $_REQUEST["regularity_additional"]; if (StrLen($startDateV) <= 0) { $errorMessage .= GetMessage("INTASK_C29_EMPTY_DATE") . ". "; } else { $startDateVTmp = Date($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATE), MakeTimeStamp($startDateV, FORMAT_DATE)); if ($startDateVTmp != $startDateV) { $errorMessage .= Str_Replace("#FORMAT#", $GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATE), GetMessage("INTASK_C29_WRONG_DATE")) . ". "; } } if (StrLen($startTimeV) <= 0) { $errorMessage .= GetMessage("INTASK_C29_EMPTY_TIME") . ". "; } else { if (IsAmPmMode()) { $startTimeV = str_replace(':', ' ', $startTimeV); $arStartTimeVTmp = Explode(" ", $startTimeV); if ($arStartTimeVTmp[0] < 12 && $arStartTimeVTmp[2] == 'pm') { $arStartTimeVTmp[0] += 12; } elseif ($arStartTimeVTmp[0] == 12 && $arStartTimeVTmp[2] == 'am') { $arStartTimeVTmp[0] = 0; } unset($arStartTimeVTmp[2]); } else { $arStartTimeVTmp = Explode(":", $startTimeV); } if (Count($arStartTimeVTmp) != 2 || IntVal($arStartTimeVTmp[0]) > 23 || IntVal($arStartTimeVTmp[0]) < 0 || $arStartTimeVTmp[1] != "00" && $arStartTimeVTmp[1] != "30") { $errorMessage .= Str_Replace("#FORMAT#", GetMessage("INTASK_C29_HM"), GetMessage("INTASK_C29_WRONG_TIME")) . ". "; } }
"><?php echo htmlspecialcharsbx($crmUF["EDIT_FORM_LABEL"]); ?> </label> </td> <td class="feed-cal-addit-right-c"> <?php $APPLICATION->IncludeComponent("bitrix:system.field.edit", $crmUF["USER_TYPE"]["USER_TYPE_ID"], array("bVarsFromForm" => false, "arUserField" => $crmUF, "form_name" => $arParams["FORM_ID"]), null, array("HIDE_ICONS" => "Y")); ?> </td> </tr> <?php } ?> </table> </div> <span id="feed-cal-additional-hide" class="feed-event-more-link-open"><span class="feed-event-more-link-text"><?php echo GetMessage('ECLF_HIDE_ADD_SECT'); ?> </span><span class="feed-event-more-link-icon"></span></span> </div> </div> <script> window.oEditEventManager = new window.EditEventManager(<?php echo CUtil::PhpToJSObject(array('id' => $id, 'editorId' => $arParams["JS_OBJECT_NAME"], 'arEvent' => $arParams['EVENT'], 'bAMPM' => IsAmPmMode(), 'message' => array('NoLimits' => GetMessageJS('EC_T_DIALOG_NEVER')))); ?> ); </script> </div>
function Show($arParams) { CClock::Init($arParams); // Show input switch ($arParams['view']) { case 'label': ?> <input type="hidden" id="<?php echo $arParams['inputId']; ?> " name="<?php echo $arParams['inputName']; ?> " value="<?php echo $arParams['initTime']; ?> "> <div id=class="bx-clock-label" onmouseover="this.className='bx-clock-label-over';" onmouseout="this.className='bx-clock-label';" onclick=""><?php echo $arParams['initTime'] ? $arParams['initTime'] : 'Time'; ?> </div><?php break; case 'select': ?> <select id="<?php echo $arParams['inputId']; ?> " name="<?php echo $arParams['inputName']; ?> "> <?php for ($i = 0; $i < 24; $i++) { $h = $i < 10 ? '0' . $i : $i; ?> <option value="<?php echo $h; ?> :00"><?php echo $h; ?> :00</option><?php if ($arParams['step']) { ?> <option value="<?php echo $h; ?> :30"><?php echo $h; ?> :30</option><?php } } ?> </select> <?php break; case 'inline': ?> <input type="hidden" id="<?php echo $arParams['inputId']; ?> " name="<?php echo $arParams['inputName']; ?> " value="<?php echo $arParams['initTime']; ?> " /> <div id="<?php echo $arParams['inputId']; ?> _clock"></div> <script type="text/javascript"> if (!window.bxClockLoaders) { window.bxClockLoaders = []; window.onload = function() { for (var i=0; i<window.bxClockLoaders.length; i++) setTimeout(window.bxClockLoaders[i], 20*i + 20); window.bxClockLoaders = null; } } window.bxClockLoaders.push("bxShowClock_<?php echo $arParams['inputId']; ?> ('<?php echo $arParams['inputId']; ?> _clock');"); </script> <?php break; default: //input ?> <input id="<?php echo $arParams['inputId']; ?> " name="<?php echo $arParams['inputName']; ?> " type="text" value="<?php echo $arParams['initTime']; ?> " size="<?php echo IsAmPmMode() ? 6 : 4; ?> " title="<?php echo $arParams['inputTitle']; ?> " /><?php break; } // Show icon if ($arParams['showIcon'] !== false) { ?> <a href="javascript:void(0);" onclick="bxShowClock_<?php echo $arParams['inputId']; ?> ()" title="<?php echo GetMessage('BX_CLOCK_TITLE'); ?> " onmouseover="this.className='bxc-icon-hover';" onmouseout="this.className='';"><img id="<?php echo $arParams['inputId']; ?> _icon" src="/bitrix/images/1.gif" class="bx-clock-icon bxc-iconkit-c"></a><?php } //Init JS and append CSS ?> <script> function bxc_load_css() { if (!window.BXClockStyles) window.BXClockStyles = jsUtils.loadCSSFile(['<?php echo CUtil::GetAdditionalFileURL("/bitrix/themes/.default/clock.css"); ?> ']); } if (!window.phpVars) phpVars = {ADMIN_THEME_ID:'.default'}; if (!window.jsUtils) { setTimeout(function(){ var oScript = document.body.appendChild(document.createElement('script')); oScript.src = '/bitrix/js/main/utils.js'; if (document.attachEvent && navigator.userAgent.toLowerCase().indexOf('opera') == -1) oScript.onreadystatechange = function(){if (oScript.readyState == 'loaded'){bxc_load_css();}}; else oScript.onload = function(){setTimeout(bxc_load_css, 50);}; }, 50); } else { bxc_load_css(); } function bxLoadClock_<?php echo $arParams['inputId']; ?> (callback) { if (!window.JCClock && !window.jsUtils) { return setTimeout(function(){bxLoadClock_<?php echo $arParams['inputId']; ?> (callback);}, 50); } if (!window.JCClock) { return jsUtils.loadJSFile(['<?php echo CUtil::GetAdditionalFileURL("/bitrix/js/main/clock.js"); ?> '], function() {bxLoadClock_<?php echo $arParams['inputId']; ?> (callback)}); } var obId = 'bxClock_<?php echo $arParams['inputId']; ?> '; if (!window[obId]) window[obId] = new JCClock({ step: <?php echo $arParams['step']; ?> , initTime: '<?php echo $arParams['initTime']; ?> ', showIcon: <?php echo $arParams['showIcon'] ? 'true' : 'false'; ?> , inputId: '<?php echo $arParams['inputId']; ?> ', iconId: '<?php echo $arParams['inputId'] . '_icon'; ?> ', zIndex: <?php echo isset($arParams['zIndex']) ? intval($arParams['zIndex']) : 0; ?> , AmPmMode: <?php echo $arParams['am_pm_mode'] ? 'true' : 'false'; ?> , MESS: { Insert: '<?php echo GetMessageJS('BX_CLOCK_INSERT'); ?> ', Close: '<?php echo GetMessageJS('BX_CLOCK_CLOSE'); ?> ', Hours: '<?php echo GetMessageJS('BX_CLOCK_HOURS'); ?> ', Minutes: '<?php echo GetMessageJS('BX_CLOCK_MINUTES'); ?> ', Up: '<?php echo GetMessageJS('BX_CLOCK_UP'); ?> ', Down: '<?php echo GetMessageJS('BX_CLOCK_DOWN'); ?> ' } }); return callback.apply(window, [window[obId]]); } function bxShowClock_<?php echo $arParams['inputId']; ?> (id) { bxLoadClock_<?php echo $arParams['inputId']; ?> (function(obClock) { obClock.Show(id); }); } </script><?php }
protected static function plannerActionShow($arParams) { global $DB, $USER; $res = false; if ($arParams['ID'] > 0) { $event = self::getEvent(array('ID' => $arParams['ID'], 'SITE_ID' => $arParams['SITE_ID'])); if ($event) { $today = ConvertTimeStamp(time() + CTimeZone::GetOffset(), 'SHORT'); $now = time(); $res = array('ID' => $event['ID'], 'NAME' => $event['NAME'], 'DESCRIPTION' => CCalendarEvent::ParseText($event['DETAIL_TEXT'], $event['ID'], $event['UF_WEBDAV_CAL_EVENT']), 'URL' => '/company/personal/user/' . $USER->GetID() . '/calendar/?EVENT_ID=' . $event['ID'], 'DATE_FROM' => MakeTimeStamp($event['DATE_FROM']), 'DATE_TO' => MakeTimeStamp($event['DATE_TO']), 'STATUS' => $event['STATUS']); $res['DATE_FROM_TODAY'] = ConvertTimeStamp(MakeTimeStamp($res['DATE_FROM']), 'SHORT') == $today; $res['DATE_TO_TODAY'] = ConvertTimeStamp(MakeTimeStamp($res['DATE_TO']), 'SHORT') == $today; if ($res['DATE_FROM_TODAY']) { if (IsAmPmMode()) { $res['DATE_F'] = FormatDate("today g:i a", $res['DATE_FROM']); $res['DATE_T'] = FormatDate("g:i a", $res['DATE_TO']); } else { $res['DATE_F'] = FormatDate("today H:i", $res['DATE_FROM']); $res['DATE_T'] = FormatDate("H:i", $res['DATE_TO']); } if ($res['DATE_TO_TODAY']) { $res['DATE_F'] .= ' - ' . $res['DATE_T']; } if ($res['DATE_FROM'] > $now) { $res['DATE_F_TO'] = GetMessage('TM_IN') . ' ' . FormatDate('Hdiff', time() * 2 - ($res['DATE_FROM'] - CTimeZone::GetOffset())); } } else { if ($res['DATE_TO_TODAY']) { $res['DATE_F'] = FormatDate(str_replace(array('#today#', '#time#'), array('today', 'H:i'), GetMessage('TM_TILL')), $res['DATE_TO']); } else { $fmt = preg_replace('/:s$/', '', $DB->DateFormatToPHP(CSite::GetDateFormat("FULL"))); $res['DATE_F'] = FormatDate($fmt, $res['DATE_FROM']); $res['DATE_F_TO'] = FormatDate($fmt, $res['DATE_TO']); } } if ($event['IS_MEETING'] == 'Y') { $arGuests = array('Y' => array(), 'N' => array(), 'Q' => array()); foreach ($event['GUESTS'] as $key => $guest) { $guest['url'] = str_replace(array('#ID#', '#USER_ID#'), $guest['id'], COption::GetOptionString('intranet', 'path_user', '/company/personal/user/#USER_ID#/', $arParams['SITE_ID'])); if ($guest['bHost']) { $res['HOST'] = $guest; } else { $arGuests[$guest['status']][] = $guest; } } $res['GUESTS'] = array_merge($arGuests['Y'], $arGuests['N'], $arGuests['Q']); } if (strlen($res['DESCRIPTION']) > 150) { $res['DESCRIPTION'] = CUtil::closetags(substr($res['DESCRIPTION'], 0, 150)) . '...'; } $res = array('EVENT' => $res); } } else { $res = array('error' => 'event not found'); } return $res; }
$APPLICATION->DelGroupRight($module_id, array($zr["ID"])); } CGroup::SetTasksForModule($module_id, array()); COption::SetOptionString($module_id, "GROUP_DEFAULT_TASK", CTask::GetIdByLetter('N', $module_id)); COption::SetOptionString($module_id, "GROUP_DEFAULT_RIGHT", "N"); } else { foreach ($arAllModuleOptions as $tab => $arAllOptions) { foreach ($arAllOptions as $opt => $arOptDef) { // if (true isset($_REQUEST[$opt])) // { $value = trim($_REQUEST[$opt]); switch ($arOptDef[1]) { case 'time': if (strlen($value) > 0) { list($hour, $min) = explode(':', $value, 2); if (IsAmPmMode() && preg_match('/(am|pm)/i', $min, $match)) { $ampm = strtolower($match[0]); if ($ampm == 'pm' && $hour < 12) { $hour += 12; } elseif ($ampm == 'am' && $hour == 12) { $hour = 0; } } $value = abs($hour * 3600 + $min * 60); if ($value >= 86400) { $value = 86399; } } else { $value = 0; } case 'int':
function __SLEGetLogCommentRecord($arComments, $arParams, $arCurrentUserSubscribe, $bTooltip = true) { // for the same post log_update - time only, if not - date and time $dateFormated = FormatDate($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATE), MakeTimeStamp(array_key_exists("LOG_DATE_FORMAT", $arComments) ? $arComments["LOG_DATE_FORMAT"] : $arComments["LOG_DATE"])); $timeFormated = FormatDateFromDB(array_key_exists("LOG_DATE_FORMAT", $arComments) ? $arComments["LOG_DATE_FORMAT"] : $arComments["LOG_DATE"], stripos($arParams["DATE_TIME_FORMAT"], 'a') || ($arParams["DATE_TIME_FORMAT"] == 'FULL' && IsAmPmMode()) !== false ? 'H:MI T' : 'HH:MI'); $dateTimeFormated = FormatDate(!empty($arParams['DATE_TIME_FORMAT']) ? $arParams['DATE_TIME_FORMAT'] == 'FULL' ? $GLOBALS['DB']->DateFormatToPHP(str_replace(':SS', '', FORMAT_DATETIME)) : $arParams['DATE_TIME_FORMAT'] : $GLOBALS['DB']->DateFormatToPHP(FORMAT_DATETIME), MakeTimeStamp(array_key_exists("LOG_DATE_FORMAT", $arComments) ? $arComments["LOG_DATE_FORMAT"] : $arComments["LOG_DATE"])); if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) { $dateFormated = ToLower($dateFormated); $dateTimeFormated = ToLower($dateTimeFormated); } // strip current year if (!empty($arParams['DATE_TIME_FORMAT']) && ($arParams['DATE_TIME_FORMAT'] == 'j F Y G:i' || $arParams['DATE_TIME_FORMAT'] == 'j F Y g:i a')) { $dateTimeFormated = ltrim($dateTimeFormated, '0'); $curYear = date('Y'); $dateTimeFormated = str_replace(array('-' . $curYear, '/' . $curYear, ' ' . $curYear, '.' . $curYear), '', $dateTimeFormated); } if ($arComments["ENTITY_TYPE"] == SONET_ENTITY_GROUP) { $path2Entity = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arComments["ENTITY_ID"])); } else { $path2Entity = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComments["ENTITY_ID"])); } if (intval($arComments["USER_ID"]) > 0) { $suffix = is_array($GLOBALS["arExtranetUserID"]) && in_array($arComments["USER_ID"], $GLOBALS["arExtranetUserID"]) ? GetMessage("SONET_LOG_EXTRANET_SUFFIX") : ""; $arTmpUser = array("NAME" => $arComments["~CREATED_BY_NAME"], "LAST_NAME" => $arComments["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arComments["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arComments["~CREATED_BY_LOGIN"]); $bUseLogin = $arParams["SHOW_LOGIN"] != "N" ? true : false; $arCreatedBy = array("FORMATTED" => CUser::FormatName($arParams["NAME_TEMPLATE"], $arTmpUser, $bUseLogin) . $suffix, "URL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComments["USER_ID"], "id" => $arComments["USER_ID"]))); if ($bTooltip) { $arCreatedBy["TOOLTIP_FIELDS"] = array("ID" => $arComments["USER_ID"], "NAME" => $arComments["~CREATED_BY_NAME"], "LAST_NAME" => $arComments["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arComments["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arComments["~CREATED_BY_LOGIN"], "USE_THUMBNAIL_LIST" => "N", "PATH_TO_SONET_MESSAGES_CHAT" => $arParams["PATH_TO_MESSAGES_CHAT"], "PATH_TO_SONET_USER_PROFILE" => $arParams["PATH_TO_USER"], "PATH_TO_VIDEO_CALL" => $arParams["PATH_TO_VIDEO_CALL"], "DATE_TIME_FORMAT" => $arParams["DATE_TIME_FORMAT"], "SHOW_YEAR" => $arParams["SHOW_YEAR"], "CACHE_TYPE" => $arParams["CACHE_TYPE"], "CACHE_TIME" => $arParams["CACHE_TIME"], "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"] . $suffix, "SHOW_LOGIN" => $arParams["SHOW_LOGIN"], "PATH_TO_CONPANY_DEPARTMENT" => $arParams["PATH_TO_CONPANY_DEPARTMENT"], "INLINE" => "Y"); } } else { $arCreatedBy = array("FORMATTED" => GetMessage("SONET_C73_CREATED_BY_ANONYMOUS")); } $arTmpUser = array("NAME" => $arComments["~USER_NAME"], "LAST_NAME" => $arComments["~USER_LAST_NAME"], "SECOND_NAME" => $arComments["~USER_SECOND_NAME"], "LOGIN" => $arComments["~USER_LOGIN"]); $arParamsTmp = $arParams; $arParamsTmp["AVATAR_SIZE"] = $arParams["AVATAR_SIZE_COMMENT"]; $arTmpCommentEvent = array("EVENT" => $arComments, "LOG_DATE" => $arComments["LOG_DATE"], "LOG_DATE_TS" => MakeTimeStamp($arComments["LOG_DATE"]), "LOG_DATE_DAY" => ConvertTimeStamp(MakeTimeStamp($arComments["LOG_DATE"]), "SHORT"), "LOG_TIME_FORMAT" => $timeFormated, "TITLE_TEMPLATE" => "", "TITLE" => "", "TITLE_FORMAT" => "", "ENTITY_NAME" => $arComments["ENTITY_TYPE"] == SONET_ENTITY_GROUP ? $arComments["GROUP_NAME"] : CUser::FormatName($arParams['NAME_TEMPLATE'], $arTmpUser, $bUseLogin), "ENTITY_PATH" => $path2Entity, "CREATED_BY" => $arCreatedBy, "AVATAR_SRC" => CSocNetLogTools::FormatEvent_CreateAvatar($arComments, $arParamsTmp)); // if (is_array($arCurrentUserSubscribe) && $arParams["USER_COMMENTS"] != "Y") // $arTmpCommentEvent["TRANSPORT"] = __SLEGetTransport($arComments, $arCurrentUserSubscribe); $arEvent = CSocNetLogTools::FindLogCommentEventByID($arComments["EVENT_ID"]); if ($arEvent && array_key_exists("CLASS_FORMAT", $arEvent) && array_key_exists("METHOD_FORMAT", $arEvent)) { if ($arParams["USER_COMMENTS"] == "Y") { $arLog = array(); } else { $arLog = array("TITLE" => $arComments["~LOG_TITLE"], "URL" => $arComments["~LOG_URL"], "PARAMS" => $arComments["~LOG_PARAMS"]); } $arFIELDS_FORMATTED = call_user_func(array($arEvent["CLASS_FORMAT"], $arEvent["METHOD_FORMAT"]), $arComments, $arParams, false, $arLog); if ($arParams["USE_COMMENTS"] != "Y") { if (array_key_exists("CREATED_BY", $arFIELDS_FORMATTED) && is_array($arFIELDS_FORMATTED["CREATED_BY"]) && array_key_exists("TOOLTIP_FIELDS", $arFIELDS_FORMATTED["CREATED_BY"])) { $arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"] = $arFIELDS_FORMATTED["CREATED_BY"]["TOOLTIP_FIELDS"]; } // $arTmpCommentEvent["ENTITY"] = $arFIELDS_FORMATTED["ENTITY"]; } } $message = $arFIELDS_FORMATTED && array_key_exists("EVENT_FORMATTED", $arFIELDS_FORMATTED) && array_key_exists("MESSAGE", $arFIELDS_FORMATTED["EVENT_FORMATTED"]) ? $arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"] : $arTmpCommentEvent["EVENT"]["MESSAGE"]; if (strlen($message) > 0) { $arFIELDS_FORMATTED["EVENT_FORMATTED"]["FULL_MESSAGE_CUT"] = CSocNetTextParser::closetags(htmlspecialcharsback($message)); } if (is_array($arTmpCommentEvent)) { if ($arTmpCommentEvent["LOG_DATE_DAY"] == ConvertTimeStamp()) { $arFIELDS_FORMATTED["EVENT_FORMATTED"]["DATETIME"] = $timeFormated; } else { $arFIELDS_FORMATTED["EVENT_FORMATTED"]["DATETIME"] = $dateTimeFormated; } $arTmpCommentEvent["EVENT_FORMATTED"] = $arFIELDS_FORMATTED["EVENT_FORMATTED"]; if (isset($arTmpCommentEvent["EVENT_FORMATTED"]) && is_array($arTmpCommentEvent["EVENT_FORMATTED"])) { $arFields2Cache = array("DATETIME", "MESSAGE", "FULL_MESSAGE_CUT", "ERROR_MSG"); foreach ($arTmpCommentEvent["EVENT_FORMATTED"] as $field => $value) { if (!in_array($field, $arFields2Cache)) { unset($arTmpCommentEvent["EVENT_FORMATTED"][$field]); } } } if (isset($arTmpCommentEvent["EVENT"]) && is_array($arTmpCommentEvent["EVENT"])) { $arFields2Cache = array("ID", "USER_ID", "LOG_DATE", "RATING_TYPE_ID", "RATING_ENTITY_ID"); foreach ($arTmpCommentEvent["EVENT"] as $field => $value) { if (!in_array($field, $arFields2Cache)) { unset($arTmpCommentEvent["EVENT"][$field]); } } } if (isset($arTmpCommentEvent["CREATED_BY"]) && is_array($arTmpCommentEvent["CREATED_BY"])) { $arFields2Cache = array("TOOLTIP_FIELDS", "FORMATTED", "URL"); foreach ($arTmpCommentEvent["CREATED_BY"] as $field => $value) { if (!in_array($field, $arFields2Cache)) { unset($arTmpCommentEvent["CREATED_BY"][$field]); } } if (isset($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"]) && is_array($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"])) { $arFields2Cache = array("ID", "PATH_TO_SONET_USER_PROFILE", "NAME", "LAST_NAME", "SECOND_NAME", "LOGIN", "EMAIL"); foreach ($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"] as $field => $value) { if (!in_array($field, $arFields2Cache)) { unset($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"][$field]); } } } } } foreach ($arTmpCommentEvent["EVENT"] as $key => $value) { if (strpos($key, "~") === 0) { unset($arTmpCommentEvent["EVENT"][$key]); } } return $arTmpCommentEvent; }
"><?php echo htmlspecialcharsbx($crmUF["EDIT_FORM_LABEL"]); ?> </label> </td> <td class="feed-cal-addit-right-c"> <?php $APPLICATION->IncludeComponent("bitrix:system.field.edit", $crmUF["USER_TYPE"]["USER_TYPE_ID"], array("bVarsFromForm" => false, "arUserField" => $crmUF, "form_name" => $arParams["FORM_ID"]), null, array("HIDE_ICONS" => "Y")); ?> </td> </tr> <?php } ?> </table> </div> <span id="feed-cal-additional-hide" class="feed-event-more-link-open"><span class="feed-event-more-link-text"><?php echo GetMessage('ECLF_HIDE_ADD_SECT'); ?> </span><span class="feed-event-more-link-icon"></span></span> </div> </div> <script> window.oEditEventManager = new window.EditEventManager(<?php echo CUtil::PhpToJSObject(array('id' => $id, 'editorId' => $arParams["JS_OBJECT_NAME"], 'arEvent' => $arParams['EVENT'], 'bAMPM' => IsAmPmMode(), 'userTimezoneName' => $arParams["USER_TIMEZONE_NAME"], 'userTimezoneDefault' => $arParams["USER_TIMEZONE_DEFAULT"], 'meetingRooms' => $arParams["MEETING_ROOMS"], 'message' => array('NoLimits' => GetMessageJS('EC_T_DIALOG_NEVER'), 'eventTzHint' => GetMessageJS('EC_EVENT_TZ_HINT'), 'eventTzDefHint' => GetMessageJS('EC_EVENT_TZ_DEF_HINT'), 'SelectMR' => GetMessageJS('EC_PL_SEL_MEET_ROOM'), 'OpenMRPage' => GetMessageJS('EC_PL_OPEN_MR_PAGE'), 'MRNotReservedErr' => GetMessageJS('EC_MR_RESERVE_ERR_BUSY'), 'MRReserveErr' => GetMessageJS('EC_MR_RESERVE_ERR')))); ?> ); </script> </div>
$arResult["commentText"] = $comment_text; } } else { $arResult["strMessage"] = GetMessage("SONET_LOG_COMMENT_EMPTY"); } } else { $arResult["strMessage"] = GetMessage("SONET_LOG_COMMENT_NO_PERMISSIONS"); } } } } elseif ($action == "get_comment") { $comment_id = $_REQUEST["cid"]; if ($arComment = CSocNetLogComments::GetByID($comment_id)) { $arParams["DATE_TIME_FORMAT"] = $_REQUEST["dtf"]; $dateFormated = FormatDate($GLOBALS['DB']->DateFormatToPHP(FORMAT_DATE), MakeTimeStamp($arComment["LOG_DATE"])); $timeFormated = FormatDateFromDB($arComment["LOG_DATE"], stripos($arParams["DATE_TIME_FORMAT"], 'a') || ($arParams["DATE_TIME_FORMAT"] == 'FULL' && IsAmPmMode()) !== false ? 'H:MI T' : 'HH:MI'); $dateTimeFormated = FormatDate(!empty($arParams['DATE_TIME_FORMAT']) ? $arParams['DATE_TIME_FORMAT'] == 'FULL' ? $GLOBALS['DB']->DateFormatToPHP(str_replace(':SS', '', FORMAT_DATETIME)) : $arParams['DATE_TIME_FORMAT'] : $GLOBALS['DB']->DateFormatToPHP(FORMAT_DATETIME), MakeTimeStamp($arComment["LOG_DATE"])); if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) { $dateFormated = ToLower($dateFormated); $dateTimeFormated = ToLower($dateTimeFormated); } // strip current year if (!empty($arParams['DATE_TIME_FORMAT']) && ($arParams['DATE_TIME_FORMAT'] == 'j F Y G:i' || $arParams['DATE_TIME_FORMAT'] == 'j F Y g:i a')) { $dateTimeFormated = ltrim($dateTimeFormated, '0'); $curYear = date('Y'); $dateTimeFormated = str_replace(array('-' . $curYear, '/' . $curYear, ' ' . $curYear, '.' . $curYear), '', $dateTimeFormated); } if (intval($arComment["USER_ID"]) > 0) { $arParams = array("PATH_TO_USER" => $_REQUEST["p_user"], "NAME_TEMPLATE" => $_REQUEST["nt"], "SHOW_LOGIN" => $_REQUEST["sl"], "AVATAR_SIZE" => $as, "PATH_TO_SMILE" => $_REQUEST["p_smile"]); $arUser = array("ID" => $arComment["USER_ID"], "NAME" => $arComment["~CREATED_BY_NAME"], "LAST_NAME" => $arComment["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arComment["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arComment["~CREATED_BY_LOGIN"], "PERSONAL_PHOTO" => $arComment["~CREATED_BY_PERSONAL_PHOTO"], "PERSONAL_GENDER" => $arComment["~CREATED_BY_PERSONAL_GENDER"]); $bUseLogin = $arParams["SHOW_LOGIN"] != "N" ? true : false;
function tasksTimeCutZeros($time) { if (IsAmPmMode()) { return trim(substr($time, 11, 11) == "12:00:00 am" ? substr($time, 0, 10) : substr($time, 0, 22)); } else { return substr($time, 11, 8) == "00:00:00" ? substr($time, 0, 10) : substr($time, 0, 16); } }
?> "><?php echo htmlspecialcharsbx(GetMessage('MI_MEETING_TITLE', array('#ID#' => $arInstance['MEETING_ID'], '#TITLE#' => $arInstance['MEETING']['TITLE']))); ?> </a></td> </tr> <?php if ($arInstance['MEETING']['DATE_START'] && MakeTimeStamp($arInstance['MEETING']['DATE_START']) > 0) { ?> <tr class="meeting-ques-info-top"> <td class="meeting-ques-left"><?php echo GetMessage('MI_REPORT_DATE_START'); ?> :</td> <td class="meeting-ques-right"><?php echo FormatDate($DB->DateFormatToPhp(FORMAT_DATE) . (IsAmPmMode() ? ' h:i a' : ' H:i'), MakeTimeStamp($arInstance['MEETING']['DATE_START'])); ?> </td> </tr> <?php } ?> <tr class="meeting-ques-info-top meeting-ques-info-top-last"> <td class="meeting-ques-left"><?php echo GetMessage('MI_REPORT_STATE'); ?> :</td> <td class="meeting-ques-right"><?php echo GetMessage("MEETING_STATE_" . $arInstance['MEETING']['CURRENT_STATE']); ?> </td>
$fromDate->add('-1 hour'); $toDate = clone $fromDate; $toDate->add('+25 hour'); $interval = 'hour'; $dateFormat = 'Y-m-d H:00:00'; $axisDateFormat = "H"; $axisCursorDateFormat = "d M Y\n" . (IsAmPmMode() ? "g:i a" : "H:i"); break; default: // for today, from 00:00 till 23:59 $fromDate = Type\DateTime::createFromTimestamp(mktime(-1, 0, 0)); $toDate = Type\DateTime::createFromTimestamp(mktime(24, 0, 0)); $interval = 'hour'; $dateFormat = 'Y-m-d H:00:00'; $axisDateFormat = "H"; $axisCursorDateFormat = array("today" => "today, " . (IsAmPmMode() ? "g:i a" : "H:i")); } $fromDateServer = clone $fromDate; $toDateServer = clone $toDate; if ($interval == 'hour') { // with timezones $userTimeOffset = CTimeZone::GetOffset(); $fromUserTimeInterval = -$userTimeOffset . ' seconds'; $fromDateServer->add($fromUserTimeInterval); $toDateServer->add($fromUserTimeInterval); } if (empty($arParams['USER_ID'])) { $arParams['USER_ID'] = $USER->getId(); } $sumActivity = 0; $sumAvgCompanyActivity = 0;
public static function FormatTimeOut($ts) { $ts = MakeTimeStamp(ConvertTimeStamp()) + $ts % 86400; return FormatDate(IsAmPmMode() ? 'h:i a' : 'H:i', $ts); }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } $bHasTitle = true; if (strlen($arResult['MEETING']['TITLE']) <= 0) { $arResult['MEETING']['TITLE'] = GetMessage('ME_TITLE_DEFAULT'); $bHasTitle = false; } $tdef = htmlspecialcharsbx(CUtil::JSEscape(GetMessage('ME_TITLE_DEFAULT'))); if ($arResult['MEETING']['DATE_START'] && MakeTimeStamp($arResult['MEETING']['DATE_START']) > 0) { $date = MakeTimeStamp($arResult['MEETING']['DATE_START']); $date_date = FormatDateFromDB(ConvertTimeStamp($date, 'SHORT'), 'SHORT'); $date_time = FormatDate(IsAmPmMode() ? 'h:i a' : 'H:i', $date); } else { $date = $date_date = $date_time = ''; } $duration = intval($arResult['MEETING']['DURATION']); $duration_coef = 60; if ($duration % 3600 == 0) { $duration_coef = 3600; } $duration = intval($duration / $duration_coef); $keeper = 0; foreach ($arResult['MEETING']['USERS'] as $USER_ID => $USER_ROLE) { if ($USER_ROLE == CMeeting::ROLE_KEEPER) { $keeper = $USER_ID; } } $this->SetViewTarget('pagetitle', 100);
function __SLMAjaxGetComment($comment_id, $arParams, $bCheckRights = false) { if ($arComment = CSocNetLogComments::GetByID($comment_id)) { if ($bCheckRights) { if (strpos($arComment["ENTITY_TYPE"], "CRM") === 0 && IsModuleInstalled("crm")) { $arListParams = array("IS_CRM" => "Y", "CHECK_CRM_RIGHTS" => "Y"); } else { $arListParams = array("CHECK_RIGHTS" => "Y", "USE_SUBSCRIBE" => "N"); } if (intval($arComment["LOG_ID"]) <= 0 || !($rsLog = CSocNetLog::GetList(array(), array("ID" => $arComment["LOG_ID"]), false, false, array("ID"), $arListParams)) || !($arLog = $rsLog->Fetch())) { return false; } } $arParams["DATE_TIME_FORMAT"] = $_REQUEST["dtf"]; $dateFormated = FormatDate($GLOBALS['DB']->DateFormatToPHP(FORMAT_DATE), MakeTimeStamp($arComment["LOG_DATE"])); $timeFormated = FormatDateFromDB($arComment["LOG_DATE"], stripos($arParams["DATE_TIME_FORMAT"], 'a') || ($arParams["DATE_TIME_FORMAT"] == 'FULL' && IsAmPmMode()) !== false ? 'H:MI T' : 'HH:MI'); $dateTimeFormated = FormatDate(!empty($arParams['DATE_TIME_FORMAT']) ? $arParams['DATE_TIME_FORMAT'] == 'FULL' ? $GLOBALS['DB']->DateFormatToPHP(str_replace(':SS', '', FORMAT_DATETIME)) : $arParams['DATE_TIME_FORMAT'] : $GLOBALS['DB']->DateFormatToPHP(FORMAT_DATETIME), MakeTimeStamp($arComment["LOG_DATE"])); if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) { $dateFormated = ToLower($dateFormated); $dateTimeFormated = ToLower($dateTimeFormated); } // strip current year if (!empty($arParams['DATE_TIME_FORMAT']) && ($arParams['DATE_TIME_FORMAT'] == 'j F Y G:i' || $arParams['DATE_TIME_FORMAT'] == 'j F Y g:i a')) { $dateTimeFormated = ltrim($dateTimeFormated, '0'); $curYear = date('Y'); $dateTimeFormated = str_replace(array('-' . $curYear, '/' . $curYear, ' ' . $curYear, '.' . $curYear), '', $dateTimeFormated); } if (intval($arComment["USER_ID"]) > 0) { $arParams = array("PATH_TO_USER" => $_REQUEST["p_user"], "NAME_TEMPLATE" => $_REQUEST["nt"], "SHOW_LOGIN" => $_REQUEST["sl"], "AVATAR_SIZE" => $as, "PATH_TO_SMILE" => $_REQUEST["p_smile"]); $arUser = array("ID" => $arComment["USER_ID"], "NAME" => $arComment["~CREATED_BY_NAME"], "LAST_NAME" => $arComment["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arComment["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arComment["~CREATED_BY_LOGIN"], "PERSONAL_PHOTO" => $arComment["~CREATED_BY_PERSONAL_PHOTO"], "PERSONAL_GENDER" => $arComment["~CREATED_BY_PERSONAL_GENDER"]); $bUseLogin = $arParams["SHOW_LOGIN"] != "N" ? true : false; $arCreatedBy = array("FORMATTED" => CUser::FormatName($arParams["NAME_TEMPLATE"], $arUser, $bUseLogin), "URL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComment["USER_ID"], "id" => $arComment["USER_ID"]))); } else { $arCreatedBy = array("FORMATTED" => GetMessage("SONET_SLM_CREATED_BY_ANONYMOUS")); } $arTmpCommentEvent = array("LOG_DATE" => $arComment["LOG_DATE"], "LOG_DATE_FORMAT" => $arComment["LOG_DATE_FORMAT"], "LOG_DATE_DAY" => ConvertTimeStamp(MakeTimeStamp($arComment["LOG_DATE"]), "SHORT"), "LOG_TIME_FORMAT" => $timeFormated, "MESSAGE" => $arComment["MESSAGE"], "MESSAGE_FORMAT" => $arComment["~MESSAGE"], "CREATED_BY" => $arCreatedBy, "AVATAR_SRC" => CSocNetLogTools::FormatEvent_CreateAvatar($arUser, $arParams, ""), "USER_ID" => $arComment["USER_ID"]); $arEventTmp = CSocNetLogTools::FindLogCommentEventByID($arComment["EVENT_ID"]); if ($arEventTmp && array_key_exists("CLASS_FORMAT", $arEventTmp) && array_key_exists("METHOD_FORMAT", $arEventTmp)) { $arComment["UF"] = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("SONET_COMMENT", $arComment["ID"], LANGUAGE_ID); $arFIELDS_FORMATTED = call_user_func(array($arEventTmp["CLASS_FORMAT"], $arEventTmp["METHOD_FORMAT"]), $arComment, array_merge($arParams, array("MOBILE" => "N", "PATH_TO_USER" => COption::GetOptionString("main", "TOOLTIP_PATH_TO_USER", SITE_DIR . "company/personal/user/#user_id#/", SITE_ID)))); $arTmpCommentEvent["MESSAGE_FORMAT"] = htmlspecialcharsback($arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"]); $arFIELDS_FORMATTED = call_user_func(array($arEventTmp["CLASS_FORMAT"], $arEventTmp["METHOD_FORMAT"]), $arComment, array_merge($arParams, array("MOBILE" => "Y", "PATH_TO_USER" => SITE_DIR . "mobile/users/?user_id=#user_id#"))); $arTmpCommentEvent["MESSAGE_FORMAT_MOBILE"] = htmlspecialcharsback($arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"]); } return $arTmpCommentEvent; } }
$comment_id = $_REQUEST["cid"]; if ($arComment = CSocNetLogComments::GetByID($comment_id)) { $arResult["arComment"] = $arComment; $dateFormated = FormatDate( $GLOBALS['DB']->DateFormatToPHP(FORMAT_DATE), MakeTimeStamp(array_key_exists("LOG_DATE_FORMAT", $arComment) ? $arComment["LOG_DATE_FORMAT"] : $arComment["LOG_DATE"]) ); $timeFormat = (isset($_REQUEST["dtf"]) ? $_REQUEST["dtf"] : CSite::GetTimeFormat()); $timeFormated = FormatDateFromDB( (array_key_exists("LOG_DATE_FORMAT", $arComment) ? $arComment["LOG_DATE_FORMAT"] : $arComment["LOG_DATE"]), (stripos($timeFormat, 'a') || ($timeFormat == 'FULL' && IsAmPmMode()) !== false ? 'H:MI T' : 'HH:MI') ); if (intval($arComment["USER_ID"]) > 0) { $arParams = array( "PATH_TO_USER" => $_REQUEST["p_user"], "NAME_TEMPLATE" => $_REQUEST["nt"], "SHOW_LOGIN" => $_REQUEST["sl"], "AVATAR_SIZE" => $_REQUEST["as"], "PATH_TO_SMILE" => $_REQUEST["p_smile"] ); $arUser = array( "ID" => $arComment["USER_ID"], "NAME" => $arComment["~CREATED_BY_NAME"],
$oneDay = 86400; $todayStartTs = CCalendar::Timestamp(CCalendar::Date(time() + $userOffset, false)); $todayEndTs = $todayStartTs + $oneDay - 1; $tomorrowStartTs = $todayStartTs + $oneDay; $tomorrowEndTs = $tomorrowStartTs + $oneDay - 1; $today = CCalendar::Date(time(), false); $tomorrow = CCalendar::Date(time() + 86400, false); $bToday = false; $bTomorrow = false; $bLater = false; $use_sections = "YES"; $iconEvent = '/bitrix/templates/mobile_app/images/calendar/event.png'; $iconMeeting = '/bitrix/templates/mobile_app/images/calendar/meeting.png'; $iconInviting = '/bitrix/templates/mobile_app/images/calendar/meeting-q.png'; $dateFormat = GetMessage('MB_CAL_EVENT_DATE_FORMAT'); $timeFormat = IsAmPmMode() ? GetMessage('MB_CAL_EVENT_TIME_FORMAT_AMPM') : GetMessage('MB_CAL_EVENT_TIME_FORMAT'); $count = count($arEvents); for ($i = 0; $i < $count; $i++) { $event = $arEvents[$i]; $event['DT_FROM_TS'] = CCalendar::_fixTimestamp($event['DT_FROM_TS']); $event['DT_TO_TS'] = CCalendar::_fixTimestamp($event['DT_TO_TS']); $item = array("ID" => $event['ID'], "NAME" => CMobile::PrepareStrToJson($event['NAME']), "URL" => $url . "?event_id=" . $event['ID']); if ($event['IS_MEETING'] && $event['USER_MEETING']['STATUS'] == 'N') { continue; } if ($event['IS_MEETING']) { $item["IMAGE"] = $event['USER_MEETING']['STATUS'] == 'Q' ? $iconInviting : $iconMeeting; } else { $item["IMAGE"] = $iconEvent; } $bOneDay = $event['DT_LENGTH'] == 86400;
function FormatDate($format="", $timestamp="", $now=false) { global $DB; if($now === false) $now = time(); switch($format) { case "SHORT": $format = $DB->dateFormatToPHP(FORMAT_DATE); break; case "FULL": $format = $DB->dateFormatToPHP(FORMAT_DATETIME); } if(is_array($format)) { $seconds_ago = $now - $timestamp; foreach($format as $format_interval => $format_value) { if($format_interval == "s") { if($seconds_ago < 60) return FormatDate($format_value, $timestamp, $now); } elseif(preg_match('/^s(\d+)/', $format_interval, $match)) { if($seconds_ago < intval($match[1])) return FormatDate($format_value, $timestamp, $now); } elseif($format_interval == "i") { if($seconds_ago < 60*60) return FormatDate($format_value, $timestamp, $now); } elseif(preg_match('/^i(\d+)/', $format_interval, $match)) { if($seconds_ago < intval($match[1])*60) return FormatDate($format_value, $timestamp, $now); } elseif($format_interval == "H") { if($seconds_ago < 24*60*60) return FormatDate($format_value, $timestamp, $now); } elseif(preg_match('/^H(\d+)/', $format_interval, $match)) { if($seconds_ago < intval($match[1])*60*60) return FormatDate($format_value, $timestamp, $now); } elseif($format_interval == "d") { if($seconds_ago < 31*24*60*60) return FormatDate($format_value, $timestamp, $now); } elseif(preg_match('/^d(\d+)/', $format_interval, $match)) { if($seconds_ago < intval($match[1])*60*60) return FormatDate($format_value, $timestamp, $now); } elseif($format_interval == "m") { if($seconds_ago < 365*24*60*60) return FormatDate($format_value, $timestamp, $now); } elseif(preg_match('/^m(\d+)/', $format_interval, $match)) { if($seconds_ago < intval($match[1])*31*24*60*60) return FormatDate($format_value, $timestamp, $now); } elseif($format_interval == "today") { $arNow = localtime($now); //le = number of seconds scince midnight //$le = $arSDate[0]+$arSDate[1]*60+$arSDate[2]*3600; //today_1 = truncate(now) $today_1 = mktime(0, 0, 0, $arNow[4]+1, $arNow[3], $arNow[5]+1900); //today_2 = truncate(now)+1 $today_2 = mktime(0, 0, 0, $arNow[4]+1, $arNow[3]+1, $arNow[5]+1900); if($timestamp >= $today_1 && $timestamp < $today_2) { return FormatDate($format_value, $timestamp, $now); } } elseif($format_interval == "yesterday") { $arNow = localtime($now); //le = number of seconds scince midnight //$le = $arSDate[0]+$arSDate[1]*60+$arSDate[2]*3600; //yesterday_1 = truncate(now)-1 $yesterday_1 = mktime(0, 0, 0, $arNow[4]+1, $arNow[3]-1, $arNow[5]+1900); //yesterday_2 = truncate(now) $yesterday_2 = mktime(0, 0, 0, $arNow[4]+1, $arNow[3], $arNow[5]+1900); if($timestamp >= $yesterday_1 && $timestamp < $yesterday_2) return FormatDate($format_value, $timestamp, $now); } elseif($format_interval == "tommorow") { $arNow = localtime($now); $tommorow_1 = mktime(0, 0, 0, $arNow[4]+1, $arNow[3]+1, $arNow[5]+1900); $tommorow_2 = mktime(0, 0, 0, $arNow[4]+1, $arNow[3]+2, $arNow[5]+1900); if($timestamp >= $tommorow_1 && $timestamp < $tommorow_2) return FormatDate($format_value, $timestamp, $now); } elseif($format_interval == "-") { if($seconds_ago < 0) return FormatDate($format_value, $timestamp, $now); } } return FormatDate(array_pop($format), $timestamp, $now); } $bCutZeroTime = false; if (substr($format, 0, 1) == '^') { $bCutZeroTime = true; $format = substr($format, 1); } $arFormatParts = preg_split("/(sago|iago|isago|Hago|dago|mago|Yago|sdiff|idiff|Hdiff|ddiff|mdiff|Ydiff|yesterday|today|tommorow|X|x|F|f|Q|M|l|D)/", $format, 0, PREG_SPLIT_DELIM_CAPTURE); $result = ""; foreach($arFormatParts as $format_part) { switch($format_part) { case "": break; case "sago": $seconds_ago = intval($now - $timestamp); $result .= _FormatDateMessage($seconds_ago, array( "0" => "FD_SECOND_AGO_0", "1" => "FD_SECOND_AGO_1", "10_20" => "FD_SECOND_AGO_10_20", "MOD_1" => "FD_SECOND_AGO_MOD_1", "MOD_2_4" => "FD_SECOND_AGO_MOD_2_4", "MOD_OTHER" => "FD_SECOND_AGO_MOD_OTHER", )); break; case "sdiff": $seconds_ago = intval($now - $timestamp); $result .= _FormatDateMessage($seconds_ago, array( "0" => "FD_SECOND_DIFF_0", "1" => "FD_SECOND_DIFF_1", "10_20" => "FD_SECOND_DIFF_10_20", "MOD_1" => "FD_SECOND_DIFF_MOD_1", "MOD_2_4" => "FD_SECOND_DIFF_MOD_2_4", "MOD_OTHER" => "FD_SECOND_DIFF_MOD_OTHER", )); break; case "iago": $minutes_ago = intval(($now - $timestamp) / 60); $result .= _FormatDateMessage($minutes_ago, array( "0" => "FD_MINUTE_AGO_0", "1" => "FD_MINUTE_AGO_1", "10_20" => "FD_MINUTE_AGO_10_20", "MOD_1" => "FD_MINUTE_AGO_MOD_1", "MOD_2_4" => "FD_MINUTE_AGO_MOD_2_4", "MOD_OTHER" => "FD_MINUTE_AGO_MOD_OTHER", )); break; case "idiff": $minutes_ago = intval(($now - $timestamp) / 60); $result .= _FormatDateMessage($minutes_ago, array( "0" => "FD_MINUTE_DIFF_0", "1" => "FD_MINUTE_DIFF_1", "10_20" => "FD_MINUTE_DIFF_10_20", "MOD_1" => "FD_MINUTE_DIFF_MOD_1", "MOD_2_4" => "FD_MINUTE_DIFF_MOD_2_4", "MOD_OTHER" => "FD_MINUTE_DIFF_MOD_OTHER", )); break; case "isago": $minutes_ago = intval(($now - $timestamp) / 60); $result .= _FormatDateMessage($minutes_ago, array( "0" => "FD_MINUTE_0", "1" => "FD_MINUTE_1", "10_20" => "FD_MINUTE_10_20", "MOD_1" => "FD_MINUTE_MOD_1", "MOD_2_4" => "FD_MINUTE_MOD_2_4", "MOD_OTHER" => "FD_MINUTE_MOD_OTHER", )); $result .= " "; $seconds_ago = intval($now - $timestamp)-($minutes_ago*60); $result .= _FormatDateMessage($seconds_ago, array( "0" => "FD_SECOND_AGO_0", "1" => "FD_SECOND_AGO_1", "10_20" => "FD_SECOND_AGO_10_20", "MOD_1" => "FD_SECOND_AGO_MOD_1", "MOD_2_4" => "FD_SECOND_AGO_MOD_2_4", "MOD_OTHER" => "FD_SECOND_AGO_MOD_OTHER", )); break; case "Hago": $hours_ago = intval(($now - $timestamp) / 60 / 60); $result .= _FormatDateMessage($hours_ago, array( "0" => "FD_HOUR_AGO_0", "1" => "FD_HOUR_AGO_1", "10_20" => "FD_HOUR_AGO_10_20", "MOD_1" => "FD_HOUR_AGO_MOD_1", "MOD_2_4" => "FD_HOUR_AGO_MOD_2_4", "MOD_OTHER" => "FD_HOUR_AGO_MOD_OTHER", )); break; case "Hdiff": $hours_ago = intval(($now - $timestamp) / 60 / 60); $result .= _FormatDateMessage($hours_ago, array( "0" => "FD_HOUR_DIFF_0", "1" => "FD_HOUR_DIFF_1", "10_20" => "FD_HOUR_DIFF_10_20", "MOD_1" => "FD_HOUR_DIFF_MOD_1", "MOD_2_4" => "FD_HOUR_DIFF_MOD_2_4", "MOD_OTHER" => "FD_HOUR_DIFF_MOD_OTHER", )); break; case "yesterday": $result .= GetMessage("FD_YESTERDAY"); break; case "today": $result .= GetMessage("FD_TODAY"); break; case "tommorow": $result .= GetMessage("FD_TOMORROW"); break; case "dago": $days_ago = intval(($now - $timestamp) / 60 / 60 / 24); $result .= _FormatDateMessage($days_ago, array( "0" => "FD_DAY_AGO_0", "1" => "FD_DAY_AGO_1", "10_20" => "FD_DAY_AGO_10_20", "MOD_1" => "FD_DAY_AGO_MOD_1", "MOD_2_4" => "FD_DAY_AGO_MOD_2_4", "MOD_OTHER" => "FD_DAY_AGO_MOD_OTHER", )); break; case "ddiff": $days_ago = intval(($now - $timestamp) / 60 / 60 / 24); $result .= _FormatDateMessage($days_ago, array( "0" => "FD_DAY_DIFF_0", "1" => "FD_DAY_DIFF_1", "10_20" => "FD_DAY_DIFF_10_20", "MOD_1" => "FD_DAY_DIFF_MOD_1", "MOD_2_4" => "FD_DAY_DIFF_MOD_2_4", "MOD_OTHER" => "FD_DAY_DIFF_MOD_OTHER", )); break; case "mago": $months_ago = intval(($now - $timestamp) / 60 / 60 / 24 / 31); $result .= _FormatDateMessage($months_ago, array( "0" => "FD_MONTH_AGO_0", "1" => "FD_MONTH_AGO_1", "10_20" => "FD_MONTH_AGO_10_20", "MOD_1" => "FD_MONTH_AGO_MOD_1", "MOD_2_4" => "FD_MONTH_AGO_MOD_2_4", "MOD_OTHER" => "FD_MONTH_AGO_MOD_OTHER", )); break; case "mdiff": $months_ago = intval(($now - $timestamp) / 60 / 60 / 24 / 31); $result .= _FormatDateMessage($months_ago, array( "0" => "FD_MONTH_DIFF_0", "1" => "FD_MONTH_DIFF_1", "10_20" => "FD_MONTH_DIFF_10_20", "MOD_1" => "FD_MONTH_DIFF_MOD_1", "MOD_2_4" => "FD_MONTH_DIFF_MOD_2_4", "MOD_OTHER" => "FD_MONTH_DIFF_MOD_OTHER", )); break; case "Yago": $years_ago = intval(($now - $timestamp) / 60 / 60 / 24 / 365); $result .= _FormatDateMessage($years_ago, array( "0" => "FD_YEARS_AGO_0", "1" => "FD_YEARS_AGO_1", "10_20" => "FD_YEARS_AGO_10_20", "MOD_1" => "FD_YEARS_AGO_MOD_1", "MOD_2_4" => "FD_YEARS_AGO_MOD_2_4", "MOD_OTHER" => "FD_YEARS_AGO_MOD_OTHER", )); break; case "Ydiff": $years_ago = intval(($now - $timestamp) / 60 / 60 / 24 / 365); $result .= _FormatDateMessage($years_ago, array( "0" => "FD_YEARS_DIFF_0", "1" => "FD_YEARS_DIFF_1", "10_20" => "FD_YEARS_DIFF_10_20", "MOD_1" => "FD_YEARS_DIFF_MOD_1", "MOD_2_4" => "FD_YEARS_DIFF_MOD_2_4", "MOD_OTHER" => "FD_YEARS_DIFF_MOD_OTHER", )); break; case "F": if(LANGUAGE_ID == "en") $result .= date($format_part, $timestamp); else $result .= GetMessage("MONTH_".date("n", $timestamp)."_S"); break; case "f": if(LANGUAGE_ID == "en") $result .= date($format_part, $timestamp); else $result .= GetMessage("MONTH_".date("n", $timestamp)); break; case "M": if(LANGUAGE_ID == "en") $result .= date($format_part, $timestamp); else $result .= GetMessage("MON_".date("n", $timestamp)); break; case "l": if(LANGUAGE_ID == "en") $result .= date($format_part, $timestamp); else $result .= GetMessage("DAY_OF_WEEK_".date("w", $timestamp)); break; case "D": if(LANGUAGE_ID == "en") $result .= date($format_part, $timestamp); else $result .= GetMessage("DOW_".date("w", $timestamp)); break; case "x": $formats = array(); $formats["tommorow"] = "tommorow, ".(IsAmPmMode() ? "g:i a" : "H:i"); $formats["-"] = preg_replace('/:s$/', '', $DB->DateFormatToPHP(CSite::GetDateFormat("FULL"))); $formats["s"] = "sago"; $formats["i"] = "iago"; $formats["today"] = "today, ".(IsAmPmMode() ? "g:i a" : "H:i"); $formats["yesterday"] = "yesterday, ".(IsAmPmMode() ? "g:i a" : "H:i"); $formats[""] = preg_replace('/:s$/', '', $DB->DateFormatToPHP(CSite::GetDateFormat("FULL"))); $result .= FormatDate($formats, $timestamp, $now); break; case "X": $day = FormatDate(array( "tommorow" => "tommorow", "-" => $DB->DateFormatToPHP(CSite::GetDateFormat("SHORT")), "today" => "today", "yesterday" => "yesterday", "" => $DB->DateFormatToPHP(CSite::GetDateFormat("SHORT")), ), $timestamp, $now); $formats = array(); $formats["tommorow"] = IsAmPmMode() ? "g:i a" : "H:i"; $formats["today"] = IsAmPmMode() ? "g:i a" : "H:i"; $formats["yesterday"] = IsAmPmMode() ? "g:i a" : "H:i"; $formats[""] = ""; $time = FormatDate($formats, $timestamp, $now); if(strlen($time)) $result .= GetMessage("FD_DAY_AT_TIME", array("#DAY#" => $day, "#TIME#" => $time)); else $result .= $day; break; case "Q": $days_ago = intval(($now - $timestamp) / 60 / 60 / 24); if($days_ago == 0) $result .= GetMessage("FD_DAY_DIFF_1", array("#VALUE#" => 1)); else $result .= FormatDate(array( "d" => "ddiff", "m" => "mdiff", "" => "Ydiff", ), $timestamp, $now); break; default: $result .= date($format_part, $timestamp); break; } } if ($bCutZeroTime) $result = preg_replace( array("/\\s*00:00:00\\s*/", "/(\\d\\d:\\d\\d)(:00)/", "/(\\s*00:00\\s*)(?!:)/"), array("", "\\1", ""), $result ); return $result; }
} mt = '<span class="time-am-pm">' + mt + '</span>'; } else hours = BX.util.str_pad(hours, 2, "0", "left"); return '<span class="time-hours">' + hours + '</span>' + '<span class="time-semicolon">:</span>' + '<span class="time-minutes">' + BX.util.str_pad(minutes, 2, "0", "left") + '</span>' + mt; } </script> <div class="timeman-container planner-container<?php echo IsAmPmMode() ? " am-pm-mode" : ""; ?> "><?php ?> <div class="timeman-wrap planner-wrap"><?php ?> <span id="timeman-block" class="timeman-block"><?php ?> <span class="bx-time" id="timeman-timer"><script type="text/javascript">document.write(plannerFormatCurrentTime(new Date().getHours(), new Date().getMinutes()))</script></span><?php ?> <span class="timeman-right-side"><?php ?> <span class="timeman-info" id="timeman-info"></span><?php ?> <span class="timeman-task-time" id="timeman-task-time" style="display: none;"><i></i><span id="timeman-task-timer"></span></span><?php ?>
} $arResult["Post"]["DATE_PUBLISH_FORMATED"] = FormatDateFromDB($arResult["Post"]["DATE_PUBLISH"], $arParams["DATE_TIME_FORMAT"], true); $arResult["Post"]["DATE_PUBLISH_DATE"] = FormatDateFromDB($arResult["Post"]["DATE_PUBLISH"], FORMAT_DATE); if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) { $arResult["Post"]["DATE_PUBLISH_FORMATED"] = ToLower($arResult["Post"]["DATE_PUBLISH_FORMATED"]); $arResult["Post"]["DATE_PUBLISH_DATE"] = ToLower($arResult["Post"]["DATE_PUBLISH_DATE"]); } // strip current year if (!empty($arParams['DATE_TIME_FORMAT_S']) && ($arParams['DATE_TIME_FORMAT_S'] == 'j F Y G:i' || $arParams['DATE_TIME_FORMAT_S'] == 'j F Y g:i a')) { $arResult["Post"]["DATE_PUBLISH_FORMATED"] = ltrim($arResult["Post"]["DATE_PUBLISH_FORMATED"], '0'); $arResult["Post"]["DATE_PUBLISH_DATE"] = ltrim($arResult["Post"]["DATE_PUBLISH_DATE"], '0'); $curYear = date('Y'); $arResult["Post"]["DATE_PUBLISH_FORMATED"] = str_replace(array('-' . $curYear, '/' . $curYear, ' ' . $curYear, '.' . $curYear), '', $arResult["Post"]["DATE_PUBLISH_FORMATED"]); $arResult["Post"]["DATE_PUBLISH_DATE"] = str_replace(array('-' . $curYear, '/' . $curYear, ' ' . $curYear, '.' . $curYear), '', $arResult["Post"]["DATE_PUBLISH_DATE"]); } $arResult["Post"]["DATE_PUBLISH_TIME"] = FormatDateFromDB($arResult["Post"]["DATE_PUBLISH"], strpos($arParams["DATE_TIME_FORMAT_S"], 'a') !== false || ($arParams["DATE_TIME_FORMAT_S"] == 'FULL' && IsAmPmMode()) !== false ? strpos(FORMAT_DATETIME, 'TT') !== false ? 'G:MI TT' : 'G:MI T' : 'GG:MI'); if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) { $arResult["Post"]["DATE_PUBLISH_TIME"] = ToLower($arResult["Post"]["DATE_PUBLISH_TIME"]); } $arResult["arUser"] = CBlogUser::GetUserInfo($arPost["AUTHOR_ID"], $arParams["PATH_TO_USER"], array("AVATAR_SIZE" => isset($arParams["AVATAR_SIZE_COMMON"]) ? $arParams["AVATAR_SIZE_COMMON"] : $arParams["AVATAR_SIZE"], "AVATAR_SIZE_COMMENT" => $arParams["AVATAR_SIZE_COMMENT"])); $arResult["arUser"]["isExtranet"] = intval($arPost["AUTHOR_ID"]) > 0 && is_array($GLOBALS["arExtranetUserID"]) && in_array($arPost["AUTHOR_ID"], $GLOBALS["arExtranetUserID"]); $arResult["Post"]["urlToPost"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST"], array("post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"]), "user_id" => $arPost["AUTHOR_ID"])); if (strlen($arPost["CATEGORY_ID"]) > 0) { $bHasTag = true; $arCategory = explode(",", $arPost["CATEGORY_ID"]); $dbCategory = CBlogCategory::GetList(array(), array("@ID" => $arCategory)); while ($arCatTmp = $dbCategory->Fetch()) { $arCatTmp["~NAME"] = $arCatTmp["NAME"]; $arCatTmp["NAME"] = htmlspecialcharsEx($arCatTmp["NAME"]); $arCatTmp["urlToCategory"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_SEARCH_TAG"], array("tag" => urlencode($arCatTmp["NAME"]))); $arResult["Category"][] = $arCatTmp;
function __RM_MkT($i) { $aMpM = IsAmPmMode(); $h1 = IntVal($i / 2); if ($aMpM) { if ($h1 >= 12) { $mt1 = 'pm'; if ($h1 > 12) { $h1 -= 12; } } else { $mt1 = 'am'; } } else { if ($h1 < 10) { $h1 = "0" . $h1; } } $i1 = $i % 2 != 0 ? "30" : "00"; $h2 = IntVal(($i + 1) / 2); if ($aMpM) { if ($h2 >= 12) { $mt2 = 'pm'; if ($h2 > 12) { $h2 -= 12; } } else { $mt2 = 'am'; } } else { if ($h2 < 10) { $h2 = "0" . $h2; } } $i2 = ($i + 1) % 2 != 0 ? "30" : "00"; return $h1 . ":" . $i1 . (!empty($mt1) ? ' ' . $mt1 : '') . "-" . $h2 . ":" . $i2 . (!empty($mt2) ? ' ' . $mt2 : ''); }
function __SLEGetLogCommentRecord($arComments, $arParams, &$arAssets) { // for the same post log_update - time only, if not - date and time $timestamp = MakeTimeStamp(array_key_exists("LOG_DATE_FORMAT", $arComments) ? $arComments["LOG_DATE_FORMAT"] : $arComments["LOG_DATE"]); $timeFormated = FormatDateFromDB($arComments["LOG_DATE"], stripos($arParams["DATE_TIME_FORMAT"], 'a') || ($arParams["DATE_TIME_FORMAT"] == 'FULL' && IsAmPmMode()) !== false ? strpos(FORMAT_DATETIME, 'TT') !== false ? 'G:MI TT' : 'G:MI T' : 'HH:MI'); $dateTimeFormated = FormatDate(!empty($arParams['DATE_TIME_FORMAT']) ? $arParams['DATE_TIME_FORMAT'] == 'FULL' ? $GLOBALS['DB']->DateFormatToPHP(str_replace(':SS', '', FORMAT_DATETIME)) : $arParams['DATE_TIME_FORMAT'] : $GLOBALS['DB']->DateFormatToPHP(FORMAT_DATETIME), $timestamp); if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) { $dateTimeFormated = ToLower($dateTimeFormated); } // strip current year if (!empty($arParams['DATE_TIME_FORMAT']) && ($arParams['DATE_TIME_FORMAT'] == 'j F Y G:i' || $arParams['DATE_TIME_FORMAT'] == 'j F Y g:i a')) { $dateTimeFormated = ltrim($dateTimeFormated, '0'); $curYear = date('Y'); $dateTimeFormated = str_replace(array('-' . $curYear, '/' . $curYear, ' ' . $curYear, '.' . $curYear), '', $dateTimeFormated); } $path2Entity = $arComments["ENTITY_TYPE"] == SONET_ENTITY_GROUP ? CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arComments["ENTITY_ID"])) : CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComments["ENTITY_ID"])); if (intval($arComments["USER_ID"]) > 0) { $suffix = is_array($GLOBALS["arExtranetUserID"]) && in_array($arComments["USER_ID"], $GLOBALS["arExtranetUserID"]) ? GetMessage("SONET_LOG_EXTRANET_SUFFIX") : ""; $arTmpUser = array("NAME" => $arComments["~CREATED_BY_NAME"], "LAST_NAME" => $arComments["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arComments["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arComments["~CREATED_BY_LOGIN"]); $bUseLogin = $arParams["SHOW_LOGIN"] != "N" ? true : false; $arCreatedBy = array("FORMATTED" => CUser::FormatName($arParams["NAME_TEMPLATE"], $arTmpUser, $bUseLogin) . $suffix, "URL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComments["USER_ID"], "id" => $arComments["USER_ID"]))); $arCreatedBy["TOOLTIP_FIELDS"] = array("ID" => $arComments["USER_ID"], "NAME" => $arComments["~CREATED_BY_NAME"], "LAST_NAME" => $arComments["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arComments["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arComments["~CREATED_BY_LOGIN"], "USE_THUMBNAIL_LIST" => "N", "PATH_TO_SONET_MESSAGES_CHAT" => $arParams["PATH_TO_MESSAGES_CHAT"], "PATH_TO_SONET_USER_PROFILE" => $arParams["PATH_TO_USER"], "PATH_TO_VIDEO_CALL" => $arParams["PATH_TO_VIDEO_CALL"], "DATE_TIME_FORMAT" => $arParams["DATE_TIME_FORMAT"], "SHOW_YEAR" => $arParams["SHOW_YEAR"], "CACHE_TYPE" => $arParams["CACHE_TYPE"], "CACHE_TIME" => $arParams["CACHE_TIME"], "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"] . $suffix, "SHOW_LOGIN" => $arParams["SHOW_LOGIN"], "PATH_TO_CONPANY_DEPARTMENT" => $arParams["PATH_TO_CONPANY_DEPARTMENT"], "INLINE" => "Y"); } else { $arCreatedBy = array("FORMATTED" => GetMessage("SONET_C73_CREATED_BY_ANONYMOUS")); } $arTmpUser = array("NAME" => $arComments["~USER_NAME"], "LAST_NAME" => $arComments["~USER_LAST_NAME"], "SECOND_NAME" => $arComments["~USER_SECOND_NAME"], "LOGIN" => $arComments["~USER_LOGIN"]); $arParamsTmp = $arParams; $arParamsTmp["AVATAR_SIZE"] = isset($arParams["AVATAR_SIZE_COMMON"]) ? $arParams["AVATAR_SIZE_COMMON"] : $arParams["AVATAR_SIZE"]; $arTmpCommentEvent = array("EVENT" => $arComments, "LOG_DATE" => $arComments["LOG_DATE"], "LOG_DATE_TS" => MakeTimeStamp($arComments["LOG_DATE"]), "LOG_DATE_DAY" => ConvertTimeStamp(MakeTimeStamp($arComments["LOG_DATE"]), "SHORT"), "LOG_TIME_FORMAT" => $timeFormated, "LOG_DATETIME_FORMAT" => $dateTimeFormated, "TITLE_TEMPLATE" => "", "TITLE" => "", "TITLE_FORMAT" => "", "ENTITY_NAME" => $arComments["ENTITY_TYPE"] == SONET_ENTITY_GROUP ? $arComments["GROUP_NAME"] : CUser::FormatName($arParams['NAME_TEMPLATE'], $arTmpUser, $bUseLogin), "ENTITY_PATH" => $path2Entity, "CREATED_BY" => $arCreatedBy, "AVATAR_SRC" => CSocNetLogTools::FormatEvent_CreateAvatar($arComments, $arParamsTmp)); $arEvent = CSocNetLogTools::FindLogCommentEventByID($arComments["EVENT_ID"]); if ($arEvent && array_key_exists("CLASS_FORMAT", $arEvent) && array_key_exists("METHOD_FORMAT", $arEvent)) { $arLog = $arParams["USER_COMMENTS"] == "Y" ? array() : array("TITLE" => $arComments["~LOG_TITLE"], "URL" => $arComments["~LOG_URL"], "PARAMS" => $arComments["~LOG_PARAMS"]); $arFIELDS_FORMATTED = call_user_func(array($arEvent["CLASS_FORMAT"], $arEvent["METHOD_FORMAT"]), $arComments, $arParams, false, $arLog); if ($arParams["USE_COMMENTS"] != "Y") { if (array_key_exists("CREATED_BY", $arFIELDS_FORMATTED) && isset($arFIELDS_FORMATTED["CREATED_BY"]["TOOLTIP_FIELDS"])) { $arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"] = $arFIELDS_FORMATTED["CREATED_BY"]["TOOLTIP_FIELDS"]; } } } $message = $arFIELDS_FORMATTED && array_key_exists("EVENT_FORMATTED", $arFIELDS_FORMATTED) && array_key_exists("MESSAGE", $arFIELDS_FORMATTED["EVENT_FORMATTED"]) ? $arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"] : $arTmpCommentEvent["EVENT"]["MESSAGE"]; if (strlen($message) > 0) { $arFIELDS_FORMATTED["EVENT_FORMATTED"]["FULL_MESSAGE_CUT"] = CSocNetTextParser::closetags(htmlspecialcharsback($message)); } if (is_array($arTmpCommentEvent)) { $arFIELDS_FORMATTED["EVENT_FORMATTED"]["DATETIME"] = $arTmpCommentEvent["LOG_DATE_DAY"] == ConvertTimeStamp() ? $timeFormated : $dateTimeFormated; $arTmpCommentEvent["EVENT_FORMATTED"] = $arFIELDS_FORMATTED["EVENT_FORMATTED"]; if (isset($arComments["UF"]["UF_SONET_COM_URL_PRV"]) && !empty($arComments["UF"]["UF_SONET_COM_URL_PRV"]["VALUE"])) { $arCss = $GLOBALS["APPLICATION"]->sPath2css; $arJs = $GLOBALS["APPLICATION"]->arHeadScripts; ob_start(); $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:system.field.view", $arComments["UF"]["UF_SONET_COM_URL_PRV"]["USER_TYPE_ID"], array("arUserField" => $arComments["UF"]["UF_SONET_COM_URL_PRV"], "arAddField" => array("NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"], "PATH_TO_USER" => $arParams["~PATH_TO_USER"])), null, array("HIDE_ICONS" => "Y")); $urlPreviewText = ob_get_clean(); $arTmpCommentEvent["EVENT_FORMATTED"]["FULL_MESSAGE_CUT"] .= $urlPreviewText; $arAssets["CSS"] = array_merge($arAssets["CSS"], array_diff($GLOBALS["APPLICATION"]->sPath2css, $arCss)); $arAssets["JS"] = array_merge($arAssets["JS"], array_diff($GLOBALS["APPLICATION"]->arHeadScripts, $arJs)); unset($arComments["UF"]["UF_SONET_COM_URL_PRV"]); } $arTmpCommentEvent["UF"] = $arComments["UF"]; if (isset($arTmpCommentEvent["EVENT_FORMATTED"]) && is_array($arTmpCommentEvent["EVENT_FORMATTED"])) { $arFields2Cache = array("DATETIME", "MESSAGE", "FULL_MESSAGE_CUT", "ERROR_MSG"); foreach ($arTmpCommentEvent["EVENT_FORMATTED"] as $field => $value) { if (!in_array($field, $arFields2Cache)) { unset($arTmpCommentEvent["EVENT_FORMATTED"][$field]); } } } if (isset($arTmpCommentEvent["EVENT"]) && is_array($arTmpCommentEvent["EVENT"])) { if (!empty($arTmpCommentEvent["EVENT"]["URL"])) { $arTmpCommentEvent["EVENT"]["URL"] = str_replace("#GROUPS_PATH#", COption::GetOptionString("socialnetwork", "workgroups_page", "/workgroups/", SITE_ID), $arTmpCommentEvent["EVENT"]["URL"]); } $arFields2Cache = array("ID", "SOURCE_ID", "EVENT_ID", "USER_ID", "LOG_DATE", "RATING_TYPE_ID", "RATING_ENTITY_ID", "URL"); foreach ($arTmpCommentEvent["EVENT"] as $field => $value) { if (!in_array($field, $arFields2Cache)) { unset($arTmpCommentEvent["EVENT"][$field]); } } } if (isset($arTmpCommentEvent["CREATED_BY"]) && is_array($arTmpCommentEvent["CREATED_BY"])) { $arFields2Cache = array("TOOLTIP_FIELDS", "FORMATTED", "URL"); foreach ($arTmpCommentEvent["CREATED_BY"] as $field => $value) { if (!in_array($field, $arFields2Cache)) { unset($arTmpCommentEvent["CREATED_BY"][$field]); } } if (isset($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"]) && is_array($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"])) { $arFields2Cache = array("ID", "PATH_TO_SONET_USER_PROFILE", "NAME", "LAST_NAME", "SECOND_NAME", "LOGIN", "EMAIL"); foreach ($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"] as $field => $value) { if (!in_array($field, $arFields2Cache)) { unset($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"][$field]); } } } } } foreach ($arTmpCommentEvent["EVENT"] as $key => $value) { if (strpos($key, "~") === 0) { unset($arTmpCommentEvent["EVENT"][$key]); } } return $arTmpCommentEvent; }
public static function MakeDateTime($date, $time, $duration = 0) { global $DB; if (!IsAmPmMode()) { $date_start = $date . ' ' . $time . ':00'; $date_start = FormatDate($DB->DateFormatToPhp(FORMAT_DATETIME), MakeTimeStamp($date . ' ' . $time, FORMAT_DATE . ' HH:MI') + intval($duration)); } else { $date_start = FormatDate($DB->DateFormatToPhp(FORMAT_DATETIME), MakeTimeStamp($date . ' ' . $time, FORMAT_DATE . ' H:MI T') + intval($duration)); } return $date_start; }