本文整理汇总了PHP中CCalendar::GetNearestEventsList方法的典型用法代码示例。如果您正苦于以下问题:PHP CCalendar::GetNearestEventsList方法的具体用法?PHP CCalendar::GetNearestEventsList怎么用?PHP CCalendar::GetNearestEventsList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCalendar
的用法示例。
在下文中一共展示了CCalendar::GetNearestEventsList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ShowError
}
}
if (!CModule::IncludeModule("calendar") || !class_exists("CCalendar")) {
return ShowError(GetMessage("EC_CALENDAR_MODULE_NOT_INSTALLED"));
}
// Limits
if (strlen($arParams["INIT_DATE"]) > 0 && strpos($arParams["INIT_DATE"], '.') !== false) {
$ts = CCalendar::Timestamp($arParams["INIT_DATE"]);
} else {
$ts = time();
}
$fromLimit = CCalendar::Date($ts, false);
$ts = CCalendar::Timestamp($fromLimit);
$toLimit = CCalendar::Date(mktime(0, 0, 0, date("m", $ts) + $arParams["FUTURE_MONTH_COUNT"], date("d", $ts), date("Y", $ts)), false);
$arResult['ITEMS'] = array();
$arEvents = CCalendar::GetNearestEventsList(array('bCurUserList' => $arParams['B_CUR_USER_LIST'], 'fromLimit' => $fromLimit, 'toLimit' => $toLimit, 'type' => $arParams['CALENDAR_TYPE'], 'sectionId' => $arParams['CALENDAR_SECTION_ID']));
if ($arEvents == 'access_denied') {
$arResult['ACCESS_DENIED'] = true;
} elseif ($arEvents == 'inactive_feature') {
$arResult['INACTIVE_FEATURE'] = true;
} elseif (is_array($arEvents)) {
if (strpos($arParams['DETAIL_URL'], '?') !== FALSE) {
$arParams['DETAIL_URL'] = substr($arParams['DETAIL_URL'], 0, strpos($arParams['DETAIL_URL'], '?'));
}
$arParams['DETAIL_URL'] = str_replace('#user_id#', $curUserId, strtolower($arParams['DETAIL_URL']));
for ($i = 0, $l = count($arEvents); $i < $l; $i++) {
$arEvents[$i]['_DETAIL_URL'] = $arParams['DETAIL_URL'] . '?EVENT_ID=' . $arEvents[$i]['ID'] . '&EVENT_DATE=' . $arEvents[$i]['DT_FROM'];
if ($arEvents[$i]['IS_MEETING'] && $arEvents[$i]['USER_MEETING']['STATUS'] == 'Q') {
$arEvents[$i]['_ADD_CLASS'] = ' calendar-not-confirmed';
$arEvents[$i]['_Q_ICON'] = '<span class="calendar-reminder" title="' . GetMessage('EC_NOT_CONFIRMED') . '">[?]</span>';
} else {
示例2: time
// We check it in the mobile menu
CUserOptions::SetOption("mobile", "calendar_first_visit", "N");
// Limits
if (strlen($arParams["INIT_DATE"]) > 0 && strpos($arParams["INIT_DATE"], '.') !== false) {
$ts = CCalendar::Timestamp($arParams["INIT_DATE"]);
} else {
$ts = time();
}
$arParams["FUTURE_MONTH_COUNT"] = 2;
$userOffset = CCalendar::GetOffset($arParams['USER_ID']);
$fromLimit = CCalendar::Date($ts + $userOffset, false);
$ts = CCalendar::Timestamp($fromLimit);
$delta = 5184000;
// 86400 * 30 * 2 ~ two month;
$toLimit = CCalendar::Date($ts + $delta, false);
$arEvents = CCalendar::GetNearestEventsList(array('bCurUserList' => true, 'userId' => $arParams['USER_ID'], 'fromLimit' => $fromLimit, 'toLimit' => $toLimit));
if ($arEvents == 'access_denied') {
$arResult['ACCESS_DENIED'] = true;
} elseif ($arEvents == 'inactive_feature') {
$arResult['INACTIVE_FEATURE'] = true;
} elseif (is_array($arEvents)) {
$arSections = array(array("ID" => 'today', "NAME" => CMobile::PrepareStrToJson(GetMessage('EVENTS_GROUP_TODAY'))), array("ID" => 'tomorrow', "NAME" => CMobile::PrepareStrToJson(GetMessage('EVENTS_GROUP_TOMORROW'))), array("ID" => 'later', "NAME" => CMobile::PrepareStrToJson(GetMessage('EVENTS_GROUP_LATE'))));
$url = '/mobile/calendar/view_event.php';
$arResult['EVENTS'] = array();
$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);
示例3: EventGetNearest
public static function EventGetNearest($arParams = array(), $nav = null, $server = null)
{
$userId = CCalendar::GetCurUserId();
$methodName = "calendar.event.get.nearest";
if (!isset($arParams['type'], $arParams['ownerId']) || $arParams['forCurrentUser']) {
$arParams['type'] = 'user';
$arParams['ownerId'] = $userId;
$arParams['forCurrentUser'] = true;
}
if (!isset($arParams['days'])) {
$arParams['days'] = 60;
}
// Limits
$ts = time();
$fromLimit = CCalendar::Date($ts, false);
$toLimit = CCalendar::Date($ts + CCalendar::DAY_LENGTH * $arParams['days'], false);
$arEvents = CCalendar::GetNearestEventsList(array('bCurUserList' => !!$arParams['forCurrentUser'], 'fromLimit' => $fromLimit, 'toLimit' => $toLimit, 'type' => $arParams['CALENDAR_TYPE'], 'sectionId' => $arParams['CALENDAR_SECTION_ID']));
if ($arEvents == 'access_denied' || $arEvents == 'inactive_feature') {
throw new Exception(GetMessage('CAL_REST_ACCESS_DENIED'));
} elseif (is_array($arEvents)) {
if (isset($arParams['detailUrl'])) {
if (strpos($arParams['detailUrl'], '?') !== FALSE) {
$arParams['detailUrl'] = substr($arParams['detailUrl'], 0, strpos($arParams['detailUrl'], '?'));
}
$arParams['detailUrl'] = str_replace('#user_id#', $userId, strtolower($arParams['detailUrl']));
for ($i = 0, $l = count($arEvents); $i < $l; $i++) {
$arEvents[$i]['~detailUrl'] = $arParams['detailUrl'] . '?EVENT_ID=' . $arEvents[$i]['ID'] . '&EVENT_DATE=' . $arEvents[$i]['DT_FROM'];
}
}
if (isset($arParams['maxEventsCount'])) {
array_splice($arEvents, intVal($arParams['maxEventsCount']));
}
}
return $arEvents;
}