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


PHP CCalendar::GetMaxTimestamp方法代码示例

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


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

示例1: EventGet

 public static function EventGet($arParams = array(), $nav = null, $server = null)
 {
     $userId = CCalendar::GetCurUserId();
     $methodName = "calendar.event.get";
     $necessaryParams = array('type');
     foreach ($necessaryParams as $param) {
         if (!isset($arParams[$param]) || empty($arParams[$param])) {
             throw new Exception(GetMessage('CAL_REST_PARAM_EXCEPTION', array('#PARAM_NAME#' => $param, '#REST_METHOD#' => $methodName)));
         }
     }
     $type = $arParams['type'];
     $ownerId = intval($arParams['ownerId']);
     $from = false;
     $to = false;
     if (isset($arParams['from'])) {
         $from = CRestUtil::unConvertDate($arParams['from']);
     }
     if (isset($arParams['to'])) {
         $to = CRestUtil::unConvertDate($arParams['to']);
     }
     // Default values for from-to period
     if ($from === false && $to === false) {
         // Limits
         $ts = time();
         $pastDays = 30;
         $futureDays = 90;
         $from = CCalendar::Date($ts - CCalendar::DAY_LENGTH * $pastDays, false);
         $to = CCalendar::Date($ts + CCalendar::DAY_LENGTH * $futureDays, false);
     } elseif ($from !== false && $to === false) {
         $to = CCalendar::Date(CCalendar::GetMaxTimestamp(), false);
     }
     $arSectionIds = array();
     $sections = CCalendarSect::GetList(array('arFilter' => array('CAL_TYPE' => $type, 'OWNER_ID' => $ownerId)));
     foreach ($sections as $section) {
         if ($section['PERM']['view_full'] || $section['PERM']['view_title'] || $section['PERM']['view_time']) {
             $arSectionIds[] = $section['ID'];
         }
     }
     if (isset($arParams['section'])) {
         if (!is_array($arParams['section']) && $arParams['section'] > 0) {
             $arParams['section'] = array($arParams['section']);
         }
         $arSectionIds = array_intersect($arSectionIds, $arParams['section']);
     }
     $params = array('type' => $type, 'ownerId' => $ownerId, 'userId' => $userId, 'section' => $arSectionIds, 'fromLimit' => $from, 'toLimit' => $to);
     $arAttendees = array();
     $arEvents = CCalendar::GetEventList($params, $arAttendees);
     return $arEvents;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:49,代码来源:calendar_restservice.php

示例2: CheckFields

 public static function CheckFields(&$arFields)
 {
     // Check dates
     //		$arFields['DT_FROM'] = CCalendar::CutZeroTime($arFields['DT_FROM']);
     //		$arFields['DT_TO'] = CCalendar::CutZeroTime($arFields['DT_TO']);
     $fromTs = CCalendar::Timestamp($arFields['DT_FROM']);
     $toTs = CCalendar::Timestamp($arFields['DT_TO']);
     if (!isset($arFields['DT_FROM_TS'])) {
         $arFields['DT_FROM_TS'] = $fromTs;
     }
     if (!isset($arFields['DT_TO_TS'])) {
         $arFields['DT_TO_TS'] = $toTs;
     }
     $h24 = 60 * 60 * 24;
     // 24 hours
     // Skip time
     if (isset($arFields['SKIP_TIME'])) {
         $arFields['DT_SKIP_TIME'] = $arFields['SKIP_TIME'] ? 'Y' : 'N';
         unset($arFields['SKIP_TIME']);
     } elseif (isset($arFields['DT_SKIP_TIME']) && $arFields['DT_SKIP_TIME'] != 'Y' && $arFields['DT_SKIP_TIME'] != 'N') {
         unset($arFields['DT_SKIP_TIME']);
     }
     // Event length in seconds
     if (!isset($arFields['DT_LENGTH'])) {
         //if($fromTs == $toTs && date('H:i', $fromTs) == '00:00') // One day
         if ($fromTs == $toTs && date('H:i', $fromTs) == '00:00' && $arFields['DT_SKIP_TIME'] == 'Y') {
             $arFields['DT_LENGTH'] = $h24;
         } else {
             $arFields['DT_LENGTH'] = intVal($toTs - $fromTs);
             if ($arFields['DT_SKIP_TIME'] == "Y") {
                 // We have dates without times
                 $arFields['DT_LENGTH'] += $h24;
             }
         }
     }
     if (!$arFields['VERSION']) {
         $arFields['VERSION'] = 1;
     }
     // Accessibility
     $arFields['ACCESSIBILITY'] = trim(strtolower($arFields['ACCESSIBILITY']));
     if (!in_array($arFields['ACCESSIBILITY'], array('busy', 'quest', 'free', 'absent'))) {
         $arFields['ACCESSIBILITY'] = 'busy';
     }
     // Importance
     $arFields['IMPORTANCE'] = trim(strtolower($arFields['IMPORTANCE']));
     if (!in_array($arFields['IMPORTANCE'], array('high', 'normal', 'low'))) {
         $arFields['IMPORTANCE'] = 'normal';
     }
     // Color
     $arFields['COLOR'] = CCalendar::Color($arFields['COLOR'], false);
     // Section
     if (!is_array($arFields['SECTIONS']) && intVal($arFields['SECTIONS']) > 0) {
         $arFields['SECTIONS'] = array(intVal($arFields['SECTIONS']));
     }
     // Check rrules
     if (is_array($arFields['RRULE']) && isset($arFields['RRULE']['FREQ']) && in_array($arFields['RRULE']['FREQ'], array('HOURLY', 'DAILY', 'MONTHLY', 'YEARLY', 'WEEKLY'))) {
         // Interval
         if (isset($arFields['RRULE']['INTERVAL']) && intVal($arFields['RRULE']['INTERVAL']) > 1) {
             $arFields['RRULE']['INTERVAL'] = intVal($arFields['RRULE']['INTERVAL']);
         }
         // Until date
         if ($arFields['RRULE']['UNTIL']) {
             if (!preg_match('/[^\\d]/', $arFields['RRULE']['UNTIL'])) {
                 $periodTs = $arFields['RRULE']['UNTIL'];
                 if ($periodTs > CCalendar::GetMaxTimestamp()) {
                     $periodTs = CCalendar::GetMaxTimestamp();
                 }
             } else {
                 $periodTs = CCalendar::Timestamp($arFields['RRULE']['UNTIL']);
             }
         } else {
             $periodTs = CCalendar::GetMaxTimestamp();
         }
         $arFields['RRULE']['UNTIL'] = $periodTs;
         $arFields['DT_TO'] = CCalendar::Date($periodTs);
         $arFields['DT_TO_TS'] = $periodTs;
         if (isset($arFields['RRULE']['BYDAY'])) {
             $BYDAY = array();
             $days = array('SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA');
             $bydays = explode(',', $arFields['RRULE']['BYDAY']);
             foreach ($bydays as $day) {
                 $day = strtoupper($day);
                 if (in_array($day, $days)) {
                     $BYDAY[] = $day;
                 }
             }
             $arFields['RRULE']['BYDAY'] = implode(',', $BYDAY);
         }
         $arFields['RRULE'] = self::PackRRule($arFields['RRULE']);
     } else {
         $arFields['RRULE'] = '';
     }
     $arFields['EXRULE'] = "";
     $arFields['RDATE'] = "";
     $arFields['EXDATE'] = "";
     // Location
     if (!is_array($arFields['LOCATION'])) {
         $arFields['LOCATION'] = array("NEW" => is_string($arFields['LOCATION']) ? $arFields['LOCATION'] : "");
     }
     // Private
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:calendar_event.php

示例3: DoSaveToDav

 public static function DoSaveToDav($Params = array(), &$arFields, $oCurEvent = false)
 {
     $sectionId = $Params['sectionId'];
     $bExchange = $Params['bExchange'];
     $bCalDav = $Params['bCalDav'];
     if (isset($oCurEvent['DAV_XML_ID'])) {
         $arFields['DAV_XML_ID'] = $oCurEvent['DAV_XML_ID'];
     }
     if (isset($oCurEvent['DAV_EXCH_LABEL'])) {
         $arFields['DAV_EXCH_LABEL'] = $oCurEvent['DAV_EXCH_LABEL'];
     }
     if (isset($oCurEvent['CAL_DAV_LABEL'])) {
         $arFields['CAL_DAV_LABEL'] = $oCurEvent['CAL_DAV_LABEL'];
     }
     $oSect = CCalendarSect::GetById($sectionId);
     if ($oCurEvent) {
         if ($oCurEvent['SECT_ID'] != $sectionId) {
             $bCalDav = CCalendar::IsCalDAVEnabled() && $oCurEvent['CAL_TYPE'] == 'user' && strlen($oCurEvent['CAL_DAV_LABEL']) > 0;
             $bExchangeEnabled = CCalendar::IsExchangeEnabled() && $oCurEvent['CAL_TYPE'] == 'user';
             if ($bExchangeEnabled || $bCalDav) {
                 $res = CCalendar::DoDeleteToDav(array('bCalDav' => $bCalDav, 'bExchangeEnabled' => $bExchangeEnabled, 'sectionId' => $oCurEvent['SECT_ID']), $oCurEvent);
                 if ($res !== true) {
                     return CCalendar::ThrowError($res);
                 }
             }
         }
     }
     $fromTs = CCalendar::Timestamp($arFields['DT_FROM']);
     $toTs = CCalendar::Timestamp($arFields['DT_TO']);
     if (!isset($arFields['DT_FROM_TS'])) {
         $arFields['DT_FROM_TS'] = $fromTs;
     }
     if (!isset($arFields['DT_TO_TS'])) {
         $arFields['DT_TO_TS'] = $toTs;
     }
     $arDavFields = $arFields;
     CCalendarEvent::CheckFields($arDavFields);
     if ($arDavFields['RRULE'] != '') {
         $arDavFields['RRULE'] = $arFields['RRULE'];
     }
     $arDavFields['DETAIL_TEXT'] = $arDavFields['DESCRIPTION'];
     $arDavFields['DETAIL_TEXT_TYPE'] = 'text';
     $arDavFields['ACTIVE_FROM'] = $arDavFields['DT_FROM'];
     $arDavFields['ACTIVE_TO'] = $arDavFields['DT_TO'];
     $arDavFields['PROPERTY_LOCATION'] = $arDavFields['LOCATION']['NEW'];
     if ($arDavFields['PROPERTY_LOCATION'] !== '') {
         $arDavFields['PROPERTY_LOCATION'] = CCalendar::GetTextLocation($arDavFields['PROPERTY_LOCATION']);
     }
     $arDavFields['PROPERTY_IMPORTANCE'] = $arDavFields['IMPORTANCE'];
     $arDavFields['REMIND_SETTINGS'] = '';
     if ($arFields['REMIND'] && is_array($arFields['REMIND']) && is_array($arFields['REMIND'][0])) {
         $arDavFields['REMIND_SETTINGS'] = floatVal($arFields['REMIND'][0]['count']) . '_' . $arFields['REMIND'][0]['type'];
     }
     // RRULE
     $arDavFields['PROPERTY_PERIOD_TYPE'] = 'NONE';
     if (is_array($arFields['RRULE']) && isset($arFields['RRULE']['FREQ']) && in_array($arFields['RRULE']['FREQ'], array('HOURLY', 'DAILY', 'MONTHLY', 'YEARLY', 'WEEKLY'))) {
         $arDavFields['PROPERTY_PERIOD_TYPE'] = $arFields['RRULE']['FREQ'];
         // Interval
         $arDavFields['PROPERTY_PERIOD_COUNT'] = isset($arFields['RRULE']['INTERVAL']) && intVal($arFields['RRULE']['INTERVAL']) > 1 ? intVal($arFields['RRULE']['INTERVAL']) : 1;
         if ($arFields['RRULE']['FREQ'] == 'WEEKLY' && isset($arFields['RRULE']['BYDAY'])) {
             //PROPERTY_PERIOD_ADDITIONAL
             $BYDAYS = array();
             $days = array('SU' => 0, 'MO' => 1, 'TU' => 2, 'WE' => 3, 'TH' => 4, 'FR' => 5, 'SA' => 6);
             $bydays = explode(',', $arFields['RRULE']['BYDAY']);
             foreach ($bydays as $day) {
                 $BYDAYS[] = $days[$day];
             }
             $arDavFields['PROPERTY_PERIOD_ADDITIONAL'] = implode(',', $BYDAYS);
         }
         $h24 = 60 * 60 * 24;
         if ($fromTs == $toTs) {
             $arDavFields['PROPERTY_EVENT_LENGTH'] = $h24;
         } else {
             $arDavFields['PROPERTY_EVENT_LENGTH'] = intVal($toTs - $fromTs);
             if ($arDavFields['PROPERTY_EVENT_LENGTH'] % $h24 == 0) {
                 // We have dates without times
                 $arDavFields['PROPERTY_EVENT_LENGTH'] += $h24;
             }
         }
         // Until date
         if (isset($arFields['RRULE']['UNTIL'])) {
             $periodTs = $arFields['RRULE']['UNTIL'];
         } else {
             $periodTs = CCalendar::GetMaxTimestamp();
         }
         $arDavFields['ACTIVE_TO'] = CCalendar::Date($periodTs);
     }
     // **** Synchronize with CalDav ****
     if ($bCalDav && $oSect['CAL_DAV_CON'] > 0) {
         // New event or move existent event to DAV calendar
         if ($arFields['ID'] <= 0 || $oCurEvent && !$oCurEvent['CAL_DAV_LABEL']) {
             $DAVRes = CDavGroupdavClientCalendar::DoAddItem($oSect['CAL_DAV_CON'], $oSect['CAL_DAV_CAL'], $arDavFields);
         } else {
             // Edit existent event
             $DAVRes = CDavGroupdavClientCalendar::DoUpdateItem($oSect['CAL_DAV_CON'], $oSect['CAL_DAV_CAL'], $oCurEvent['DAV_XML_ID'], $oCurEvent['CAL_DAV_LABEL'], $arDavFields);
         }
         if (!is_array($DAVRes) || !array_key_exists("XML_ID", $DAVRes)) {
             return CCalendar::CollectCalDAVErros($DAVRes);
         }
         // // It's ok, we successfuly save event to caldav calendar - and save it to DB
//.........这里部分代码省略.........
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:calendar.php

示例4: ReminderAgent

 public static function ReminderAgent($eventId = 0, $userId = 0, $viewPath = '', $calendarType = '', $ownerId = 0)
 {
     if ($eventId > 0 && $userId > 0 && $calendarType != '') {
         if (!CModule::IncludeModule("im")) {
             return false;
         }
         $skipReminding = false;
         global $USER;
         // Create tmp user
         if ($bTmpUser = !$USER || !is_object($USER)) {
             $USER = new CUser();
         }
         // We have to use this to set timezone offset to local user's timezone
         self::SetOffset(false, self::GetOffset($userId));
         $arEvents = CCalendarEvent::GetList(array('arFilter' => array("ID" => $eventId, "DELETED" => "N", "FROM_LIMIT" => CCalendar::Date(time() - 3600, false), "TO_LIMIT" => CCalendar::Date(CCalendar::GetMaxTimestamp(), false)), 'parseRecursion' => true, 'maxInstanceCount' => 3, 'preciseLimits' => true, 'fetchAttendees' => true, 'checkPermissions' => false, 'setDefaultLimit' => false));
         if ($arEvents && is_array($arEvents[0])) {
             $event = $arEvents[0];
         }
         if ($event && $event['IS_MEETING']) {
             $attendees = CCalendarEvent::GetAttendees($event['PARENT_ID']);
             $attendees = $attendees[$event['PARENT_ID']];
             foreach ($attendees as $attendee) {
                 // If current user is an attendee but his status is 'N' we don't take care about reminding
                 if ($attendee['USER_ID'] == $userId && $attendee['STATUS'] == 'N') {
                     $skipReminding = true;
                     break;
                 }
             }
         }
         if ($event && $event['DELETED'] != 'Y' && !$skipReminding) {
             // Get Calendar Info
             $Section = CCalendarSect::GetById($event['SECT_ID'], false);
             if ($Section) {
                 $arNotifyFields = array('FROM_USER_ID' => $userId, 'TO_USER_ID' => $userId, 'NOTIFY_TYPE' => IM_NOTIFY_SYSTEM, 'NOTIFY_MODULE' => "calendar", 'NOTIFY_EVENT' => "reminder", 'NOTIFY_TAG' => "CALENDAR|INVITE|" . $eventId . "|" . $userId . "|REMINDER", 'NOTIFY_SUB_TAG' => "CALENDAR|INVITE|" . $eventId);
                 $fromTs = CCalendar::Timestamp($event['DATE_FROM'], false, $event['DT_SKIP_TIME'] !== 'Y');
                 if ($event['DT_SKIP_TIME'] !== 'Y') {
                     $fromTs -= $event['~USER_OFFSET_FROM'];
                 }
                 $arNotifyFields['MESSAGE'] = GetMessage('EC_EVENT_REMINDER', array('#EVENT_NAME#' => $event["NAME"], '#DATE_FROM#' => CCalendar::Date($fromTs, $event['DT_SKIP_TIME'] !== 'Y')));
                 $sectionName = $Section['NAME'];
                 $ownerName = CCalendar::GetOwnerName($calendarType, $ownerId);
                 if ($calendarType == 'user' && $ownerId == $userId) {
                     $arNotifyFields['MESSAGE'] .= ' ' . GetMessage('EC_EVENT_REMINDER_IN_PERSONAL', array('#CALENDAR_NAME#' => $sectionName));
                 } else {
                     if ($calendarType == 'user') {
                         $arNotifyFields['MESSAGE'] .= ' ' . GetMessage('EC_EVENT_REMINDER_IN_USER', array('#CALENDAR_NAME#' => $sectionName, '#USER_NAME#' => $ownerName));
                     } else {
                         if ($calendarType == 'group') {
                             $arNotifyFields['MESSAGE'] .= ' ' . GetMessage('EC_EVENT_REMINDER_IN_GROUP', array('#CALENDAR_NAME#' => $sectionName, '#GROUP_NAME#' => $ownerName));
                         } else {
                             $arNotifyFields['MESSAGE'] .= ' ' . GetMessage('EC_EVENT_REMINDER_IN_COMMON', array('#CALENDAR_NAME#' => $sectionName, '#IBLOCK_NAME#' => $ownerName));
                         }
                     }
                 }
                 if ($viewPath != '') {
                     $arNotifyFields['MESSAGE'] .= "\n" . GetMessage('EC_EVENT_REMINDER_DETAIL', array('#URL_VIEW#' => $viewPath));
                 }
                 CIMNotify::Add($arNotifyFields);
                 foreach (GetModuleEvents("calendar", "OnRemindEvent", true) as $arEvent) {
                     ExecuteModuleEventEx($arEvent, array(array('eventId' => $eventId, 'userId' => $userId, 'viewPath' => $viewPath, 'calType' => $calendarType, 'ownerId' => $ownerId)));
                 }
                 if (CCalendarEvent::CheckRecurcion($event) && ($nextEvent = $arEvents[1])) {
                     $remAgentParams = array('eventId' => $eventId, 'userId' => $userId, 'viewPath' => $viewPath, 'calendarType' => $calendarType, 'ownerId' => $ownerId);
                     // 1. clean reminders
                     CCalendar::RemoveAgent($remAgentParams);
                     $startTs = CCalendar::Timestamp($nextEvent['DATE_FROM'], false, $event["DT_SKIP_TIME"] !== 'Y');
                     if ($nextEvent["DT_SKIP_TIME"] == 'N' && $nextEvent["TZ_FROM"]) {
                         $startTs = $startTs - CCalendar::GetTimezoneOffset($nextEvent["TZ_FROM"], $startTs);
                         // UTC timestamp
                     }
                     // 2. Set new reminders
                     $reminder = $nextEvent['REMIND'][0];
                     if ($reminder) {
                         $delta = intVal($reminder['count']) * 60;
                         //Minute
                         if ($reminder['type'] == 'hour') {
                             $delta = $delta * 60;
                         } elseif ($reminder['type'] == 'day') {
                             $delta = $delta * 60 * 24;
                         }
                         //Day
                         // $startTs - UTC timestamp;  date("Z", $startTs) - offset of the server
                         $agentTime = $startTs + date("Z", $startTs);
                         if ($agentTime - $delta >= time() - 60 * 5) {
                             // Inaccuracy - 5 min
                             CCalendar::AddAgent(CCalendar::Date($agentTime - $delta), $remAgentParams);
                         }
                     }
                 }
             }
         }
         self::$offset = null;
         if (isset($bTmpUser) && $bTmpUser) {
             unset($USER);
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:97,代码来源:calendar.php


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