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; }
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'); }
?> "> <input type="text" value="" class="feed-add-destination-inp" id="sonet_group_create_popup_users_input_post_<?php echo $selectorName; ?> "> </span> <a href="#" class="feed-add-destination-link" id="sonet_group_create_popup_users_tag_post_<?php echo $selectorName; ?> "><?php echo GetMessage(IsModuleInstalled("intranet") ? "SONET_GCE_T_ADD_EMPLOYEE" : "SONET_GCE_T_ADD_USER"); ?> </a><?php $arValue = $arResult["POST"]["USER_CODES"] ? $arResult["POST"]["USER_CODES"] : array(); $arStructure = IsModuleInstalled('intranet') ? CSocNetLogDestination::GetStucture(array("LAZY_LOAD" => true, "DEPARTMENT_ID" => isset($arResult["siteDepartmentID"]) && intval($arResult["siteDepartmentID"]) > 0 ? intval($arResult["siteDepartmentID"]) : false)) : false; ?> <script type="text/javascript"> var department = <?php echo $arStructure && !empty($arStructure['department']) ? CUtil::PhpToJSObject($arStructure['department']) : '{}'; ?> ; var lastUsers = <?php echo empty($arResult["DEST_USERS_LAST"]) ? '{}' : CUtil::PhpToJSObject($arResult["DEST_USERS_LAST"]); ?> ; <?php if (!$arStructure || empty($arStructure['department_relation'])) { ?>
} } /** * @var string $arParams["HTML_BEFORE_TEXTAREA"] * @var string $arParams["HTML_AFTER_TEXTAREA"] * @var array $arParams["UPLOAD_FILE"] * @var array $arParams["UPLOAD_WEBDAV_ELEMENT"] */ $arParams["UPLOADS_CID"] = array(); $arParams["UPLOADS_HTML"] = ""; $arParams["DESTINATION"] = is_array($arParams["DESTINATION"]) && IsModuleInstalled("socialnetwork") ? $arParams["DESTINATION"] : array(); $arParams["DESTINATION_SHOW"] = array_key_exists("SHOW", $arParams["DESTINATION"]) ? $arParams["DESTINATION"]["SHOW"] : $arParams["DESTINATION_SHOW"]; $arParams["DESTINATION_SHOW"] = $arParams["DESTINATION_SHOW"] == "Y" ? "Y" : "N"; $arParams["DESTINATION"] = array_key_exists("VALUE", $arParams["DESTINATION"]) ? $arParams["DESTINATION"]["VALUE"] : $arParams["DESTINATION"]; if (empty($arParams["DESTINATION"]) && in_array("MentionUser", $arParams["BUTTONS"]) && CModule::IncludeModule("socialnetwork")) { $arStructure = CSocNetLogDestination::GetStucture(array("LAZY_LOAD" => true)); $arParams["DESTINATION"] = array("LAST" => array("USERS" => CSocNetLogDestination::GetLastUser()), "DEPARTMENT" => $arStructure['department'], "DEPARTMENT_RELATION" => $arStructure['department_relation']); if (CModule::IncludeModule('extranet') && !CExtranet::IsIntranetUser()) { $arParams["DESTINATION"]['EXTRANET_USER'] = '******'; $arParams["DESTINATION"]['USERS'] = CSocNetLogDestination::GetExtranetUser(); } else { $arDestUser = array(); foreach ($arParams["DESTINATION"]['LAST']['USERS'] as $value) { $arDestUser[] = str_replace('U', '', $value); } $arParams["DESTINATION"]['EXTRANET_USER'] = '******'; $arParams["DESTINATION"]['USERS'] = CSocNetLogDestination::GetUsers(array('id' => $arDestUser)); } } $arParams["TAGS"] = is_array($arParams["TAGS"]) ? $arParams["TAGS"] : array(); if (!empty($arParams["TAGS"])) {
} elseif ($type == 'U') { $arResult["PostToShow"]["FEED_DESTINATION"]['SELECTED'][$ar2] = 'users'; $arDestUser[] = $value; } elseif ($type == 'SG') { $arResult["PostToShow"]["FEED_DESTINATION"]['SELECTED'][$ar2] = 'sonetgroups'; } elseif ($type == 'DR' || $type == 'D') { $arResult["PostToShow"]["FEED_DESTINATION"]['SELECTED'][$ar2] = 'department'; } } } } } } else { $arResult["PostToShow"]["FEED_DESTINATION"]['SELECTED']['UA'] = 'groups'; } // intranet structure $arStructure = CSocNetLogDestination::GetStucture(); $arResult["PostToShow"]["FEED_DESTINATION"]['DEPARTMENT'] = $arStructure['department']; $arResult["PostToShow"]["FEED_DESTINATION"]['DEPARTMENT_RELATION'] = $arStructure['department_relation']; 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)); } } $this->IncludeComponentTemplate();