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


PHP CCalendar::SaveEvent方法代码示例

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


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

示例1: Execute

 public function Execute()
 {
     if (!CModule::IncludeModule("calendar")) {
         return CBPActivityExecutionStatus::Closed;
     }
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $documentService = $this->workflow->GetService("DocumentService");
     $fromTs = CCalendar::Timestamp($this->CalendarFrom);
     $toTs = $this->CalendarTo == '' ? $fromTs : CCalendar::Timestamp($this->CalendarTo);
     $arFields = array("CAL_TYPE" => !$this->CalendarType ? 'user' : $this->CalendarType, "NAME" => trim($this->CalendarName) == '' ? GetMessage('EC_DEFAULT_EVENT_NAME') : $this->CalendarName, "DESCRIPTION" => $this->CalendarDesrc, "SKIP_TIME" => date('H:i', $fromTs) == '00:00' && date('H:i', $toTs) == '00:00', "IS_MEETING" => false, "RRULE" => false);
     if ($fromTs == $toTs && !$arFields["SKIP_TIME"]) {
         $toTs += 3600;
     }
     $arFields['DATE_FROM'] = CCalendar::Date($fromTs);
     $arFields['DATE_TO'] = CCalendar::Date($toTs);
     if ($this->CalendarSection && intVal($this->CalendarSection) > 0) {
         $arFields['SECTIONS'] = array(intVal($this->CalendarSection));
     }
     if ($this->CalendarOwnerId || $arFields["CAL_TYPE"] != "user" && $arFields["CAL_TYPE"] != "group") {
         $arFields["OWNER_ID"] = $this->CalendarOwnerId;
         $eventId = CCalendar::SaveEvent(array('arFields' => $arFields, 'autoDetectSection' => true));
     } else {
         $arCalendarUser = CBPHelper::ExtractUsers($this->CalendarUser, $documentId);
         foreach ($arCalendarUser as $calendarUser) {
             $arFields["CAL_TYPE"] = "user";
             $arFields["OWNER_ID"] = $calendarUser;
             $eventId = CCalendar::SaveEvent(array('arFields' => $arFields, 'autoDetectSection' => true));
         }
     }
     return CBPActivityExecutionStatus::Closed;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:32,代码来源:calendar2activity.php

示例2: UpdateListItems


//.........这里部分代码省略.........
				elseif($arData['fRecurrence'] == -1 && $id > 0)
				{
					$arData['RRULE'] = -1;
				}

				if (isset($arData['EventDate']))
				{
					$skipTime = $arData['fAllDayEvent'] ? 'Y' : 'N';
					$TZBias = $arData['fAllDayEvent'] ? 0 : $TZBias;
					$arData['EventDate'] += $TZBias;
					$arData['EndDate'] += $TZBias;

//					$arData["DT_FROM"] = ConvertTimeStamp($arData['EventDate'], 'FULL');
//					$arData["DT_TO"] = ConvertTimeStamp($arData['EndDate'], 'FULL');
				}
				else
				{
					$arData["DT_FROM"] = -1;
					$arData["DT_TO"] = -1;
				}

				// fields
				$arFields = array(
					"ID" => $id,
					'CAL_TYPE' => $calType,
					'OWNER_ID' => $ownerId,
					'CREATED_BY' => $userId,
					'DT_FROM_TS' => $arData['EventDate'],
					'DT_TO_TS' => $arData['EndDate'],
					'DT_SKIP_TIME' => $skipTime,
//					"DT_FROM" => $arData["DT_FROM"],
//					"DT_TO" => $arData["DT_TO"],
					'NAME' => $arData['Title'],
					'DESCRIPTION' => CCalendar::ParseHTMLToBB($arData['Description']),
					'SECTIONS' => array($arSection['ID']),
					'ACCESSIBILITY' => $arStatusValues[$arData['MetaInfo_BusyStatus']],
					'IMPORTANCE' => $arPriorityValues[$arData['MetaInfo_Priority']],
					'RRULE' => $arData['RRULE'],
					'LOCATION' => CCalendar::UnParseTextLocation($arData['Location'])
				);

				if (isset($arData['DT_LENGTH']) && $arData['DT_LENGTH'] > 0)
					$arFields['DT_LENGTH'] = $arData['DT_LENGTH'];

				$EventID = CCalendar::SaveEvent(
					array(
						'arFields' => $arFields,
						'fromWebservice' => true
					)
				);

				if ($EventID)
				{
					// dirty hack
					$arReplicationIDs[$EventID] = $arData['MetaInfo_ReplicationID'];

					$arResponseRows[$EventID] = new CXMLCreator('Result');
					$arResponseRows[$EventID]->setAttribute('ID', $obMethod->getAttribute('ID').','.$arData['_command']);
					$arResponseRows[$EventID]->setAttribute('List', $listName);

					$arResponseRows[$EventID]->addChild($obNode = new CXMLCreator('ErrorCode'));
					$obNode->setData('0x00000000');
					//$arResponseRows[$EventID]->setAttribute('Version', 3);
				}
			}
		}

		$userId = (is_object($USER) && $USER->GetID()) ? $USER->GetID() : 1;
		$fetchMeetings = CCalendar::GetMeetingSection($userId) == $arSection['ID'];
		$arEvents = CCalendarEvent::GetList(
			array(
				'arFilter' => array(
					'CAL_TYPE' => $calType,
					'OWNER_ID' => $ownerId,
					'SECTION' => $arSection['ID'],
					//'INCLUDE_INVITINGS' => 'N'
				),
				'getUserfields' => false,
				'parseRecursion' => false,
				'fetchAttendees' => false,
				'fetchMeetings' => $fetchMeetings,
				'userId' => $userId
			)
		);

		foreach ($arEvents as $key => $event)
		{
			if ($arResponseRows[$event['ID']])
			{
				$obRow = $this->__getRow($event, $listName, $last_change = 0);
				$obRow->setAttribute('xmlns:z', "#RowsetSchema");
				if ($arReplicationIDs[$event['ID']])
					$obRow->setAttribute('MetaInfo_ReplicationID', $arReplicationIDs[$event['ID']]);

				$arResponseRows[$event['ID']]->addChild($obRow);
			}
			$obResponse->addChild($arResponseRows[$event['ID']]);
		}
		return array('UpdateListItemsResult' => $obResponse);
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:webservice.php

示例3: SaveCalendarEvent

 protected static function SaveCalendarEvent(&$arFields)
 {
     $responsibleID = isset($arFields['RESPONSIBLE_ID']) ? intval($arFields['RESPONSIBLE_ID']) : 0;
     $typeID = isset($arFields['TYPE_ID']) ? intval($arFields['TYPE_ID']) : CCrmActivityType::Undefined;
     if (!($responsibleID > 0 && ($typeID === CCrmActivityType::Call || $typeID === CCrmActivityType::Meeting))) {
         return false;
     }
     if (!(IsModuleInstalled('calendar') && CModule::IncludeModule('calendar'))) {
         return false;
     }
     $arCalEventFields = array('CAL_TYPE' => 'user', 'OWNER_ID' => $responsibleID, 'NAME' => isset($arFields['SUBJECT']) ? $arFields['SUBJECT'] : '', 'DT_FROM' => isset($arFields['START_TIME']) ? $arFields['START_TIME'] : '', 'DT_TO' => isset($arFields['END_TIME']) ? $arFields['END_TIME'] : '', 'IMPORTANCE' => CCrmActivityPriority::ToCalendarEventImportance(isset($arFields['PRIORITY']) ? intval($arFields['PRIORITY']) : CCrmActivityPriority::Low), 'DESCRIPTION' => isset($arFields['DESCRIPTION']) ? $arFields['DESCRIPTION'] : '');
     $associatedEntityID = isset($arFields['ASSOCIATED_ENTITY_ID']) ? intval($arFields['ASSOCIATED_ENTITY_ID']) : 0;
     if ($associatedEntityID > 0) {
         $arCalEventFields['ID'] = $associatedEntityID;
         $arPresentEventFields = CCalendarEvent::GetById($associatedEntityID, false);
         if (is_array($arPresentEventFields)) {
             if (isset($arPresentEventFields['RRULE']) && $arPresentEventFields['RRULE'] != '') {
                 $arCalEventFields['RRULE'] = CCalendarEvent::ParseRRULE($arPresentEventFields['RRULE']);
             }
             if (isset($arPresentEventFields['DT_LENGTH'])) {
                 $arCalEventFields['DT_LENGTH'] = $arPresentEventFields['DT_LENGTH'];
             }
         }
     }
     if (isset($arFields['NOTIFY_TYPE']) && $arFields['NOTIFY_TYPE'] != CCrmActivityNotifyType::None) {
         $arCalEventFields['REMIND'] = array(array('type' => CCrmActivityNotifyType::ToCalendarEventRemind($arFields['NOTIFY_TYPE']), 'count' => isset($arFields['NOTIFY_VALUE']) ? intval($arFields['NOTIFY_VALUE']) : 15));
     }
     self::$IGNORE_CALENDAR_EVENTS = true;
     // We must initialize CCalendar!
     $calendar = new CCalendar();
     $calendar->Init(array('type' => 'user', 'userId' => $responsibleID, 'ownerId' => $responsibleID));
     $result = $calendar->SaveEvent(array('arFields' => $arCalEventFields, 'userId' => $responsibleID, 'autoDetectSection' => true, 'autoCreateSection' => true));
     $eventID = intval($result);
     $ownerID = intval($arFields['OWNER_ID']);
     $ownerTypeID = intval($arFields['OWNER_TYPE_ID']);
     $arBindings = isset($arFields['BINDINGS']) ? $arFields['BINDINGS'] : array();
     if (empty($arBindings) && $ownerID > 0 && $ownerTypeID > 0) {
         $arBindings[] = array('OWNER_TYPE_ID' => $ownerTypeID, 'OWNER_ID' => $ownerID);
     }
     if ($eventID > 0 && !empty($arBindings)) {
         $arUserFields = array();
         foreach ($arBindings as &$arBinding) {
             $arUserFields[] = CUserTypeCrm::GetShortEntityType(CCrmOwnerType::ResolveName($arBinding['OWNER_TYPE_ID'])) . '_' . $arBinding['OWNER_ID'];
         }
         unset($arBinding);
         CCalendarEvent::UpdateUserFields($eventID, array('UF_CRM_CAL_EVENT' => $arUserFields));
     }
     self::$IGNORE_CALENDAR_EVENTS = false;
     return $result;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:50,代码来源:crm_activity.php

示例4: 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

示例5: array

<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!CModule::IncludeModule("calendar") || WIZARD_IS_RERUN) {
    return;
}
COption::SetOptionString("intranet", "calendar_2", "Y");
// company calendar calendar type
CCalendarType::Edit(array('NEW' => true, 'arFields' => array('XML_ID' => 'company_calendar', 'NAME' => GetMessage('CAL_TYPE_COMPANY_NAME'), 'DESCRIPTION' => '', 'ACCESS' => array('G2' => CCalendar::GetAccessTasksByName('calendar_type', 'calendar_type_view')))));
// Sections
$sectId0 = CCalendar::SaveSection(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'ID' => 0, 'NAME' => GetMessage("CAL_COMPANY_SECT_0"), 'DESCRIPTION' => GetMessage("CAL_COMPANY_SECT_DESC_0"), 'COLOR' => '#855CC5', 'TEXT_COLOR' => '', 'OWNER_ID' => '', 'EXPORT' => array('ALLOW' => true, 'SET' => '3_9'), 'ACCESS' => array(), 'IS_EXCHANGE' => false)));
$sectId1 = CCalendar::SaveSection(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'ID' => 0, 'NAME' => GetMessage("CAL_COMPANY_SECT_1"), 'DESCRIPTION' => GetMessage("CAL_COMPANY_SECT_DESC_1"), 'COLOR' => '#7DDEC2', 'TEXT_COLOR' => '', 'OWNER_ID' => '', 'EXPORT' => array('ALLOW' => true, 'SET' => '3_9'), 'ACCESS' => array(), 'IS_EXCHANGE' => false)));
$sectId2 = CCalendar::SaveSection(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'ID' => 0, 'NAME' => GetMessage("CAL_COMPANY_SECT_2"), 'DESCRIPTION' => GetMessage("CAL_COMPANY_SECT_DESC_2"), 'COLOR' => '#F6EA68', 'TEXT_COLOR' => '', 'OWNER_ID' => '', 'EXPORT' => array('ALLOW' => true, 'SET' => '3_9'), 'ACCESS' => array(), 'IS_EXCHANGE' => false)));
// Events for company_calendar
CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'OWNER_ID' => 0, 'NAME' => GetMessage("CAL_COMP_EVENT_NAME_0"), 'DESCRIPTION' => GetMessage("CAL_COMP_EVENT_DESC_0"), 'DT_FROM' => GetTime(mktime(9, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'DT_TO' => GetTime(mktime(16, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'RRULE' => array('FREQ' => 'WEEKLY', 'INTERVAL' => 1, 'UNTIL' => GetTime(mktime(0, 0, 0, date("m"), date("d"), date("Y") + 1), "SHORT"), 'BYDAY' => 'TU'), 'SECTIONS' => $sectId0), 'userId' => 1));
CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'OWNER_ID' => 0, 'NAME' => GetMessage("CAL_COMP_EVENT_NAME_1"), 'DESCRIPTION' => GetMessage("CAL_COMP_EVENT_DESC_1"), 'DT_FROM' => GetTime(mktime(0, 0, 0, date("m"), date("d") + 2, date("Y")), "SHORT"), 'DT_TO' => GetTime(mktime(0, 0, 0, date("m"), date("d") + 2, date("Y")), "SHORT"), 'RRULE' => array('FREQ' => 'MONTHLY', 'INTERVAL' => 1, 'UNTIL' => GetTime(mktime(0, 0, 0, date("m"), date("d"), date("Y") + 1), "SHORT")), 'SECTIONS' => $sectId0), 'userId' => 1));
CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'OWNER_ID' => 0, 'NAME' => GetMessage("CAL_COMP_EVENT_NAME_2"), 'DESCRIPTION' => GetMessage("CAL_COMP_EVENT_DESC_2"), 'DT_FROM' => GetTime(mktime(10, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'DT_TO' => GetTime(mktime(12, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'RRULE' => array('FREQ' => 'WEEKLY', 'INTERVAL' => 1, 'BYDAY' => 'MO'), 'SECTIONS' => $sectId1), 'userId' => 1));
CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'OWNER_ID' => 0, 'NAME' => GetMessage("CAL_COMP_EVENT_NAME_3"), 'DESCRIPTION' => GetMessage("CAL_COMP_EVENT_DESC_3"), 'DT_FROM' => GetTime(mktime(9, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'DT_TO' => GetTime(mktime(18, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'RRULE' => array('FREQ' => 'WEEKLY', 'INTERVAL' => 1, 'BYDAY' => 'TU'), 'SECTIONS' => $sectId2), 'userId' => 1));
CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'OWNER_ID' => 0, 'NAME' => GetMessage("CAL_COMP_EVENT_NAME_4"), 'DESCRIPTION' => GetMessage("CAL_COMP_EVENT_DESC_4"), 'DT_FROM' => GetTime(mktime(12, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'DT_TO' => GetTime(mktime(17, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'RRULE' => array('FREQ' => 'WEEKLY', 'INTERVAL' => 1, 'BYDAY' => 'FR'), 'SECTIONS' => $sectId2), 'userId' => 1));
CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'OWNER_ID' => 1, 'NAME' => GetMessage("CAL_COMP_EVENT_NAME_5"), 'DESCRIPTION' => GetMessage("CAL_COMP_EVENT_DESC_5"), 'DT_FROM' => GetTime(mktime(16, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'DT_TO' => GetTime(mktime(21, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'RRULE' => array('FREQ' => 'WEEKLY', 'INTERVAL' => 1, 'BYDAY' => 'SA'), 'SECTIONS' => $sectId1), 'userId' => 1));
// User's calendar type
CCalendarType::Edit(array('NEW' => true, 'arFields' => array('XML_ID' => 'user', 'NAME' => GetMessage('CAL_TYPE_USER_NAME'), 'DESCRIPTION' => '', 'ACCESS' => array('G2' => CCalendar::GetAccessTasksByName('calendar_type', 'calendar_type_edit')))));
// Group's calendar type
CCalendarType::Edit(array('NEW' => true, 'arFields' => array('XML_ID' => 'group', 'NAME' => GetMessage('CAL_TYPE_GROUP_NAME'), 'DESCRIPTION' => '', 'ACCESS' => array('G2' => CCalendar::GetAccessTasksByName('calendar_type', 'calendar_type_edit')))));
$id = CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'user', 'OWNER_ID' => 1, 'NAME' => GetMessage("W_IB_CALENDAR_EMP_ABS"), 'DT_FROM' => GetTime(mktime(12, 0, 0, date("m"), date("d") + 1, date("Y")), "FULL"), 'DT_TO' => GetTime(mktime(14, 0, 0, date("m"), date("d") + 1, date("Y")), "FULL"), 'DESCRIPTION' => ''), 'userId' => 1, 'autoDetectSection' => true, 'autoCreateSection' => true));
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:27,代码来源:index.php

示例6: 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

示例7: EditCalendarEventEntry

 public static function EditCalendarEventEntry($arFields = array(), $arUFFields = array(), $arAccessCodes = array(), $params = array())
 {
     global $DB;
     if ($arFields['SECTION']) {
         $arFields['SECTIONS'] = array($arFields['SECTION']);
     }
     $arFields["OWNER_ID"] = $params["userId"];
     $arFields["CAL_TYPE"] = $params["type"];
     // Add author for new event
     //if (!$arFields["ID"] && !empty($arAccessCodes))
     if (!$arFields["ID"]) {
         $arAccessCodes[] = 'U' . $params["userId"];
     }
     $arAccessCodes = array_unique($arAccessCodes);
     $arAttendees = CCalendar::GetDestinationUsers($arAccessCodes);
     if (trim($arFields["NAME"]) === '') {
         $arFields["NAME"] = GetMessage('EC_DEFAULT_EVENT_NAME');
     }
     $arFields['IS_MEETING'] = !empty($arAttendees) && $arAttendees != array($params["userId"]);
     if (isset($arFields['RRULE']) && !empty($arFields['RRULE'])) {
         if (is_array($arFields['RRULE']['BYDAY'])) {
             $arFields['RRULE']['BYDAY'] = implode(',', $arFields['RRULE']['BYDAY']);
         }
     }
     if ($arFields['IS_MEETING']) {
         $arFields['ATTENDEES_CODES'] = $arAccessCodes;
         $arFields['ATTENDEES'] = $arAttendees;
         $arFields['MEETING_HOST'] = $params["userId"];
         $arFields['MEETING'] = array('HOST_NAME' => CCalendar::GetUserName($params["userId"]), 'TEXT' => '', 'OPEN' => false, 'NOTIFY' => true, 'REINVITE' => false);
     } else {
         $arFields['ATTENDEES'] = false;
     }
     $eventId = CCalendar::SaveEvent(array('arFields' => $arFields, 'autoDetectSection' => true));
     if ($eventId > 0) {
         if (count($arUFFields) > 0) {
             CCalendarEvent::UpdateUserFields($eventId, $arUFFields);
         }
         foreach ($arAccessCodes as $key => $value) {
             if ($value == "UA") {
                 unset($arAccessCodes[$key]);
                 $arAccessCodes[] = "G2";
                 break;
             }
         }
         if ($arFields['IS_MEETING'] && !empty($arUFFields['UF_WEBDAV_CAL_EVENT'])) {
             $UF = $GLOBALS['USER_FIELD_MANAGER']->GetUserFields("CALENDAR_EVENT", $eventId, LANGUAGE_ID);
             CCalendar::UpdateUFRights($arUFFields['UF_WEBDAV_CAL_EVENT'], $arAccessCodes, $UF['UF_WEBDAV_CAL_EVENT']);
         }
         $arSoFields = array("ENTITY_TYPE" => SONET_SUBSCRIBE_ENTITY_USER, "ENTITY_ID" => $params["userId"], "USER_ID" => $params["userId"], "=LOG_DATE" => $DB->CurrentTimeFunction(), "TITLE_TEMPLATE" => "#TITLE#", "TITLE" => $arFields["NAME"], "MESSAGE" => '', "TEXT_MESSAGE" => '');
         $dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "calendar", "SOURCE_ID" => $eventId), false, false, array("ID"));
         $arCodes = array();
         foreach ($arAccessCodes as $value) {
             if (substr($value, 0, 2) === 'SG') {
                 $arCodes[] = $value . '_K';
             }
             $arCodes[] = $value;
         }
         $arCodes = array_unique($arCodes);
         if ($arRes = $dbRes->Fetch()) {
             CSocNetLog::Update($arRes["ID"], $arSoFields);
             CSocNetLogRights::DeleteByLogID($arRes["ID"]);
             CSocNetLogRights::Add($arRes["ID"], $arCodes);
         } else {
             $arSoFields = array_merge($arSoFields, array("EVENT_ID" => "calendar", "SITE_ID" => SITE_ID, "SOURCE_ID" => $eventId, "ENABLE_COMMENTS" => "Y", "CALLBACK_FUNC" => false));
             $logID = CSocNetLog::Add($arSoFields, false);
             CSocNetLogRights::Add($logID, $arCodes);
         }
     }
 }
开发者ID:rasuldev,项目名称:torino,代码行数:69,代码来源:calendar_livefeed.php

示例8: array

<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!CModule::IncludeModule("calendar")) {
    return;
}
COption::SetOptionString("intranet", "calendar_2", "Y");
if (WIZARD_FIRST_INSTAL != 'Y') {
    // calendar type
    $arTypes = CCalendarType::GetList(array("arFilter" => array("XML_ID" => 'events_info')));
    if (!$arTypes || count($arTypes) <= 0) {
        CCalendarType::Edit(array('NEW' => true, 'arFields' => array('XML_ID' => 'events_info', 'NAME' => GetMessage('CAL_DEFAULT_TYPE'), 'ACCESS' => array('G2' => CCalendar::GetAccessTasksByName('calendar_type', 'calendar_type_view')))));
    }
    // Sections
    $sectId0 = CCalendar::SaveSection(array('arFields' => array('CAL_TYPE' => 'events_info', 'ID' => 0, 'NAME' => GetMessage("CAL_TYPE_COMPANY_NAME"), 'DESCRIPTION' => "", 'COLOR' => '#855CC5', 'TEXT_COLOR' => '', 'OWNER_ID' => '', 'EXPORT' => array('ALLOW' => true, 'SET' => '3_9'), 'ACCESS' => array(), 'IS_EXCHANGE' => false)));
    // Events for company_calendar
    CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'events_info', 'OWNER_ID' => 0, 'NAME' => GetMessage("CAL_EVENT_1_NAME"), 'DESCRIPTION' => "", 'DT_FROM' => GetTime(mktime(0, 0, 0, date("m"), date("d") + 4, date("Y")), "FULL"), 'DT_TO' => GetTime(mktime(0, 0, 0, date("m"), date("d") + 4, date("Y")), "FULL"), 'RRULE' => array(), 'SECTIONS' => $sectId0), 'userId' => 1));
    CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'events', 'OWNER_ID' => 0, 'NAME' => GetMessage("CAL_EVENT_2_NAME"), 'DESCRIPTION' => "", 'COLOR' => '#FFFF80', 'DT_FROM' => GetTime(mktime(0, 0, 0, date("m"), date("d"), date("Y")), "SHORT"), 'DT_TO' => GetTime(mktime(0, 0, 0, date("m"), date("d"), date("Y")), "SHORT"), 'RRULE' => array('FREQ' => 'WEEKLY', 'INTERVAL' => 3, 'BYDAY' => 'SA'), 'SECTIONS' => $sectId0), 'userId' => 1));
}
开发者ID:spas-viktor,项目名称:books,代码行数:21,代码来源:index.php

示例9: array

                $arFields['LOCATION']['NEW'] = $loc['NEW'];
            }
        }
        if (isset($_POST['rrule']) && $_POST['rrule'] == '') {
            $arFields['RRULE'] = '';
        }
        if ($arFields['IS_MEETING']) {
            $arFields['ATTENDEES'] = $_POST['attendees'];
            $arFields['ATTENDEES'] = $_POST['attendees'];
            if ($newMeeting && !in_array($ownerId, $arFields['ATTENDEES'])) {
                $arFields['ATTENDEES'][] = $ownerId;
            }
            $arFields['MEETING_HOST'] = $ownerId;
            $arFields['MEETING'] = array('HOST_NAME' => CCalendar::GetUserName($ownerId), 'TEXT' => '', 'OPEN' => false, 'NOTIFY' => true, 'REINVITE' => true);
        }
        $newId = CCalendar::SaveEvent(array('arFields' => $arFields, 'autoDetectSection' => true, 'autoCreateSection' => true));
    } elseif ($_REQUEST['app_calendar_action'] == 'drop_event' && check_bitrix_sessid()) {
        $res = CCalendar::DeleteEvent(intVal($_POST['event_id']));
    }
    die;
}
$calType = 'user';
$ownerId = $userId;
if ($arResult['NEW']) {
} else {
    $Event = CCalendarEvent::GetList(array('arFilter' => array("ID" => $eventId, "OWNER_ID" => $userId, "DELETED" => "N"), 'parseRecursion' => false, 'fetchAttendees' => true, 'fetchMeetings' => true, 'checkPermissions' => true, 'setDefaultLimit' => false));
    if ($Event && is_array($Event[0])) {
        $Event = $Event[0];
        if ($Event['IS_MEETING']) {
            foreach ($Event['~ATTENDEES'] as $attendee) {
                $attendee['DISPLAY_NAME'] = CCalendar::GetUserName($attendee);
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例10: Add

 public function Add($arParams)
 {
     global $USER;
     $today = CTimeMan::RemoveHoursTS(time());
     $data = array('CAL_TYPE' => 'user', 'OWNER_ID' => $USER->GetID(), 'NAME' => $arParams['name'], 'DT_FROM' => ConvertTimeStamp($today + CTimeMan::MakeShortTS($arParams['from']), 'FULL'), 'DT_TO' => ConvertTimeStamp($today + CTimeMan::MakeShortTS($arParams['to']), 'FULL'));
     if ($arParams['absence'] == 'Y') {
         $data['ACCESSIBILITY'] = 'absent';
     }
     return CCalendar::SaveEvent(array('arFields' => $data, 'userId' => $USER->GetID(), 'autoDetectSection' => true, 'autoCreateSection' => true));
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:10,代码来源:timeman.php

示例11: EventUpdate

 public static function EventUpdate($arParams = array(), $nav = null, $server = null)
 {
     $userId = CCalendar::GetCurUserId();
     $methodName = "calendar.event.update";
     $necessaryParams = array('id', 'ownerId', '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)));
         }
     }
     $id = intVal($arParams['id']);
     $type = $arParams['type'];
     $ownerId = intval($arParams['ownerId']);
     $arFields = array("ID" => $id);
     if (isset($arParams['from_ts'])) {
         $arFields["DT_FROM_TS"] = intVal($arParams['from_ts']);
     }
     if (isset($arParams['to_ts'])) {
         $arFields["DT_TO_TS"] = intVal($arParams['to_ts']);
     }
     if (isset($arParams['skip_time'])) {
         $arFields["SKIP_TIME"] = $arParams['skip_time'] == 'Y';
     }
     if (isset($arParams['name'])) {
         $arFields["NAME"] = trim($arParams['name']);
     }
     if (isset($arParams['description'])) {
         $arFields["DESCRIPTION"] = trim($arParams['description']);
     }
     if (isset($arParams['section'])) {
         $sectionId = $arParams['section'];
         $arFields["SECTIONS"] = array($sectionId);
         $res = CCalendarSect::GetList(array('arFilter' => array('CAL_TYPE' => $type, 'OWNER_ID' => $ownerId, 'ID' => $arParams['section'])));
         if ($res && is_array($res) && isset($res[0])) {
             if (!$res[0]['PERM']['edit']) {
                 throw new Exception(GetMessage('CAL_REST_ACCESS_DENIED'));
             }
         } else {
             throw new Exception('CAL_REST_SECTION_ERROR');
         }
     }
     if (isset($arParams['color'])) {
         $color = CCalendar::Color($arParams['color']);
         if ($color) {
             $arFields["COLOR"] = $color;
         }
     }
     if (isset($arParams['text_color'])) {
         $color = CCalendar::Color($arParams['text_color']);
         if ($color) {
             $arFields["TEXT_COLOR"] = $color;
         }
     }
     if (isset($arParams['accessibility'])) {
         $arFields["ACCESSIBILITY"] = $arParams['accessibility'];
     }
     if (isset($arParams['importance'])) {
         $arFields["IMPORTANCE"] = $arParams['importance'];
     }
     if (isset($arParams['private_event'])) {
         $arFields["PRIVATE_EVENT"] = $arParams['private_event'] == "Y";
     }
     if (isset($arParams['rrule'])) {
         $arFields["RRULE"] = $arParams['rrule'];
     }
     if (isset($arParams['is_meeting'])) {
         $arFields["IS_MEETING"] = $arParams['is_meeting'] == "Y";
     }
     if (isset($arParams['location'])) {
         $arFields["LOCATION"] = $arParams['LOCATION'];
     }
     if (isset($arParams['remind'])) {
         $arFields["REMIND"] = $arParams['REMIND'];
     }
     if ($arFields['IS_MEETING']) {
         $arFields['ATTENDEES'] = isset($arParams['attendees']) ? $arParams['attendees'] : false;
         $meeting = isset($arParams['meeting']) ? $arParams['meeting'] : array();
         $arFields['MEETING_HOST'] = isset($arParams['host']) ? intVal($arParams['host']) : $userId;
         $arFields['MEETING'] = array('HOST_NAME' => CCalendar::GetUserName($arFields['MEETING_HOST']), 'TEXT' => $meeting['text'], 'OPEN' => (bool) $meeting['open'], 'NOTIFY' => (bool) $meeting['notify'], 'REINVITE' => (bool) $meeting['reinvite']);
     }
     $newId = CCalendar::SaveEvent(array('arFields' => $arFields));
     if (!$newId) {
         throw new Exception(GetMessage("CAL_REST_EVENT_UPDATE_ERROR"));
     }
     return $newId;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:86,代码来源:calendar_restservice.php

示例12: foreach

 if (!in_array($strPriority, $arPriorityType)) {
     $strPriority = 'normal';
 }
 $arResult['VALUES']['REMIND_LEN'] = $intRemLen;
 $arResult['VALUES']['REMIND_TYPE'] = $strRemType;
 $arResult['VALUES']['PRIORITY'] = $strPriority;
 if (false == $boolError) {
     $strEntityShort = CUserTypeCrm::GetShortEntityType($arResult['ENTITY_TYPE']) . '_';
     foreach ($arID as $intID => $iUserID) {
         $arCrmEvents = array();
         $arCrmEvents[] = $strEntityShort . $intID;
         $arFields = array('CAL_TYPE' => 'user', 'OWNER_ID' => $iUserID, 'NAME' => $arResult['VALUES']['CALENDAR_TOPIC'], 'DT_FROM' => $arResult['VALUES']['CALENDAR_FROM'], 'DT_TO' => $arResult['VALUES']['CALENDAR_TO'], 'DESCRIPTION' => $arResult['VALUES']['CALENDAR_DESC'], 'IMPORTANCE' => $strPriority);
         if ('Y' == $arResult['VALUES']['REMIND_FLAG']) {
             $arFields['REMIND'] = array(array('type' => $strRemType, 'count' => $intRemLen));
         }
         $intEventID = CCalendar::SaveEvent(array('arFields' => $arFields, 'userId' => $iUserID, 'autoDetectSection' => true, 'autoCreateSection' => true));
         if (0 < intval($intEventID)) {
             CCalendarEvent::UpdateUserFields($intEventID, array('UF_CRM_CAL_EVENT' => $arCrmEvents));
         } else {
             $boolError = true;
             $arResult['ERROR_MESSAGE'][] = GetMessage('BX_CRM_CACA_ERR_ADD_FAIL');
         }
     }
 }
 if (true == $boolError) {
     $arKeys = array_keys($arDefResult['VALUES']);
     foreach ($arKeys as $strKey) {
         if (!isset($arResult['VALUES'][$strKey])) {
             $arResult['VALUES'][$strKey] = '';
         }
     }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例13: SetMeetingParams

 public static function SetMeetingParams($userId, $eventId, $arFields)
 {
     $eventId = intVal($eventId);
     $userId = intVal($userId);
     // Check $arFields
     if (!in_array($arFields['ACCESSIBILITY'], array('busy', 'quest', 'free', 'absent'))) {
         $arFields['ACCESSIBILITY'] = 'busy';
     }
     $event = CCalendarEvent::GetById($eventId);
     if (!$event) {
         return false;
     }
     $res = CCalendarEvent::GetList(array('arFilter' => array("PARENT_ID" => $eventId, "CREATED_BY" => $userId, "IS_MEETING" => 1, "DELETED" => "N"), 'parseRecursion' => false, 'fetchAttendees' => true, 'fetchMeetings' => true, 'checkPermissions' => true, 'setDefaultLimit' => false));
     if (!$res || !$res[0]) {
         $res = CCalendarEvent::GetList(array('arFilter' => array("ID" => $eventId, "CREATED_BY" => $userId, "IS_MEETING" => 1, "DELETED" => "N"), 'parseRecursion' => false, 'fetchAttendees' => true, 'fetchMeetings' => true, 'checkPermissions' => true, 'setDefaultLimit' => false));
     }
     if ($res[0]) {
         $event = $res[0];
         $arReminders = array();
         if (isset($arFields['REMIND'])) {
             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 = array("ID" => $event['ID'], "REMIND" => $arReminders, "ACCESSIBILITY" => $arFields['ACCESSIBILITY']);
         //SaveEvent
         CCalendar::SaveEvent(array('arFields' => $arFields));
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:34,代码来源:calendar_event.php

示例14: plannerActionAdd

 protected static function plannerActionAdd($arParams)
 {
     global $USER;
     $today = ConvertTimeStamp(time() + CTimeZone::GetOffset(), 'SHORT');
     $data = array('CAL_TYPE' => 'user', 'OWNER_ID' => $USER->GetID(), 'NAME' => $arParams['NAME'], 'DT_FROM' => self::MakeDateTime($today, $arParams['FROM']), 'DT_TO' => self::MakeDateTime($today, $arParams['TO']));
     if ($arParams['ABSENCE'] == 'Y') {
         $data['ACCESSIBILITY'] = 'absent';
     }
     CCalendar::SaveEvent(array('arFields' => $data, 'userId' => $USER->GetID(), 'autoDetectSection' => true, 'autoCreateSection' => true));
 }
开发者ID:Satariall,项目名称:izurit,代码行数:10,代码来源:calendar_event_handlers.php

示例15: AddEvent

 public static function AddEvent($MEETING_ID, $arFields, $arParams = array())
 {
     global $USER;
     $EventID = false;
     if (self::IsNewCalendar()) {
         $arEventFields = array('ID' => $arFields['EVENT_ID'], 'CAL_TYPE' => 'user', 'OWNER_ID' => $arFields['OWNER_ID'], 'DT_FROM' => $arFields['DATE_START'], 'DT_TO' => ConvertTimeStamp(MakeTimeStamp($arFields['DATE_START']) + $arFields['DURATION'], 'FULL'), 'NAME' => $arFields['TITLE'], 'DESCRIPTION' => CCalendar::ParseHTMLToBB($arFields['DESCRIPTION']), 'IS_MEETING' => true, 'MEETING_HOST' => $arFields['OWNER_ID'], 'MEETING' => array('HOST_NAME' => CCalendar::GetUserName($arFields['OWNER_ID'])), 'ATTENDEES' => array_keys($arFields['USERS']));
         if ($arFields['CURRENT_STATE'] == CMeeting::STATE_CLOSED) {
             $arEventFields['DT_TO'] = MakeTimeStamp($arFields['DATE_FINISH']) > MakeTimeStamp($arFields['DATE_START']) ? $arFields['DATE_FINISH'] : $arEventFields['DT_TO'];
         }
         $matches = array();
         if (preg_match('/^mr_([\\d]+)_([\\d]+)$/', $arFields["PLACE"], $matches)) {
             $arEventFields['LOCATION'] = 'ECMR_' . $matches[2];
             if ($arFields['EVENT_ID'] > 0) {
                 $arCurrentEvent = CCalendarEvent::GetById($arFields['EVENT_ID']);
                 if ($arCurrentEvent['LOCATION']) {
                     $res = CCalendar::ParseLocation($arCurrentEvent['LOCATION']);
                     if ($res['mrevid']) {
                         $arEventFields['LOCATION'] .= '_' . $res['mrevid'];
                     }
                 }
             }
         } else {
             $arEventFields['LOCATION'] = $arFields['PLACE'];
         }
         if (isset($arFields['REINVITE'])) {
             $arEventFields['MEETING']['REINVITE'] = $arFields['REINVITE'];
         } else {
             $arEventFields['MEETING']['REINVITE'] = false;
         }
         if (isset($arFields['NOTIFY'])) {
             $arEventFields['MEETING']['NOTIFY'] = $arFields['NOTIFY'];
         }
         $EventID = CCalendar::SaveEvent(array('arFields' => $arEventFields, 'userId' => $arFields['OWNER_ID'], 'autoDetectSection' => true, 'autoCreateSection' => true));
     } elseif (!$arFields['EVENT_ID']) {
         $iblockId = $arParams['CALENDAR_IBLOCK_ID'] ? $arParams['CALENDAR_IBLOCK_ID'] : COption::GetOptionInt('intranet', 'iblock_calendar', 0, SITE_ID);
         $obCalendar = new CEventCalendar();
         $obCalendar->Init(array('ownerType' => 'USER', 'ownerId' => $USER->GetID(), 'bOwner' => true, 'iblockId' => $iblockId, 'userIblockId' => $iblockId, 'bCache' => false, 'pathToUserCalendar' => '/company/personal/user/#user_id#/calendar/'));
         $guestCalendarId = false;
         $guestSection = $obCalendar->GetSectionIDByOwnerId($USER->GetID(), 'USER', $iblockId);
         $arGuestCalendars = array();
         if (!$guestSection) {
             $guestSection = $obCalendar->CreateSectionForOwner($USER->GetID(), "USER", $iblockId);
         }
         $arGuestCalendars = $obCalendar->GetCalendars(array('sectionId' => $guestSection, 'iblockId' => $iblockId, 'ownerType' => 'USER', 'ownerId' => $USER->GetID(), 'bOwner' => 1, 'forExport' => true, 'bOnlyID' => true));
         if (count($arGuestCalendars) > 0) {
             $arUserSet = $obCalendar->GetUserSettings(array('static' => false, 'userId' => $USER->GetID()));
             if ($arUserSet && isset($arUserSet['MeetCalId']) && in_array($arUserSet['MeetCalId'], $arGuestCalendars)) {
                 $guestCalendarId = intVal($arUserSet['MeetCalId']);
             } else {
                 $guestCalendarId = $arGuestCalendars[0];
             }
         }
         //$bGroup = $arParams['GROUP_ID'] > 0;
         $arPermissions = $obCalendar->GetPermissions(array('setProperties' => true));
         $arEventFields = array('iblockId' => $obCalendar->iblockId, 'ownerType' => $obCalendar->ownerType, 'ownerId' => $obCalendar->ownerId, 'RMiblockId' => self::__getRMIblockID(), 'allowResMeeting' => true, 'bNew' => true, 'fullUrl' => $obCalendar->fullUrl, 'userId' => $obCalendar->userId, 'pathToUserCalendar' => $obCalendar->pathToUserCalendar, 'pathToGroupCalendar' => $obCalendar->pathToGroupCalendar, 'userIblockId' => $obCalendar->iblockId, 'calendarId' => $guestCalendarId, 'sectionId' => $guestSection, 'dateFrom' => $arFields['DATE_START'], 'dateTo' => $arFields['DATE_FINISH'] ? $arFields['DATE_FINISH'] : ConvertTimeStamp(MakeTimeStamp($arFields['DATE_START']) + $arFields['DURATION'], 'FULL'), 'name' => $arFields['TITLE'], 'desc' => $arFields['DESCRIPTION'], 'prop' => array(), 'isMeeting' => true, 'guests' => array_keys($arFields['USERS']), 'notDisplayCalendar' => true);
         if ($EventID = $obCalendar->SaveEvent($arEventFields)) {
             CEventCalendar::ClearCache('/event_calendar/events/' . $arEventFields['iblockId'] . '/');
             CEventCalendar::ClearCache('/event_calendar/events/' . $arEventFields['userIblockId'] . '/');
         }
     }
     if ($EventID) {
         self::Update($MEETING_ID, array('EVENT_ID' => $EventID));
     }
     return $EventID;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:65,代码来源:meeting.php


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