Beispiel #1
0
 public static function GetSocNetDestination($user_id = false, $selected = array())
 {
     global $CACHE_MANAGER;
     if (!is_array($selected)) {
         $selected = array();
     }
     $DESTINATION = array('LAST' => array('SONETGROUPS' => CSocNetLogDestination::GetLastSocnetGroup()));
     if (!$user_id) {
         $user_id = CCalendar::GetCurUserId();
     }
     $DESTINATION['LAST']['SONETGROUPS'] = CSocNetLogDestination::GetLastSocnetGroup();
     $cacheTtl = defined("BX_COMP_MANAGED_CACHE") ? 3153600 : 3600 * 4;
     $cacheId = 'blog_post_form_dest_' . $user_id;
     $cacheDir = '/blog/form/dest/' . SITE_ID . '/' . $user_id;
     $obCache = new CPHPCache();
     if ($obCache->InitCache($cacheTtl, $cacheId, $cacheDir)) {
         $DESTINATION['SONETGROUPS'] = $obCache->GetVars();
     } else {
         $obCache->StartDataCache();
         $DESTINATION['SONETGROUPS'] = CSocNetLogDestination::GetSocnetGroup(array('features' => array("blog", array("premoderate_post", "moderate_post", "write_post", "full_post"))));
         if (defined("BX_COMP_MANAGED_CACHE")) {
             $CACHE_MANAGER->StartTagCache($cacheDir);
             foreach ($DESTINATION['SONETGROUPS'] as $val) {
                 $CACHE_MANAGER->RegisterTag("sonet_features_G_" . $val["entityId"]);
                 $CACHE_MANAGER->RegisterTag("sonet_group_" . $val["entityId"]);
             }
             $CACHE_MANAGER->RegisterTag("sonet_user2group_U" . $user_id);
             $CACHE_MANAGER->EndTagCache();
         }
         $obCache->EndDataCache($DESTINATION['SONETGROUPS']);
     }
     $arDestUser = array();
     $DESTINATION['SELECTED'] = array();
     foreach ($selected as $ind => $code) {
         if (substr($code, 0, 2) == 'DR') {
             $DESTINATION['SELECTED'][$code] = "department";
         } elseif (substr($code, 0, 2) == 'UA') {
             $DESTINATION['SELECTED'][$code] = "groups";
         } elseif (substr($code, 0, 2) == 'SG') {
             $DESTINATION['SELECTED'][$code] = "sonetgroups";
         } elseif (substr($code, 0, 1) == 'U') {
             $DESTINATION['SELECTED'][$code] = "users";
             $arDestUser[] = str_replace('U', '', $code);
         }
     }
     // intranet structure
     $arStructure = CSocNetLogDestination::GetStucture();
     //$arStructure = CSocNetLogDestination::GetStucture(array("LAZY_LOAD" => true));
     $DESTINATION['DEPARTMENT'] = $arStructure['department'];
     $DESTINATION['DEPARTMENT_RELATION'] = $arStructure['department_relation'];
     $DESTINATION['DEPARTMENT_RELATION_HEAD'] = $arStructure['department_relation_head'];
     $DESTINATION['LAST']['DEPARTMENT'] = CSocNetLogDestination::GetLastDepartment();
     // users
     $DESTINATION['LAST']['USERS'] = CSocNetLogDestination::GetLastUser();
     if (CModule::IncludeModule('extranet') && !CExtranet::IsIntranetUser()) {
         $DESTINATION['EXTRANET_USER'] = '******';
         $DESTINATION['USERS'] = CSocNetLogDestination::GetExtranetUser();
     } else {
         foreach ($DESTINATION['LAST']['USERS'] as $value) {
             $arDestUser[] = str_replace('U', '', $value);
         }
         $DESTINATION['EXTRANET_USER'] = '******';
         $DESTINATION['USERS'] = CSocNetLogDestination::GetUsers(array('id' => $arDestUser));
     }
     $users = array();
     foreach ($DESTINATION['USERS'] as $key => $entry) {
         if ($entry['isExtranet'] == 'N') {
             $users[$key] = $entry;
         }
     }
     $DESTINATION['USERS'] = $users;
     return $DESTINATION;
 }
Beispiel #2
0
        $backurl = $APPLICATION->GetCurPageParam($componentTemplate == 'twitpost' ? "current_fieldset=SOCSERV" : "", array("sessid", "user_id", "action"));
    }
    LocalRedirect($backurl);
}
if ($componentTemplate == 'twitpost') {
    $arResult["TWIT_HASH"] = htmlspecialcharsbx(COption::GetOptionString("socialservices", "twitter_search_hash", "#b24"));
}
$arResult['CURRENTURL'] = $APPLICATION->GetCurPageParam($add, $arParamsToDelete);
if (CModule::IncludeModule("socialnetwork")) {
    CJSCore::Init(array('socnetlogdest'));
    // socialnetwork
    if (method_exists('CSocNetLogDestination', 'GetDestinationSort')) {
        $arResult["PostToShow"]["FEED_DESTINATION"] = array('DEST_SORT' => CSocNetLogDestination::GetDestinationSort(array("DEST_CONTEXT" => "SOCSERVICES")), 'LAST' => array());
        CSocNetLogDestination::fillLastDestination($arResult["PostToShow"]["FEED_DESTINATION"]['DEST_SORT'], $arResult["PostToShow"]["FEED_DESTINATION"]['LAST']);
    } else {
        $arResult["PostToShow"]["FEED_DESTINATION"] = array('LAST' => array('SONETGROUPS' => CSocNetLogDestination::GetLastSocnetGroup(), 'DEPARTMENT' => CSocNetLogDestination::GetLastDepartment(), 'LAST' => CSocNetLogDestination::GetLastUser()));
    }
    $arResult["PostToShow"]["FEED_DESTINATION"]['SONETGROUPS'] = CSocNetLogDestination::GetSocnetGroup(array('features' => array("blog", array("premoderate_post", "moderate_post", "write_post", "full_post"))));
    $arDestUser = array();
    $arResult["PostToShow"]["FEED_DESTINATION"]['SELECTED'] = array();
    if (!empty($arResult["PostToShow"]["SPERM"])) {
        $arResult["PostToShow"]["FEED_DESTINATION"]['SELECTED'] = array();
        if (empty($arResult["PostToShow"]["SPERM"])) {
            if (CModule::IncludeModule('extranet') && !CExtranet::IsIntranetUser()) {
                if (!empty($arResult["PostToShow"]["FEED_DESTINATION"]['LAST']['SONETGROUPS'])) {
                    foreach ($arResult["PostToShow"]["FEED_DESTINATION"]['LAST']['SONETGROUPS'] as $val) {
                        $arResult["PostToShow"]["FEED_DESTINATION"]['SELECTED'][$val] = "sonetgroups";
                    }
                } else {
                    foreach ($arResult["PostToShow"]["FEED_DESTINATION"]['SONETGROUPS'] as $k => $val) {
                        $arResult["PostToShow"]["FEED_DESTINATION"]['SELECTED'][$k] = "sonetgroups";
Beispiel #3
0
 protected function processActionDetailUserShare()
 {
     $this->arResult = $this->dispatcher->processActionDetailUserShare($this->arParams);
     if (\Bitrix\Main\Loader::includeModule('socialnetwork')) {
         // socialnetwork
         $this->arResult["FEED_DESTINATION"] = array('LAST' => array());
         $this->arResult["FEED_DESTINATION"]['LAST']['SONETGROUPS'] = array();
         $this->arResult["FEED_DESTINATION"]['SONETGROUPS'] = array();
         $this->arResult["FEED_DESTINATION"]['SELECTED'] = array();
         // intranet structure
         $arStructure = CSocNetLogDestination::GetStucture(array("LAZY_LOAD" => true));
         $this->arResult["FEED_DESTINATION"]['DEPARTMENT'] = $arStructure['department'];
         $this->arResult["FEED_DESTINATION"]['DEPARTMENT_RELATION'] = $arStructure['department_relation'];
         $this->arResult["FEED_DESTINATION"]['DEPARTMENT_RELATION_HEAD'] = $arStructure['department_relation_head'];
         $this->arResult["FEED_DESTINATION"]['LAST']['DEPARTMENT'] = CSocNetLogDestination::GetLastDepartment();
         // users
         $this->arResult["FEED_DESTINATION"]['LAST']['USERS'] = CSocNetLogDestination::GetLastUser();
         foreach ($this->arResult["FEED_DESTINATION"]['LAST']['USERS'] as $value) {
             $this->arResult["dest_users"][] = str_replace('U', '', $value);
         }
         $this->arResult["FEED_DESTINATION"]['EXTRANET_USER'] = '******';
         $this->arResult["FEED_DESTINATION"]['USERS'] = CSocNetLogDestination::GetUsers(array('id' => $this->arResult["dest_users"]));
         $this->arResult["FEED_DESTINATION"]["DENY_TOALL"] = true;
     }
     $this->includeComponentTemplate('ajax_user');
 }
                            $arDestUser[] = $value;
                        } elseif ($type == 'SG') {
                            $arResult["PostToShow"]["FEED_DESTINATION"]['SELECTED']['SG' . $value] = 'sonetgroups';
                        } elseif ($type == 'DR') {
                            $arResult["PostToShow"]["FEED_DESTINATION"]['SELECTED']['DR' . $value] = 'department';
                        }
                    }
                }
            }
        }
        // intranet structure
        $arStructure = CSocNetLogDestination::GetStucture(array("LAZY_LOAD" => true));
        $arResult["PostToShow"]["FEED_DESTINATION"]['DEPARTMENT'] = $arStructure['department'];
        $arResult["PostToShow"]["FEED_DESTINATION"]['DEPARTMENT_RELATION'] = $arStructure['department_relation'];
        $arResult["PostToShow"]["FEED_DESTINATION"]['DEPARTMENT_RELATION_HEAD'] = $arStructure['department_relation_head'];
        $arResult["PostToShow"]["FEED_DESTINATION"]['LAST']['DEPARTMENT'] = CSocNetLogDestination::GetLastDepartment();
        // users
        $arResult["PostToShow"]["FEED_DESTINATION"]['LAST']['USERS'] = CSocNetLogDestination::GetLastUser();
        if (CModule::IncludeModule('extranet') && !CExtranet::IsIntranetUser()) {
            $arResult["PostToShow"]["FEED_DESTINATION"]['EXTRANET_USER'] = '******';
            $arResult["PostToShow"]["FEED_DESTINATION"]['USERS'] = CSocNetLogDestination::GetExtranetUser();
        } else {
            foreach ($arResult["PostToShow"]["FEED_DESTINATION"]['LAST']['USERS'] as $value) {
                $arDestUser[] = str_replace('U', '', $value);
            }
            $arResult["PostToShow"]["FEED_DESTINATION"]['EXTRANET_USER'] = '******';
            $arResult["PostToShow"]["FEED_DESTINATION"]['USERS'] = CSocNetLogDestination::GetUsers(array('id' => $arDestUser));
        }
    }
} else {
    $arResult["FATAL_MESSAGE"] = GetMessage("BLOG_ERR_NO_RIGHTS");