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


PHP CCalendar::GetType方法代码示例

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


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

示例1: Show


//.........这里部分代码省略.........
     }
     self::$userMeetingSection = CCalendar::GetCurUserMeetingSection();
     //  **** GET SECTIONS ****
     $arSections = self::GetSectionList(array('ADDITIONAL_IDS' => $arDisplayedSPSections));
     $bReadOnly = !self::$perm['edit'] && !self::$perm['section_edit'];
     if (self::$type == 'user' && self::$ownerId != self::$userId) {
         $bReadOnly = true;
     }
     if (!$USER->IsAuthorized()) {
         $bReadOnly = true;
     }
     $bCreateDefault = true;
     if (self::$type == 'user') {
         $bCreateDefault = self::$ownerId == self::$userId;
     }
     $noEditAccessedCalendars = true;
     $additonalMeetingsId = array();
     foreach ($arSections as $i => $section) {
         $arSections[$i]['~IS_MEETING_FOR_OWNER'] = $section['CAL_TYPE'] == 'user' && $section['OWNER_ID'] != self::$userId && CCalendar::GetMeetingSection($section['OWNER_ID']) == $section['ID'];
         if (!in_array($section['ID'], $hiddenSections)) {
             $arSectionIds[] = $section['ID'];
             // It's superposed calendar of the other user and it's need to show user's meetings
             if ($arSections[$i]['~IS_MEETING_FOR_OWNER']) {
                 $additonalMeetingsId[] = array('ID' => $section['OWNER_ID'], 'SECTION_ID' => $section['ID']);
             }
         }
         // We check access only for main sections because we can't edit superposed section
         if ($arSections[$i]['CAL_TYPE'] == self::$type && $arSections[$i]['OWNER_ID'] == self::$ownerId) {
             if ($noEditAccessedCalendars && $section['PERM']['edit']) {
                 $noEditAccessedCalendars = false;
             }
             if ($bReadOnly && ($section['PERM']['edit'] || $section['PERM']['edit_section'])) {
                 $bReadOnly = false;
             }
         }
         if (self::$bSuperpose && in_array($section['ID'], $arAddSections)) {
             $arSections[$i]['SUPERPOSED'] = true;
         }
         if ($bCreateDefault && $section['CAL_TYPE'] == self::$type && $section['OWNER_ID'] == self::$ownerId) {
             $bCreateDefault = false;
         }
     }
     if ($noEditAccessedCalendars && !$bCreateDefault) {
         $bReadOnly = true;
     }
     if (self::$bSuperpose && $bReadOnly && count($arAddSections) <= 0) {
         self::$bSuperpose = false;
     }
     self::$bReadOnly = $bReadOnly;
     if (!$bReadOnly && $showNewEventDialog) {
         $JSConfig['showNewEventDialog'] = true;
         $JSConfig['bChooseMR'] = isset($_GET['CHOOSE_MR']) && $_GET['CHOOSE_MR'] == "Y";
     }
     if (!in_array($JSConfig['lastSection'], $arSectionIds)) {
         $JSConfig['lastSection'] = $arSectionIds[0];
     }
     //  **** GET EVENTS ****
     // NOTICE: Attendees for meetings selected inside this method and returns as array by link '$arAttendees'
     $arAttendees = array();
     // List of attendees for each event Array([ID] => Array(), ..,);
     $arEvents = self::GetEventList(array('type' => self::$type, 'section' => $arSectionIds, 'fromLimit' => self::Date(mktime(0, 0, 0, $init_month - 1, 20, $init_year), false), 'toLimit' => self::Date(mktime(0, 0, 0, $init_month + 1, 10, $init_year), false), 'additonalMeetingsId' => $additonalMeetingsId), $arAttendees);
     $arTaskIds = array();
     //  **** GET TASKS ****
     if (self::$bTasks && !in_array('tasks', $hiddenSections)) {
         $arTasks = self::GetTaskList(array('fromLimit' => self::Date(mktime(0, 0, 0, $init_month - 1, 20, $init_year), false), 'toLimit' => self::Date(mktime(0, 0, 0, $init_month + 1, 10, $init_year), false)), $arTaskIds);
         if (count($arTasks) > 0) {
             $arEvents = array_merge($arEvents, $arTasks);
         }
     }
     // We don't have any section
     if ($bCreateDefault) {
         $defCalendar = CCalendarSect::CreateDefault(array('type' => CCalendar::GetType(), 'ownerId' => CCalendar::GetOwnerId()));
         $arSectionIds[] = $defCalendar['ID'];
         $arSections[] = $defCalendar;
         self::$userMeetingSection = $defCalendar['ID'];
     }
     if (CCalendarType::CanDo('calendar_type_edit', self::$type)) {
         $JSConfig['new_section_access'] = CCalendarSect::GetDefaultAccess(self::$type, self::$ownerId);
     }
     if ($bReadOnly && (!count($arSections) || count($arSections) == 1 && !self::$bIntranet)) {
         $bShowSections = false;
     } else {
         $bShowSections = true;
     }
     $arColors = array('#CEE669', '#E6A469', '#98AEF6', '#7DDEC2', '#B592EC', '#D98E85', '#F6EA68', '#DDBFEB', '#FF8D89', '#FFCEFF', '#3ABF54', '#BF793A', '#1C1CD8', '#4BB798', '#855CC5', '#B25D52', '#FFBD26', '#C48297', '#E53D37', '#7DF5FF');
     // Build calendar base html and dialogs
     CCalendarSceleton::Build(array('id' => $id, 'type' => self::$type, 'ownerId' => self::$ownerId, 'bShowSections' => $bShowSections, 'bShowSuperpose' => self::$bSuperpose, 'bShowBanner' => $bShowBanner, 'bOutlook' => self::$bIntranet && self::$bWebservice, 'bExtranet' => $bExtranet, 'bReadOnly' => $bReadOnly, 'bShowTasks' => self::$bTasks, 'arTaskIds' => $arTaskIds, 'bSocNet' => self::$bSocNet, 'bIntranet' => self::$bIntranet, 'bCalDAV' => $bCalDAV, 'bExchange' => $bExchange, 'bExchangeConnected' => $bExchangeConnected, 'inPersonalCalendar' => self::IsPersonal(), 'colors' => $arColors, 'bAMPM' => self::$bAMPM));
     $JSConfig['arCalColors'] = $arColors;
     $JSConfig['events'] = $arEvents;
     $JSConfig['attendees'] = $arAttendees;
     $JSConfig['sections'] = $arSections;
     $JSConfig['sectionsIds'] = $arSectionIds;
     $JSConfig['hiddenSections'] = $hiddenSections;
     $JSConfig['readOnly'] = $bReadOnly;
     $JSConfig['accessNames'] = self::GetAccessNames();
     $JSConfig['bSuperpose'] = self::$bSuperpose;
     $JSConfig['additonalMeetingsId'] = $additonalMeetingsId;
     // Append Javascript files and CSS files, and some base configs
     CCalendarSceleton::InitJS($JSConfig);
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:calendar.php

示例2: Edit


//.........这里部分代码省略.........
     $offset = CCalendar::GetOffset();
     $arFields['LOCATION'] = CCalendar::SetLocation($arFields['LOCATION']['OLD'], $arFields['LOCATION']['NEW'], array('dateFrom' => CCalendar::Date($arFields['DT_FROM_TS'] + $offset), 'dateTo' => CCalendar::Date($arFields['DT_TO_TS'] + $offset), 'name' => $arFields['NAME'], 'persons' => count($attendees), 'attendees' => $attendees, 'bRecreateReserveMeetings' => $arFields['LOCATION']['RE_RESERVE'] !== 'N'));
     $bSendInvitations = false;
     if (!isset($arFields['IS_MEETING']) && isset($arFields['ATTENDEES']) && is_array($arFields['ATTENDEES']) && empty($arFields['ATTENDEES'])) {
         $arFields['IS_MEETING'] = false;
     }
     $attendeesCodes = array();
     if ($arFields['IS_MEETING'] && is_array($arFields['MEETING'])) {
         if (!empty($arFields['ATTENDEES_CODES'])) {
             $attendeesCodes = $arFields['ATTENDEES_CODES'];
             $arFields['ATTENDEES_CODES'] = implode(',', $arFields['ATTENDEES_CODES']);
         }
         // Organizer
         $bSendInvitations = $Params['bSendInvitations'] !== false;
         $arFields['~MEETING'] = array('HOST_NAME' => $arFields['MEETING']['HOST_NAME'], 'TEXT' => $arFields['MEETING']['TEXT'], 'OPEN' => $arFields['MEETING']['OPEN'], 'NOTIFY' => $arFields['MEETING']['NOTIFY'], 'REINVITE' => $arFields['MEETING']['REINVITE']);
         $arFields['MEETING'] = serialize($arFields['~MEETING']);
     }
     $arReminders = array();
     if ($arFields['REMIND'] && is_array($arFields['REMIND'])) {
         foreach ($arFields['REMIND'] as $remind) {
             if (in_array($remind['type'], array('min', 'hour', 'day'))) {
                 $arReminders[] = array('type' => $remind['type'], 'count' => floatVal($remind['count']));
             }
         }
     }
     $arFields['REMIND'] = count($arReminders) > 0 ? serialize($arReminders) : '';
     $AllFields = self::GetFields();
     $dbFields = array();
     foreach ($arFields as $field => $val) {
         if (isset($AllFields[$field]) && $field != "ID") {
             $dbFields[$field] = $arFields[$field];
         }
     }
     CTimeZone::Disable();
     if ($bNew) {
         $ID = CDatabase::Add("b_calendar_event", $dbFields, array('DESCRIPTION', 'MEETING', 'RDATE', 'EXDATE'));
     } else {
         $ID = $arFields['ID'];
         $strUpdate = $DB->PrepareUpdate("b_calendar_event", $dbFields);
         $strSql = "UPDATE b_calendar_event SET " . $strUpdate . " WHERE ID=" . IntVal($arFields['ID']);
         $DB->QueryBind($strSql, array('DESCRIPTION' => $arFields['DESCRIPTION'], 'MEETING' => $arFields['MEETING'], 'RDATE' => $arFields['RDATE'], 'EXDATE' => $arFields['EXDATE']));
     }
     CTimeZone::Enable();
     if ($bNew && !isset($dbFields['DAV_XML_ID'])) {
         $strSql = "UPDATE b_calendar_event SET " . $DB->PrepareUpdate("b_calendar_event", array('DAV_XML_ID' => $ID)) . " WHERE ID=" . IntVal($ID);
         $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     }
     // Clean links
     // Del link from table
     if (!$bNew) {
         $arAffectedSections = CCalendarEvent::GetCurrentSectionIds($ID);
         $DB->Query("DELETE FROM b_calendar_event_sect WHERE EVENT_ID=" . IntVal($ID), false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
     } else {
         $arAffectedSections = array();
     }
     $strSections = "0";
     foreach ($arFields['SECTIONS'] as $sect) {
         if (IntVal($sect) > 0) {
             $strSections .= "," . IntVal($sect);
             $arAffectedSections[] = IntVal($sect);
         }
     }
     if (count($arAffectedSections) > 0) {
         CCalendarSect::UpdateModificationLabel($arAffectedSections);
     }
     // We don't have any section for this event
     // and we have to create default one.
     if ($strSections == "0") {
         $defCalendar = CCalendarSect::CreateDefault(array('type' => CCalendar::GetType(), 'ownerId' => CCalendar::GetOwnerId()));
         $strSections .= "," . IntVal($defCalendar['ID']);
     }
     // Add links
     $strSql = "INSERT INTO b_calendar_event_sect(EVENT_ID, SECT_ID) " . "SELECT " . intVal($ID) . ", ID " . "FROM b_calendar_section " . "WHERE ID in (" . $strSections . ")";
     $DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
     $bPull = CModule::IncludeModule("pull");
     if ($arFields['IS_MEETING']) {
         if (isset($arFields['ATTENDEES'])) {
             self::InviteAttendees($ID, $arFields, $arFields['ATTENDEES'], is_array($Params['attendeesStatuses']) ? $Params['attendeesStatuses'] : array(), $bSendInvitations, $userId);
             if ($bPull) {
                 // TODO: CACHE IT!
                 $attendees = self::GetAttendees($ID);
                 $attendees = $attendees[$ID];
                 foreach ($attendees as $user) {
                     CPullStack::AddByUser($user['USER_ID'], array('module_id' => 'calendar', 'command' => 'event_update', 'params' => array('EVENT' => CCalendarEvent::OnPullPrepareArFields($arFields), 'ATTENDEES' => $attendees, 'NEW' => $bNew ? 'Y' : 'N')));
                 }
             }
         }
     } else {
         if ($bPull) {
             CPullStack::AddByUser($userId, array('module_id' => 'calendar', 'command' => 'event_update', 'params' => array('EVENT' => CCalendarEvent::OnPullPrepareArFields($arFields), 'ATTENDEES' => array(), 'NEW' => $bNew ? 'Y' : 'N')));
         }
     }
     // Clean old reminders and add new reminders
     self::UpdateReminders(array('id' => $ID, 'reminders' => $arReminders, 'arFields' => $arFields, 'userId' => $userId, 'path' => $path, 'bNew' => $bNew));
     if ($arFields['CAL_TYPE'] == 'user' && $arFields['IS_MEETING'] && !empty($attendeesCodes)) {
         CCalendarLiveFeed::OnEditCalendarEventEntry($ID, $arFields, $attendeesCodes);
     }
     CCalendar::ClearCache('event_list');
     return $ID;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:calendar_event.php

示例3: CanDo

 public static function CanDo($operation, $sectId = 0, $userId = false)
 {
     global $USER;
     if (!isset($USER) || !$sectId) {
         return false;
     }
     if ($USER->CanDoOperation('edit_php')) {
         return true;
     }
     if ((CCalendar::GetType() == 'group' || CCalendar::GetType() == 'user') && CCalendar::IsSocNet() && CCalendar::IsSocnetAdmin()) {
         return true;
     }
     $res = in_array($operation, self::GetOperations($sectId, $userId));
     self::$bClearOperationCache = false;
     return $res;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:16,代码来源:calendar_sect.php


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