当前位置: 首页>>代码示例>>PHP>>正文


PHP CCalendar::_fixTimestamp方法代码示例

本文整理汇总了PHP中CCalendar::_fixTimestamp方法的典型用法代码示例。如果您正苦于以下问题:PHP CCalendar::_fixTimestamp方法的具体用法?PHP CCalendar::_fixTimestamp怎么用?PHP CCalendar::_fixTimestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCalendar的用法示例。


在下文中一共展示了CCalendar::_fixTimestamp方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetMessage

 $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;
     // One full day
     $bDuringOneDay = !$bOneDay && FormatDate('d.m.Y', $event['DT_FROM_TS']) === FormatDate('d.m.Y', $event['DT_TO_TS']);
     $fromToMess = '';
     // It's event for today
     if ($event['DT_FROM_TS'] <= $todayEndTs && $event['DT_TO_TS'] >= $todayStartTs) {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例2: SendMessage

 public static function SendMessage($Params)
 {
     if (!CModule::IncludeModule("im")) {
         return false;
     }
     $mode = $Params['mode'];
     // invite|change|cancel|accept|decline
     $Params["meetingText"] = isset($Params["meetingText"]) && is_string($Params["meetingText"]) ? trim($Params["meetingText"]) : '';
     $fromUser = intVal($Params["userId"]);
     $toUser = intVal($Params["guestId"]);
     if (!$fromUser || !$toUser || $toUser == $fromUser) {
         return false;
     }
     $fromTs = CCalendar::Timestamp($Params["from"]);
     $toTs = CCalendar::Timestamp($Params["to"]);
     $fromTs = CCalendar::_fixTimestamp($fromTs);
     $toTs = CCalendar::_fixTimestamp($toTs);
     $arNotifyFields = array('EMAIL_TEMPLATE' => "CALENDAR_INVITATION", 'NOTIFY_MODULE' => "calendar");
     if ($mode == 'accept' || $mode == 'decline') {
         $arNotifyFields['FROM_USER_ID'] = $toUser;
         $arNotifyFields['TO_USER_ID'] = $fromUser;
         if (date('H:i', $fromTs) != '00:00' || date('H:i', $toTs) != '00:00') {
             $Params["from"] = CCalendar::Date($fromTs + CCalendar::GetOffset($fromUser), true, true, true);
             $Params["to"] = CCalendar::Date($toTs + CCalendar::GetOffset($fromUser), true, true, true);
         }
     } else {
         $arNotifyFields['FROM_USER_ID'] = $fromUser;
         $arNotifyFields['TO_USER_ID'] = $toUser;
         if (date('H:i', $fromTs) != '00:00' || date('H:i', $toTs) != '00:00') {
             $Params["from"] = CCalendar::Date($fromTs + CCalendar::GetOffset($toUser), true, true, true);
             $Params["to"] = CCalendar::Date($toTs + CCalendar::GetOffset($toUser), true, true, true);
         }
     }
     $Params["from"] = CCalendar::CutZeroTime($Params["from"]);
     $Params["to"] = CCalendar::CutZeroTime($Params["to"]);
     // If it's event for all day - add one day to timestamp
     if (date("His", $toTs) == '000000') {
         $toTs += self::GetDayLen();
     }
     // Don't send messages for events in the past
     if ($toTs < time()) {
         return false;
     }
     $rs = CUser::GetList($by = "id", $order = "asc", array("ID_EQUAL_EXACT" => $toUser, "ACTIVE" => "Y"));
     if (!$rs->Fetch()) {
         return false;
     }
     $eventId = intVal($Params["eventId"]);
     $calendarUrl = self::GetPathForCalendarEx($arNotifyFields['TO_USER_ID']);
     $calendarUrlEV = $calendarUrl . (strpos($calendarUrl, "?") === false ? '?' : '&') . 'EVENT_ID=' . $eventId;
     $curPath = CCalendar::GetPath();
     $titleWithLink = $Params["name"];
     if ($curPath && $eventId) {
         $curPath = CHTTP::urlDeleteParams($curPath, array("action", "sessid", "bx_event_calendar_request", "EVENT_ID"));
         $curPath = CHTTP::urlAddParams($curPath, array('EVENT_ID' => $eventId));
         $titleWithLink = "[url=" . $curPath . "]" . $Params["name"] . "[/url]";
     }
     $arNotifyFields = array('FROM_USER_ID' => $fromUser, 'TO_USER_ID' => $toUser, 'EMAIL_TEMPLATE' => "CALENDAR_INVITATION", 'NOTIFY_MODULE' => "calendar");
     switch ($mode) {
         case 'invite':
             $arNotifyFields['NOTIFY_EVENT'] = "invite";
             $arNotifyFields['NOTIFY_TYPE'] = IM_NOTIFY_CONFIRM;
             $arNotifyFields['NOTIFY_TAG'] = "CALENDAR|INVITE|" . $eventId . "|" . $toUser;
             $arNotifyFields['NOTIFY_SUB_TAG'] = "CALENDAR|INVITE|" . $eventId;
             $arNotifyFields['MESSAGE'] = GetMessage('EC_MESS_INVITE_SITE', array('#TITLE#' => $Params["name"], '#ACTIVE_FROM#' => $Params["from"]));
             $arNotifyFields['MESSAGE_OUT'] = GetMessage('EC_MESS_INVITE', array('#OWNER_NAME#' => CCalendar::GetUserName($Params['userId']), '#TITLE#' => $Params["name"], '#ACTIVE_FROM#' => $Params["from"]));
             if ($Params['location'] != "") {
                 $arNotifyFields['MESSAGE'] .= "\n\n" . GetMessage('EC_LOCATION') . ': ' . $Params['location'];
                 $arNotifyFields['MESSAGE_OUT'] .= "\n\n" . GetMessage('EC_LOCATION') . ': ' . $Params['location'];
             }
             if ($Params["meetingText"] != "") {
                 $arNotifyFields['MESSAGE'] .= "\n\n" . GetMessage('EC_MESS_MEETING_TEXT', array('#MEETING_TEXT#' => $Params["meetingText"]));
                 $arNotifyFields['MESSAGE_OUT'] .= "\n\n" . GetMessage('EC_MESS_MEETING_TEXT', array('#MEETING_TEXT#' => $Params["meetingText"]));
             }
             $arNotifyFields['MESSAGE'] .= "\n\n" . GetMessage('EC_MESS_INVITE_DETAILS_SITE', array('#LINK#' => $calendarUrlEV));
             $arNotifyFields['NOTIFY_BUTTONS'] = array(array('TITLE' => GetMessage('EC_MESS_INVITE_CONF_Y_SITE'), 'VALUE' => 'Y', 'TYPE' => 'accept'), array('TITLE' => GetMessage('EC_MESS_INVITE_CONF_N_SITE'), 'VALUE' => 'N', 'TYPE' => 'cancel'));
             $arNotifyFields['MESSAGE_OUT'] .= "\n\n" . GetMessage('EC_MESS_INVITE_CONF_Y', array('#LINK#' => $calendarUrlEV . '&CONFIRM=Y'));
             $arNotifyFields['MESSAGE_OUT'] .= "\n" . GetMessage('EC_MESS_INVITE_CONF_N', array('#LINK#' => $calendarUrlEV . '&CONFIRM=N'));
             $arNotifyFields['MESSAGE_OUT'] .= "\n\n" . GetMessage('EC_MESS_INVITE_DETAILS', array('#LINK#' => $calendarUrlEV));
             $arNotifyFields['TITLE'] = GetMessage('EC_MESS_INVITE_TITLE', array('#OWNER_NAME#' => CCalendar::GetUserName($Params['userId']), '#TITLE#' => $Params["name"]));
             break;
         case 'change':
             $arNotifyFields['NOTIFY_EVENT'] = "change";
             $arNotifyFields['NOTIFY_TYPE'] = IM_NOTIFY_CONFIRM;
             $arNotifyFields['NOTIFY_TAG'] = "CALENDAR|INVITE|" . $eventId . "|" . $toUser;
             $arNotifyFields['NOTIFY_SUB_TAG'] = "CALENDAR|INVITE|" . $eventId;
             $arNotifyFields['MESSAGE'] = GetMessage('EC_MESS_INVITE_CHANGED_SITE', array('#TITLE#' => $Params["name"], '#ACTIVE_FROM#' => $Params["from"]));
             $arNotifyFields['MESSAGE_OUT'] = GetMessage('EC_MESS_INVITE_CHANGED', array('#OWNER_NAME#' => CCalendar::GetUserName($Params['userId']), '#TITLE#' => $Params["name"], '#ACTIVE_FROM#' => $Params["from"]));
             if ($Params["meetingText"] != "") {
                 $arNotifyFields['MESSAGE'] .= "\n\n" . GetMessage('EC_MESS_MEETING_TEXT', array('#MEETING_TEXT#' => $Params["meetingText"]));
                 $arNotifyFields['MESSAGE_OUT'] .= "\n\n" . GetMessage('EC_MESS_MEETING_TEXT', array('#MEETING_TEXT#' => $Params["meetingText"]));
             }
             $arNotifyFields['MESSAGE'] .= "\n\n" . GetMessage('EC_MESS_INVITE_DETAILS_SITE', array('#LINK#' => $calendarUrlEV));
             $arNotifyFields['NOTIFY_BUTTONS'] = array(array('TITLE' => GetMessage('EC_MESS_INVITE_CONF_Y_SITE'), 'VALUE' => 'Y', 'TYPE' => 'accept'), array('TITLE' => GetMessage('EC_MESS_INVITE_CONF_N_SITE'), 'VALUE' => 'N', 'TYPE' => 'cancel'));
             $arNotifyFields['MESSAGE_OUT'] .= "\n\n" . GetMessage('EC_MESS_INVITE_CONF_Y', array('#LINK#' => $calendarUrlEV . '&CONFIRM=Y'));
             $arNotifyFields['MESSAGE_OUT'] .= "\n" . GetMessage('EC_MESS_INVITE_CONF_N', array('#LINK#' => $calendarUrlEV . '&CONFIRM=N'));
             $arNotifyFields['MESSAGE_OUT'] .= "\n\n" . GetMessage('EC_MESS_INVITE_DETAILS', array('#LINK#' => $calendarUrlEV));
             $arNotifyFields['TITLE'] = GetMessage('EC_MESS_INVITE_CHANGED_TITLE', array('#TITLE#' => $Params["name"]));
             break;
         case 'change_notify':
//.........这里部分代码省略.........
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:calendar.php

示例3: intVal

     $this->IncludeComponentTemplate();
     return;
 }
 $APPLICATION->RestartBuffer();
 if ($_REQUEST['app_calendar_action'] == 'save_event' && check_bitrix_sessid()) {
     // Save event info
     $type = 'user';
     $ownerId = $userId;
     $id = intVal($_POST['event_id']);
     $sectId = intVal($_POST['sect_id']);
     $newMeeting = $_POST['new_meeting'] == 'Y';
     $from_ts = $_POST['from_ts'];
     $to_ts = $_POST['to_ts'];
     if (isset($_POST['skip_time']) && $_POST['skip_time'] == 'Y') {
         $from_ts = CCalendar::_fixTimestamp($from_ts);
         $to_ts = CCalendar::_fixTimestamp($to_ts);
     }
     $arFields = array("ID" => $id, "CAL_TYPE" => $_POST['cal_type'], "OWNER_ID" => $_POST['owner_id'], "DT_FROM_TS" => $from_ts, "DT_TO_TS" => $to_ts, "SKIP_TIME" => isset($_POST['skip_time']) && $_POST['skip_time'] == 'Y', 'NAME' => CMobile::ConvertFromUtf(trim($_POST['name'])), 'DESCRIPTION' => CMobile::ConvertFromUtf(trim($_POST['desc'])), 'SECTIONS' => array($sectId), 'ACCESSIBILITY' => $_POST['accessibility'], 'IMPORTANCE' => $_POST['importance'], 'PRIVATE_EVENT' => $_POST['private_event'] == "Y", "REMIND" => $_POST['remind'], 'LOCATION' => array(), "IS_MEETING" => !empty($_POST['attendees']));
     // LOCATION
     if (is_array($_POST['location']) && !empty($_POST['location'])) {
         $arFields['LOCATION'] = $_POST['location'];
         $arFields['LOCATION']['CHANGED'] = $arFields['LOCATION']['CHANGED'] == 'Y';
         $arFields['LOCATION']['NEW'] = CMobile::ConvertFromUtf($arFields['LOCATION']['NEW']);
         $arFields['LOCATION']['OLD'] = CMobile::ConvertFromUtf($arFields['LOCATION']['OLD']);
         if ($arFields['LOCATION']['CHANGED']) {
             $loc = CCalendar::UnParseTextLocation($arFields['LOCATION']['NEW']);
             $arFields['LOCATION']['NEW'] = $loc['NEW'];
         }
     }
     if (isset($_POST['rrule']) && $_POST['rrule'] == '') {
         $arFields['RRULE'] = '';
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php


注:本文中的CCalendar::_fixTimestamp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。