本文整理汇总了PHP中CCalendar::GetUserName方法的典型用法代码示例。如果您正苦于以下问题:PHP CCalendar::GetUserName方法的具体用法?PHP CCalendar::GetUserName怎么用?PHP CCalendar::GetUserName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCalendar
的用法示例。
在下文中一共展示了CCalendar::GetUserName方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __getRow
//.........这里部分代码省略.........
$obRow->setAttribute('ows_MetaInfo_Priority', intval($arPriorityValues[$event['IMPORTANCE']]));
$obRow->setAttribute('ows_Created', $this->__makeDateTime(MakeTimeStamp($event['DATE_CREATE'])-$TZBias));
$obRow->setAttribute('ows_Modified', $this->__makeDateTime($change-$TZBias));
$obRow->setAttribute('ows_EventType', $bRecurrent ? 1 : 0);
$obRow->setAttribute('ows_Location', CCalendar::GetTextLocation($event['LOCATION']));
$obRow->setAttribute('ows_Description', $event['~DESCRIPTION']); // Description parsed from BB-codes to HTML
$obRow->setAttribute('ows_EventDate', $this->__makeDateTime($ts_start));
$obRow->setAttribute('ows_EndDate', $this->__makeDateTime($ts_start + $event['DT_LENGTH']));
//$obRow->setAttribute('ows_EndDate', $this->__makeDateTime(((false && $bRecurrent) ? $ts_start + $event['DT_LENGTH'] : $ts_finish) + ($bAllDay ? 86340 : 0)));
//$obRow->setAttribute('ows_EndDate', $this->__makeDateTime(($bRecurrent ? $ts_start + $event['DT_LENGTH'] : $ts_finish) - ($bAllDay ? 20 : 0)));
$obRow->setAttribute('ows_fAllDayEvent', $bAllDay);
/* Recurrence */
$obRow->setAttribute('ows_fRecurrence', $bRecurrent);
if ($bRecurrent)
{
$obRow->setAttribute('ows_UID', CIntranetUtils::makeGUID(md5($event['ID'].'_'.$change)));
$tz_data = '';
$tz_data .= '<timeZoneRule>';
$tz_data .= '<standardBias>'.(-intval(($TZBias - (date('I') ? 3600 : 0)) /60)).'</standardBias>';
$tz_data .= '<additionalDaylightBias>-60</additionalDaylightBias>';
$bUseTransition = COption::GetOptionString('intranet', 'tz_transition', 'Y') == 'Y';
if ($bUseTransition)
{
$transition_standard = COption::GetOptionString('intranet', 'tz_transition_standard', '');
$transition_daylight = COption::GetOptionString('intranet', 'tz_transition_daylight', '');
if (!$transition_standard) $transition_standard = '<transitionRule month="10" day="su" weekdayOfMonth="last" /><transitionTime>3:0:0</transitionTime>';
if (!$transition_daylight) $transition_daylight = '<transitionRule month="3" day="su" weekdayOfMonth="last" /><transitionTime>2:0:0</transitionTime>';
$tz_data .= '<standardDate>'.$transition_standard.'</standardDate><daylightDate>'.$transition_daylight.'</daylightDate>';
}
$tz_data .= '</timeZoneRule>';
$obRow->setAttribute('ows_XMLTZone', $tz_data);
//$obRow->setAttribute('ows_TimeZone', 7);
$recurence_data = '';
$recurence_data .= '<recurrence>';
$recurence_data .= '<rule>';
$recurence_data .= '<firstDayOfWeek>'.$first_week_day.'</firstDayOfWeek>';
$recurence_data .= '<repeat>';
switch($rrule['FREQ'])
{
case 'DAILY':
$recurence_data .= '<daily dayFrequency="'.$rrule['INTERVAL'].'" />';
break;
case 'WEEKLY':
$days = '';
foreach ($rrule['BYDAY'] as $day)
$days .= strtolower($day).'="TRUE" ';
$recurence_data .= '<weekly '.$days.'weekFrequency="'.$rrule['INTERVAL'].'" />';
break;
case 'MONTHLY':
$recurence_data .= '<monthly monthFrequency="'.$rrule['INTERVAL'].'" day="'.date('d', $ts_start).'" />';
break;
case 'YEARLY':
$recurence_data .= '<yearly yearFrequency="'.$rrule['INTERVAL'].'" month="'.date('m', $ts_start).'" day="'.date('d', $ts_start).'" />';
break;
}
$recurence_data .= '</repeat>';
if (date('Y', $ts_finish) == '2038' || date('Y', $ts_finish) == '2037')
$recurence_data .= '<repeatForever>FALSE</repeatForever>';
else
$recurence_data .= '<windowEnd>'.$this->__makeDateTime($ts_finish).'</windowEnd>';
$recurence_data .= '</rule>';
$recurence_data .= '</recurrence>';
$obRow->setAttribute('ows_RecurrenceData', $recurence_data);
//$obRow->setAttribute('ows_Duration', $event['DT_LENGTH'] + ($bAllDay ? 86340 : 0));
//$obRow->setAttribute('ows_Duration', $event['DT_LENGTH'] - ($bAllDay ? 20 : 0));
$obRow->setAttribute('ows_Duration', $duration);
}
else
{
//$obRow->setAttribute('ows_Duration', ($duration ? $duration : 86400) - 60);
$obRow->setAttribute('ows_Duration', $duration);
}
$obRow->setAttribute('ows_UniqueId', $event['ID'].';#'.$listName);
$obRow->setAttribute('ows_FSObjType', $event['ID'].';#0');
$obRow->setAttribute('ows_Editor', $event['CREATED_BY'].';#'.CCalendar::GetUserName($event['CREATED_BY']));
$obRow->setAttribute('ows_PermMask', '0x7fffffffffffffff');
$obRow->setAttribute('ows_ContentTypeId', '0x01020005CE290982A58C439E00342702139D1A');
return $obRow;
}
示例2: GetAttendees
public static function GetAttendees($arEventIds = array())
{
global $DB;
$arAttendees = array();
if (!is_array($arEventIds)) {
$arEventIds = array($arEventIds);
}
$strMeetIds = "";
foreach ($arEventIds as $id) {
if (intVal($id) > 0) {
$strMeetIds .= ',' . intVal($id);
}
}
$strMeetIds = trim($strMeetIds, ', ');
if ($strMeetIds != '') {
$strSql = "\n\t\t\tSELECT\n\t\t\t\tCA.*,\n\t\t\t\tU.LOGIN, U.NAME, U.LAST_NAME, U.SECOND_NAME, U.EMAIL, U.PERSONAL_PHOTO, U.WORK_POSITION,\n\t\t\t\tBUF.UF_DEPARTMENT\n\t\t\tFROM\n\t\t\t\tb_calendar_attendees CA\n\t\t\t\tLEFT JOIN b_user U ON (U.ID=CA.USER_ID)\n\t\t\t\tLEFT JOIN b_uts_user BUF ON (BUF.VALUE_ID = CA.USER_ID)\n\t\t\tWHERE\n\t\t\t\tU.ACTIVE = 'Y' AND\n\t\t\t\tCA.EVENT_ID in (" . $strMeetIds . ")";
$res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
while ($attendee = $res->Fetch()) {
if (!isset($arAttendees[$attendee['EVENT_ID']])) {
$arAttendees[$attendee['EVENT_ID']] = array();
}
$attendee["STATUS"] = trim($attendee["STATUS"]);
$attendee["DESCRIPTION"] = trim($attendee["DESCRIPTION"]);
$attendee["COLOR"] = trim($attendee["COLOR"]);
$attendee["TEXT_COLOR"] = trim($attendee["TEXT_COLOR"]);
$attendee["ACCESSIBILITY"] = trim($attendee["ACCESSIBILITY"]);
if (empty($attendee["ACCESSIBILITY"])) {
$attendee["ACCESSIBILITY"] = 'busy';
}
CCalendar::SetUserDepartment($attendee["USER_ID"], empty($attendee['UF_DEPARTMENT']) ? array() : unserialize($attendee['UF_DEPARTMENT']));
$attendee['DISPLAY_NAME'] = CCalendar::GetUserName($attendee);
$attendee['URL'] = CCalendar::GetUserUrl($attendee["USER_ID"]);
$attendee['AVATAR'] = CCalendar::GetUserAvatarSrc($attendee);
$arAttendees[$attendee['EVENT_ID']][] = $attendee;
}
}
return $arAttendees;
}
示例3: FormatDate
}
$event['UF_CRM_CAL_EVENT'] = $UF['UF_CRM_CAL_EVENT'];
if (empty($event['UF_CRM_CAL_EVENT']['VALUE'])) {
$event['UF_CRM_CAL_EVENT'] = false;
}
$event['UF_WEBDAV_CAL_EVENT'] = $UF['UF_WEBDAV_CAL_EVENT'];
if (empty($event['UF_WEBDAV_CAL_EVENT']['VALUE'])) {
$event['UF_WEBDAV_CAL_EVENT'] = false;
}
$event['FROM_WEEK_DAY'] = FormatDate('D', $fromTs);
$event['FROM_MONTH_DAY'] = FormatDate('j', $fromTs);
$event['FROM_MONTH'] = FormatDate('n', $fromTs);
$arHost = CCalendar::GetUser($event['MEETING_HOST'], true);
$arHost['AVATAR_SRC'] = CCalendar::GetUserAvatarSrc($arHost);
$arHost['URL'] = CCalendar::GetUserUrl($event['MEETING_HOST'], $arParams["PATH_TO_USER"]);
$arHost['DISPLAY_NAME'] = CCalendar::GetUserName($arHost);
$curUserStatus = '';
$userId = CCalendar::GetCurUserId();
$viewComments = CCalendar::IsPersonal($event['CAL_TYPE'], $event['OWNER_ID'], $userId) || CCalendarSect::CanDo('calendar_view_full', $event['SECT_ID'], $userId);
if ($event['IS_MEETING'] && empty($event['ATTENDEES_CODES'])) {
$event['ATTENDEES_CODES'] = CCalendarEvent::CheckEndUpdateAttendeesCodes($event);
}
if ($event['IS_MEETING']) {
$attendees = array('y' => array('users' => array(), 'count' => 4, 'countMax' => 8, 'title' => GetMessage('EC_ATT_Y'), 'id' => "bxview-att-cont-y-" . $event['ID']), 'n' => array('users' => array(), 'count' => 2, 'countMax' => 3, 'title' => GetMessage('EC_ATT_N'), 'id' => "bxview-att-cont-n-" . $event['ID']), 'q' => array('users' => array(), 'count' => 2, 'countMax' => 3, 'title' => GetMessage('EC_ATT_Q'), 'id' => "bxview-att-cont-q-" . $event['ID']), 'm' => array('users' => array(), 'count' => 4, 'countMax' => 8, 'title' => GetMessage('EC_ATT_M'), 'id' => "bxview-att-cont-m-" . $event['ID']));
if (is_array($event['~ATTENDEES'])) {
foreach ($event['~ATTENDEES'] as $att) {
if ($userId == $att["USER_ID"]) {
$curUserStatus = $att['STATUS'];
$viewComments = true;
}
$att['AVATAR_SRC'] = CCalendar::GetUserAvatarSrc($att);
示例4: GetOwnerName
public static function GetOwnerName($type = '', $ownerId = '')
{
$type = strtolower($type);
$key = $type . '_' . $ownerId;
if (isset(self::$ownerNames[$key])) {
return self::$ownerNames[$key];
}
$ownerName = '';
if ($type == 'user') {
$ownerName = CCalendar::GetUserName($ownerId);
} elseif ($type == 'group') {
// Get group name
if (!CModule::IncludeModule("socialnetwork")) {
return $ownerName;
}
if ($arGroup = CSocNetGroup::GetByID($ownerId)) {
$ownerName = $arGroup["~NAME"];
}
} else {
// Get type name
$arTypes = CCalendarType::GetList(array("arFilter" => array("XML_ID" => $type)));
$ownerName = $arTypes[0]['NAME'];
}
self::$ownerNames[$key] = $ownerName;
$ownerName = trim($ownerName);
return $ownerName;
}
示例5: 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);
}
示例6: GetSuperposedList
public static function GetSuperposedList($Params = array())
{
global $DB;
$checkPermissions = $Params['checkPermissions'] !== false;
$checkSocnetPermissions = $Params['checkSocnetPermissions'] !== false;
$userId = isset($Params['userId']) ? intVal($Params['userId']) : self::$userId;
$arResult = array();
$arSectionIds = array();
$sqlSearch = "";
// Common types
$strTypes = "";
if (isset($Params['TYPES']) && is_array($Params['TYPES'])) {
foreach ($Params['TYPES'] as $type) {
$strTypes .= ",'" . CDatabase::ForSql($type) . "'";
}
$strTypes = trim($strTypes, ", ");
if ($strTypes != "") {
$sqlSearch .= "(CS.CAL_TYPE in (" . $strTypes . "))";
}
}
// Group's calendars
$strGroups = "0";
if (is_array($Params['GROUPS']) && count($Params['GROUPS']) > 0) {
foreach ($Params['GROUPS'] as $ownerId) {
if (IntVal($ownerId) > 0) {
$strGroups .= "," . IntVal($ownerId);
}
}
if ($strGroups != "0") {
if ($sqlSearch != "") {
$sqlSearch .= " OR ";
}
$sqlSearch .= "(CS.OWNER_ID in (" . $strGroups . ") AND CS.CAL_TYPE='group')";
}
}
if ($sqlSearch != "") {
$strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\tCS.*,\n\t\t\t\t\tCT.NAME AS TYPE_NAME, CT.DESCRIPTION AS TYPE_DESC\n\t\t\t\tFROM\n\t\t\t\t\tb_calendar_section CS\n\t\t\t\t\tLEFT JOIN b_calendar_type CT ON (CS.CAL_TYPE=CT.XML_ID)\n\t\t\t\tWHERE\n\t\t\t\t\t(\n\t\t\t\t\t\tCT.ACTIVE='Y'\n\t\t\t\t\tAND\n\t\t\t\t\t\tCS.ACTIVE='Y'\n\t\t\t\t\tAND\n\t\t\t\t\t(\n\t\t\t\t\t\t{$sqlSearch}\n\t\t\t\t\t))";
$res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
while ($arRes = $res->Fetch()) {
$arSectionIds[] = $arRes['ID'];
$arResult[] = $arRes;
}
}
// User's calendars
$strUsers = "0";
if (is_array($Params['USERS']) && count($Params['USERS']) > 0) {
foreach ($Params['USERS'] as $ownerId) {
if (IntVal($ownerId) > 0) {
$strUsers .= "," . IntVal($ownerId);
}
}
if ($strUsers != "0") {
$strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\tCS.*,\n\t\t\t\t\tU.LOGIN AS USER_LOGIN, U.NAME AS USER_NAME, U.LAST_NAME AS USER_LAST_NAME, U.SECOND_NAME AS USER_SECOND_NAME\n\t\t\t\tFROM\n\t\t\t\t\tb_calendar_section CS\n\t\t\t\t\tLEFT JOIN b_user U ON (CS.OWNER_ID=U.ID)\n\t\t\t\tWHERE\n\t\t\t\t\t(\n\t\t\t\t\t\tCS.ACTIVE='Y'\n\t\t\t\t\tAND\n\t\t\t\t\t\tCS.OWNER_ID in (" . $strUsers . ")\n\t\t\t\t\tAND\n\t\t\t\t\t\tCS.CAL_TYPE='user'\n\t\t\t\t\t)";
$res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
while ($arRes = $res->Fetch()) {
$arSectionIds[] = $arRes['ID'];
$arResult[] = $arRes;
}
}
if ($checkPermissions && count($arSectionIds) > 0) {
if ($checkSocnetPermissions) {
if (isset($Params['USERS']) && count($Params['USERS']) > 0) {
$arFeaturesU = CSocNetFeatures::IsActiveFeature(SONET_ENTITY_USER, $Params['USERS'], "calendar");
$arViewU = CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_USER, $Params['USERS'], "calendar", 'view');
$arWriteU = CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_GROUP, $Params['USERS'], "calendar", 'write');
}
if (isset($Params['GROUPS']) && count($Params['GROUPS']) > 0) {
$arFeaturesG = CSocNetFeatures::IsActiveFeature(SONET_ENTITY_GROUP, $Params['GROUPS'], "calendar");
$arViewG = CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_GROUP, $Params['GROUPS'], "calendar", 'view');
$arWriteG = CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_GROUP, $Params['GROUPS'], "calendar", 'write');
}
}
CCalendarSect::GetArrayPermissions($arSectionIds);
$res = array();
$sectIds = array();
foreach ($arResult as $sect) {
$sectId = $sect['ID'];
$ownerId = $sect['OWNER_ID'];
if (self::CanDo('calendar_view_time', $sectId) && !in_array($sectId, $sectIds)) {
if ($checkSocnetPermissions) {
// Disabled in socialnetwork
if ($sect['CAL_TYPE'] == 'group' && (!$arFeaturesG[$ownerId] || !$arViewG[$ownerId]) || $sect['CAL_TYPE'] == 'user' && (!$arFeaturesU[$ownerId] || !$arViewU[$ownerId])) {
continue;
}
}
$sect['PERM'] = array('view_time' => self::CanDo('calendar_view_time', $sectId), 'view_title' => self::CanDo('calendar_view_title', $sectId), 'view_full' => self::CanDo('calendar_view_full', $sectId), 'add' => self::CanDo('calendar_add', $sectId), 'edit' => self::CanDo('calendar_edit', $sectId), 'edit_section' => self::CanDo('calendar_edit_section', $sectId), 'access' => self::CanDo('calendar_edit_access', $sectId));
if ($checkSocnetPermissions) {
if ($sect['CAL_TYPE'] == 'group' && !$arWriteG[$ownerId] || $sect['CAL_TYPE'] == 'user' && !$arWriteU[$ownerId]) {
$sect['PERM']['add'] = false;
$sect['PERM']['edit'] = false;
$sect['PERM']['edit_section'] = false;
$sect['PERM']['access'] = false;
}
}
if ($sect['CAL_TYPE'] == 'user') {
if (isset($sect['USER_NAME'], $sect['USER_LAST_NAME'])) {
$sect['OWNER_NAME'] = CCalendar::GetUserName(array("NAME" => $sect['USER_NAME'], "LAST_NAME" => $sect['USER_LAST_NAME'], "LOGIN" => $sect['USER_LOGIN'], "ID" => $ownerId, "SECOND_NAME" => $sect['USER_SECOND_NAME']));
unset($sect['USER_LOGIN']);
unset($sect['USER_LAST_NAME']);
//.........这里部分代码省略.........
示例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);
}
}
}
示例8: elseif
$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);
$arAttendees[] = $attendee;
}
unset($Event['~ATTENDEES']);
$arResult['ATTENDEES'] = $arAttendees;
}
$Event['~LOCATION'] = $Event['LOCATION'] !== '' ? CCalendar::GetTextLocation($Event["LOCATION"]) : '';
if ($Event['RRULE'] !== '') {
$Event['RRULE'] = CCalendarEvent::ParseRRULE($Event['RRULE']);
if (is_array($Event['RRULE']) && !isset($Event['RRULE']['UNTIL'])) {
$Event['RRULE']['UNTIL'] = $Event['DT_TO_TS'];
}
$Event['DT_TO_TS'] = $Event['DT_FROM_TS'] + intval($Event['DT_LENGTH']);
}
$arResult['EVENT'] = $Event;
$calType = $Event['CAL_TYPE'];
示例9: 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;
}
示例10: DialogViewEvent
public static function DialogViewEvent($Params)
{
global $APPLICATION, $USER_FIELD_MANAGER;
$id = $Params['id'];
$event = $Params['event'];
$event['~DT_FROM_TS'] = $event['DT_FROM_TS'];
$event['~DT_TO_TS'] = $event['DT_TO_TS'];
$event['DT_FROM_TS'] = $Params['fromTs'];
$event['DT_TO_TS'] = $Params['fromTs'] + $event['DT_LENGTH'];
$UF = $USER_FIELD_MANAGER->GetUserFields("CALENDAR_EVENT", $event['ID'], LANGUAGE_ID);
$event['UF_CRM_CAL_EVENT'] = $UF['UF_CRM_CAL_EVENT'];
if (empty($event['UF_CRM_CAL_EVENT']['VALUE'])) {
$event['UF_CRM_CAL_EVENT'] = false;
}
$event['UF_WEBDAV_CAL_EVENT'] = $UF['UF_WEBDAV_CAL_EVENT'];
if (empty($event['UF_WEBDAV_CAL_EVENT']['VALUE'])) {
$event['UF_WEBDAV_CAL_EVENT'] = false;
}
$event['FROM_WEEK_DAY'] = FormatDate('D', $event['DT_FROM_TS']);
$event['FROM_MONTH_DAY'] = FormatDate('j', $event['DT_FROM_TS']);
$event['FROM_MONTH'] = FormatDate('n', $event['DT_FROM_TS']);
$arHost = CCalendar::GetUser($event['MEETING_HOST'], true);
$arHost['AVATAR_SRC'] = CCalendar::GetUserAvatarSrc($arHost);
$arHost['URL'] = CCalendar::GetUserUrl($event['MEETING_HOST'], $Params["PATH_TO_USER"]);
$arHost['DISPLAY_NAME'] = CCalendar::GetUserName($arHost);
$curUserStatus = '';
$userId = CCalendar::GetCurUserId();
$viewComments = CCalendar::IsPersonal($event['CAL_TYPE'], $event['OWNER_ID'], $userId) || CCalendarSect::CanDo('calendar_view_full', $event['SECT_ID'], $userId);
if ($event['IS_MEETING'] && empty($event['ATTENDEES_CODES'])) {
$event['ATTENDEES_CODES'] = CCalendarEvent::CheckEndUpdateAttendeesCodes($event);
}
if ($event['IS_MEETING']) {
$attendees = array('y' => array('users' => array(), 'count' => 4, 'countMax' => 8, 'title' => GetMessage('EC_ATT_Y'), 'id' => "bxview-att-cont-y-" . $event['ID']), 'n' => array('users' => array(), 'count' => 2, 'countMax' => 3, 'title' => GetMessage('EC_ATT_N'), 'id' => "bxview-att-cont-n-" . $event['ID']), 'q' => array('users' => array(), 'count' => 2, 'countMax' => 3, 'title' => GetMessage('EC_ATT_Q'), 'id' => "bxview-att-cont-q-" . $event['ID']));
if (is_array($event['~ATTENDEES'])) {
foreach ($event['~ATTENDEES'] as $att) {
if ($userId == $att["USER_ID"]) {
$curUserStatus = $att['STATUS'];
$viewComments = true;
}
$att['AVATAR_SRC'] = CCalendar::GetUserAvatarSrc($att);
$att['URL'] = CCalendar::GetUserUrl($att["USER_ID"], $Params["PATH_TO_USER"]);
$attendees[strtolower($att['STATUS'])]['users'][] = $att;
}
}
}
$arTabs = array(array('name' => GetMessage('EC_BASIC'), 'title' => GetMessage('EC_BASIC_TITLE'), 'id' => $id . "view-tab-0", 'active' => true), array('name' => GetMessage('EC_EDEV_ADD_TAB'), 'title' => GetMessage('EC_EDEV_ADD_TAB_TITLE'), 'id' => $id . "view-tab-1"));
?>
<div id="bxec_view_ed_<?php
echo $id;
?>
" class="bxec-popup">
<div style="width: 700px; height: 1px;"></div>
<div class="bxec-d-tabs" id="<?php
echo $id;
?>
_viewev_tabs">
<?php
foreach ($arTabs as $tab) {
?>
<div class="bxec-d-tab <?php
if ($tab['active']) {
echo 'bxec-d-tab-act';
}
?>
" title="<?php
echo isset($tab['title']) ? $tab['title'] : $tab['name'];
?>
" id="<?php
echo $tab['id'];
?>
" <?php
if ($tab['show'] === false) {
echo 'style="display:none;"';
}
?>
>
<b></b><div><span><?php
echo $tab['name'];
?>
</span></div><i></i>
</div>
<?php
}
?>
</div>
<div class="bxec-d-cont">
<?php
/* ####### TAB 0 : BASIC ####### */
?>
<div id="<?php
echo $id;
?>
view-tab-0-cont" class="bxec-d-cont-div" style="display: block;">
<div class="bx-cal-view-icon">
<div class="bx-cal-view-icon-day"><?php
echo $event['FROM_WEEK_DAY'];
?>
</div>
<div class="bx-cal-view-icon-date"><?php
echo $event['FROM_MONTH_DAY'];
//.........这里部分代码省略.........
示例11: 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;
}