本文整理汇总了PHP中CCalendar::UpdateUFRights方法的典型用法代码示例。如果您正苦于以下问题:PHP CCalendar::UpdateUFRights方法的具体用法?PHP CCalendar::UpdateUFRights怎么用?PHP CCalendar::UpdateUFRights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCalendar
的用法示例。
在下文中一共展示了CCalendar::UpdateUFRights方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
}
示例2: SaveEvent
//.........这里部分代码省略.........
$newId = self::SaveEvent(array('arFields' => $arFieldsNew));
if ($newId) {
// Delete
self::DeleteEvent($arFields['ID']);
}
return $newId;
}
}
if ($oCurEvent) {
$Params['currentEvent'] = $oCurEvent;
}
if (!$bPersonal && !CCalendarSect::CanDo('calendar_edit', $oCurEvent['SECT_ID'], self::$userId)) {
return GetMessage('EC_ACCESS_DENIED');
}
} elseif ($sectionId > 0 && !$bPersonal && !CCalendarSect::CanDo('calendar_add', $sectionId, self::$userId)) {
return CCalendar::ThrowError(GetMessage('EC_ACCESS_DENIED'));
}
if ($Params['autoDetectSection'] && $sectionId <= 0) {
$res = CCalendarSect::GetList(array('arFilter' => array('CAL_TYPE' => $arFields['CAL_TYPE'], 'OWNER_ID' => $arFields['OWNER_ID']), 'checkPermissions' => false));
if ($res && is_array($res) && isset($res[0])) {
$sectionId = $res[0]['ID'];
} elseif ($Params['autoCreateSection']) {
$defCalendar = CCalendarSect::CreateDefault(array('type' => $arFields['CAL_TYPE'], 'ownerId' => $arFields['OWNER_ID']));
$sectionId = $defCalendar['ID'];
$Params['bAffectToDav'] = false;
}
if ($sectionId > 0) {
$arFields['SECTIONS'] = array($sectionId);
} else {
return false;
}
}
if (isset($arFields["RRULE"])) {
$arFields["RRULE"] = CCalendarEvent::CheckRRULE($arFields["RRULE"]);
}
// Set version
if (!isset($arFields['VERSION']) || $arFields['VERSION'] <= $oCurEvent['VERSION']) {
$arFields['VERSION'] = $oCurEvent['VERSION'] ? $oCurEvent['VERSION'] + 1 : 1;
}
$offset = CCalendar::GetOffset();
if (!isset($arFields['DT_FROM_TS'])) {
$arFields['DT_FROM_TS'] = self::Timestamp($arFields['DT_FROM']);
$arFields['DT_TO_TS'] = self::Timestamp($arFields['DT_TO']);
}
if (!isset($arFields['SKIP_TIME'])) {
$item['DT_SKIP_TIME'] = date('H:i', $arFields['DT_FROM_TS']) == '00:00' && date('H:i', $arFields['DT_TO_TS']) == '00:00';
}
if ($Params['bServerTime'] !== true && !$arFields['SKIP_TIME'] && $offset != 0) {
$arFields['DT_FROM_TS'] -= $offset;
$arFields['DT_TO_TS'] -= $offset;
}
$arFields['DT_FROM'] = self::Date($arFields['DT_FROM_TS']);
$arFields['DT_TO'] = self::Date($arFields['DT_TO_TS']);
if ($Params['autoDetectSection'] && $sectionId <= 0 && $arFields['OWNER_ID'] > 0) {
$res = CCalendarSect::GetList(array('arFilter' => array('CAL_TYPE' => $arFields['CAL_TYPE'], 'OWNER_ID' => $arFields['OWNER_ID']), 'checkPermissions' => false));
if ($res && is_array($res) && isset($res[0])) {
$sectionId = $res[0]['ID'];
} elseif ($Params['autoCreateSection']) {
$defCalendar = CCalendarSect::CreateDefault(array('type' => $arFields['CAL_TYPE'], 'ownerId' => $arFields['OWNER_ID']));
$sectionId = $defCalendar['ID'];
$Params['bAffectToDav'] = false;
}
if ($sectionId > 0) {
$arFields['SECTIONS'] = array($sectionId);
} else {
return false;
}
}
$bExchange = CCalendar::IsExchangeEnabled() && $arFields['CAL_TYPE'] == 'user';
$bCalDav = CCalendar::IsCalDAVEnabled() && $arFields['CAL_TYPE'] == 'user';
if ($Params['bAffectToDav'] !== false && ($bExchange || $bCalDav) && $sectionId > 0) {
$res = CCalendar::DoSaveToDav(array('bCalDav' => $bCalDav, 'bExchange' => $bExchange, 'sectionId' => $sectionId), $arFields, $oCurEvent);
if ($res !== true) {
return CCalendar::ThrowError($res);
}
}
$Params['arFields'] = $arFields;
$Params['userId'] = $userId;
if (self::$ownerId != $arFields['OWNER_ID'] && self::$type != $arFields['CAL_TYPE']) {
$Params['path'] = self::GetPath($arFields['CAL_TYPE'], $arFields['OWNER_ID'], 1);
} else {
$Params['path'] = self::$path;
}
$id = CCalendarEvent::Edit($Params);
$UFs = $Params['UF'];
if (isset($UFs) && count($UFs) > 0) {
CCalendarEvent::UpdateUserFields($id, $UFs);
if ($arFields['IS_MEETING']) {
if (!empty($UFs['UF_WEBDAV_CAL_EVENT'])) {
$UF = $GLOBALS['USER_FIELD_MANAGER']->GetUserFields("CALENDAR_EVENT", $id, LANGUAGE_ID);
CCalendar::UpdateUFRights($UFs['UF_WEBDAV_CAL_EVENT'], $arFields['ATTENDEES_CODES'], $UF['UF_WEBDAV_CAL_EVENT']);
}
}
}
$arFields['ID'] = $id;
foreach (GetModuleEvents("calendar", "OnAfterCalendarEventEdit", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array('arFields' => $arFields, 'bNew' => $bNew, 'userId' => $userId));
}
return $id;
}
示例3: Request
//.........这里部分代码省略.........
$arFields['ATTENDEES_CODES'] = $arAccessCodes;
$arFields['ATTENDEES'] = CCalendar::GetDestinationUsers($arAccessCodes);
$arFields['MEETING_HOST'] = self::$userId;
$arFields['MEETING'] = array(
'HOST_NAME' => self::GetUserName($arFields['MEETING_HOST']),
'TEXT' => isset($_POST['meeting_text']) ? $_POST['meeting_text'] : '',
'OPEN' => $_POST['open_meeting'] === 'Y',
'NOTIFY' => $_POST['meeting_notify'] === 'Y',
'REINVITE' => $_POST['meeting_reinvite'] === 'Y'
);
}
$newId = self::SaveEvent(array('arFields' => $arFields));
if ($newId)
{
// Userfields for event
$arUFFields = array();
foreach ($_POST as $field => $value)
{
if (substr($field, 0, 3) == "UF_")
{
$arUFFields[$field] = $value;
}
}
if (count($arUFFields) > 0)
CCalendarEvent::UpdateUserFields($newId, $arUFFields);
if ($arFields['IS_MEETING'])
{
if (!empty($arUFFields['UF_WEBDAV_CAL_EVENT']))
{
$UF = $GLOBALS['USER_FIELD_MANAGER']->GetUserFields("CALENDAR_EVENT", $newId, LANGUAGE_ID);
CCalendar::UpdateUFRights($arUFFields['UF_WEBDAV_CAL_EVENT'], $arAccessCodes, $UF['UF_WEBDAV_CAL_EVENT']);
}
// Save to livefeed
}
$arFilter = array("ID" => $newId);
$month = intVal($_REQUEST['month']);
$year = intVal($_REQUEST['year']);
$arFilter["FROM_LIMIT"] = self::Date(mktime(0, 0, 0, $month - 1, 20, $year), false);
$arFilter["TO_LIMIT"] = self::Date(mktime(0, 0, 0, $month + 1, 10, $year), false);
$arAttendees = array(); // List of attendees for event
$arEvents = CCalendarEvent::GetList(
array(
'arFilter' => $arFilter,
'parseRecursion' => true,
'fetchAttendees' => true,
'userId' => self::$userId
)
);
}
if ($arEvents && $arFields['IS_MEETING'])
$arAttendees = CCalendarEvent::GetLastAttendees();
CCalendar::OutputJSRes($reqId, array(
'id' => $newId,
'events' => $arEvents,
'attendees' => $arAttendees,
'deletedEventId' => ($id && $newId != $id) ? $id : 0