本文整理汇总了PHP中CExtranet::GetMyGroupsUsers方法的典型用法代码示例。如果您正苦于以下问题:PHP CExtranet::GetMyGroupsUsers方法的具体用法?PHP CExtranet::GetMyGroupsUsers怎么用?PHP CExtranet::GetMyGroupsUsers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CExtranet
的用法示例。
在下文中一共展示了CExtranet::GetMyGroupsUsers方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetListItemChangesSinceToken
function GetListItemChangesSinceToken($listName, $viewFields = '', $query = '', $rowLimit = 0, $changeToken = '')
{
global $APPLICATION, $USER;
if (!($listName_original = CIntranetUtils::checkGUID($listName))) {
return new CSoapFault('Data error', 'Wrong GUID - ' . $listName);
}
if (!$USER->IsAdmin() && (!defined("IS_EXTRANET") || IS_EXTRANET != "Y")) {
$rsUsers = CUser::GetList($by = "id", $order = "asc", array("ID" => $USER->GetID()), array("SELECT" => array("UF_DEPARTMENT")));
if ($arUser = $rsUsers->Fetch()) {
if (intval($arUser["UF_DEPARTMENT"][0]) > 0) {
$bUserIntranet = true;
}
}
if (!$bUserIntranet) {
return new CSoapFault('Data error', 'User has no permissions to read intranet contacts');
}
}
$listName = ToUpper(CIntranetUtils::makeGUID($listName_original));
$arFilter = array('ACTIVE' => 'Y');
$page = 1;
$bUpdateFields = false;
$tsLastFieldsChange = COption::GetOptionString('intranet', 'ws_contacts_last_fields_change', false);
$this->bGetImages = COption::GetOptionString('intranet', 'ws_contacts_get_images', 'Y') == 'Y';
if (strlen($changeToken) > 0) {
if ($pos = strpos($changeToken, ';')) {
list($newChangeToken, $page, $last_change) = explode(';', $changeToken);
$page++;
$changeToken = $newChangeToken;
}
$arFilter['TIMESTAMP_X_1'] = ConvertTimeStamp($changeToken, 'FULL');
if (!$arFilter['TIMESTAMP_X_1']) {
return new CSoapFault('Params error', 'Wrong changeToken: ' . $changeToken);
}
if ($tsLastFieldsChange !== false && $tsLastFieldsChange > $changeToken) {
$bUpdateFields = true;
}
}
if (CModule::IncludeModule('extranet') && defined("IS_EXTRANET") && IS_EXTRANET == "Y") {
$arFilter["GROUPS_ID"] = array(COption::GetOptionInt("extranet", "extranet_group"));
}
if (!CModule::IncludeModule('extranet') || defined("IS_EXTRANET") && IS_EXTRANET == "Y" && defined("IS_EMPLOYEES") && IS_EMPLOYEES == "Y" || (!defined("IS_EXTRANET") || IS_EXTRANET != "Y")) {
$arFilter["!UF_DEPARTMENT"] = false;
} else {
$arFilter["UF_DEPARTMENT"] = false;
}
// it's needed to check is current user an intranet user if he requested intranet script
$arListParams = array("SELECT" => array("UF_DEPARTMENT"));
if ($rowLimit > 0) {
$arListParams["NAV_PARAMS"] = array("nPageSize" => $rowLimit, "bShowAll" => false, "iNumPage" => $page);
}
$obUsers = CUser::GetList($by = 'id', $order = 'asc', $arFilter, $arListParams);
if (!isset($last_change)) {
$last_change = 0;
}
$data = new CXMLCreator('listitems');
$data->setAttribute('MinTimeBetweenSyncs', 0);
$data->setAttribute('RecommendedTimeBetweenSyncs', 180);
$data->setAttribute('TimeStamp', $this->__makeDateTime());
$data->setAttribute('EffectivePermMask', 'FullMask');
$data->addChild($obChanges = new CXMLCreator('Changes'));
if ((!$changeToken || $bUpdateFields) && $page <= 1) {
$arGetListResult = $this->GetList($listName);
$obChanges->addChild($arGetListResult['GetListResult']);
}
//TODO: the next thing is to do something like this for all deleted events.
//$obChanges->addChild($obId = new CXMLCreator('Id'));
//$obId->setAttribute('ChangeType', 'Delete');
//$obId->setData('702');
//<Id ChangeType="Delete">14</Id>
$data->addChild($obData = new CXMLCreator('rs:data'));
$counter = 0;
if (CModule::IncludeModule('extranet') && defined("IS_EXTRANET") && IS_EXTRANET == "Y") {
$arUsersInMyGroupsID = CExtranet::GetMyGroupsUsers(CExtranet::GetExtranetSiteID());
$arPublicUsersID = CExtranet::GetPublicUsers();
}
while ($arUser = $obUsers->Fetch()) {
if (CModule::IncludeModule('extranet') && !CExtranet::IsExtranetAdmin()) {
if (defined("IS_EXTRANET") && IS_EXTRANET == "Y" && (!in_array($arUser["ID"], $arUsersInMyGroupsID) && !in_array($arUser["ID"], $arPublicUsersID) || $arUser["ID"] == $USER->GetID())) {
continue;
}
}
if (is_array($arUser['UF_DEPARTMENT']) && count($arUser['UF_DEPARTMENT']) > 0) {
if ($this->arDepartmentsCache[$arUser['UF_DEPARTMENT'][0]]) {
$arUser['WORK_COMPANY'] = $this->arDepartmentsTopCache[$arUser['UF_DEPARTMENT'][0]];
$arUser['UF_DEPARTMENT'] = $this->arDepartmentsCache[$arUser['UF_DEPARTMENT'][0]];
} else {
$dbRes = CIBlockSection::GetByID($arUser['UF_DEPARTMENT'][0]);
if ($arRes = $dbRes->Fetch()) {
if (!defined("IS_EXTRANET") || IS_EXTRANET != "Y" || defined("IS_EMPLOYEES") && IS_EMPLOYEES == "Y") {
$arUser['DEPARTMENT'] = $this->arDepartmentsCache[$arUser['UF_DEPARTMENT'][0]] = $arRes['NAME'];
}
// this case crashes inner cache of top departments
//if (!$arUser['WORK_COMPANY'])
//{
if ($top_section = CIntranetUtils::GetIBlockTopSection($arUser['UF_DEPARTMENT'])) {
$dbRes = CIBlockSection::GetByID($top_section);
if ($arRes = $dbRes->Fetch()) {
$arUser['WORK_COMPANY'] = $this->arDepartmentsTopCache[$arUser['UF_DEPARTMENT'][0]] = $arRes['NAME'];
}
}
//.........这里部分代码省略.........
示例2: __SLEGetLogRecord
function __SLEGetLogRecord($logID, $arParams, $arCurrentUserSubscribe, $current_page_date)
{
static $isExtranetInstalled, $isExtranetSite, $isExtranetUser, $arUserIdVisible, $arAvailableExtranetUserID, $isExtranetAdmin, $bCurrentUserIsAdmin, $arSocNetFeaturesSettings;
if (!$isExtranetInstalled) {
$isExtranetInstalled = CModule::IncludeModule("extranet") ? "Y" : "N";
$isExtranetSite = $isExtranetInstalled == "Y" && CExtranet::IsExtranetSite() ? "Y" : "N";
$isExtranetUser = $isExtranetInstalled == "Y" && !CExtranet::IsIntranetUser() ? "Y" : "N";
$isExtranetAdmin = $isExtranetInstalled == "Y" && CExtranet::IsExtranetAdmin() ? "Y" : "N";
$bCurrentUserIsAdmin = CSocNetUser::IsCurrentUserModuleAdmin();
$arSocNetFeaturesSettings = CSocNetAllowed::GetAllowedFeatures();
if ($isExtranetUser == "Y") {
$arUserIdVisible = CExtranet::GetMyGroupsUsersSimple(SITE_ID);
} elseif ($isExtranetInstalled == "Y" && $isExtranetUser != "Y") {
if ($isExtranetAdmin == "Y" && $bCurrentUserIsAdmin) {
$arAvailableExtranetUserID = CExtranet::GetMyGroupsUsers(SITE_ID);
} else {
$arAvailableExtranetUserID = CExtranet::GetMyGroupsUsersSimple(CExtranet::GetExtranetSiteID());
}
}
}
$cache_time = 31536000;
$arEvent = array();
$cache = new CPHPCache();
$arCacheID = array();
$arKeys = array("AVATAR_SIZE", "DESTINATION_LIMIT", "CHECK_PERMISSIONS_DEST", "NAME_TEMPLATE", "NAME_TEMPLATE_WO_NOBR", "SHOW_LOGIN", "DATE_TIME_FORMAT", "PATH_TO_USER", "PATH_TO_GROUP", "PATH_TO_CONPANY_DEPARTMENT");
foreach ($arKeys as $param_key) {
if (array_key_exists($param_key, $arParams)) {
$arCacheID[$param_key] = $arParams[$param_key];
} else {
$arCacheID[$param_key] = false;
}
}
$cache_id = "log_post_" . $logID . "_" . md5(serialize($arCacheID)) . "_" . SITE_TEMPLATE_ID . "_" . SITE_ID . "_" . LANGUAGE_ID . "_" . FORMAT_DATETIME . "_" . CTimeZone::GetOffset();
$cache_path = "/sonet/log/" . intval(intval($logID) / 1000) . "/" . $logID . "/entry/";
if (is_object($cache) && $cache->InitCache($cache_time, $cache_id, $cache_path)) {
$arCacheVars = $cache->GetVars();
$arEvent["FIELDS_FORMATTED"] = $arCacheVars["FIELDS_FORMATTED"];
if (array_key_exists("CACHED_CSS_PATH", $arEvent["FIELDS_FORMATTED"])) {
if (!is_array($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"]) && strlen($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"]) > 0) {
$GLOBALS['APPLICATION']->SetAdditionalCSS($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"]);
} elseif (is_array($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"])) {
foreach ($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"] as $css_path) {
$GLOBALS['APPLICATION']->SetAdditionalCSS($css_path);
}
}
}
if (array_key_exists("CACHED_JS_PATH", $arEvent["FIELDS_FORMATTED"])) {
if (!is_array($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"]) && $arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"] !== '') {
$GLOBALS['APPLICATION']->AddHeadScript($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"]);
} elseif (is_array($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"])) {
foreach ($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"] as $js_path) {
$GLOBALS['APPLICATION']->AddHeadScript($js_path);
}
}
}
} else {
if (is_object($cache)) {
$cache->StartDataCache($cache_time, $cache_id, $cache_path);
}
$arFilter = array("ID" => $logID);
$arListParams = array("CHECK_RIGHTS" => "N", "USE_FOLLOW" => "N", "USE_SUBSCRIBE" => "N");
$arSelect = array("ID", "TMP_ID", "ENTITY_TYPE", "ENTITY_ID", "USER_ID", "EVENT_ID", "LOG_DATE", "LOG_UPDATE", "TITLE_TEMPLATE", "TITLE", "MESSAGE", "TEXT_MESSAGE", "URL", "MODULE_ID", "CALLBACK_FUNC", "EXTERNAL_ID", "SITE_ID", "PARAMS", "COMMENTS_COUNT", "ENABLE_COMMENTS", "SOURCE_ID", "GROUP_NAME", "GROUP_OWNER_ID", "GROUP_INITIATE_PERMS", "GROUP_VISIBLE", "GROUP_OPENED", "GROUP_IMAGE_ID", "USER_NAME", "USER_LAST_NAME", "USER_SECOND_NAME", "USER_LOGIN", "USER_PERSONAL_PHOTO", "USER_PERSONAL_GENDER", "CREATED_BY_NAME", "CREATED_BY_LAST_NAME", "CREATED_BY_SECOND_NAME", "CREATED_BY_LOGIN", "CREATED_BY_PERSONAL_PHOTO", "CREATED_BY_PERSONAL_GENDER", "RATING_TYPE_ID", "RATING_ENTITY_ID", "SOURCE_TYPE");
$dbEvent = CSocNetLog::GetList(array(), $arFilter, false, false, $arSelect, $arListParams);
if ($arEvent = $dbEvent->GetNext()) {
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->StartTagCache($cache_path);
$GLOBALS["CACHE_MANAGER"]->RegisterTag("USER_NAME_" . intval($arEvent["USER_ID"]));
$GLOBALS["CACHE_MANAGER"]->RegisterTag("SONET_LOG_" . intval($arEvent["ID"]));
if ($arEvent["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
$GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_group_" . $arEvent["ENTITY_ID"]);
}
}
$arEvent["EVENT_ID_FULLSET"] = CSocNetLogTools::FindFullSetEventIDByEventID($arEvent["EVENT_ID"]);
if ($arEvent["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
static $arSiteWorkgroupsPage;
if (!$arSiteWorkgroupsPage && (IsModuleInstalled("extranet") || is_set($arEvent["URL"]) && strpos($arEvent["URL"], "#GROUPS_PATH#") !== false)) {
$rsSite = CSite::GetList($by = "sort", $order = "desc", array("ACTIVE" => "Y"));
while ($arSite = $rsSite->Fetch()) {
$arSiteWorkgroupsPage[$arSite["ID"]] = COption::GetOptionString("socialnetwork", "workgroups_page", $arSite["DIR"] . "workgroups/", $arSite["ID"]);
}
}
if (is_set($arEvent["URL"]) && isset($arSiteWorkgroupsPage[SITE_ID])) {
$arEvent["URL"] = str_replace("#GROUPS_PATH#", $arSiteWorkgroupsPage[SITE_ID], $arEvent["URL"]);
}
}
$arEventTmp = CSocNetLogTools::FindLogEventByID($arEvent["EVENT_ID"]);
if ($arEventTmp && isset($arEventTmp["CLASS_FORMAT"]) && isset($arEventTmp["METHOD_FORMAT"])) {
$arEvent["UF"] = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("SONET_LOG", $arEvent["ID"], LANGUAGE_ID);
$arEvent["FIELDS_FORMATTED"] = call_user_func(array($arEventTmp["CLASS_FORMAT"], $arEventTmp["METHOD_FORMAT"]), $arEvent, $arParams);
if (is_array($arEvent["FIELDS_FORMATTED"])) {
if (isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"])) {
if (in_array($arEvent["EVENT_ID"], array('calendar'))) {
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"] = htmlspecialcharsback($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"]);
} else {
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"] = CSocNetTextParser::closetags(htmlspecialcharsback($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"]));
}
}
if (isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"])) {
$arFields2Cache = array("URL", "STYLE", "DESTINATION", "DESTINATION_MORE", "TITLE_24", "TITLE_24_2", "TITLE_24_2_STYLE", "IS_IMPORTANT", "MESSAGE", "FOOTER_MESSAGE", "MESSAGE_TITLE_24", "DATETIME_FORMATTED", "LOG_DATE_FORMAT", "MENU", "COMMENT_URL");
foreach ($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"] as $field => $value) {
//.........这里部分代码省略.........
示例3: GetList
function GetList($arParams)
{
$sectionId = isset($arParams['sectionId']) && $arParams['sectionId'] !== false ? $arParams['sectionId'] : 0;
$iblockId = $arParams['iblockId'];
$xmlId = isset($arParams['xmlId']) && $arParams['xmlId'] !== false ? $arParams['xmlId'] : 0;
$forExport = $arParams['forExport'] == true;
$checkPermissions = $forExport ? 'N' : 'Y';
$bOwner = $arParams['bOwner'] === true;
$arFilter = array("SECTION_ID" => $sectionId, "IBLOCK_ID" => $iblockId, "ACTIVE" => "Y", "CHECK_PERMISSIONS" => $checkPermissions);
if ($bOwner) {
$ownerType = $arParams['ownerType'];
$ownerId = $arParams['ownerId'];
if ($ownerType == 'USER') {
$arFilter["CREATED_BY"] = $ownerId;
$userId = $arParams['userId'] ? intVal($arParams['userId']) : $GLOBALS['USER']->GetID();
$bCurUserOwner = $ownerId == $userId;
} elseif ($ownerType == 'GROUP') {
$arFilter["SOCNET_GROUP_ID"] = $ownerId;
$bCurUserOwner = true;
}
} else {
$ownerType = false;
$ownerId = false;
$bCurUserOwner = true;
}
/* modified by wladart */
// get superpose calendars
//if (!$bOwner && CModule::IncludeModule('extranet'))
if (CModule::IncludeModule('extranet')) {
if (CExtranet::IsExtranetSite()) {
$arUsersInMyGroupsID = CExtranet::GetMyGroupsUsers(SITE_ID);
$arPublicUsersID = CExtranet::GetPublicUsers();
$arUsersToFilter = array_merge($arUsersInMyGroupsID, $arPublicUsersID);
$arFilter["CREATED_BY"] = $arUsersToFilter;
} else {
$arFilter["CREATED_BY"] = CExtranet::GetIntranetUsers();
}
}
/* --modified by wladart */
if ($xmlId !== 0) {
$arFilter['XML_ID'] = $xmlId;
if ($sectionId === 0) {
unset($arFilter['SECTION_ID']);
}
}
$rsData = CIBlockSection::GetList(array('ID' => 'ASC'), $arFilter);
$arCalendars = array();
if (!$arParams['bSuperposed'] && !$arParams['bOnlyID']) {
$outerUrl = $GLOBALS['APPLICATION']->GetCurPageParam('', array("action", "bx_event_calendar_request", "clear_cache", "bitrix_include_areas", "bitrix_show_mode", "back_url_admin", "SEF_APPLICATION_CUR_PAGE_URL"), false);
}
while ($arRes = $rsData->Fetch()) {
$privateStatus = CECCalendar::GetPrivateStatus($iblockId, $arRes['ID'], $ownerType);
if ($privateStatus == 'private' && !$bCurUserOwner) {
continue;
}
if ($arParams['bOnlyID']) {
$arCalendars[] = intVal($arRes['ID']);
continue;
}
$calendar = array("ID" => intVal($arRes['ID']), "IBLOCK_ID" => $iblockId, "IBLOCK_SECTION_ID" => intVal($arRes['IBLOCK_SECTION_ID']), "NAME" => htmlspecialcharsex($arRes['NAME']), "DESCRIPTION" => htmlspecialcharsex($arRes['DESCRIPTION']), "COLOR" => CECCalendar::GetColor($iblockId, $arRes['ID'], $ownerType), "PRIVATE_STATUS" => $privateStatus);
if (!$arParams['bSuperposed']) {
$calendar["OUTLOOK_JS"] = CECCalendar::GetOutlookLink(array('ID' => intVal($arRes['ID']), 'XML_ID' => $arRes['XML_ID'], 'IBLOCK_ID' => $iblockId, 'NAME' => htmlspecialcharsex($arRes['NAME']), 'PREFIX' => CEventCalendar::GetOwnerName(array('iblockId' => $iblockId, 'ownerType' => $ownerType, 'ownerId' => $ownerId)), 'LINK_URL' => $outerUrl));
$arExport = CECCalendar::GetExportParams($iblockId, $arRes['ID'], $ownerType, $ownerId);
$calendar["EXPORT"] = $arExport['ALLOW'];
$calendar["EXPORT_SET"] = $arExport['SET'];
$calendar["EXPORT_LINK"] = $arExport['LINK'];
}
$arCalendars[] = $calendar;
}
return $arCalendars;
}
示例4: array
}
}
}
}
$arUsersToFilter = array();
$dbRequests = CSocNetUserToGroup::GetList(array(), array("GROUP_ID" => $group_id, "<=ROLE" => SONET_ROLES_USER, "USER_ACTIVE" => "Y"), false, false, array("ID", "USER_ID", "ROLE"));
if ($dbRequests) {
while ($arRequests = $dbRequests->Fetch()) {
$arUsersToFilter[] = $arRequests["USER_ID"];
}
}
} elseif ($EXTERNAL == 'A' && strlen($site) > 0 && CModule::IncludeModule("extranet") && CExtranet::IsExtranetSite($site)) {
if ($GLOBALS["APPLICATION"]->GetGroupRight("socialnetwork", false, "Y", "Y", array($site, false)) >= "W") {
$arUsersToFilter = CExtranet::GetExtranetGroupUsers();
} else {
$arUsersToFilter = CExtranet::GetMyGroupsUsers($site);
}
} elseif ($EXTERNAL == 'A' && CModule::IncludeModule("extranet") && CExtranet::IsIntranetUser()) {
$arUsersToFilter = CExtranet::GetIntranetUsers();
} elseif (IsModuleInstalled('extranet')) {
require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/epilog_after.php";
die;
}
$matches = array();
if (preg_match('/^(.*?)<[a-z0-9.\\-_]+@[a-z0-9.\\-]+> \\[([\\d]+?)\\]/i', $search, $matches)) {
$matches[2] = intval($matches[2]);
if ($matches[2] > 0 && (!is_array($arUsersToFilter) || in_array($matches[2], $arUsersToFilter))) {
$dbRes = CUser::GetByID($matches[2]);
if ($arRes = $dbRes->Fetch()) {
$arUsers = array(array('ID' => $arRes['ID'], 'NAME' => str_replace(array(';', ','), ' ', CIntranetUtils::FormatName($nameTemplate, $arRes, false)) . ' <' . $arRes['EMAIL'] . '>', 'UF_DEPARTMENT' => $arRes['UF_DEPARTMENT'], 'READY' => 'Y'));
Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
示例5: trim
}
$arParams['NAME_TEMPLATE'] .= $bIntranet ? ' <#EMAIL#>' : '';
$arParams['NAME_TEMPLATE'] .= " [#ID#]";
try {
$sl = $signer->unsign($arParams["sl"]);
$bUseLogin = trim($sl) != "N";
} catch (\Bitrix\Main\Security\Sign\BadSignatureException $e) {
$bUseLogin = false;
}
if (CModule::IncludeModule('extranet')) {
if (CExtranet::IsIntranetUser($arParams["site"])) {
$arUsersInMyGroupsID = CExtranet::GetMyGroupsUsers($arParams["site"]);
$arIntranetUsersID = CExtranet::GetIntranetUsers();
$arUsersToFilter = array_merge($arUsersInMyGroupsID, $arIntranetUsersID);
} else {
$arUsersInMyGroupsID = CExtranet::GetMyGroupsUsers($arParams["site"]);
$arPublicUsersID = CExtranet::GetPublicUsers();
$arUsersToFilter = array_merge($arUsersInMyGroupsID, $arPublicUsersID);
}
}
$arResult = array();
$dbUsers = CSocNetUser::SearchUsers($_REQUEST["search"], $arParams["gf"], $arParams["pe"]);
if ($dbUsers && ($arUser = $dbUsers->Fetch())) {
do {
if (is_array($arUsersToFilter) && in_array($arUser["ID"], $arUsersToFilter) || !is_array($arUsersToFilter)) {
$arResult[] = array("NAME" => CUser::FormatName($arParams['NAME_TEMPLATE'], $arUser, $bUseLogin));
}
} while ($arUser = $dbUsers->Fetch());
}
echo CUtil::PhpToJSObject($arResult);
require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/epilog_after.php";
示例6: GetAddressbookExtranetUserFilter
private static function GetAddressbookExtranetUserFilter($siteId, $arFilter = array())
{
if (CModule::IncludeModule('extranet') && (CExtranet::IsExtranetSite($siteId) || !CExtranet::IsIntranetUser($siteId))) {
if (!CExtranet::IsExtranetAdmin()) {
$arIDs = array_merge(CExtranet::GetMyGroupsUsers($siteId), CExtranet::GetPublicUsers());
if (array_key_exists("ID", $arFilter)) {
$arIDs1 = $arFilter["ID"];
if (!is_array($arIDs1)) {
$arIDs1 = explode("|", $arIDs1);
}
$arIDs = array_intersect($arIDs1, $arIDs);
}
if (count($arIDs) > 0) {
$arFilter['ID'] = implode('|', array_unique($arIDs));
} else {
$arFilter['ID'] = 0;
}
}
} else {
$arFilter['!UF_DEPARTMENT'] = false;
}
return $arFilter;
}
示例7: AjaxRequest
public function AjaxRequest($arParams = false)
{
global $USER;
if (!$USER->IsAuthorized()) {
return false;
}
$elements = "";
if ($_REQUEST['action'] == 'structure-item') {
$arFinderParams = array("PROVIDER" => $this->id, "TYPE" => 'structure-item');
//be careful with field list because of CUser::FormatName()
if (CModule::IncludeModule('extranet') && !CExtranet::IsIntranetUser($arParams["SITE_ID"])) {
$arExtranetUsers = CExtranet::GetMyGroupsUsersFull(CExtranet::GetExtranetSiteID(), false);
$dbRes = new CDBResult();
$dbRes->InitFromArray($arExtranetUsers);
} else {
$dbRes = CUser::GetList($by = 'last_name', $order = 'asc', array('ACTIVE' => 'Y', 'CONFIRM_CODE' => false, 'UF_DEPARTMENT' => intval($_REQUEST['item'])), array("FIELDS" => array('ID', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'LOGIN', 'EMAIL', 'PERSONAL_PHOTO', 'PERSONAL_GENDER', 'WORK_POSITION', 'PERSONAL_PROFESSION')));
}
while ($arUser = $dbRes->Fetch()) {
$arPhoto = array('IMG' => '');
if (!$arUser['PERSONAL_PHOTO']) {
switch ($arUser['PERSONAL_GENDER']) {
case "M":
$suffix = "male";
break;
case "F":
$suffix = "female";
break;
default:
$suffix = "unknown";
}
$arUser['PERSONAL_PHOTO'] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID);
}
if ($arUser['PERSONAL_PHOTO'] > 0) {
$arPhoto = CIntranetUtils::InitImage($arUser['PERSONAL_PHOTO'], 30);
}
$arItem = array("ID" => "IU" . $arUser["ID"], "NAME" => CUser::FormatName(CSite::GetNameFormat(false), $arUser, true, false), "AVATAR" => $arPhoto['CACHE']['src'], "DESC" => $arUser['WORK_POSITION'] ? $arUser['WORK_POSITION'] : $arUser['PERSONAL_PROFESSION']);
$elements .= CFinder::GetFinderItem($arFinderParams, $arItem);
}
} else {
$search = urldecode($_REQUEST['search']);
if (!CModule::IncludeModule('extranet') || CExtranet::IsIntranetUser($arParams["SITE_ID"])) {
$arFinderParams = array("PROVIDER" => $this->id, "TYPE" => 4);
$dbRes = CIBlockSection::GetList(array('ID' => 'ASC'), array('IBLOCK_ID' => COption::GetOptionInt('intranet', 'iblock_structure'), '%NAME' => $search), false, array('ID', 'NAME'));
$dbRes->NavStart(7);
while ($arSection = $dbRes->NavNext(false)) {
$arItem = array("ID" => $arSection["ID"], "AVATAR" => "/bitrix/js/main/core/images/access/avatar-user-everyone.png", "NAME" => $arSection["NAME"], "DESC" => GetMessage("authprov_group"), "CHECKBOX" => array("D#ID#" => GetMessage("authprov_check_d"), "DR#ID#" => GetMessage("authprov_check_dr")));
$elements .= CFinder::GetFinderItem($arFinderParams, $arItem);
}
}
$arFinderParams = array("PROVIDER" => $this->id, "TYPE" => 3);
$arFilter = array("ACTIVE" => "Y", "CONFIRM_CODE" => false, "NAME_SEARCH" => $search);
if (CModule::IncludeModule('extranet') && !CExtranet::IsIntranetUser($arParams["SITE_ID"])) {
$arExtranetUsersId = CExtranet::GetMyGroupsUsers($arParams["SITE_ID"]);
if (count($arExtranetUsersId) > 0) {
$arFilter["ID"] = implode('|', $arExtranetUsersId);
} else {
$arFilter = false;
}
}
if ($arFilter) {
//be careful with field list because of CUser::FormatName()
$dbRes = CUser::GetList($by = 'last_name', $order = 'asc', $arFilter, array("FIELDS" => array('ID', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'LOGIN', 'EMAIL', 'PERSONAL_PHOTO', 'PERSONAL_GENDER', 'WORK_POSITION', 'PERSONAL_PROFESSION'), "NAV_PARAMS" => array("nTopCount" => 7)));
while ($arUser = $dbRes->Fetch()) {
$arPhoto = array('IMG' => '');
if (!$arUser['PERSONAL_PHOTO']) {
switch ($arUser['PERSONAL_GENDER']) {
case "M":
$suffix = "male";
break;
case "F":
$suffix = "female";
break;
default:
$suffix = "unknown";
}
$arUser['PERSONAL_PHOTO'] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID);
}
if ($arUser['PERSONAL_PHOTO'] > 0) {
$arPhoto = CIntranetUtils::InitImage($arUser['PERSONAL_PHOTO'], 30);
}
$arItem = array("ID" => "IU" . $arUser["ID"], "NAME" => CUser::FormatName(CSite::GetNameFormat(false), $arUser, true, false), "AVATAR" => $arPhoto['CACHE']['src'], "DESC" => $arUser['WORK_POSITION'] ? $arUser['WORK_POSITION'] : $arUser['PERSONAL_PROFESSION']);
$elements .= CFinder::GetFinderItem($arFinderParams, $arItem);
}
}
}
return $elements;
}
示例8: elseif
}
} elseif ($action == "delete" && CSocNetUser::IsCurrentUserModuleAdmin(SITE_ID, false)) {
$log_id = intval($_REQUEST["log_id"]);
if ($log_id > 0) {
$arResult["bResult"] = CSocNetLog::Delete($log_id) ? "Y" : "N";
}
} elseif ($action == "get_more_destination") {
$isExtranetInstalled = CModule::IncludeModule("extranet") ? "Y" : "N";
$isExtranetSite = $isExtranetInstalled == "Y" && CExtranet::IsExtranetSite() ? "Y" : "N";
$isExtranetUser = $isExtranetInstalled == "Y" && !CExtranet::IsIntranetUser() ? "Y" : "N";
$isExtranetAdmin = $isExtranetInstalled == "Y" && CExtranet::IsExtranetAdmin() ? "Y" : "N";
if ($isExtranetUser == "Y") {
$arUserIdVisible = CExtranet::GetMyGroupsUsersSimple(SITE_ID);
} elseif ($isExtranetInstalled == "Y" && $isExtranetUser != "Y" && $isExtranetAdmin != "Y") {
if ($isExtranetAdmin == "Y" && $bCurrentUserIsAdmin) {
$arAvailableExtranetUserID = CExtranet::GetMyGroupsUsers(SITE_ID);
} else {
$arAvailableExtranetUserID = CExtranet::GetMyGroupsUsersSimple(CExtranet::GetExtranetSiteID());
}
}
$arResult["arDestinations"] = false;
$log_id = intval($_REQUEST["log_id"]);
$created_by_id = intval($_REQUEST["created_by_id"]);
$iDestinationLimit = intval($_REQUEST["dlim"]);
if ($log_id > 0) {
$arRights = array();
$db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetLogEntryGetRights");
while ($arEvent = $db_events->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array(array("LOG_ID" => $log_id), &$arRights)) === false) {
$bSkipGetRights = true;
break;
示例9: array
$obCache->StartDataCache();
global $CACHE_MANAGER;
$CACHE_MANAGER->StartTagCache($cache_dir);
if (defined("BX_COMP_MANAGED_CACHE")) {
$CACHE_MANAGER->RegisterTag('intranet_users');
$CACHE_MANAGER->RegisterTag('intranet_birthday');
}
}
$arFilter = array('ACTIVE' => 'Y');
if ($arResult['DEPARTMENT'] > 0 && (!CModule::IncludeModule('extranet') || !CExtranet::IsExtranetSite())) {
$arFilter['UF_DEPARTMENT'] = CIntranetUtils::GetIBlockSectionChildren(intval($arResult['DEPARTMENT']));
} elseif (!CModule::IncludeModule('extranet') || !CExtranet::IsExtranetSite()) {
$arFilter["!UF_DEPARTMENT"] = false;
}
if (CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite()) {
$arIDs = array_merge(CExtranet::GetMyGroupsUsers(SITE_ID), CExtranet::GetPublicUsers());
if ($arParams['bCache'] && defined("BX_COMP_MANAGED_CACHE")) {
$CACHE_MANAGER->RegisterTag('extranet_public');
$CACHE_MANAGER->RegisterTag('extranet_user_' . $USER->GetID());
}
if (count($arIDs) > 0) {
$arFilter['ID'] = implode('|', array_unique($arIDs));
} else {
$bDisable = true;
}
}
$arNavParams = array('nTopCount' => $arParams['NUM_USERS']);
$dbUsers = CUser::GetList($by = 'CURRENT_BIRTHDAY', $order = "asc", $arFilter, array('SELECT' => array('UF_*'), 'NAV_PARAMS' => $arNavParams));
$arResult['USERS'] = array();
$num = 0;
while ($arUser = $dbUsers->Fetch()) {
示例10: unset
}
if (CModule::IncludeModule("socialnetwork") && IntVal($arParams["SOCNET_GROUP_ID"]) <= 0 && IntVal($arParams["USER_ID"]) <= 0) {
unset($arFilter[">PERMS"]);
$cacheSoNet = new CPHPCache();
$cache_idSoNet = "blog_sonet_" . SITE_ID . "_" . $USER->GetID() . "_extranet";
$cache_pathSoNet = "/" . SITE_ID . "/blog/sonet/";
if ($arParams["CACHE_TIME"] > 0 && $cacheSoNet->InitCache($arParams["CACHE_TIME"], $cache_idSoNet, $cache_pathSoNet)) {
$Vars = $cacheSoNet->GetVars();
$arAvBlog = $Vars["arAvBlog"];
CBitrixComponentTemplate::ApplyCachedData($Vars["templateCachedData"]);
$cacheSoNet->Output();
} else {
if ($arParams["CACHE_TIME"] > 0) {
$cacheSoNet->StartDataCache($arParams["CACHE_TIME"], $cache_idSoNet, $cache_pathSoNet);
}
$arUsersInMyGroupsID = CExtranet::GetMyGroupsUsers(SITE_ID);
$arUsersInMyGroupsID[] = $USER->GetID();
$arPublicUsersID = CExtranet::GetPublicUsers();
$arUsersToFilter = array_merge($arUsersInMyGroupsID, $arPublicUsersID);
$arAvBlog = array();
$arFilterTmp = array("ACTIVE" => "Y", "GROUP_SITE_ID" => SITE_ID);
if (IntVal($arParams["GROUP_ID"]) > 0) {
$arFilterTmp["GROUP_ID"] = $arParams["GROUP_ID"];
}
$dbBlog = CBlog::GetList(array(), $arFilterTmp);
while ($arBlog = $dbBlog->Fetch()) {
if (IntVal($arBlog["SOCNET_GROUP_ID"]) > 0) {
if (CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), SONET_ENTITY_GROUP, $arBlog["SOCNET_GROUP_ID"], "blog", "view_post")) {
$arAvBlog[] = $arBlog["ID"];
}
} else {
示例11: IsProfileViewable
function IsProfileViewable($arUser, $site_id = false)
{
global $USER;
// if current user is admin
if (CExtranet::IsExtranetAdmin()) {
return true;
}
// if extranet site is not set
if (!CExtranet::GetExtranetSiteID()) {
return true;
}
// if current user is not authorized
if (!$USER->IsAuthorized()) {
return false;
}
// if intranet and current user is not employee
if (!CExtranet::IsExtranetSite($site_id) && !CExtranet::IsIntranetUser()) {
return false;
}
// if intranet and profile user is not employee
if (!CExtranet::IsExtranetSite($site_id)) {
if (CExtranet::IsIntranetUser() && intval($arUser["UF_DEPARTMENT"]) > 0) {
return true;
} else {
$arUsersInMyGroupsID = CExtranet::GetMyGroupsUsers(CExtranet::GetExtranetSiteID());
if (!in_array($arUser["ID"], $arUsersInMyGroupsID) && $arUser["ID"] != $USER->GetID()) {
return false;
}
}
}
if (CExtranet::IsExtranetSite($site_id) && $arUser[COption::GetOptionString("extranet", "extranet_public_uf_code", "UF_PUBLIC")] != 1) {
$arUsersInMyGroupsID = CExtranet::GetMyGroupsUsers(SITE_ID);
if (!in_array($arUser["ID"], $arUsersInMyGroupsID) && $arUser["ID"] != $USER->GetID()) {
return false;
}
}
return true;
}
示例12: executeComponent
public function executeComponent()
{
if (!CModule::IncludeModule('intranet')) {
ShowError(GetMessage('INTR_ISL_INTRANET_MODULE_NOT_INSTALLED'));
return;
}
if (!CModule::IncludeModule('socialnetwork')) {
return;
}
$showDepHeadAdditional = $this->arParams['SHOW_DEP_HEAD_ADDITIONAL'] == 'Y';
$bNav = $this->arParams['SHOW_NAV_TOP'] == 'Y' || $this->arParams['SHOW_NAV_BOTTOM'] == 'Y';
$isEnoughFiltered = $this->fillFilter();
list($cntStartCacheId, $cntStart) = $this->getCacheIdWithDepartment();
if ($this->arParams['SHOW_UNFILTERED_LIST'] == 'N' && !$this->bExcel && !$isEnoughFiltered) {
$this->arResult['EMPTY_UNFILTERED_LIST'] = 'Y';
$this->includeComponentTemplate();
return;
}
$this->arParams['bCache'] = $cntStart == count($this->arFilter) && !$this->bExcel && $this->arParams['CACHE_TYPE'] == 'Y' && $this->arParams['CACHE_TIME'] > 0;
$this->arResult['FILTER_VALUES'] = $this->arFilter;
if (!$this->bExcel && $bNav) {
CPageOption::SetOptionString("main", "nav_page_in_session", "N");
}
$bFromCache = false;
if ($this->arParams['bCache']) {
if ($bFromCache = $this->initCache($cntStartCacheId)) {
$vars = $this->obCache->getVars();
$this->arResult['USERS'] = $vars['USERS'];
$this->arResult['DEPARTMENTS'] = $vars['DEPARTMENTS'];
$this->arResult['DEPARTMENT_HEAD'] = $vars['DEPARTMENT_HEAD'];
$this->arResult['USERS_NAV'] = $vars['USERS_NAV'];
$strUserIDs = $vars['STR_USER_ID'];
} else {
$this->obCache->startDataCache();
$this->getCacheManager()->startTagCache($this->cacheDir);
$this->getCacheManager()->registerTag('intranet_users');
}
}
if (!$bFromCache) {
// get users list
$obUser = new CUser();
$arSelect = array('ID', 'ACTIVE', 'CONFIRM_CODE', 'DEP_HEAD', 'GROUP_ID', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'LOGIN', 'EMAIL', 'LID', 'DATE_REGISTER', 'PERSONAL_PROFESSION', 'PERSONAL_WWW', 'PERSONAL_ICQ', 'PERSONAL_GENDER', 'PERSONAL_BIRTHDATE', 'PERSONAL_PHOTO', 'PERSONAL_PHONE', 'PERSONAL_FAX', 'PERSONAL_MOBILE', 'PERSONAL_PAGER', 'PERSONAL_STREET', 'PERSONAL_MAILBOX', 'PERSONAL_CITY', 'PERSONAL_STATE', 'PERSONAL_ZIP', 'PERSONAL_COUNTRY', 'PERSONAL_NOTES', 'WORK_COMPANY', 'WORK_DEPARTMENT', 'WORK_POSITION', 'WORK_WWW', 'WORK_PHONE', 'WORK_FAX', 'WORK_PAGER', 'WORK_STREET', 'WORK_MAILBOX', 'WORK_CITY', 'WORK_STATE', 'WORK_ZIP', 'WORK_COUNTRY', 'WORK_PROFILE', 'WORK_LOGO', 'WORK_NOTES', 'PERSONAL_BIRTHDAY', 'LAST_ACTIVITY_DATE', 'LAST_LOGIN', 'IS_ONLINE');
$this->arResult['USERS'] = array();
$this->arResult['DEPARTMENTS'] = array();
$this->arResult['DEPARTMENT_HEAD'] = 0;
// disable/enable appearing of department head on page
if ($showDepHeadAdditional && !empty($this->arFilter['UF_DEPARTMENT']) && is_array($this->arFilter['UF_DEPARTMENT'])) {
if ($this->arParams['bCache']) {
$this->getCacheManager()->registerTag('intranet_department_' . $this->arFilter['UF_DEPARTMENT'][0]);
}
$managerId = CIntranetUtils::GetDepartmentManagerID($this->arFilter['UF_DEPARTMENT'][0]);
$appendManager = CUser::GetByID($managerId)->Fetch();
if ($appendManager) {
$this->arResult['DEPARTMENT_HEAD'] = $appendManager['ID'];
$this->arFilter['!ID'] = $appendManager['ID'];
$this->arResult['USERS'][$appendManager['ID']] = $appendManager;
}
}
$bDisable = false;
if (CModule::IncludeModule('extranet')) {
if (CExtranet::IsExtranetSite() && !CExtranet::IsExtranetAdmin()) {
$arIDs = array_merge(CExtranet::GetMyGroupsUsers(SITE_ID), CExtranet::GetPublicUsers());
if ($this->arParams['bCache']) {
$this->getCacheManager()->registerTag('extranet_public');
$this->getCacheManager()->registerTag('extranet_user_' . $this->getUser()->getID());
}
if (false !== ($key = array_search($this->getUser()->getID(), $arIDs))) {
unset($arIDs[$key]);
}
if (count($arIDs) > 0) {
$this->arFilter['ID'] = implode('|', array_unique($arIDs));
} else {
$bDisable = true;
}
}
}
if ($bDisable) {
$dbUsers = new CDBResult();
$dbUsers->initFromArray(array());
} else {
$arListParams = array('SELECT' => array('UF_*'), 'ONLINE_INTERVAL' => static::LAST_ACTIVITY);
if (!$this->bExcel && $this->arParams['USERS_PER_PAGE'] > 0) {
$arListParams['NAV_PARAMS'] = array('nPageSize' => $this->arParams['USERS_PER_PAGE'], 'bShowAll' => false);
}
$dbUsers = $obUser->GetList($sortBy = 'last_name', $sortDir = 'asc', $this->arFilter, $arListParams);
}
$strUserIDs = '';
while ($arUser = $dbUsers->Fetch()) {
$this->arResult['USERS'][$arUser['ID']] = $arUser;
$strUserIDs .= ($strUserIDs === '' ? '' : '|') . $arUser['ID'];
}
$structure = CIntranetUtils::getStructure();
$this->arResult['DEPARTMENTS'] = $structure['DATA'];
$this->setDepWhereUserIsHead();
$arAdmins = array();
/** @noinspection PhpUndefinedVariableInspection */
$rsUsers = CUser::GetList($o, $b, array("GROUPS_ID" => array(static::ADMIN_GROUP_ID)), array("SELECT" => array("ID")));
while ($ar = $rsUsers->Fetch()) {
$arAdmins[$ar["ID"]] = $ar["ID"];
}
//.........这里部分代码省略.........