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
        }
        $obCache->EndDataCache(array("SONET_GROUPS" => $arSonetGroups, "SONET_GROUPS_EXTRANET" => $arSonetGroupsExtranet));
    }
    if (is_array($arSonetGroupsExtranet) && !empty($arSonetGroupsExtranet)) {
        $arExtranetGroupID = array();
        foreach ($arSonetGroupsExtranet as $arSonetGroupTmp) {
            if (is_array($arSonetGroupTmp) && array_key_exists("entityId", $arSonetGroupTmp) && intval($arSonetGroupTmp["entityId"]) > 0) {
                $arExtranetGroupID[] = intval($arSonetGroupTmp["entityId"]);
            }
        }
    }
    if (method_exists('CSocNetLogDestination', 'GetDestinationSort')) {
        $arSonetGroupsLast = array("DEST_SORT" => CSocNetLogDestination::GetDestinationSort(array("DEST_CONTEXT" => "USER_INVITE", "CODE_TYPE" => 'SG')), "LAST" => array());
        CSocNetLogDestination::fillLastDestination($arSonetGroupsLast["DEST_SORT"], $arSonetGroupsLast["LAST"]);
    } else {
        $arSonetGroupsLast = array("LAST" => array('SONETGROUPS' => CSocNetLogDestination::GetLastSocnetGroup()));
    }
    $APPLICATION->IncludeComponent("bitrix:intranet.user.selector.new", ".default", array("MULTIPLE" => "N", "NAME" => "INVITE_DEPARTMENT", "VALUE" => 0, "POPUP" => "Y", "INPUT_NAME" => "UF_DEPARTMENT", "ON_SECTION_SELECT" => "onInviteDialogSectionsSelect", "SITE_ID" => $SITE_ID, "SHOW_STRUCTURE_ONLY" => "Y", "SHOW_EXTRANET_USERS" => "NONE"), null, array("HIDE_ICONS" => "Y"));
    ?>
	<div class="intranet-tabs-box" id="intranet-dialog-tabs"><?php 
    ?>
<div class="webform-round-corners webform-error-block" id="invite-dialog-error-block" style="display: none;">
			<div class="webform-corners-top"><div class="webform-left-corner"></div><div class="webform-right-corner"></div></div>
			<div class="webform-content" id="invite-dialog-error-content"><?php 
    echo $strError;
    ?>
</div>
			<div class="webform-corners-bottom"><div class="webform-left-corner"></div><div class="webform-right-corner"></div></div>
		</div><?php 
    ?>
<div class="intranet-tabs">
             $serverName = SITE_SERVER_NAME;
         } else {
             $serverName = COption::GetOptionString("main", "server_name", "www.bitrixsoft.com");
         }
         if (strLen($serverName) <= 0) {
             $serverName = $_SERVER["HTTP_HOST"];
         }
     }
     $serverName = "http://" . $serverName;
     $arResult["PATH_TO_POST"] = CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_POST"]), array("blog" => $arBlog["URL"], "post_id" => "#post_id#", "user_id" => $arBlog["OWNER_ID"], "group_id" => $arParams["SOCNET_GROUP_ID"]));
     $arResult["PATH_TO_POST1"] = $serverName . substr($arResult["PATH_TO_POST"], 0, strpos($arResult["PATH_TO_POST"], "#post_id#"));
     $arResult["PATH_TO_POST2"] = substr($arResult["PATH_TO_POST"], strpos($arResult["PATH_TO_POST"], "#post_id#") + strlen("#post_id#"));
 }
 CJSCore::Init(array('socnetlogdest'));
 // socialnetwork
 $arResult["PostToShow"]["FEED_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/' . $user_id;
 $obCache = new CPHPCache();
 if ($obCache->InitCache($cacheTtl, $cacheId, $cacheDir)) {
     $arResult["PostToShow"]["FEED_DESTINATION"]['SONETGROUPS'] = $obCache->GetVars();
 } else {
     $obCache->StartDataCache();
     $arResult["PostToShow"]["FEED_DESTINATION"]['SONETGROUPS'] = CSocNetLogDestination::GetSocnetGroup(array('features' => array("blog", array("premoderate_post", "moderate_post", "write_post", "full_post"))));
     if (defined("BX_COMP_MANAGED_CACHE")) {
         $GLOBALS["CACHE_MANAGER"]->StartTagCache($cacheDir);
         foreach ($arResult["PostToShow"]["FEED_DESTINATION"]['SONETGROUPS'] as $val) {
             $GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_features_G_" . $val["entityId"]);
             $GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_group_" . $val["entityId"]);
         }
Beispiel #5
0
                $GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_group_" . $val["entityId"]);
            }
            $GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_user2group_U" . $GLOBALS["USER"]->GetID());
            $GLOBALS["CACHE_MANAGER"]->EndTagCache();
        }
        $obCache->EndDataCache(array("SONET_GROUPS" => $arSonetGroups, "SONET_GROUPS_EXTRANET" => $arSonetGroupsExtranet));
    }
    if (is_array($arSonetGroupsExtranet) && !empty($arSonetGroupsExtranet)) {
        $arExtranetGroupID = array();
        foreach ($arSonetGroupsExtranet as $arSonetGroupTmp) {
            if (is_array($arSonetGroupTmp) && array_key_exists("entityId", $arSonetGroupTmp) && intval($arSonetGroupTmp["entityId"]) > 0) {
                $arExtranetGroupID[] = intval($arSonetGroupTmp["entityId"]);
            }
        }
    }
    $arSonetGroupsLast = CSocNetLogDestination::GetLastSocnetGroup();
    $APPLICATION->IncludeComponent("bitrix:intranet.user.selector.new", ".default", array("MULTIPLE" => "N", "NAME" => "INVITE_DEPARTMENT", "VALUE" => 0, "POPUP" => "Y", "INPUT_NAME" => "UF_DEPARTMENT", "ON_SECTION_SELECT" => "onInviteDialogSectionsSelect", "SITE_ID" => $SITE_ID, "SHOW_STRUCTURE_ONLY" => "Y", "SHOW_EXTRANET_USERS" => "NONE"), null, array("HIDE_ICONS" => "Y"));
    ?>
	<div class="intranet-tabs-box" id="intranet-dialog-tabs"><?php 
    ?>
<div class="webform-round-corners webform-error-block" id="invite-dialog-error-block" style="display: none;">
			<div class="webform-corners-top"><div class="webform-left-corner"></div><div class="webform-right-corner"></div></div>
			<div class="webform-content" id="invite-dialog-error-content"><?php 
    echo $strError;
    ?>
</div>
			<div class="webform-corners-bottom"><div class="webform-left-corner"></div><div class="webform-right-corner"></div></div>
		</div><?php 
    ?>
<div class="intranet-tabs">
			<span class="intranet-tab<?php