Exemple #1
0
<?php

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);
Exemple #2
0
            } else {
                $arBlogGroupID = array();
                $rsBlogGroup = CBlogGroup::GetList(array(), array(), false, false, array("ID"));
                while ($arBlogGroup = $rsBlogGroup->Fetch()) {
                    if (!in_array($arBlogGroup["ID"], $arIdeaBlogGroupID)) {
                        $arBlogGroupID[] = $arBlogGroup["ID"];
                    }
                }
                $arBlog = CBlog::GetByOwnerID($arParams["USER_ID"], $arBlogGroupID);
            }
        }
        $obCache->EndDataCache($arBlog);
    }
    $arResult["Blog"] = $arBlog;
    if ($GLOBALS["USER"]->IsAuthorized()) {
        CSocNetTools::InitGlobalExtranetArrays();
        if (isset($GLOBALS["arExtranetGroupID"])) {
            $arResult["arExtranetGroupID"] = $GLOBALS["arExtranetGroupID"];
        }
    }
}
$arParams["ID"] = trim($arParams["ID"]);
if (preg_match("/^[1-9][0-9]*\$/", $arParams["ID"])) {
    $arParams["ID"] = IntVal($arParams["ID"]);
} else {
    $arParams["ID"] = preg_replace("/[^a-zA-Z0-9_-]/is", "", Trim($arParams["~ID"]));
    $arParams["ID"] = CBlogPost::GetID($arParams["ID"], $arBlog["ID"]);
}
if ($arParams["ID"] == "" && !$arResult["bFromList"]) {
    ShowError(GetMessage("B_B_MES_NO_POST"));
    @define("ERROR_404", "Y");
 public static function GetUsersAll($arParams)
 {
     global $DB, $USER;
     static $arFields = array("ID" => array("FIELD" => "U.ID", "TYPE" => "int"), "ACTIVE" => array("FIELD" => "U.ACTIVE", "TYPE" => "string"), "NAME" => array("FIELD" => "U.NAME", "TYPE" => "string"), "LAST_NAME" => array("FIELD" => "U.LAST_NAME", "TYPE" => "string"), "SECOND_NAME" => array("FIELD" => "U.SECOND_NAME", "TYPE" => "string"), "LOGIN" => array("FIELD" => "U.LOGIN", "TYPE" => "string"), "PERSONAL_PHOTO" => array("FIELD" => "U.PERSONAL_PHOTO", "TYPE" => "int"), "WORK_POSITION" => array("FIELD" => "U.WORK_POSITION", "TYPE" => "string"), "CONFIRM_CODE" => array("FIELD" => "U.CONFIRM_CODE", "TYPE" => "string"), "PERSONAL_PROFESSION" => array("FIELD" => "U.PERSONAL_PROFESSION", "TYPE" => "string"));
     $currentUserId = $USER->GetId();
     if (!$currentUserId) {
         return array();
     }
     $bExtranetEnabled = CModule::IncludeModule("extranet");
     $bExtranetUser = $bExtranetEnabled && !CExtranet::IsIntranetUser();
     $rsData = CUserTypeEntity::GetList(array("ID" => "ASC"), array("FIELD_NAME" => "UF_DEPARTMENT", "ENTITY_ID" => "USER"));
     if ($arRes = $rsData->Fetch()) {
         $UFId = intval($arRes["ID"]);
     } else {
         return array();
     }
     $arOrder = array("ID" => "ASC");
     $arFilter = array('ACTIVE' => 'Y');
     if (IsModuleInstalled("intranet") || COption::GetOptionString("main", "new_user_registration_email_confirmation", "N") == "Y") {
         $arFilter["CONFIRM_CODE"] = false;
     }
     $arGroupBy = false;
     $arSelectFields = array("ID", "NAME", "LAST_NAME", "SECOND_NAME", "LOGIN", "PERSONAL_PHOTO", "WORK_POSITION", "PERSONAL_PROFESSION");
     $arSqls = CSocNetGroup::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields);
     $arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "DISTINCT", $arSqls["SELECT"]);
     if (!$bExtranetUser) {
         $strJoin = "\n\t\t\t\tLEFT JOIN b_utm_user UM ON UM.VALUE_ID = U.ID and FIELD_ID = " . intval($UFId) . "\n\t\t\t\tLEFT JOIN b_sonet_user2group UG ON UG.USER_ID = U.ID\n\t\t\t\tLEFT JOIN b_sonet_user2group UG_MY ON UG_MY.GROUP_ID = UG.GROUP_ID AND UG_MY.USER_ID = " . intval($currentUserId) . "\n\t\t\t";
         $arSqls["WHERE"] .= (strlen($arSqls["WHERE"]) > 0 ? " AND " : "") . "\n\t\t\t\t(\n\t\t\t\t\tUM.VALUE_ID > 0\n\t\t\t\t\tOR UG_MY.ID IS NOT NULL\n\t\t\t\t)";
     } else {
         $strJoin = "\n\t\t\t\tINNER JOIN b_sonet_user2group UG ON UG.USER_ID = U.ID\n\t\t\t\tINNER JOIN b_sonet_user2group UG_MY ON UG_MY.GROUP_ID = UG.GROUP_ID AND UG_MY.USER_ID = " . intval($currentUserId) . "\n\t\t\t";
     }
     $strSql = "SELECT\n\t\t\t\t" . $arSqls["SELECT"] . "\n\t\t\tFROM b_user U\n\t\t\t\t" . $arSqls["FROM"] . " ";
     $strSql .= $strJoin . " ";
     if (strlen($arSqls["WHERE"]) > 0) {
         $strSql .= "WHERE " . $arSqls["WHERE"] . " ";
     }
     if (strlen($arSqls["ORDERBY"]) > 0) {
         $strSql .= "ORDER BY " . $arSqls["ORDERBY"] . " ";
     }
     //echo "!1!=".htmlspecialcharsbx($strSql)."<br>";
     $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     $maxCount = IsModuleInstalled('bitrix24') ? 200 : 500;
     $resultCount = 0;
     if ($bExtranetEnabled) {
         CSocNetTools::InitGlobalExtranetArrays();
     }
     while ($arUser = $dbRes->GetNext()) {
         if ($resultCount > $maxCount) {
             $countExceeded = true;
             break;
         }
         $sName = trim(CUser::FormatName(empty($arParams["NAME_TEMPLATE"]) ? CSite::GetNameFormat(false) : $arParams["NAME_TEMPLATE"], $arUser, true, false));
         if (empty($sName)) {
             $sName = $arUser["~LOGIN"];
         }
         $arFileTmp = CFile::ResizeImageGet($arUser["PERSONAL_PHOTO"], array('width' => 32, 'height' => 32), BX_RESIZE_IMAGE_EXACT, false);
         $arUsers['U' . $arUser["ID"]] = array('id' => 'U' . $arUser["ID"], 'entityId' => $arUser["ID"], 'name' => $sName, 'avatar' => empty($arFileTmp['src']) ? '' : $arFileTmp['src'], 'desc' => $arUser['WORK_POSITION'] ? $arUser['WORK_POSITION'] : ($arUser['PERSONAL_PROFESSION'] ? $arUser['PERSONAL_PROFESSION'] : '&nbsp;'), 'isExtranet' => isset($GLOBALS["arExtranetUserID"]) && is_array($GLOBALS["arExtranetUserID"]) && in_array($arUser["ID"], $GLOBALS["arExtranetUserID"]) ? "Y" : "N");
         $arUsers['U' . $arUser["ID"]]['checksum'] = md5(serialize($arUsers['U' . $arUser["ID"]]));
         $resultCount++;
     }
     if ($countExceeded) {
         return CSocNetLogDestination::GetUsers(array("id" => array($currentUserId)), true);
     }
     return $arUsers;
 }
Exemple #4
0
    function AddLiveComment($commentId = 0, $path = "", $arParams = array())
    {
        if (IntVal($commentId) <= 0) {
            return;
        }
        if (CModule::IncludeModule("pull") && CPullOptions::GetNginxStatus() && ($arComment = CBlogComment::GetByID($commentId)) && ($arPost = CBlogPost::GetByID($arComment["POST_ID"]))) {
            if (strlen($path) <= 0 && strlen($arComment["PATH"]) > 0) {
                $path = CComponentEngine::MakePathFromTemplate($arComment["PATH"], array("post_id" => $arComment["POST_ID"], "comment_id" => $commentId));
            }
            if (strlen($path) <= 0) {
                $path = CComponentEngine::MakePathFromTemplate($arPost["PATH"], array("post_id" => $arComment["POST_ID"], "comment_id" => $commentId)) . "?commentId=" . $commentId;
            }
            $arFormatParams = array("PATH_TO_USER" => isset($arParams["PATH_TO_USER"]) ? $arParams["PATH_TO_USER"] : '', "PATH_TO_POST" => $path, "NAME_TEMPLATE" => isset($arParams["NAME_TEMPLATE"]) ? $arParams["NAME_TEMPLATE"] : CSite::GetNameFormat(), "SHOW_LOGIN" => isset($arParams["SHOW_LOGIN"]) ? $arParams["SHOW_LOGIN"] : true, "AVATAR_SIZE_COMMENT" => isset($arParams["AVATAR_SIZE_COMMENT"]) ? $arParams["AVATAR_SIZE_COMMENT"] : 58, "PATH_TO_SMILE" => isset($arParams["PATH_TO_SMILE"]) ? $arParams["PATH_TO_SMILE"] : '', "DATE_TIME_FORMAT" => isset($arParams["DATE_TIME_FORMAT"]) ? $arParams["DATE_TIME_FORMAT"] : '', "SHOW_RATING" => isset($arParams["SHOW_RATING"]) ? $arParams["SHOW_RATING"] : '', "RATING_TYPE" => "like");
            $arComment["DateFormated"] = FormatDateFromDB($arComment["DATE_CREATE"], $arFormatParams["DATE_TIME_FORMAT"], true);
            if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) {
                $arComment["DateFormated"] = ToLower($arComment["DateFormated"]);
            }
            $arComment["UF"] = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("BLOG_COMMENT", $commentId, LANGUAGE_ID);
            $arAuthor = CBlogUser::GetUserInfo($arComment["AUTHOR_ID"], $arFormatParams["PATH_TO_USER"], array("AVATAR_SIZE_COMMENT" => $arFormatParams["AVATAR_SIZE_COMMENT"]));
            if (IsModuleInstalled('extranet') && CModule::IncludeModule('socialnetwork')) {
                CSocNetTools::InitGlobalExtranetArrays();
            }
            $arTmpUser = array("NAME" => $arAuthor["~NAME"], "LAST_NAME" => $arAuthor["~LAST_NAME"], "SECOND_NAME" => $arAuthor["~SECOND_NAME"], "LOGIN" => $arAuthor["~LOGIN"], "NAME_LIST_FORMATTED" => "");
            $arAuthor["NAME_FORMATED"] = CUser::FormatName($arFormatParams["NAME_TEMPLATE"], $arTmpUser, $arFormatParams["SHOW_LOGIN"] != "N");
            if (intval($arAuthor["PERSONAL_PHOTO"]) > 0) {
                $image_resize = CFile::ResizeImageGet($arAuthor["PERSONAL_PHOTO"], array("width" => $arFormatParams["AVATAR_SIZE_COMMENT"], "height" => $arFormatParams["AVATAR_SIZE_COMMENT"]), BX_RESIZE_IMAGE_EXACT);
                $arAuthor["PERSONAL_PHOTO_RESIZED"] = array("src" => $image_resize["src"]);
            }
            $p = new blogTextParser(false, '');
            $ufCode = "UF_BLOG_COMMENT_FILE";
            if (is_array($arComment["UF"][$ufCode])) {
                $p->arUserfields = array($ufCode => array_merge($arComment["UF"][$ufCode], array("TAG" => "DOCUMENT ID")));
            }
            $arAllow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N", "VIDEO" => "Y", "SHORT_ANCHOR" => "Y");
            $arParserParams = array("imageWidth" => 800, "imageHeight" => 800);
            $arComment["TextFormated"] = $p->convert($arComment["POST_TEXT"], false, array(), $arAllow, $arParserParams);
            $p->bMobile = true;
            $arComment["TextFormatedMobile"] = $p->convert($arComment["POST_TEXT"], false, array(), $arAllow, $arParserParams);
            if ($perm >= BLOG_PERMS_MODERATE) {
                if ($arComment["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH) {
                    $arComment["CAN_HIDE"] = "Y";
                } else {
                    $arComment["CAN_SHOW"] = "Y";
                }
            } else {
                $arComment["CAN_SHOW"] = $arComment["CAN_HIDE"] = "N";
            }
            $urlToPost = CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arFormatParams["PATH_TO_POST"]), array("post_id" => "#source_post_id#", "user_id" => $arPost["AUTHOR_ID"]));
            $urlToPost .= strpos($urlToPost, "?") !== false ? "&" : "?";
            $arUrl = array("LINK" => $urlToPost, "SHOW" => $urlToPost . "show_comment_id=#comment_id#&comment_post_id=#post_id#&" . bitrix_sessid_get(), "HIDE" => $urlToPost . "hide_comment_id=#comment_id#&comment_post_id=#post_id#&" . bitrix_sessid_get(), "DELETE" => $urlToPost . "delete_comment_id=#comment_id#&comment_post_id=#post_id#&" . bitrix_sessid_get(), "USER" => htmlspecialcharsback($arFormatParams["PATH_TO_USER"]));
            CRatingsComponentsMain::GetShowRating($arFormatParams);
            if ($arFormatParams["SHOW_RATING"] == "Y") {
                $arRating = CRatings::GetRatingVoteResult('BLOG_COMMENT', array($arComment["ID"]));
            }
            $arCommentParams = array("ID" => $commentId, "ENTITY_XML_ID" => "BLOG_" . $arPost["ID"], "FULL_ID" => array("BLOG_" . $arPost["ID"], $commentId), "ACTION" => "REPLY", "APPROVED" => "Y", "PANELS" => array("EDIT" => "N", "MODERATE" => "N", "DELETE" => "N"), "NEW" => "Y", "AUTHOR" => array("ID" => $GLOBALS["USER"]->GetID(), "NAME" => $arAuthor["NAME_FORMATED"], "URL" => $arAuthor["url"], "E-MAIL" => $arComment["AuthorEmail"], "AVATAR" => $arAuthor["PERSONAL_PHOTO_resized"]["src"], "IS_EXTRANET" => is_array($GLOBALS["arExtranetUserID"]) && in_array($GLOBALS["USER"]->GetID(), $GLOBALS["arExtranetUserID"])), "POST_TIMESTAMP" => $arComment["DATE_CREATE_TS"], "POST_TIME" => $arComment["DATE_CREATE_TIME"], "POST_DATE" => $arComment["DateFormated"], "POST_MESSAGE_TEXT" => $arComment["TextFormated"], "POST_MESSAGE_TEXT_MOBILE" => $arComment["TextFormatedMobile"], "URL" => array("LINK" => str_replace(array("##comment_id#", "#comment_id#"), array("", $commentId), $arUrl["LINK"]), "EDIT" => "__blogEditComment('" . $commentId . "', '" . $arPost["ID"] . "');", "MODERATE" => str_replace(array("#source_post_id#", "#post_id#", "#comment_id#", "&" . bitrix_sessid_get()), array($arPost["ID"], $arPost["ID"], $commentId, ""), $arComment["CAN_SHOW"] == "Y" ? $arUrl["SHOW"] : ($arComment["CAN_HIDE"] == "Y" ? $arUrl["HIDE"] : "")), "DELETE" => str_replace(array("#source_post_id#", "#post_id#", "#comment_id#", "&" . bitrix_sessid_get()), array($arPost["ID"], $arPost["ID"], $commentId, ""), $arUrl["DELETE"])), "AFTER" => "", "BEFORE_ACTIONS_MOBILE" => "", "AFTER_MOBILE" => "");
            if ($arFormatParams["SHOW_RATING"] == "Y") {
                $arRatingData = array("ENTITY_TYPE_ID" => "BLOG_COMMENT", "ENTITY_ID" => $commentId, "OWNER_ID" => $arComment["AUTHOR_ID"], "USER_VOTE" => $arRating[$commentId]["USER_VOTE"], "USER_HAS_VOTED" => $arRating[$commentId]["USER_HAS_VOTED"], "TOTAL_VOTES" => $arRating[$commentId]["TOTAL_VOTES"], "TOTAL_POSITIVE_VOTES" => $arRating[$commentId]["TOTAL_POSITIVE_VOTES"], "TOTAL_NEGATIVE_VOTES" => $arRating[$commentId]["TOTAL_NEGATIVE_VOTES"], "TOTAL_VALUE" => $arRating[$commentId]["TOTAL_VALUE"], "PATH_TO_USER_PROFILE" => $arUrl["USER"]);
                ob_start();
                $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:rating.vote", $arFormatParams["RATING_TYPE"], $arRatingData, false, array("HIDE_ICONS" => "Y"));
                $arCommentParams["BEFORE_ACTIONS"] = ob_get_clean();
                ob_start();
                $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:rating.vote", "mobile_comment_" . $arFormatParams["RATING_TYPE"], $arRatingData, false, array("HIDE_ICONS" => "Y"));
                $arCommentParams["BEFORE_ACTIONS_MOBILE"] = ob_get_clean();
            }
            $arUFResult = self::BuildUFFields($arComment["UF"]);
            $arCommentParams["AFTER"] .= $arUFResult["AFTER"];
            $arCommentParams["AFTER_MOBILE"] .= $arUFResult["AFTER_MOBILE"];
            if ($arComment["CAN_EDIT"] == "Y") {
                ob_start();
                ?>
<script>
					top.text<?php 
                echo $commentId;
                ?>
 = text<?php 
                echo $commentId;
                ?>
 = '<?php 
                echo CUtil::JSEscape(htmlspecialcharsBack($arComment["POST_TEXT"]));
                ?>
';
					top.title<?php 
                echo $commentId;
                ?>
 = title<?php 
                echo $commentId;
                ?>
 = '<?php 
                echo isset($arComment["TITLE"]) ? CUtil::JSEscape($arComment["TITLE"]) : '';
                ?>
';
					top.arComFiles<?php 
                echo $commentId;
                ?>
 = [];<?php 
                ?>
</script><?php 
                $arCommentParams["AFTER"] .= ob_get_clean();
            }
            CPullWatch::AddToStack('UNICOMMENTSBLOG_' . $arPost["ID"], array('module_id' => 'unicomments', 'command' => 'comment', 'params' => $arCommentParams));
        }
    }
    public static function __ShowAttendeesDestinationHtml($Params = array())
    {
        CSocNetTools::InitGlobalExtranetArrays();
        $id = $Params['id'];
        $DESTINATION = CCalendar::GetSocNetDestination(false, $Params['event']['ATTENDEES_CODES']);
        ?>
		<div id="event-grid-att<?php 
        echo $id;
        ?>
" class="event-grid-dest-block">
			<div class="event-grid-dest-wrap-outer">
				<div class="event-grid-dest-label"><?php 
        echo GetMessage("EC_EDEV_GUESTS");
        ?>
:</div>
				<div class="event-grid-dest-wrap" id="event-grid-dest-cont">
					<span id="event-grid-dest-item"></span>
					<span class="feed-add-destination-input-box" id="event-grid-dest-input-box">
						<input type="text" value="" class="feed-add-destination-inp" id="event-grid-dest-input">
					</span>
					<a href="#" class="feed-add-destination-link" id="event-grid-dest-add-link"></a>
					<script>
						<?php 
        if (is_array($GLOBALS["arExtranetGroupID"])) {
            ?>
							if (typeof window['arExtranetGroupID'] == 'undefined')
							{
								window['arExtranetGroupID'] = <?php 
            echo CUtil::PhpToJSObject($GLOBALS["arExtranetGroupID"]);
            ?>
;
							}
							<?php 
        }
        ?>
						BX.message({
							'BX_FPD_LINK_1':'<?php 
        echo GetMessageJS("EC_DESTINATION_1");
        ?>
',
							'BX_FPD_LINK_2':'<?php 
        echo GetMessageJS("EC_DESTINATION_2");
        ?>
'
						});
						window.editEventDestinationFormName = top.editEventDestinationFormName = 'edit_event_<?php 
        echo randString(6);
        ?>
';
						//
						BX.SocNetLogDestination.init({
							name : editEventDestinationFormName,
							searchInput : BX('event-grid-dest-input'),
							extranetUser :  false,
							userSearchArea: 'I',
							bindMainPopup : { 'node' : BX('event-grid-dest-cont'), 'offsetTop' : '5px', 'offsetLeft': '15px'},
							bindSearchPopup : { 'node' : BX('event-grid-dest-cont'), 'offsetTop' : '5px', 'offsetLeft': '15px'},
							callback : {
								select : BxEditEventGridSelectCallback,
								unSelect : BxEditEventGridUnSelectCallback,
								openDialog : BxEditEventGridOpenDialogCallback,
								closeDialog : BxEditEventGridCloseDialogCallback,
								openSearch : BxEditEventGridOpenDialogCallback,
								closeSearch : BxEditEventGridCloseSearchCallback
							},
							items : {
								users : <?php 
        echo empty($DESTINATION['USERS']) ? '{}' : CUtil::PhpToJSObject($DESTINATION['USERS']);
        ?>
,
								groups : <?php 
        echo $DESTINATION["EXTRANET_USER"] == 'Y' || array_key_exists("DENY_TOALL", $DESTINATION) && $DESTINATION["DENY_TOALL"] ? '{}' : "{'UA' : {'id':'UA','name': '" . (!empty($DESTINATION['DEPARTMENT']) ? GetMessageJS("MPF_DESTINATION_3") : GetMessageJS("MPF_DESTINATION_4")) . "'}}";
        ?>
,
								sonetgroups : <?php 
        echo empty($DESTINATION['SONETGROUPS']) ? '{}' : CUtil::PhpToJSObject($DESTINATION['SONETGROUPS']);
        ?>
,
								department : <?php 
        echo empty($DESTINATION['DEPARTMENT']) ? '{}' : CUtil::PhpToJSObject($DESTINATION['DEPARTMENT']);
        ?>
,
								departmentRelation : <?php 
        echo empty($DESTINATION['DEPARTMENT_RELATION']) ? '{}' : CUtil::PhpToJSObject($DESTINATION['DEPARTMENT_RELATION']);
        ?>
							},
							itemsLast : {
								users : <?php 
        echo empty($DESTINATION['LAST']['USERS']) ? '{}' : CUtil::PhpToJSObject($DESTINATION['LAST']['USERS']);
        ?>
,
								sonetgroups : <?php 
        echo empty($DESTINATION['LAST']['SONETGROUPS']) ? '{}' : CUtil::PhpToJSObject($DESTINATION['LAST']['SONETGROUPS']);
        ?>
,
								department : <?php 
        echo empty($DESTINATION['LAST']['DEPARTMENT']) ? '{}' : CUtil::PhpToJSObject($DESTINATION['LAST']['DEPARTMENT']);
        ?>
,
								groups : <?php 
        echo $DESTINATION["EXTRANET_USER"] == 'Y' ? '{}' : "{'UA':true}";
        ?>
							},
							itemsSelected : <?php 
        echo empty($DESTINATION['SELECTED']) ? '{}' : CUtil::PhpToJSObject($DESTINATION['SELECTED']);
        ?>
,
							destSort : <?php 
        echo empty($DESTINATION['DEST_SORT']) ? '{}' : CUtil::PhpToJSObject($DESTINATION['DEST_SORT']);
        ?>
						});
					</script>
				</div>
			</div>

			<!-- Meeting host -->
			<div class="event-grid-host-cont">
				<span class="event-grid-host-cont-label"><?php 
        echo GetMessage('EC_EDEV_HOST');
        ?>
:</span>
				<a title="<?php 
        echo htmlspecialcharsbx($Params['host']['DISPLAY_NAME']);
        ?>
" href="<?php 
        echo $Params['host']['URL'];
        ?>
" target="_blank" class="bxcal-user"><span class="bxcal-user-avatar-outer"><span class="bxcal-user-avatar"><img src="<?php 
        echo $Params['host']['AVATAR_SRC'];
        ?>
" width="<?php 
        echo $Params['AVATAR_SIZE'];
        ?>
" height="<?php 
        echo $Params['AVATAR_SIZE'];
        ?>
" /></span></span><span class="bxcal-user-name"><?php 
        echo htmlspecialcharsbx($Params['host']['DISPLAY_NAME']);
        ?>
</span></a>

			</div>

			<!-- Attendees cont -->
			<div class="event-grid-attendees-cont">
				<div id="event-edit-att-y" class="event-grid-attendees-cont-y"></div>
				<div id="event-edit-att-n" class="event-grid-attendees-cont-n"></div>
				<div id="event-edit-att-q" class="event-grid-attendees-cont-q"></div>
			</div>
		</div>

		<div id="event-grid-meeting-params<?php 
        echo $id;
        ?>
" class="event-grid-params">
			<div class="bxec-add-meet-text"><a id="<?php 
        echo $id;
        ?>
_add_meet_text" href="javascript:void(0);"><?php 
        echo GetMessage('EC_ADD_METTING_TEXT');
        ?>
</a></div>
			<div class="bxec-meet-text" id="<?php 
        echo $id;
        ?>
_meet_text_cont">
				<div class="bxec-mt-d"><?php 
        echo GetMessage('EC_METTING_TEXT');
        ?>
 (<a id="<?php 
        echo $id;
        ?>
_hide_meet_text" href="javascript:void(0);" title="<?php 
        echo GetMessage('EC_HIDE_METTING_TEXT_TITLE');
        ?>
"><?php 
        echo GetMessage('EC_HIDE');
        ?>
</a>): </div><br />
				<textarea name="meeting_text" class="bxec-mt-t" cols="63" id="<?php 
        echo $id;
        ?>
_meeting_text" rows="3"></textarea>
			</div>

			<div class="bxec-popup-row bxec-popup-row-checkbox">
				<input type="checkbox" id="<?php 
        echo $id;
        ?>
_ed_open_meeting" value="Y" name="open_meeting"/>
				<label style="display: inline-block;" for="<?php 
        echo $id;
        ?>
_ed_open_meeting"><?php 
        echo GetMessage('EC_OPEN_MEETING');
        ?>
</label>
			</div>
			<div class="bxec-popup-row bxec-popup-row-checkbox">
				<input type="checkbox" id="<?php 
        echo $id;
        ?>
_ed_notify_status" value="Y" name="meeting_notify"/>
				<label for="<?php 
        echo $id;
        ?>
_ed_notify_status"><?php 
        echo GetMessage('EC_NOTIFY_STATUS');
        ?>
</label>
			</div>
			<div class="bxec-popup-row bxec-popup-row-checkbox" id="<?php 
        echo $id;
        ?>
_ed_reivite_cont">
				<input type="checkbox" id="<?php 
        echo $id;
        ?>
_ed_reivite" value="Y" name="meeting_reinvite"/>
				<label for="<?php 
        echo $id;
        ?>
_ed_reivite"><?php 
        echo GetMessage('EC_REINVITE');
        ?>
</label>
			</div>
		</div>
		<?php 
    }
 public static function SearchUsers($search, $nameTemplate = "", $bSelf = true, $bEmployeesOnly = false, $bExtranetOnly = false, $departmentId = false)
 {
     CUtil::JSPostUnescape();
     $arUsers = array();
     $search = trim($search);
     if (strlen($search) <= 0 || !GetFilterQuery("TEST", $search)) {
         return $arUsers;
     }
     $bIntranetEnable = IsModuleInstalled('intranet');
     $bExtranetEnable = CModule::IncludeModule('extranet');
     $bBitrix24Enable = IsModuleInstalled('bitrix24');
     $bExtranetUser = $bExtranetEnable && !CExtranet::IsIntranetUser();
     $current_user_id = intval($GLOBALS["USER"]->GetID());
     if ($bExtranetEnable) {
         CSocNetTools::InitGlobalExtranetArrays();
     }
     $arSearchValue = preg_split('/\\s+/', trim($search));
     array_walk($arSearchValue, array('CSocNetLogDestination', '__percent_walk'));
     $arFilter = array(array('LOGIC' => 'OR', '%=NAME' => $arSearchValue, '%=LAST_NAME' => $arSearchValue, '%=EMAIL' => $search, '%=LOGIN' => $search), 'ACTIVE' => 'Y');
     if ($bIntranetEnable || COption::GetOptionString("main", "new_user_registration_email_confirmation", "N") == "Y") {
         $arFilter["CONFIRM_CODE"] = false;
     }
     if ($bEmployeesOnly || $bBitrix24Enable && !$bExtranetEnable) {
         $arFilter["!UF_DEPARTMENT"] = false;
     } elseif ($bExtranetOnly) {
         $arFilter["UF_DEPARTMENT"] = false;
     }
     if ($bIntranetEnable && $bExtranetEnable && ($bExtranetUser || !$bEmployeesOnly)) {
         $arFilteredUserIDs = CExtranet::GetMyGroupsUsersSimple(CExtranet::GetExtranetSiteID());
         if ($bExtranetUser) {
             $arFilter["ID"] = array_merge(array($current_user_id), $arFilteredUserIDs);
         } else {
             $arFilter[] = array('LOGIC' => 'OR', '!UF_DEPARTMENT' => false, 'ID' => array_merge(array($current_user_id), $arFilteredUserIDs));
         }
     }
     $arSelect = array("ID", "NAME", "LAST_NAME", "SECOND_NAME", "EMAIL", "LOGIN", "WORK_POSITION", "PERSONAL_PROFESSION", "PERSONAL_PHOTO", "PERSONAL_GENDER");
     if ($bIntranetEnable) {
         $arSelect[] = 'UF_DEPARTMENT';
     }
     if (intval($departmentId) > 0) {
         $acc = new CAccess();
     }
     $rsUser = \Bitrix\Main\UserTable::getList(array('order' => array('LAST_NAME' => 'ASC'), 'filter' => $arFilter, 'select' => $arSelect, 'limit' => 20, 'data_doubling' => false));
     while ($arUser = $rsUser->fetch()) {
         if (!$bSelf && $current_user_id == $arUser['ID']) {
             continue;
         }
         if (is_object($acc)) {
             $acc->UpdateCodes(array("USER_ID" => $arUser["ID"]));
             $arUserGroupCode = CAccess::GetUserCodesArray($arUser["ID"], array("PROVIDER_ID" => "intranet"));
             if (!in_array("DR" . intval($departmentId), $arUserGroupCode)) {
                 continue;
             }
         }
         $sName = CUser::FormatName(empty($nameTemplate) ? CSite::GetNameFormat(false) : $nameTemplate, $arUser, true, true);
         $arFileTmp = CFile::ResizeImageGet($arUser["PERSONAL_PHOTO"], array('width' => 32, 'height' => 32), BX_RESIZE_IMAGE_EXACT, false);
         $arUsers['U' . $arUser["ID"]] = array('id' => 'U' . $arUser["ID"], 'entityId' => $arUser["ID"], 'name' => $sName, 'avatar' => empty($arFileTmp['src']) ? '' : $arFileTmp['src'], 'desc' => $arUser['WORK_POSITION'] ? $arUser['WORK_POSITION'] : ($arUser['PERSONAL_PROFESSION'] ? $arUser['PERSONAL_PROFESSION'] : '&nbsp;'), 'isExtranet' => isset($GLOBALS["arExtranetUserID"]) && is_array($GLOBALS["arExtranetUserID"]) && in_array($arUser["ID"], $GLOBALS["arExtranetUserID"]) ? "Y" : "N");
         $checksum = md5(serialize($arUsers['U' . $arUser["ID"]]));
         $arUsers['U' . $arUser["ID"]]['checksum'] = $checksum;
     }
     return $arUsers;
 }