本文整理汇总了PHP中CCalendar::GetUserManagers方法的典型用法代码示例。如果您正苦于以下问题:PHP CCalendar::GetUserManagers方法的具体用法?PHP CCalendar::GetUserManagers怎么用?PHP CCalendar::GetUserManagers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCalendar
的用法示例。
在下文中一共展示了CCalendar::GetUserManagers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetList
//.........这里部分代码省略.........
if (isset($arFields[strtoupper($by)])) {
$strOrderBy .= $arFields[strtoupper($by)]["FIELD_NAME"] . ' ' . (strtolower($order) == 'desc' ? 'desc' . (strtoupper($DB->type) == "ORACLE" ? " NULLS LAST" : "") : 'asc' . (strtoupper($DB->type) == "ORACLE" ? " NULLS FIRST" : "")) . ',';
}
}
if (strlen($strOrderBy) > 0) {
$strOrderBy = "ORDER BY " . rtrim($strOrderBy, ",");
}
$strSqlSearch = GetFilterSqlSearch($arSqlSearch);
if (isset($arFilter['ADDITIONAL_IDS']) && is_array($arFilter['ADDITIONAL_IDS']) && count($arFilter['ADDITIONAL_IDS']) > 0) {
$strTypes = "";
foreach ($arFilter['ADDITIONAL_IDS'] as $adid) {
$strTypes .= "," . IntVal($adid);
}
$strSqlSearch = '(' . $strSqlSearch . ') OR ID in(' . trim($strTypes, ', ') . ')';
}
$select = 'CS.*';
$from = 'b_calendar_section CS';
// Fetch types info into selection
if ($Params['joinTypeInfo']) {
$select .= ", CT.NAME AS TYPE_NAME, CT.DESCRIPTION AS TYPE_DESC";
$from .= "\n INNER JOIN b_calendar_type CT ON (CS.CAL_TYPE=CT.XML_ID)";
}
$strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\t{$select}\n\t\t\t\tFROM\n\t\t\t\t\t{$from}\n\t\t\t\tWHERE\n\t\t\t\t\t{$strSqlSearch}\n\t\t\t\t{$strOrderBy}";
$res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$arResult = array();
$arSectionIds = array();
$isExchangeEnabled = CCalendar::IsExchangeEnabled();
$isCalDAVEnabled = CCalendar::IsCalDAVEnabled();
while ($arRes = $res->Fetch()) {
$arRes['COLOR'] = CCalendar::Color($arRes['COLOR'], true);
$arSectionIds[] = $arRes['ID'];
if (isset($arRes['EXPORT']) && $arRes['EXPORT'] != "") {
$arRes['EXPORT'] = unserialize($arRes['EXPORT']);
if (is_array($arRes['EXPORT']) && $arRes['EXPORT']['ALLOW']) {
$arRes['EXPORT']['LINK'] = self::GetExportLink($arRes['ID'], $arRes['CAL_TYPE'], $arRes['OWNER_ID']);
}
}
if (!is_array($arRes['EXPORT'])) {
$arRes['EXPORT'] = array('ALLOW' => false, 'SET' => false, 'LINK' => false);
}
// Outlook js
if (CCalendar::IsIntranetEnabled()) {
$arRes['OUTLOOK_JS'] = CCalendarSect::GetOutlookLink(array('ID' => intVal($arRes['ID']), 'XML_ID' => $arRes['XML_ID'], 'TYPE' => $arRes['CAL_TYPE'], 'NAME' => $arRes['NAME'], 'PREFIX' => CCalendar::GetOwnerName($arRes['CAL_TYPE'], $arRes['OWNER_ID']), 'LINK_URL' => CCalendar::GetOuterUrl()));
}
if ($arRes['CAL_TYPE'] == 'user') {
$arRes['IS_EXCHANGE'] = strlen($arRes["DAV_EXCH_CAL"]) > 0 && $isExchangeEnabled;
if ($arRes["CAL_DAV_CON"] && $isCalDAVEnabled) {
$arRes["CAL_DAV_CON"] = intVal($arRes["CAL_DAV_CON"]);
$resCon = CDavConnection::GetList(array("ID" => "ASC"), array("ID" => $arRes["CAL_DAV_CON"]));
if ($con = $resCon->Fetch()) {
$arRes['CAL_DAV_CON'] = $arRes["CAL_DAV_CON"];
} else {
$arRes['CAL_DAV_CON'] = false;
}
}
} else {
$arRes['IS_EXCHANGE'] = false;
$arRes['CAL_DAV_CON'] = false;
}
$arResult[] = $arRes;
}
if ($bCache) {
$cache->StartDataCache(CCalendar::CacheTime(), $cacheId, $cachePath);
$cache->EndDataCache(array("arResult" => $arResult, "arSectionIds" => $arSectionIds));
}
}
if ($checkPermissions && count($arSectionIds) > 0) {
$userId = $Params['userId'] ? intVal($Params['userId']) : $USER->GetID();
$arPerm = CCalendarSect::GetArrayPermissions($arSectionIds);
$res = array();
$arAccessCodes = array();
$settings = CCalendar::GetSettings(array('request' => false));
foreach ($arResult as $sect) {
$sectId = $sect['ID'];
$bOwner = $sect['CAL_TYPE'] == 'user' && $sect['OWNER_ID'] == $userId;
$bManager = false;
if (CModule::IncludeModule('intranet') && $sect['CAL_TYPE'] == 'user' && $settings['dep_manager_sub']) {
if (!$userId) {
$userId = CCalendar::GetUserId();
}
$bManager = in_array($userId, CCalendar::GetUserManagers($sect['OWNER_ID'], true));
}
if ($bOwner || $bManager || self::CanDo('calendar_view_time', $sectId)) {
$sect['PERM'] = array('view_time' => $bManager || $bOwner || self::CanDo('calendar_view_time', $sectId, $userId), 'view_title' => $bManager || $bOwner || self::CanDo('calendar_view_title', $sectId, $userId), 'view_full' => $bManager || $bOwner || self::CanDo('calendar_view_full', $sectId, $userId), 'add' => $bOwner || self::CanDo('calendar_add', $sectId, $userId), 'edit' => $bOwner || self::CanDo('calendar_edit', $sectId, $userId), 'edit_section' => $bOwner || self::CanDo('calendar_edit_section', $sectId, $userId), 'access' => $bOwner || self::CanDo('calendar_edit_access', $sectId, $userId));
if ($bOwner || self::CanDo('calendar_edit_access', $sectId, $userId)) {
$sect['ACCESS'] = array();
if (count($arPerm[$sectId]) > 0) {
// Add codes to get they full names for interface
$arAccessCodes = array_merge($arAccessCodes, array_keys($arPerm[$sectId]));
$sect['ACCESS'] = $arPerm[$sectId];
}
}
$res[] = $sect;
}
}
CCalendar::PushAccessNames($arAccessCodes);
$arResult = $res;
}
return $arResult;
}
示例2: GetAbsent
public static function GetAbsent($users = false, $Params = array())
{
global $DB;
// Can be called from agent... So we have to create $USER if it is not exists
$tempUser = CCalendar::TempUser(false, true);
$curUserId = isset($Params['userId']) ? intVal($Params['userId']) : CCalendar::GetCurUserId();
$arUsers = array();
if ($users !== false && is_array($users)) {
foreach ($users as $id) {
if ($id > 0) {
$arUsers[] = intVal($id);
}
}
}
if (!count($arUsers)) {
$users = false;
}
// Part 1: select ordinary events
$arFilter = array('CAL_TYPE' => 'user', 'DELETED' => 'N', 'ACCESSIBILITY' => 'absent');
if (isset($Params['fromLimit'])) {
$arFilter['FROM_LIMIT'] = CCalendar::Date(CCalendar::Timestamp($Params['fromLimit'], false), true, false);
}
if (isset($Params['toLimit'])) {
$arFilter['TO_LIMIT'] = CCalendar::Date(CCalendar::Timestamp($Params['toLimit'], false), true, false);
}
$arEvents = CCalendarEvent::GetList(array('arFilter' => $arFilter, 'getUserfields' => false, 'parseRecursion' => true, 'fetchAttendees' => false, 'fetchMeetings' => true, 'userId' => $curUserId, 'checkPermissions' => false, 'preciseLimits' => true));
// Part 2: select attendees
CTimeZone::Disable();
if (count($arUsers) > 0) {
$userQ = ' AND CA.USER_ID in (' . implode(',', $arUsers) . ')';
} else {
$userQ = '';
}
$strSql = "\n\t\t\tSELECT\n\t\t\t\tCA.EVENT_ID as ID, CA.USER_ID, CA.STATUS, CA.ACCESSIBILITY,\n\t\t\t\tCE.CAL_TYPE,CE.OWNER_ID,CE.NAME," . $DB->DateToCharFunction("CE.DT_FROM") . " as DT_FROM," . $DB->DateToCharFunction("CE.DT_TO") . " as DT_TO, CE.DT_LENGTH, CE.PRIVATE_EVENT, CE.ACCESSIBILITY, CE.IMPORTANCE, CE.IS_MEETING, CE.MEETING_HOST, CE.MEETING, CE.LOCATION, CE.RRULE, CE.EXRULE, CE.RDATE, CE.EXDATE,\n\t\t\t\tCES.SECT_ID\n\t\t\tFROM b_calendar_attendees CA\n\t\t\tLEFT JOIN\n\t\t\t\tb_calendar_event CE ON(CA.EVENT_ID=CE.ID)\n\t\t\tLEFT JOIN\n\t\t\t\tb_calendar_event_sect CES ON (CA.EVENT_ID=CES.EVENT_ID)\n\t\t\tWHERE\n\t\t\t\t\tCE.ID IS NOT NULL\n\t\t\t\tAND\n\t\t\t\t\tCE.DELETED='N'\n\t\t\t\tAND\n\t\t\t\t\tSTATUS='Y'\n\t\t\t\tAND\n\t\t\t\t\tCA.ACCESSIBILITY='absent'\n\t\t\t\t{$userQ}\n\t\t\t";
if (isset($arFilter['FROM_LIMIT'])) {
$strSql .= "AND ";
if (strtoupper($DB->type) == "MYSQL") {
$strSql .= "CE.DT_TO>=FROM_UNIXTIME('" . MkDateTime(FmtDate($arFilter['FROM_LIMIT'], "D.M.Y"), "d.m.Y") . "')";
} elseif (strtoupper($DB->type) == "MSSQL") {
$strSql .= "CE.DT_TO>=" . $DB->CharToDateFunction($arFilter['FROM_LIMIT'], "SHORT");
} elseif (strtoupper($DB->type) == "ORACLE") {
$strSql .= "CE.DT_TO>=TO_DATE('" . FmtDate($arFilter['FROM_LIMIT'], "D.M.Y") . " 00:00:00','dd.mm.yyyy hh24:mi:ss')";
}
}
if ($arFilter['TO_LIMIT']) {
$strSql .= "AND ";
if (strtoupper($DB->type) == "MYSQL") {
$strSql .= "CE.DT_FROM<=FROM_UNIXTIME('" . MkDateTime(FmtDate($arFilter['TO_LIMIT'], "D.M.Y") . " 23:59:59", "d.m.Y H:i:s") . "')";
} elseif (strtoupper($DB->type) == "MSSQL") {
$strSql .= "CE.DT_FROM<=dateadd(day, 1, " . $DB->CharToDateFunction($arFilter['TO_LIMIT'], "SHORT") . ")";
} elseif (strtoupper($DB->type) == "ORACLE") {
$strSql .= "CE.DT_FROM<=TO_DATE('" . FmtDate($arFilter['TO_LIMIT'], "D.M.Y") . " 23:59:59','dd.mm.yyyy hh24:mi:ss')";
}
}
$res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$arEvents2 = array();
while ($event = $res->Fetch()) {
$event = self::PreHandleEvent($event);
if ($event['CAL_TYPE'] == 'user' && $event['IS_MEETING'] && $event['OWNER_ID'] == $event['USER_ID']) {
continue;
}
if (self::CheckRecurcion($event)) {
self::ParseRecursion($arEvents2, $event, array('fromLimit' => $arFilter["FROM_LIMIT"], 'toLimit' => $arFilter["TO_LIMIT"]));
} else {
self::HandleEvent($arEvents2, $event);
}
}
CTimeZone::Enable();
$arEvents = array_merge($arEvents, $arEvents2);
$bSocNet = CModule::IncludeModule("socialnetwork");
$result = array();
$settings = CCalendar::GetSettings(array('request' => false));
foreach ($arEvents as $event) {
$userId = isset($event['USER_ID']) ? $event['USER_ID'] : $event['OWNER_ID'];
if ($users !== false && !in_array($userId, $arUsers)) {
continue;
}
if ($bSocNet && !CSocNetFeatures::IsActiveFeature(SONET_ENTITY_USER, $userId, "calendar")) {
continue;
}
if ((!$event['CAL_TYPE'] != 'user' || $curUserId != $event['OWNER_ID']) && $curUserId != $event['CREATED_BY'] && !isset($arUserMeeting[$event['ID']])) {
$sectId = $event['SECT_ID'];
if (!$event['ACCESSIBILITY']) {
$event['ACCESSIBILITY'] = 'busy';
}
$private = $event['PRIVATE_EVENT'] && $event['CAL_TYPE'] == 'user';
$bManager = false;
if (!$private && CCalendar::IsIntranetEnabled() && CModule::IncludeModule('intranet') && $event['CAL_TYPE'] == 'user' && $settings['dep_manager_sub']) {
$bManager = in_array($curUserId, CCalendar::GetUserManagers($event['OWNER_ID'], true));
}
if ($private || !CCalendarSect::CanDo('calendar_view_full', $sectId) && !$bManager) {
if ($private) {
$event['NAME'] = '[' . GetMessage('EC_ACCESSIBILITY_' . strtoupper($event['ACCESSIBILITY'])) . ']';
} else {
if (!CCalendarSect::CanDo('calendar_view_title', $sectId)) {
$event['NAME'] = '[' . GetMessage('EC_ACCESSIBILITY_' . strtoupper($event['ACCESSIBILITY'])) . ']';
} else {
$event['NAME'] = $event['NAME'] . ' [' . GetMessage('EC_ACCESSIBILITY_' . strtoupper($event['ACCESSIBILITY'])) . ']';
}
}
//.........这里部分代码省略.........
示例3: GetAbsent
public static function GetAbsent($users = false, $Params = array())
{
// Can be called from agent... So we have to create $USER if it is not exists
$tempUser = CCalendar::TempUser(false, true);
$curUserId = isset($Params['userId']) ? intVal($Params['userId']) : CCalendar::GetCurUserId();
$arUsers = array();
if ($users !== false && is_array($users)) {
foreach ($users as $id) {
if ($id > 0) {
$arUsers[] = intVal($id);
}
}
}
if (!count($arUsers)) {
$users = false;
}
$arFilter = array('DELETED' => 'N', 'ACCESSIBILITY' => 'absent');
if ($users) {
$arFilter['CREATED_BY'] = $users;
}
if (isset($Params['fromLimit'])) {
$arFilter['FROM_LIMIT'] = CCalendar::Date(CCalendar::Timestamp($Params['fromLimit'], false), true, false);
}
if (isset($Params['toLimit'])) {
$arFilter['TO_LIMIT'] = CCalendar::Date(CCalendar::Timestamp($Params['toLimit'], false), true, false);
}
$arEvents = CCalendarEvent::GetList(array('arFilter' => $arFilter, 'parseRecursion' => true, 'getUserfields' => false, 'userId' => $curUserId, 'preciseLimits' => true, 'checkPermissions' => false, 'skipDeclined' => true));
$bSocNet = CModule::IncludeModule("socialnetwork");
$result = array();
$settings = CCalendar::GetSettings(array('request' => false));
foreach ($arEvents as $event) {
$userId = isset($event['USER_ID']) ? $event['USER_ID'] : $event['CREATED_BY'];
if ($users !== false && !in_array($userId, $arUsers)) {
continue;
}
if ($bSocNet && !CSocNetFeatures::IsActiveFeature(SONET_ENTITY_USER, $userId, "calendar")) {
continue;
}
if ((!$event['CAL_TYPE'] != 'user' || $curUserId != $event['OWNER_ID']) && $curUserId != $event['CREATED_BY'] && !isset($arUserMeeting[$event['ID']])) {
$sectId = $event['SECT_ID'];
if (!$event['ACCESSIBILITY']) {
$event['ACCESSIBILITY'] = 'busy';
}
$private = $event['PRIVATE_EVENT'] && $event['CAL_TYPE'] == 'user';
$bManager = false;
if (!$private && CCalendar::IsIntranetEnabled() && CModule::IncludeModule('intranet') && $event['CAL_TYPE'] == 'user' && $settings['dep_manager_sub']) {
$bManager = in_array($curUserId, CCalendar::GetUserManagers($event['OWNER_ID'], true));
}
if ($private || !CCalendarSect::CanDo('calendar_view_full', $sectId) && !$bManager) {
$event = self::ApplyAccessRestrictions($event, $userId);
}
}
$skipTime = $event['DT_SKIP_TIME'] === 'Y';
$fromTs = CCalendar::Timestamp($event['DATE_FROM'], false, !$skipTime);
$toTs = CCalendar::Timestamp($event['DATE_TO'], false, !$skipTime);
if ($event['DT_SKIP_TIME'] !== 'Y') {
$fromTs -= $event['~USER_OFFSET_FROM'];
$toTs -= $event['~USER_OFFSET_TO'];
}
$result[] = array('ID' => $event['ID'], 'NAME' => $event['NAME'], 'DATE_FROM' => CCalendar::Date($fromTs, !$skipTime, false), 'DATE_TO' => CCalendar::Date($toTs, !$skipTime, false), 'DT_FROM_TS' => $fromTs, 'DT_TO_TS' => $toTs, 'CREATED_BY' => $userId, 'DETAIL_TEXT' => '', 'USER_ID' => $userId);
}
// Sort by DATE_FROM_TS_UTC
usort($result, array('CCalendar', '_NearestSort'));
CCalendar::TempUser($tempUser, false);
return $result;
}