Esempio n. 1
0
define("STOP_STATISTICS", true);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
require_once "functions.php";
CModule::IncludeModule('socialnetwork');
if (!$USER->IsAuthorized()) {
    die;
}
$SITE_ID = isset($_GET["SITE_ID"]) ? $_GET["SITE_ID"] : SITE_ID;
if ($_REQUEST["mode"] == "search") {
    CUtil::decodeURIComponent($_GET);
    $APPLICATION->RestartBuffer();
    CSocNetTools::InitGlobalExtranetArrays($SITE_ID);
    $arFilter = array("SITE_ID" => $SITE_ID, "%NAME" => $_GET["query"]);
    if (!CSocNetUser::IsCurrentUserModuleAdmin($SITE_ID)) {
        $arFilter["CHECK_PERMISSIONS"] = $USER->GetID();
    }
    $rsGroups = CSocNetGroup::GetList(array("NAME" => "ASC"), $arFilter);
    $arGroups = array();
    while ($arGroup = $rsGroups->Fetch()) {
        if (isset($GLOBALS["arExtranetGroupID"]) && is_array($GLOBALS["arExtranetGroupID"]) && in_array($arGroup["ID"], $GLOBALS["arExtranetGroupID"])) {
            $arGroup["IS_EXTRANET"] = "Y";
        }
        $arGroups[] = group2JSItem($arGroup);
    }
    if (isset($_REQUEST["features_perms"]) && sizeof($_REQUEST["features_perms"]) == 2) {
        filterByFeaturePerms($arGroups, $_REQUEST["features_perms"]);
    }
    Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
    echo CUtil::PhpToJsObject($arGroups);
    die;
}
Esempio n. 2
0
    }
}
$arResult["LAST_GROUPS"] = array();
$arGroupsFilter = array("SITE_ID" => SITE_ID);
$arPopupOptions = CUserOptions::GetOption("socialnetwork", "groups_popup", array());
if (is_array($arPopupOptions) && strlen($arPopupOptions["last_selected"]) > 0) {
    $arFilter = array("SITE_ID" => SITE_ID, "ID" => array_unique(explode(',', $arPopupOptions["last_selected"])));
    if (!CSocNetUser::IsCurrentUserModuleAdmin()) {
        $arFilter["CHECK_PERMISSIONS"] = $GLOBALS["USER"]->GetID();
    }
    $rsGroups = CSocNetGroup::GetList(array("NAME" => "ASC"), $arFilter);
    while ($arGroup = $rsGroups->Fetch()) {
        $arGroupTmp = group2JSItem($arGroup);
        if (!in_array($arGroupTmp, $arResult["SELECTED"])) {
            $arResult["LAST_GROUPS"][] = $arGroupTmp;
        }
    }
    $arResult["LAST_GROUPS"] = array_slice($arResult["LAST_GROUPS"], 0, 10);
}
$arResult["LAST_GROUPS"] = array_merge($arResult["SELECTED"], $arResult["LAST_GROUPS"]);
$arResult["MY_GROUPS"] = array();
$rsGroups = CSocNetUserToGroup::GetList(array("GROUP_NAME" => "ASC"), array("USER_ID" => $USER->GetID(), "<=ROLE" => SONET_ROLES_USER, "GROUP_SITE_ID" => SITE_ID, "GROUP_ACTIVE" => "Y"), false, array("nPageSize" => 50, "bDescPageNumbering" => false), array("ID", "GROUP_ID", "GROUP_NAME", "GROUP_DESCRIPTION", "GROUP_IMAGE_ID"));
while ($arGroup = $rsGroups->Fetch()) {
    $arResult["MY_GROUPS"][] = group2JSItem($arGroup, "GROUP_");
}
if (isset($arParams["FEATURES_PERMS"]) && sizeof($arParams["FEATURES_PERMS"]) == 2) {
    filterByFeaturePerms($arResult["LAST_GROUPS"], $arParams["FEATURES_PERMS"]);
    filterByFeaturePerms($arResult["SELECTED"], $arParams["FEATURES_PERMS"]);
    filterByFeaturePerms($arResult["MY_GROUPS"], $arParams["FEATURES_PERMS"]);
}
$this->IncludeComponentTemplate();