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


PHP CCalendar::WeekDayByInd方法代码示例

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


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

示例1: ModifyEvent

 public static function ModifyEvent($calendarId, $arFields)
 {
     list($sectionId, $entityType, $entityId) = $calendarId;
     $userId = $entityType == 'user' ? $entityId : 0;
     self::$silentErrorMode = true;
     CCalendar::SetOffset(false, CCalendar::GetOffset($userId));
     $entityType = strtolower($entityType);
     $eventId = isset($arFields["ID"]) && intval($arFields["ID"]) > 0 ? intval($arFields["ID"]) : 0;
     $arNewFields = array("DAV_XML_ID" => $arFields['XML_ID'], "CAL_DAV_LABEL" => isset($arFields['PROPERTY_BXDAVCD_LABEL']) && strlen($arFields['PROPERTY_BXDAVCD_LABEL']) > 0 ? $arFields['PROPERTY_BXDAVCD_LABEL'] : '', "DAV_EXCH_LABEL" => isset($arFields['PROPERTY_BXDAVEX_LABEL']) && strlen($arFields['PROPERTY_BXDAVEX_LABEL']) > 0 ? $arFields['PROPERTY_BXDAVEX_LABEL'] : '', "ID" => $eventId, 'NAME' => $arFields["NAME"] ? $arFields["NAME"] : GetMessage('EC_NONAME_EVENT'), 'CAL_TYPE' => $entityType, 'OWNER_ID' => $entityId, 'DESCRIPTION' => isset($arFields['DESCRIPTION']) ? $arFields['DESCRIPTION'] : '', 'SECTIONS' => $sectionId, 'ACCESSIBILITY' => isset($arFields['ACCESSIBILITY']) ? $arFields['ACCESSIBILITY'] : 'busy', 'IMPORTANCE' => isset($arFields['IMPORTANCE']) ? $arFields['IMPORTANCE'] : 'normal', "REMIND" => is_array($arFields['REMIND']) ? $arFields['REMIND'] : array(), "RRULE" => is_array($arFields['RRULE']) ? is_array($arFields['RRULE']) : array(), "VERSION" => isset($arFields['VERSION']) ? intVal($arFields['VERSION']) : 1, "PRIVATE_EVENT" => !!$arFields['PRIVATE_EVENT']);
     $bServerTime = false;
     if (isset($arFields['DT_FROM_TS'], $arFields['DT_TO_TS'])) {
         $arNewFields["DT_FROM_TS"] = $arFields['DT_FROM_TS'];
         $arNewFields["DT_TO_TS"] = $arFields['DT_TO_TS'];
         $arNewFields["SKIP_TIME"] = $arFields['SKIP_TIME'];
         $bServerTime = true;
     } elseif (isset($arFields['ACTIVE_FROM'], $arFields['ACTIVE_TO'])) {
         $arNewFields["DT_FROM"] = $arFields['ACTIVE_FROM'];
         $arNewFields["DT_TO"] = $arFields['ACTIVE_TO'];
     }
     if (!empty($arFields['PROPERTY_REMIND_SETTINGS'])) {
         $ar = explode("_", $arFields["PROPERTY_REMIND_SETTINGS"]);
         if (count($ar) == 2) {
             $arNewFields["REMIND"][] = array('type' => $ar[1], 'count' => floatVal($ar[0]));
         }
     }
     if (!empty($arFields['PROPERTY_ACCESSIBILITY'])) {
         $arNewFields["ACCESSIBILITY"] = $arFields['PROPERTY_ACCESSIBILITY'];
     }
     if (!empty($arFields['PROPERTY_IMPORTANCE'])) {
         $arNewFields["IMPORTANCE"] = $arFields['PROPERTY_IMPORTANCE'];
     }
     if (!empty($arFields['PROPERTY_LOCATION'])) {
         $arNewFields["LOCATION"] = CCalendar::UnParseTextLocation($arFields['PROPERTY_LOCATION']);
     }
     if (!empty($arFields['DETAIL_TEXT'])) {
         $arNewFields["DESCRIPTION"] = $arFields['DETAIL_TEXT'];
     }
     $arNewFields["DESCRIPTION"] = CCalendar::ClearExchangeHtml($arNewFields["DESCRIPTION"]);
     if (isset($arFields["PROPERTY_PERIOD_TYPE"]) && in_array($arFields["PROPERTY_PERIOD_TYPE"], array("DAILY", "WEEKLY", "MONTHLY", "YEARLY"))) {
         $arNewFields['RRULE']['FREQ'] = $arFields["PROPERTY_PERIOD_TYPE"];
         $arNewFields['RRULE']['INTERVAL'] = $arFields["PROPERTY_PERIOD_COUNT"];
         if (!isset($arNewFields['DT_LENGTH']) && !empty($arFields['PROPERTY_EVENT_LENGTH'])) {
             $arNewFields['DT_LENGTH'] = intval($arFields['PROPERTY_EVENT_LENGTH']);
         } else {
             $arNewFields['DT_LENGTH'] = $arFields['DT_TO_TS'] - $arFields['DT_FROM_TS'];
             //$arNewFields['DT_LENGTH'] = self::GetDayLen();
         }
         if ($arNewFields['RRULE']['FREQ'] == "WEEKLY" && !empty($arFields['PROPERTY_PERIOD_ADDITIONAL'])) {
             $arNewFields['RRULE']['BYDAY'] = array();
             $bydays = explode(',', $arFields['PROPERTY_PERIOD_ADDITIONAL']);
             foreach ($bydays as $day) {
                 $day = CCalendar::WeekDayByInd($day, false);
                 if ($day !== false) {
                     $arNewFields['RRULE']['BYDAY'][] = $day;
                 }
             }
             $arNewFields['RRULE']['BYDAY'] = implode(',', $arNewFields['RRULE']['BYDAY']);
         }
         if (isset($arFields['ACTIVE_TO'])) {
             $arNewFields['RRULE']['UNTIL'] = $arFields['ACTIVE_TO'];
         } else {
             $arNewFields['RRULE']['UNTIL'] = $arFields['DT_TO_TS'];
         }
     }
     $eventId = CCalendar::SaveEvent(array('arFields' => $arNewFields, 'userId' => $userId, 'bAffectToDav' => false, 'bSilentAccessMeeting' => true, 'bServerTime' => $bServerTime));
     self::$silentErrorMode = false;
     return $eventId;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:68,代码来源:calendar.php

示例2: ParseRecursion

 public static function ParseRecursion(&$res, $event, $Params = array())
 {
     $event['DT_LENGTH'] = intVal($event['DT_LENGTH']);
     // length in seconds
     $length = $event['DT_LENGTH'];
     $rrule = self::ParseRRULE($event['RRULE']);
     $h24 = CCalendar::GetDayLen();
     $instanceCount = $Params['instanceCount'] && $Params['instanceCount'] > 0 ? $Params['instanceCount'] : false;
     $preciseLimits = $Params['preciseLimits'];
     if ($length < 0) {
         // Protection from infinite recursion
         $length = $h24;
     }
     // Time boundaries
     if (isset($Params['fromLimitTs'])) {
         $limitFromTS = intVal($Params['fromLimitTs']);
     } else {
         $limitFromTS = CCalendar::Timestamp($Params['fromLimit']);
     }
     if (isset($Params['toLimitTs'])) {
         $limitToTS = intVal($Params['toLimitTs']);
     } else {
         $limitToTS = CCalendar::Timestamp($Params['toLimit']);
     }
     $limitFromTSReal = $limitFromTS;
     $evFromTS = isset($event['DT_FROM_TS']) ? $event['DT_FROM_TS'] : CCalendar::Timestamp($event['DT_FROM']);
     $evToTS = isset($event['DT_TO_TS']) ? $event['DT_TO_TS'] : CCalendar::Timestamp($event['DT_TO']);
     if ($limitFromTS < $evFromTS) {
         $limitFromTS = $evFromTS;
     }
     if ($limitToTS > $evToTS) {
         $limitToTS = $evToTS;
     }
     $fromTS = $evFromTS;
     $offset = CCalendar::GetOffset();
     if ($event['DT_SKIP_TIME'] == 'N' && $offset != 0) {
         $fromTS += $offset;
     }
     $event['~DT_FROM'] = $event['DT_FROM'];
     $event['~DT_FROM_TS'] = $event['DT_FROM_TS'];
     if ($event['DT_SKIP_TIME'] == 'Y') {
         if ($event['DT_LENGTH'] == $h24) {
             $event['~DT_TO'] = $event['DT_FROM'];
             $event['~DT_TO_TS'] = $event['DT_FROM_TS'];
         } else {
             $event['~DT_TO_TS'] = mktime(date("H", $evFromTS), date("i", $evFromTS), date("s", $evFromTS) + $event['DT_LENGTH'] - $h24, date("m", $evFromTS), date("d", $evFromTS), date("Y", $evFromTS));
             $event['~DT_TO'] = CCalendar::Date($event['~DT_TO_TS']);
         }
     } else {
         $event['~DT_TO_TS'] = mktime(date("H", $evFromTS), date("i", $evFromTS), date("s", $evFromTS) + $event['DT_LENGTH'], date("m", $evFromTS), date("d", $evFromTS), date("Y", $evFromTS));
         $event['~DT_TO'] = CCalendar::Date($event['~DT_TO_TS']);
     }
     $hour = date("H", $fromTS);
     $min = date("i", $fromTS);
     $sec = date("s", $fromTS);
     $orig_d = date("d", $fromTS);
     $orig_m = date("m", $fromTS);
     $orig_y = date("Y", $fromTS);
     $count = 0;
     $realCount = 0;
     $dispCount = 0;
     while (true) {
         $d = date("d", $fromTS);
         $m = date("m", $fromTS);
         $y = date("Y", $fromTS);
         $toTS = mktime($hour, $min, $sec + $length, $m, $d, $y);
         if (!$fromTS || $fromTS < $evFromTS - CCalendar::GetDayLen() || $rrule['COUNT'] > 0 && $count >= $rrule['COUNT'] || !$rrule['COUNT'] && $fromTS >= $limitToTS || $instanceCount && $dispCount >= $instanceCount) {
             break;
         }
         if ($rrule['FREQ'] == 'WEEKLY') {
             $weekDay = CCalendar::WeekDayByInd(date("w", $fromTS));
             if ($rrule['BYDAY'][$weekDay]) {
                 if ($preciseLimits && $fromTS > $limitFromTSReal || !$preciseLimits && $fromTS > $limitFromTS - $h24) {
                     if ($event['DT_SKIP_TIME'] == 'N' && $offset != 0) {
                         $fromTS -= $offset;
                         $toTS -= $offset;
                     }
                     self::HandleREvent($res, $event, array('DT_FROM_TS' => $fromTS, 'DT_TO_TS' => $toTS, 'RINDEX' => $count, 'RRULE' => $rrule));
                     $dispCount++;
                 }
                 $realCount++;
             }
             if (isset($weekDay) && $weekDay == 'SU') {
                 $delta = ($rrule['INTERVAL'] - 1) * 7 + 1;
             } else {
                 $delta = 1;
             }
             $fromTS = mktime($hour, $min, $sec, $m, $d + $delta, $y);
         } else {
             if ($preciseLimits && $fromTS > $limitFromTSReal || !$preciseLimits && $fromTS > $limitFromTS - $h24) {
                 if ($event['DT_SKIP_TIME'] == 'N' && $offset != 0) {
                     $fromTS -= $offset;
                     $toTS -= $offset;
                 }
                 self::HandleREvent($res, $event, array('DT_FROM_TS' => $fromTS, 'DT_TO_TS' => $toTS, 'RINDEX' => $count, 'RRULE' => $rrule));
                 $dispCount++;
             }
             $realCount++;
             switch ($rrule['FREQ']) {
                 //					case 'HOURLY':
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:calendar_event.php

示例3: ConvertEntity


//.........这里部分代码省略.........
     } else {
         $arGroupPerm = CIBlock::GetGroupPermissions($iblockId);
         $taskByLetter = array('D' => CCalendar::GetAccessTasksByName('calendar_section', 'calendar_denied'), 'R' => CCalendar::GetAccessTasksByName('calendar_section', 'calendar_view'), 'W' => CCalendar::GetAccessTasksByName('calendar_section', 'calendar_edit'), 'X' => CCalendar::GetAccessTasksByName('calendar_section', 'calendar_access'));
         foreach ($arGroupPerm as $groupId => $letter) {
             $Access['G' . $groupId] = $taskByLetter[$letter];
         }
     }
     // 1. Fetch sections
     $arUserSections = CEventCalendar::GetCalendarList(array($iblockId, $sectionId, 0, $ownerType));
     $calendarIndex = array();
     foreach ($arUserSections as $section) {
         $arUF = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields($ent_id, $section['ID']);
         if (isset($arUF["UF_CAL_CONVERTED"]) && strlen($arUF["UF_CAL_CONVERTED"]['VALUE']) > 0) {
             continue;
         }
         $SectionAccess = array();
         if ($bSetAccessFromCalendar && $ownerType == 'user') {
             if ($section['PRIVATE_STATUS'] == 'private') {
                 $deniedTask = CCalendar::GetAccessTasksByName('calendar_section', 'calendar_denied');
                 $SectionAccess['G2'] = $deniedTask;
             } elseif ($section['PRIVATE_STATUS'] == 'time') {
                 $viewTimeTask = CCalendar::GetAccessTasksByName('calendar_section', 'calendar_view_time');
                 $SectionAccess['G2'] = $viewTimeTask;
             } elseif ($section['PRIVATE_STATUS'] == 'title') {
                 $viewTitleTask = CCalendar::GetAccessTasksByName('calendar_section', 'calendar_view_title');
                 $SectionAccess['G2'] = $viewTitleTask;
             } else {
                 $SectionAccess = $Access;
                 // nested from common access settings from socnet
             }
         } else {
             $SectionAccess = $Access;
             // G2 => denied
         }
         $new_sect_id = CCalendarSect::Edit(array('arFields' => array("CAL_TYPE" => $ownerType, "NAME" => $section['NAME'], "OWNER_ID" => $ownerId, "CREATED_BY" => $createdBy, "DESCRIPTION" => $section['DESCRIPTION'], "COLOR" => $section["COLOR"], "ACCESS" => $SectionAccess)));
         // Set converted property
         $bs->Update($section['ID'], array('UF_CAL_CONVERTED' => 1));
         $calendarIndex[$section['ID']] = $new_sect_id;
         $sectCount++;
     }
     // 2. Create events
     $arEvents = CEventCalendar::GetCalendarEventsList(array($iblockId, $sectionId, 0), array());
     foreach ($arEvents as $event) {
         if (!isset($calendarIndex[$event['IBLOCK_SECTION_ID']]) || $event['PROPERTY_PARENT'] > 0) {
             continue;
         }
         $arFields = array("CAL_TYPE" => $ownerType, "OWNER_ID" => $ownerId, "CREATED_BY" => $event["CREATED_BY"], "DT_FROM" => $event['ACTIVE_FROM'], "DT_TO" => $event['ACTIVE_TO'], 'NAME' => htmlspecialcharsback($event['NAME']), 'DESCRIPTION' => CCalendar::ParseHTMLToBB(htmlspecialcharsback($event['DETAIL_TEXT'])), 'SECTIONS' => array($calendarIndex[$event['IBLOCK_SECTION_ID']]), 'ACCESSIBILITY' => $event['PROPERTY_ACCESSIBILITY'], 'IMPORTANCE' => $event['PROPERTY_IMPORTANCE'], 'PRIVATE_EVENT' => $event['PROPERTY_PRIVATE'] && $event['PROPERTY_PRIVATE'] == 'true' ? '1' : '', 'RRULE' => array(), 'LOCATION' => array('NEW' => $event['PROPERTY_LOCATION'], 'RE_RESERVE' => 'N'), "REMIND" => array(), "IS_MEETING" => $event['PROPERTY_IS_MEETING'] == 'Y');
         if (!empty($event['PROPERTY_REMIND_SETTINGS'])) {
             $ar = explode("_", $event["PROPERTY_REMIND_SETTINGS"]);
             if (count($ar) == 2) {
                 $arFields["REMIND"][] = array('type' => $ar[1], 'count' => floatVal($ar[0]));
             }
         }
         if (isset($event["PROPERTY_PERIOD_TYPE"]) && in_array($event["PROPERTY_PERIOD_TYPE"], array("DAILY", "WEEKLY", "MONTHLY", "YEARLY"))) {
             $arFields['RRULE']['FREQ'] = $event["PROPERTY_PERIOD_TYPE"];
             $arFields['RRULE']['INTERVAL'] = $event["PROPERTY_PERIOD_COUNT"];
             if (!empty($event['PROPERTY_EVENT_LENGTH'])) {
                 $arFields['DT_LENGTH'] = intval($event['PROPERTY_EVENT_LENGTH']);
             }
             if (!$arFields['DT_LENGTH']) {
                 $arFields['DT_LENGTH'] = 86400;
             }
             if ($arFields['RRULE']['FREQ'] == "WEEKLY" && !empty($event['PROPERTY_PERIOD_ADDITIONAL'])) {
                 $arFields['RRULE']['BYDAY'] = array();
                 $bydays = explode(',', $event['PROPERTY_PERIOD_ADDITIONAL']);
                 foreach ($bydays as $day) {
                     $day = CCalendar::WeekDayByInd($day);
                     if ($day !== false) {
                         $arFields['RRULE']['BYDAY'][] = $day;
                     }
                 }
                 $arFields['RRULE']['BYDAY'] = implode(',', $arFields['RRULE']['BYDAY']);
             }
             $arFields['RRULE']['UNTIL'] = $event['ACTIVE_TO'];
         }
         if ($arFields['IS_MEETING']) {
             if ($event['PROPERTY_PARENT'] > 0) {
                 continue;
             }
             $host = intVal($event['CREATED_BY']);
             $arFields['ATTENDEES'] = array();
             if ($event['PROPERTY_HOST_IS_ABSENT'] == 'N') {
                 $arFields['ATTENDEES'][] = $host;
             }
             $arGuests = CECEvent::GetGuests(self::$userIblockId, $event['ID']);
             $attendeesStatuses = array();
             foreach ($arGuests as $userId => $ev) {
                 $attendeesStatuses[$userId] = $ev['PROPERTY_VALUES']['CONFIRMED'];
                 $arFields['ATTENDEES'][] = $userId;
             }
             $arFields['MEETING_HOST'] = $host;
             $arFields['MEETING'] = array('HOST_NAME' => CCalendar::GetUserName($host), 'TEXT' => is_array($event['PROPERTY_MEETING_TEXT']) && is_string($event['PROPERTY_MEETING_TEXT']['TEXT']) ? trim($event['PROPERTY_MEETING_TEXT']['TEXT']) : '', 'OPEN' => false, 'NOTIFY' => false, 'REINVITE' => false);
         }
         $new_event_id = CCalendar::SaveEvent(array('arFields' => $arFields, 'bAffectToDav' => false, 'attendeesStatuses' => $attendeesStatuses, 'bSendInvitations' => false));
         $eventsCount++;
     }
     // 3. Set userfield
     $bs->Update($sectionId, array('UF_CAL_CONVERTED' => 1));
     return array('eventsCount' => $eventsCount, 'sectCount' => $sectCount);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:calendar_convert.php


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