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 }
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)); } }
<?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);
$arTmpUser = array("NAME" => $arUserRequests["FIRST_USER_NAME"], "LAST_NAME" => $arUserRequests["FIRST_USER_LAST_NAME"], "SECOND_NAME" => $arUserRequests["FIRST_USER_SECOND_NAME"], "LOGIN" => $arUserRequests["FIRST_USER_LOGIN"]); $strNameFormatted = CUser::FormatName($arParams['NAME_TEMPLATE'], $arTmpUser, $bUseLogin); $arEventTmp["Event"] = array("ID" => $arUserRequests["ID"], "USER_ID" => $arUserRequests["FIRST_USER_ID"], "USER_NAME" => $arUserRequests["FIRST_USER_NAME"], "USER_LAST_NAME" => $arUserRequests["FIRST_USER_LAST_NAME"], "USER_SECOND_NAME" => $arUserRequests["FIRST_USER_SECOND_NAME"], "USER_LOGIN" => $arUserRequests["FIRST_USER_LOGIN"], "USER_NAME_FORMATTED" => $strNameFormatted, "USER_PERSONAL_PHOTO" => $arUserRequests["FIRST_USER_PERSONAL_PHOTO"], "USER_PERSONAL_PHOTO_FILE" => $arImage["FILE"], "USER_PERSONAL_PHOTO_IMG" => $arImage["IMG"], "USER_PROFILE_URL" => $pu, "SHOW_PROFILE_LINK" => $canViewProfile, "IS_ONLINE" => $arUserRequests["FIRST_USER_IS_ONLINE"] == "Y", "DATE_UPDATE" => $arUserRequests["DATE_UPDATE"], "MESSAGE" => $parser->convert($arUserRequests["~MESSAGE"], false, array(), array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "LIST" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "SMILES" => "Y", "UPLOAD" => "N", "NL2BR" => "N"))); $arEventTmp["Urls"]["FriendAdd"] = htmlspecialcharsbx($APPLICATION->GetCurUri("EventType=FriendRequest&eventID=" . $arUserRequests["ID"] . "&action=add&" . bitrix_sessid_get() . "&backurl=" . urlencode($GLOBALS["APPLICATION"]->GetCurPageParam("", array("EventType", "eventID", "action"))))); $arEventTmp["Urls"]["FriendReject"] = htmlspecialcharsbx($APPLICATION->GetCurUri("EventType=FriendRequest&eventID=" . $arUserRequests["ID"] . "&action=reject&" . bitrix_sessid_get() . "&backurl=" . urlencode($GLOBALS["APPLICATION"]->GetCurPageParam("", array("EventType", "eventID", "action"))))); $arResult["Events"][] = $arEventTmp; } $dbUserRequests = CSocNetUserToGroup::GetList(array("DATE_CREATE" => "ASC"), array("USER_ID" => $GLOBALS["USER"]->GetID(), "ROLE" => SONET_ROLES_REQUEST, "INITIATED_BY_TYPE" => SONET_INITIATED_BY_GROUP), false, false, array("ID", "INITIATED_BY_USER_ID", "MESSAGE", "INITIATED_BY_USER_NAME", "DATE_CREATE", "INITIATED_BY_USER_LAST_NAME", "INITIATED_BY_USER_SECOND_NAME", "INITIATED_BY_USER_LOGIN", "INITIATED_BY_USER_PHOTO", "GROUP_ID", "GROUP_NAME", "GROUP_IMAGE_ID", "GROUP_VISIBLE")); while ($arUserRequests = $dbUserRequests->GetNext()) { if ($arResult["Events"] == false) { $arResult["Events"] = array(); } $arEventTmp["EventType"] = "GroupRequest"; $pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arUserRequests["INITIATED_BY_USER_ID"])); $canViewProfileU = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arUserRequests["INITIATED_BY_USER_ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin()); $arImage = CSocNetTools::InitImage($arUserRequests["INITIATED_BY_USER_PHOTO"], 150, "/bitrix/images/socialnetwork/nopic_user_150.gif", 150, $pu, $canViewProfileU); $pg = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arUserRequests["GROUP_ID"])); $canViewProfileG = CSocNetUser::IsCurrentUserModuleAdmin() || $arUserRequests["GROUP_VISIBLE"] == "Y"; if (intval($arUserRequests["GROUP_IMAGE_ID"]) <= 0) { $arUserRequests["GROUP_IMAGE_ID"] = COption::GetOptionInt("socialnetwork", "default_group_picture", false, SITE_ID); } $arImageG = CSocNetTools::InitImage($arUserRequests["GROUP_IMAGE_ID"], 150, "/bitrix/images/socialnetwork/nopic_group_150.gif", 150, $pg, $canViewProfileG); $arTmpUser = array("NAME" => $arUserRequests["INITIATED_BY_USER_NAME"], "LAST_NAME" => $arUserRequests["INITIATED_BY_USER_LAST_NAME"], "SECOND_NAME" => $arUserRequests["INITIATED_BY_USER_SECOND_NAME"], "LOGIN" => $arUserRequests["INITIATED_BY_USER_LOGIN"]); $strNameFormatted = CUser::FormatName($arParams['NAME_TEMPLATE'], $arTmpUser, $bUseLogin); $arEventTmp["Event"] = array("ID" => $arUserRequests["ID"], "USER_ID" => $arUserRequests["INITIATED_BY_USER_ID"], "USER_NAME" => $arUserRequests["INITIATED_BY_USER_NAME"], "USER_LAST_NAME" => $arUserRequests["INITIATED_BY_USER_LAST_NAME"], "USER_SECOND_NAME" => $arUserRequests["INITIATED_BY_USER_SECOND_NAME"], "USER_LOGIN" => $arUserRequests["INITIATED_BY_USER_LOGIN"], "USER_NAME_FORMATTED" => $strNameFormatted, "USER_PERSONAL_PHOTO" => $arUserRequests["INITIATED_BY_USER_PHOTO"], "USER_PERSONAL_PHOTO_FILE" => $arImage["FILE"], "USER_PERSONAL_PHOTO_IMG" => $arImage["IMG"], "USER_PROFILE_URL" => $pu, "SHOW_PROFILE_LINK" => $canViewProfileU, "DATE_CREATE" => $arUserRequests["DATE_CREATE"], "GROUP_NAME" => $arUserRequests["GROUP_NAME"], "GROUP_IMAGE_ID" => $arUserRequests["GROUP_IMAGE_ID"], "GROUP_IMAGE_ID_FILE" => $arImageG["FILE"], "GROUP_IMAGE_ID_IMG" => $arImageG["IMG"], "GROUP_PROFILE_URL" => $pg, "SHOW_GROUP_LINK" => $canViewProfileG, "MESSAGE" => $parser->convert($arUserRequests["~MESSAGE"], false, array(), array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "LIST" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "SMILES" => "Y", "UPLOAD" => "N", "NL2BR" => "N"))); $arEventTmp["Urls"]["FriendAdd"] = htmlspecialcharsbx($APPLICATION->GetCurUri("EventType=GroupRequest&eventID=" . $arUserRequests["ID"] . "&action=add&" . bitrix_sessid_get() . "&backurl=" . urlencode($GLOBALS["APPLICATION"]->GetCurPageParam("", array("EventType", "eventID", "action"))))); $arEventTmp["Urls"]["FriendReject"] = htmlspecialcharsbx($APPLICATION->GetCurUri("EventType=GroupRequest&eventID=" . $arUserRequests["ID"] . "&action=reject&" . bitrix_sessid_get() . "&backurl=" . urlencode($GLOBALS["APPLICATION"]->GetCurPageParam("", array("EventType", "eventID", "action"))))); $arResult["Events"][] = $arEventTmp; } $this->IncludeComponentTemplate(); }
switch ($arFriends[$pref . "_USER_PERSONAL_GENDER"]) { case "M": $suffix = "male"; break; case "F": $suffix = "female"; break; default: $suffix = "unknown"; } $arFriends[$pref . "_USER_PERSONAL_PHOTO"] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID); } $arImage = CSocNetTools::InitImage($arFriends[$pref . "_USER_PERSONAL_PHOTO"], $arParams["THUMBNAIL_LIST_SIZE"], "/bitrix/images/socialnetwork/nopic_30x30.gif", 30, $pu, $canViewProfile); } else { // old $arImage = CSocNetTools::InitImage($arFriends[$pref . "_USER_PERSONAL_PHOTO"], 50, "/bitrix/images/socialnetwork/nopic_user_50.gif", 50, $pu, $canViewProfile); } $arResult["Friends"]["List"][] = array("ID" => $arFriends["ID"], "USER_ID" => $arFriends[$pref . "_USER_ID"], "USER_NAME" => $arFriends[$pref . "_USER_NAME"], "USER_LAST_NAME" => $arFriends[$pref . "_USER_LAST_NAME"], "USER_SECOND_NAME" => $arFriends[$pref . "_USER_SECOND_NAME"], "USER_LOGIN" => $arFriends[$pref . "_USER_LOGIN"], "USER_PERSONAL_PHOTO" => $arFriends[$pref . "_USER_PERSONAL_PHOTO"], "USER_PERSONAL_PHOTO_FILE" => $arImage["FILE"], "USER_PERSONAL_PHOTO_IMG" => $arImage["IMG"], "USER_PROFILE_URL" => $pu, "SHOW_PROFILE_LINK" => $canViewProfile); } } } // USER GROUPS $arResult["Groups"] = false; if ($arResult["CurrentUserPerms"]["Operations"]["viewgroups"]) { $arGroupFilter = array("USER_ID" => $arResult["User"]["ID"], "<=ROLE" => SONET_ROLES_USER, "GROUP_SITE_ID" => SITE_ID, "GROUP_ACTIVE" => "Y"); if (COption::GetOptionString("socialnetwork", "work_with_closed_groups", "N") != "Y") { $arGroupFilter["GROUP_CLOSED"] = "N"; } if (CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite()) { if (!$GLOBALS["USER"]->IsAdmin() && !CSocNetUser::IsCurrentUserModuleAdmin()) { $arGroupFilterMy = array("USER_ID" => $GLOBALS["USER"]->GetID(), "<=ROLE" => SONET_ROLES_USER, "GROUP_SITE_ID" => SITE_ID, "GROUP_ACTIVE" => "Y");
} 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");
$rsUser = CUser::GetByID($arParams["ENTITY_ID"]); if ($arUser = $rsUser->GetNext()) { if (intval($arUser["PERSONAL_PHOTO"]) <= 0) { switch ($arUser["PERSONAL_GENDER"]) { case "M": $suffix = "male"; break; case "F": $suffix = "female"; break; default: $suffix = "unknown"; } $arUser["PERSONAL_PHOTO"] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID); } $arResult["PICTURE"] = CSocNetTools::InitImage($arUser["PERSONAL_PHOTO"], 100, "/bitrix/images/socialnetwork/nopic_user_100.gif", 100, "", false); $arResult["PICTURE"]["FILE"]["SRC"] = __RSSCheckServerName($arResult["PICTURE"]["FILE"]["SRC"], $arResult["SERVER_NAME"]); $arResult["NAME"] = CUser::FormatName($arParams['NAME_TEMPLATE'], $arUser, $bUseLogin); $arResult["DESCRIPTION"] = ""; $arResult["URL"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arParams["ENTITY_ID"])); $arResult["URL"] = __RSSCheckServerName($arResult["URL"], $arResult["SERVER_NAME"]); } } if ($arResult["NAME"]) { $APPLICATION->RestartBuffer(); header("Content-Type: text/xml; charset=" . LANG_CHARSET); header("Pragma: no-cache"); $arFilter["ENTITY_TYPE"] = Trim($arParams["ENTITY_TYPE"]); $arFilter["ENTITY_ID"] = intval($arParams["ENTITY_ID"]); $arFilter["EVENT_ID"] = array(); if ($arParams["EVENT_ID"]) {
case 'PERSONAL_PHONE': case 'PERSONAL_FAX': case 'PERSONAL_MOBILE': case 'WORK_PHONE': case 'WORK_FAX': if (StrLen($val) > 0) { $valEncoded = preg_replace('/[^\\d\\+]+/', '', $val); $val = '<a href="callto:' . $valEncoded . '">' . $val . '</a>'; } break; case 'PERSONAL_GENDER': $val = $val == 'F' ? GetMessage("SONET_C241_FEMALE") : ($val == 'M' ? GetMessage("SONET_C241_MALE") : ""); break; case 'PERSONAL_BIRTHDAY': if (StrLen($val) > 0) { $arBirthdayTmp = CSocNetTools::Birthday($val, $arUser['PERSONAL_GENDER'], $arParams['SHOW_YEAR']); $val = $arBirthdayTmp["DATE"]; } break; default: break; } $arUser["UserFieldsMain"]["DATA"][$userFieldName] = array("NAME" => GetMessage("SONET_C241_" . $userFieldName), "VALUE" => $val); } } if (count($arUser["UserFieldsMain"]["DATA"]) > 0) { $arUser["UserFieldsMain"]["SHOW"] = "Y"; } } // USER PROPERIES $arUser["UserPropertiesMain"] = array("SHOW" => "N", "DATA" => array());
$APPLICATION->RestartBuffer(); Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET); echo CUtil::PhpToJsObject(array('RESULT' => $arResult)); require $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/epilog_after.php"; die; } } else { $arResult["User"]["ID"] = $arParams["ID"]; $arResult["User"]["NAME"] = $arParams["~NAME"]; $arResult["User"]["LAST_NAME"] = $arParams["~LAST_NAME"]; $arResult["User"]["SECOND_NAME"] = $arParams["~SECOND_NAME"]; $arResult["User"]["LOGIN"] = $arParams["LOGIN"]; if ($arParams["USE_THUMBNAIL_LIST"] == "Y" && strlen($arParams["HREF"]) <= 0) { $arResult["User"]["PersonalPhotoImgThumbnail"] = array("Image" => $arParams["~PERSONAL_PHOTO_IMG"], "Url" => false); } elseif ($arParams["USE_THUMBNAIL_LIST"] == "Y" && intval($arParams["PERSONAL_PHOTO_FILE"]["ID"]) > 0) { $arImage = CSocNetTools::InitImage($arParams["PERSONAL_PHOTO_FILE"]["ID"], $arParams["THUMBNAIL_LIST_SIZE"], "/bitrix/images/1.gif", 1, $arParams["~HREF"], $canViewProfile); $arResult["User"]["PersonalPhotoImgThumbnail"] = array("Image" => $arImage["IMG"], "Url" => $arParams["~HREF"]); } } if (array_key_exists("NAME_LIST_FORMATTED", $arParams) && strlen(trim($arParams['NAME_LIST_FORMATTED'])) > 0) { $arResult["User"]["NAME_FORMATTED"] = trim($arParams['NAME_LIST_FORMATTED']); } else { $arResult["User"]["NAME_FORMATTED"] = CUser::FormatName($arParams['NAME_TEMPLATE'], $arResult["User"], $bUseLogin); } if ($bSocialNetwork) { $arResult["User"]["HTML_ID"] = $arParams["HTML_ID"]; } if (strlen($arParams["HREF"]) > 0) { $arResult["User"]["HREF"] = $arParams["~HREF"]; } $arResult["bSocialNetwork"] = $bSocialNetwork;
while ($arGroup = $dbGroups->GetNext()) { $arGroup["GROUP_URL"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arGroup["ID"])); if (intval($arGroup["IMAGE_ID"]) <= 0) { $arGroup["IMAGE_ID"] = COption::GetOptionInt("socialnetwork", "default_group_picture", false, SITE_ID); } $arImage = CSocNetTools::InitImage($arGroup["IMAGE_ID"], 50, "/bitrix/images/socialnetwork/nopic_group_50.gif", 50, $arGroup["GROUP_URL"], true); $arGroup["IMAGE_FILE"] = $arImage["FILE"]; $arGroup["IMAGE_IMG"] = $arImage["IMG"]; $arGroup["FULL_DATE_CHANGE_FORMATED"] = date($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($arGroup["DATE_ACTIVITY"], CSite::GetDateFormat("FULL"))); $arResult["Groups"][] = $arGroup; } $this->IncludeComponentTemplate(); } } else { if (!CModule::IncludeModule("socialnetwork")) { ShowError(GetMessage("SONET_MODULE_NOT_INSTALL")); return; } $arResult["Urls"]["GroupSearch"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_SEARCH"], array()); $dbGroups = CSocNetUserToGroup::GetList(array("GROUP_NAME" => "ASC"), array("USER_ID" => $GLOBALS["USER"]->GetID(), "<=ROLE" => SONET_ROLES_USER, "GROUP_SITE_ID" => SITE_ID, "GROUP_ACTIVE" => "Y"), false, array("nTopCount" => $arParams["ITEMS_COUNT"]), array("ID", "GROUP_ID", "GROUP_NAME", "GROUP_DESCRIPTION", "GROUP_IMAGE_ID", "GROUP_DATE_ACTIVITY")); $arResult["Groups"] = array(); while ($arGroup = $dbGroups->GetNext()) { $arGroup["GROUP_URL"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arGroup["GROUP_ID"])); $arImage = CSocNetTools::InitImage($arGroup["GROUP_IMAGE_ID"], 50, "/bitrix/images/socialnetwork/nopic_group_50.gif", 50, $arGroup["GROUP_URL"], true); $arGroup["IMAGE_FILE"] = $arImage["FILE"]; $arGroup["IMAGE_IMG"] = $arImage["IMG"]; $arGroup["FULL_DATE_CHANGE_FORMATED"] = date($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($arGroup["GROUP_DATE_ACTIVITY"], CSite::GetDateFormat("FULL"))); $arResult["Groups"][] = array("GROUP_URL" => $arGroup["GROUP_URL"], "IMAGE_FILE" => $arGroup["IMAGE_FILE"], "IMAGE_IMG" => $arGroup["IMAGE_IMG"], "FULL_DATE_CHANGE_FORMATED" => $arGroup["FULL_DATE_CHANGE_FORMATED"], "ID" => $arGroup["GROUP_ID"], "NAME" => $arGroup["GROUP_NAME"], "DESCRIPTION" => $arGroup["GROUP_DESCRIPTION"], "IMAGE_ID" => $arGroup["GROUP_IMAGE_ID"], "DATE_ACTIVITY" => $arGroup["GROUP_DATE_ACTIVITY"]); } $this->IncludeComponentTemplate(); }
public function initGroupImage($groupPath, $imageId, $imageSize = 100) { $defaultGroupImageId = null; if ($imageId <= 0) { if ($defaultGroupImageId === null) { $defaultGroupImageId = COption::GetOptionInt("socialnetwork", "default_group_picture", false, SITE_ID); } $imageId = $defaultGroupImageId; } $arImage = CSocNetTools::InitImage($imageId, $imageSize, "/bitrix/images/socialnetwork/nopic_group_100.gif", $imageSize, $groupPath, true); return $arImage; }
function _ShowUserString($arUser, $is_public = false, $arParams, $arGadgetParams) { ?> <tr> <td colspan="2"><div class="gd-contacts-vertical-spacer"></div></td> </tr> <tr> <td colspan="2" width="100%" class="gd-contacts-main"><?php $tooltip_id = randString(8); $link = CComponentEngine::MakePathFromTemplate($arGadgetParams["DETAIL_URL"], array("user_id" => $arUser["ID"], "USER_ID" => $arUser["ID"], "ID" => $arUser["ID"])); if (strlen($arUser["PERSONAL_PHOTO"]) <= 0) { switch ($arUser["PERSONAL_GENDER"]) { case "M": $suffix = "male"; break; case "F": $suffix = "female"; break; default: $suffix = "unknown"; } $arUser["PERSONAL_PHOTO"] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID); $arImage = CSocNetTools::InitImage($arUser["PERSONAL_PHOTO"], 30, "/bitrix/images/socialnetwork/nopic_30x30.gif", 30, $link, true); $arUser["PERSONAL_PHOTO"] = $arImage["IMG"]; } ?> <table cellspacing="0" cellpadding="0" border="0" id="anchor_<?php echo $tooltip_id; ?> " class="bx-user-info-anchor"><?php ?> <tr><?php ?> <td class="bx-user-info-anchor-cell"><?php ?> <div class="bx-user-info-thumbnail" align="center" valign="middle" style="width: 30px; height: 32px;"><?php echo $arUser["PERSONAL_PHOTO"]; ?> </div><?php ?> </td><?php ?> <td class="bx-user-info-anchor-cell" valign="top"><?php ?> <a class="bx-user-info-name" href="<?php echo $link; ?> "><?php echo CUser::FormatName($arParams["NAME_TEMPLATE"], $arUser, $arParams["SHOW_LOGIN"] != "N"); ?> </a><?php ?> </td><?php ?> </tr><?php ?> </table><?php ?> <script type="text/javascript"> BX.tooltip(<?php echo $arUser["ID"]; ?> , "anchor_<?php echo $tooltip_id; ?> "); </script><?php ?> </td> </tr> <tr> <td colspan="2" class="gd-contacts-delimiter"></td> </tr> <?php return true; }
$ImageSize = 150; } if (intval($arUserRequests["FROM_USER_PERSONAL_PHOTO"]) <= 0) { switch ($arUserRequests["FROM_USER_PERSONAL_GENDER"]) { case "M": $suffix = "male"; break; case "F": $suffix = "female"; break; default: $suffix = "unknown"; } $arUserRequests["FROM_USER_PERSONAL_PHOTO"] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, $site); } $arImage = CSocNetTools::InitImage($arUserRequests["FROM_USER_PERSONAL_PHOTO"], $ImageSize, "/bitrix/images/socialnetwork/nopic_user_" . $ImageSize . ".gif", $ImageSize, $pu, $canViewProfile); $arData[1] = $arUserRequests["ID"]; //1 $arData[2] = $arUserRequests["FROM_USER_ID"]; //2 // $arData[3] = $arUserRequests["FROM_USER_NAME"]." ".$arUserRequests["FROM_USER_LAST_NAME"]; $arTmpUser = array("NAME" => $arUserRequests["~FROM_USER_NAME"], "LAST_NAME" => $arUserRequests["~FROM_USER_LAST_NAME"], "SECOND_NAME" => $arUserRequests["~FROM_USER_SECOND_NAME"], "LOGIN" => $arUserRequests["~FROM_USER_LOGIN"]); $arData[3] = CUser::FormatName($arParams['NAME_TEMPLATE'], $arTmpUser, $bUseLogin); $arData[4] = $arImage["IMG"]; //4 $arData[5] = $pu; //5 $arData[6] = $canViewProfile ? "Y" : "N"; //6 $arData[7] = CSocNetUser::IsOnLine($arUserRequests["FROM_USER_ID"]) ? "Y" : "N"; //7
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'] : ' '), '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; }
$arResult["Urls"]["BanLink"] = htmlspecialcharsbx($APPLICATION->GetCurUri("userID=" . $arResult["User"]["ID"] . "&action=ban&" . bitrix_sessid_get() . "")); $arResult["ShowBanLink"] = !CSocNetUser::IsUserModuleAdmin($arResult["User"]["ID"]) && $arResult["User"]["ID"] != $GLOBALS["USER"]->GetID() && (!$arResult["UsersRelation"] || $arResult["UsersRelation"] != SONET_RELATIONS_BAN); if (intval($arResult["User"]["PERSONAL_PHOTO"]) <= 0) { switch ($arResult["User"]["PERSONAL_GENDER"]) { case "M": $suffix = "male"; break; case "F": $suffix = "female"; break; default: $suffix = "unknown"; } $arResult["User"]["PERSONAL_PHOTO"] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID); } $arImage = CSocNetTools::InitImage($arResult["User"]["PERSONAL_PHOTO"], 150, "/bitrix/images/socialnetwork/nopic_user_150.gif", 150, $arResult["Urls"]["User"], $arResult["CanViewProfile"]); $arResult["User"]["PERSONAL_PHOTO_FILE"] = $arImage["FILE"]; $arResult["User"]["PERSONAL_PHOTO_IMG"] = $arImage["IMG"]; $parser = new CSocNetTextParser(LANGUAGE_ID, $arParams["PATH_TO_SMILE"]); $arResult["Events"] = false; $dbMessages = CSocNetMessages::GetMessagesForChat($GLOBALS["USER"]->GetID(), $arResult["User"]["ID"], false, $arNavParams); while ($arMessages = $dbMessages->GetNext()) { if ($arResult["Events"] == false) { $arResult["Events"] = array(); } $arResult["Events"][] = array("WHO" => $arMessages["WHO"], "ID" => $arMessages["ID"], "TITLE" => $arMessages["TITLE"], "DATE_VIEW" => $arMessages["DATE_VIEW"], "DATE_CREATE" => $arMessages["DATE_CREATE"], "DATE_CREATE_FMT" => $arMessages["DATE_CREATE_FMT"], "DATE_CREATE_FORMAT" => $arMessages["DATE_CREATE_FORMAT"], "IS_READ" => StrLen($arMessages["DATE_VIEW"]) > 0 || $arMessages["WHO"] == "OUT", "READ_LINK" => htmlspecialcharsbx($APPLICATION->GetCurUri("eventID=" . $arMessages["ID"] . "&action=close&" . bitrix_sessid_get() . "")), "DELETE_LINK" => htmlspecialcharsbx($APPLICATION->GetCurUri("eventID=" . $arMessages["ID"] . "&action=delete&" . bitrix_sessid_get() . "")), "MESSAGE" => $parser->convert($arMessages["~MESSAGE"], false, array(), array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "LIST" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "SMILES" => "Y", "UPLOAD" => "N", "NL2BR" => "N"))); } $arResult["NAV_STRING"] = $dbMessages->GetPageNavStringEx($navComponentObject, GetMessage("SONET_C31_NAV"), "", false); $arResult["NAV_CACHED_DATA"] = $navComponentObject->GetTemplateCachedData(); $arResult["NAV_RESULT"] = $dbMessages; }
/** * <p>Метод инициализирует массив прав пользователя на операции над профайлом заданного пользователя.</p> * * * @param int $currentUserID Код пользователя, права которого проверяются. * * @param int $userID Код пользователя, к профайлу которого осуществляется доступ. * * @param bool $bCurrentUserIsAdmin Флаг, является ли администратором пользователь, права которого * проверяются. * * @return array <p>Массив с ключами:<br><b>IsCurrentUser</b> - флаг, осуществляется ли доступ к * собственному профайлу,<br><b>Relation</b> - отношения между * пользователями,<br><b>Operations</b> - массив операций: <br> modifyuser - право на * изменение профайла, если в главном модуле разрешено * редактировать профиль,<br> modifyuser_main - право на изменение * профайла,<br> viewcontacts - право на просмотр контактной информации,<br> * invitegroup - приглашение в группу, <br> message - отправка персонального * сообщения, <br> viewfriends - просмотр друзей, <br> viewgroups - просмотр групп, * <br> viewprofile - просмотр профиля. </p> <a name="examples"></a> * * <h4>Example</h4> * <pre> * Array * ( * [Operations] => Array * ( * [modifyuser] => 1 * [viewcontacts] => 1 * [invitegroup] => 1 * [message] => 1 * [viewfriends] => 1 * [viewgroups] => 1 * [viewprofile] => 1 * [modifyuser_main] => * ) * * [IsCurrentUser] => * [Relation] => * ) * </pre> * * * @static * @link http://dev.1c-bitrix.ru/api_help/socialnetwork/classes/csocnetuserperms/inituserperms.php * @author Bitrix */ public static function InitUserPerms($currentUserID, $userID, $bCurrentUserIsAdmin) { global $arSocNetUserOperations, $USER; $arReturn = array(); $currentUserID = IntVal($currentUserID); $userID = IntVal($userID); if ($userID <= 0) { return false; } $arReturn["Operations"] = array(); if ($currentUserID <= 0) { $arReturn["IsCurrentUser"] = false; $arReturn["Relation"] = false; $arReturn["Operations"]["modifyuser"] = false; $arReturn["Operations"]["viewcontacts"] = false; foreach ($arSocNetUserOperations as $operation => $defPerm) { $arReturn["Operations"][$operation] = CSocNetUserPerms::CanPerformOperation($currentUserID, $userID, $operation, false); } } else { $arReturn["IsCurrentUser"] = $currentUserID == $userID; if ($arReturn["IsCurrentUser"]) { $arReturn["Relation"] = false; } else { $arReturn["Relation"] = CSocNetUserRelations::GetRelation($currentUserID, $userID); } if ($bCurrentUserIsAdmin || $arReturn["IsCurrentUser"]) { $arReturn["Operations"]["modifyuser"] = true; $arReturn["Operations"]["viewcontacts"] = true; foreach ($arSocNetUserOperations as $operation => $defPerm) { $arReturn["Operations"][$operation] = true; } } else { $arReturn["Operations"]["modifyuser"] = false; if (CSocNetUser::IsFriendsAllowed()) { $arReturn["Operations"]["viewcontacts"] = $arReturn["Relation"] == SONET_RELATIONS_FRIEND; } else { $arReturn["Operations"]["viewcontacts"] = true; } foreach ($arSocNetUserOperations as $operation => $defPerm) { $arReturn["Operations"][$operation] = CSocNetUserPerms::CanPerformOperation($currentUserID, $userID, $operation, false); } } $arReturn["Operations"]["modifyuser_main"] = false; if ($arReturn["IsCurrentUser"]) { if ($USER->CanDoOperation('edit_own_profile')) { $arReturn["Operations"]["modifyuser_main"] = true; } } elseif ($USER->CanDoOperation('edit_all_users') || $USER->CanDoOperation('edit_subordinate_users') && count(array_diff(CUser::GetUserGroup($userID), CSocNetTools::GetSubordinateGroups($currentUserID))) <= 0) { $arReturn["Operations"]["modifyuser_main"] = true; } } return $arReturn; }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } $arParams['NAME_TEMPLATE'] = $arParams['NAME_TEMPLATE'] ? $arParams['NAME_TEMPLATE'] : CSite::GetNameFormat(); $bUseLogin = $arParams['SHOW_LOGIN'] != "N" ? true : false; $arResult["bUseLogin"] = $bUseLogin; $arResult['CAN_EDIT_USER'] = $USER->CanDoOperation('edit_all_users') || $USER->CanDoOperation('edit_subordinate_users') && count(array_diff(CUser::GetUserGroup($arParams["USER"]['ID']), CSocNetTools::GetSubordinateGroups())) == 0; $arResult['CAN_EDIT_USER_SELF'] = $USER->CanDoOperation('edit_own_profile') && $arParams["USER"]['ID'] == $USER->GetID(); $arResult['USER_PROP'] = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("USER", 0, LANGUAGE_ID); $arResult['CAN_MESSAGE'] = false; $arResult['CAN_VIDEO_CALL'] = false; $arResult['CAN_VIEW_PROFILE'] = false; if (CModule::IncludeModule('socialnetwork') && $GLOBALS["USER"]->IsAuthorized()) { $arResult["CurrentUserPerms"] = CSocNetUserPerms::InitUserPerms($GLOBALS["USER"]->GetID(), $arParams["USER"]["ID"], CSocNetUser::IsCurrentUserModuleAdmin()); if ($GLOBALS["USER"]->GetID() != $arParams["USER"]["ID"] && $arParams["USER"]["ACTIVE"] != "N" && CBXFeatures::IsFeatureEnabled("WebMessenger") && (IsModuleInstalled("im") || $arResult["CurrentUserPerms"]["Operations"]["message"])) { $arResult['CAN_MESSAGE'] = true; } if ($arResult["CurrentUserPerms"]["Operations"]["viewprofile"]) { $arResult['CAN_VIEW_PROFILE'] = true; } if ($GLOBALS["USER"]->GetID() != $arParams["USER"]["ID"] && $arResult["CurrentUserPerms"]["Operations"]["videocall"] && $arParams["USER"]["ACTIVE"] != "N") { $arResult['CAN_VIDEO_CALL'] = true; } if (!CModule::IncludeModule("video")) { $arResult['CAN_VIDEO_CALL'] = false; } elseif (!CVideo::CanUserMakeCall()) { $arResult['CAN_VIDEO_CALL'] = false; } }
$arCacheResult["Groups"]["List"] = false; $dbGroup = CSocNetGroup::GetList(array("DATE_ACTIVITY" => "DESC"), $arGroupFilter, false, $arNavParams, array("ID", "NAME", "DESCRIPTION", "IMAGE_ID", "VISIBLE", "OWNER_ID", "INITIATE_PERMS", "OPENED")); while ($arGroup = $dbGroup->GetNext()) { if ($arCacheResult["Groups"]["List"] == false) { $arCacheResult["Groups"]["List"] = array(); } $pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arGroup["ID"])); if (intval($arGroup["IMAGE_ID"]) <= 0) { $arGroup["IMAGE_ID"] = COption::GetOptionInt("socialnetwork", "default_group_picture", false, SITE_ID); } $arImageResized = false; $imageFile = CFile::GetFileArray($arGroup["IMAGE_ID"]); if ($imageFile !== false) { $arImageResized = CFile::ResizeImageGet($imageFile, array("width" => $arParams["THUMBNAIL_SIZE"], "height" => $arParams["THUMBNAIL_SIZE"]), BX_RESIZE_IMAGE_EXACT); } $arImage = CSocNetTools::InitImage($arGroup["IMAGE_ID"], 150, "/bitrix/images/socialnetwork/nopic_group_150.gif", 150, $pu, true); if ($arParams["PAGE"] == "group_request_group_search") { $arCurrentUserPerms4Group = CSocNetUserToGroup::InitUserPerms($arResult["User"]["ID"], array("ID" => $arGroup["ID"], "OWNER_ID" => $arGroup["OWNER_ID"], "INITIATE_PERMS" => $arGroup["INITIATE_PERMS"], "VISIBLE" => $arGroup["VISIBLE"], "OPENED" => $arGroup["OPENED"]), CSocNetUser::IsCurrentUserModuleAdmin()); } $arCacheResult["Groups"]["List"][] = array("GROUP_ID" => $arGroup["ID"], "GROUP_NAME" => $arGroup["NAME"], "GROUP_DESCRIPTION" => strlen($arGroup["DESCRIPTION"]) > 50 ? substr($arGroup["DESCRIPTION"], 0, 50) . "..." : $arGroup["DESCRIPTION"], "GROUP_PHOTO" => $arGroup["IMAGE_ID"], "GROUP_PHOTO_FILE" => $arImage["FILE"], "GROUP_PHOTO_IMG" => $arImage["IMG"], "GROUP_PHOTO_RESIZED" => $arImageResized, "GROUP_URL" => $pu, "GROUP_REQUEST_USER_URL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_REQUEST_USER"], array("group_id" => $arGroup["ID"], "user_id" => $arResult["UserRequest"]["ID"])), "CAN_INVITE2GROUP" => $arParams["PAGE"] != "user_groups" ? $arCurrentUserPerms4Group && $arCurrentUserPerms4Group["UserCanInitiate"] : false, "FULL" => array("DATE_CREATE_FORMATTED" => date($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($arGroup["DATE_CREATE"], CSite::GetDateFormat("FULL"))), "DATE_UPDATE_FORMATTED" => date($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($arGroup["DATE_UPDATE"], CSite::GetDateFormat("FULL"))), "DATE_ACTIVITY_FORMATTED" => date($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($arGroup["DATE_ACTIVITY"], CSite::GetDateFormat("FULL"))))); $arGroupID[] = $arGroup["ID"]; } if (CModule::IncludeModule("extranet") && !CExtranet::IsExtranetSite()) { $arExtranetGroupID = array(); $dbGroupTmp = CSocNetGroup::GetList(array(), array("ID" => $arGroupID, "SITE_ID" => CExtranet::GetExtranetSiteID()), false, false, array("ID")); while ($arGroupTmp = $dbGroupTmp->Fetch()) { $arExtranetGroupID[] = $arGroupTmp["ID"]; } if (count($arExtranetGroupID) > 0 && is_array($arCacheResult["Groups"]["List"])) { foreach ($arCacheResult["Groups"]["List"] as $key => $arGroupTmp) { $arCacheResult["Groups"]["List"][$key]["IS_EXTRANET"] = in_array($arGroupTmp["GROUP_ID"], $arExtranetGroupID) ? "Y" : "N";
$arResult["Events"] = false; $dbMessages = CSocNetMessages::GetMessagesUsers($GLOBALS["USER"]->GetID(), $arNavParams); while ($arMessages = $dbMessages->GetNext()) { if ($arResult["Events"] == false) { $arResult["Events"] = array(); } $pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arMessages["ID"])); $canViewProfile = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arMessages["ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin()); $canAnsver = $arMessages["ACTIVE"] != "N" && (IsModuleInstalled("im") || CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arMessages["ID"], "message", CSocNetUser::IsCurrentUserModuleAdmin())); $relation = CSocNetUserRelations::GetRelation($GLOBALS["USER"]->GetID(), $arMessages["ID"]); if (intval($arMessages["PERSONAL_PHOTO"]) <= 0) { switch ($arMessages["PERSONAL_GENDER"]) { case "M": $suffix = "male"; break; case "F": $suffix = "female"; break; default: $suffix = "unknown"; } $arMessages["PERSONAL_PHOTO"] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID); } $arImage = CSocNetTools::InitImage($arMessages["PERSONAL_PHOTO"], 100, "/bitrix/images/socialnetwork/nopic_user_100.gif", 100, $pu, $canViewProfile); $arResult["Events"][] = array("USER_ID" => $arMessages["ID"], "USER_NAME" => $arMessages["NAME"], "USER_LAST_NAME" => $arMessages["LAST_NAME"], "USER_SECOND_NAME" => $arMessages["SECOND_NAME"], "USER_LOGIN" => $arMessages["LOGIN"], "USER_PERSONAL_PHOTO" => $arMessages["PERSONAL_PHOTO"], "USER_PERSONAL_PHOTO_FILE" => $arImage["FILE"], "USER_PERSONAL_PHOTO_IMG" => $arImage["IMG"], "USER_PROFILE_URL" => $pu, "SHOW_PROFILE_LINK" => $canViewProfile, "SHOW_ANSWER_LINK" => $canAnsver, "ANSWER_LINK" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MESSAGE_FORM"], array("user_id" => $arMessages["ID"])), "CHAT_LINK" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MESSAGES_CHAT"], array("user_id" => $arMessages["ID"])), "BAN_LINK" => htmlspecialcharsbx($APPLICATION->GetCurUri("userID=" . $arMessages["ID"] . "&action=ban&" . bitrix_sessid_get() . "")), "SHOW_BAN_LINK" => !CSocNetUser::IsUserModuleAdmin($arMessages["ID"]) && $arMessages["ID"] != $GLOBALS["USER"]->GetID() && (!$relation || $relation != SONET_RELATIONS_BAN), "IS_ONLINE" => $arMessages["IS_ONLINE"] == "Y", "TOTAL" => $arMessages["TOTAL"], "MAX_DATE" => $arMessages["MAX_DATE"], "MAX_DATE_FORMAT" => $arMessages["MAX_DATE_FORMAT"], "UNREAD" => $arMessages["UNREAD"], "USER_MESSAGES_LINK" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MESSAGES_USERS_MESSAGES"], array("user_id" => $arMessages["ID"]))); } $arResult["NAV_STRING"] = $dbMessages->GetPageNavStringEx($navComponentObject, GetMessage("SONET_C30_NAV"), "", false); $arResult["NAV_CACHED_DATA"] = $navComponentObject->GetTemplateCachedData(); $arResult["NAV_RESULT"] = $dbMessages; } $this->IncludeComponentTemplate();
$arResult['IS_ABSENT'] = CIntranetUtils::IsUserAbsent($arResult["User"]['ID']); } if (intval($arResult["User"]["PERSONAL_PHOTO"]) <= 0) { switch ($arResult["User"]["PERSONAL_GENDER"]) { case "M": $suffix = "male"; break; case "F": $suffix = "female"; break; default: $suffix = "unknown"; } $arResult["User"]["PERSONAL_PHOTO"] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID); } $arImage = CSocNetTools::InitImage($arResult["User"]["PERSONAL_PHOTO"], 50, "/bitrix/images/socialnetwork/nopic_user_50.gif", 50, $arResult["CurrentUserPerms"]["Operations"]["viewprofile"] ? $arResult["Urls"]["User"] : "", true, 'target="_blank"'); $arResult["User"]["PersonalPhotoFile"] = $arImage["FILE"]; $arResult["User"]["PersonalPhotoImg"] = $arImage["IMG"]; $arResult["ChatLastDate"] = CSocNetMessages::GetChatLastDate($GLOBALS["USER"]->GetID(), $arResult["User"]["ID"]); $arResult["REPLY_MESSAGE_ID"] = intval($arParams["MESSAGE_ID"]); } } //common part if (StrLen($arResult["FatalError"]) <= 0) { //intranet structure $arResult["Structure"] = false; if (IsModuleInstalled('intranet') && CModule::IncludeModule('iblock') && (!CModule::IncludeModule('extranet') || !CExtranet::IsExtranetSite())) { if (($iblock_id = COption::GetOptionInt('intranet', 'iblock_structure', 0)) > 0) { $arResult["Structure"] = array(); $sec = CIBlockSection::GetList(array("left_margin" => "asc", "SORT" => "ASC"), array("ACTIVE" => "Y", "CNT_ACTIVE" => "Y", "IBLOCK_ID" => $iblock_id), true); while ($ar = $sec->GetNext()) {
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'] : ' '), '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; }
$arResult["Requests"]["List"] = false; while ($arRequests = $dbRequests->GetNext()) { if ($arResult["Requests"]["List"] == false) { $arResult["Requests"]["List"] = array(); } $pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arRequests["USER_ID"])); $canViewProfile = CSocNetUserPerms::CanPerformOperation($USER->GetID(), $arRequests["USER_ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin()); if (intval($arRequests["USER_PERSONAL_PHOTO"]) <= 0) { switch ($arRequests["USER_PERSONAL_GENDER"]) { case "M": $suffix = "male"; break; case "F": $suffix = "female"; break; default: $suffix = "unknown"; } $arRequests["USER_PERSONAL_PHOTO"] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID); } $arImage = CSocNetTools::InitImage($arRequests["USER_PERSONAL_PHOTO"], 150, "/bitrix/images/socialnetwork/nopic_user_150.gif", 150, $pu, $canViewProfile); $arResult["Requests"]["List"][] = array("ID" => $arRequests["ID"], "USER_ID" => $arRequests["USER_ID"], "USER_NAME" => $arRequests["USER_NAME"], "USER_LAST_NAME" => $arRequests["USER_LAST_NAME"], "USER_SECOND_NAME" => $arRequests["USER_SECOND_NAME"], "USER_LOGIN" => $arRequests["USER_LOGIN"], "USER_PERSONAL_PHOTO" => $arRequests["USER_PERSONAL_PHOTO"], "USER_PERSONAL_PHOTO_FILE" => $arImage["FILE"], "USER_PERSONAL_PHOTO_IMG" => $arImage["IMG"], "USER_PROFILE_URL" => $pu, "SHOW_PROFILE_LINK" => $canViewProfile, "DATE_CREATE" => FormatDateFromDB($arRequests["DATE_CREATE"]), "MESSAGE" => $parser->convert($arRequests["~MESSAGE"], false, array(), array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "LIST" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "SMILES" => "Y", "UPLOAD" => "N", "NL2BR" => "N"))); } $arResult["NAV_STRING"] = $dbRequests->GetPageNavStringEx($navComponentObject, GetMessage("SONET_C12_NAV"), "", false); } } } } } } $this->IncludeComponentTemplate();
$userProp = array(); if (!empty($arRes)) { foreach ($arRes as $key => $val) { $userProp[$val["FIELD_NAME"]] = strLen($val["EDIT_FORM_LABEL"]) > 0 ? $val["EDIT_FORM_LABEL"] : $val["FIELD_NAME"]; } } $userProp1 = array("LOGIN" => GetMessage("MAIN_UL_P_LOGIN"), "NAME" => GetMessage("MAIN_UL_P_NAME"), "SECOND_NAME" => GetMessage("MAIN_UL_P_SECOND_NAME"), "LAST_NAME" => GetMessage("MAIN_UL_P_LAST_NAME"), "EMAIL" => GetMessage("MAIN_UL_P_EMAIL"), "LAST_LOGIN" => GetMessage("MAIN_UL_P_LAST_LOGIN"), "DATE_REGISTER" => GetMessage("MAIN_UL_P_DATE_REGISTER"), "PERSONAL_BIRTHDAY" => GetMessage("MAIN_UL_P_PERSONAL_BIRTHDAY"), "PERSONAL_PROFESSION" => GetMessage("MAIN_UL_P_PERSONAL_PROFESSION"), "PERSONAL_WWW" => GetMessage("MAIN_UL_P_PERSONAL_WWW"), "PERSONAL_ICQ" => GetMessage("MAIN_UL_P_PERSONAL_ICQ"), "PERSONAL_GENDER" => GetMessage("MAIN_UL_P_PERSONAL_GENDER"), "PERSONAL_PHOTO" => GetMessage("MAIN_UL_P_PERSONAL_PHOTO"), "PERSONAL_NOTES" => GetMessage("MAIN_UL_P_PERSONAL_NOTES"), "PERSONAL_PHONE" => GetMessage("MAIN_UL_P_PERSONAL_PHONE"), "PERSONAL_FAX" => GetMessage("MAIN_UL_P_PERSONAL_FAX"), "PERSONAL_MOBILE" => GetMessage("MAIN_UL_P_PERSONAL_MOBILE"), "PERSONAL_PAGER" => GetMessage("MAIN_UL_P_PERSONAL_PAGER"), "PERSONAL_COUNTRY" => GetMessage("MAIN_UL_P_PERSONAL_COUNTRY"), "PERSONAL_STATE" => GetMessage("MAIN_UL_P_PERSONAL_STATE"), "PERSONAL_CITY" => GetMessage("MAIN_UL_P_PERSONAL_CITY"), "PERSONAL_ZIP" => GetMessage("MAIN_UL_P_PERSONAL_ZIP"), "PERSONAL_STREET" => GetMessage("MAIN_UL_P_PERSONAL_STREET"), "PERSONAL_MAILBOX" => GetMessage("MAIN_UL_P_PERSONAL_MAILBOX"), "WORK_COMPANY" => GetMessage("MAIN_UL_P_WORK_COMPANY"), "WORK_DEPARTMENT" => GetMessage("MAIN_UL_P_WORK_DEPARTMENT"), "WORK_POSITION" => GetMessage("MAIN_UL_P_WORK_POSITION"), "WORK_WWW" => GetMessage("MAIN_UL_P_WORK_WWW"), "WORK_PROFILE" => GetMessage("MAIN_UL_P_WORK_PROFILE"), "WORK_LOGO" => GetMessage("MAIN_UL_P_WORK_LOGO"), "WORK_NOTES" => GetMessage("MAIN_UL_P_WORK_NOTES"), "WORK_PHONE" => GetMessage("MAIN_UL_P_WORK_PHONE"), "WORK_FAX" => GetMessage("MAIN_UL_P_WORK_FAX"), "WORK_PAGER" => GetMessage("MAIN_UL_P_WORK_PAGER"), "WORK_COUNTRY" => GetMessage("MAIN_UL_P_WORK_COUNTRY"), "WORK_STATE" => GetMessage("MAIN_UL_P_WORK_STATE"), "WORK_CITY" => GetMessage("MAIN_UL_P_WORK_CITY"), "WORK_ZIP" => GetMessage("MAIN_UL_P_WORK_ZIP"), "WORK_STREET" => GetMessage("MAIN_UL_P_WORK_STREET"), "WORK_MAILBOX" => GetMessage("MAIN_UL_P_WORK_MAILBOX")); } $arNameTemplate = array('#LAST_NAME# #NAME#' => GetMessage('MAIN_UL_P_NAME_TEMPLATE_SMITH_JOHN'), '#LAST_NAME# #NAME# #SECOND_NAME#' => GetMessage('MAIN_UL_P_NAME_TEMPLATE_SMITH_JOHN_LLOYD'), '#LAST_NAME#, #NAME# #SECOND_NAME#' => GetMessage('MAIN_UL_P_NAME_TEMPLATE_SMITH_COMMA_JOHN_LLOYD'), '#NAME# #SECOND_NAME# #LAST_NAME#' => GetMessage('MAIN_UL_P_NAME_TEMPLATE_JOHN_LLOYD_SMITH'), '#NAME_SHORT# #SECOND_NAME_SHORT# #LAST_NAME#' => GetMessage('MAIN_UL_P_NAME_TEMPLATE_J_L_SMITH'), '#NAME_SHORT# #LAST_NAME#' => GetMessage('MAIN_UL_P_NAME_TEMPLATE_J_SMITH'), '#LAST_NAME# #NAME_SHORT#' => GetMessage('MAIN_UL_P_NAME_TEMPLATE_SMITH_J'), '#LAST_NAME# #NAME_SHORT# #SECOND_NAME_SHORT#' => GetMessage('MAIN_UL_P_NAME_TEMPLATE_SMITH_J_L'), '#LAST_NAME#, #NAME_SHORT#' => GetMessage('MAIN_UL_P_NAME_TEMPLATE_SMITH_COMMA_J'), '#LAST_NAME#, #NAME_SHORT# #SECOND_NAME_SHORT#' => GetMessage('MAIN_UL_P_NAME_TEMPLATE_SMITH_COMMA_J_L'), '#NAME# #LAST_NAME#' => GetMessage('MAIN_UL_P_NAME_TEMPLATE_JOHN_SMITH'), '#NAME# #SECOND_NAME_SHORT# #LAST_NAME#' => GetMessage('MAIN_UL_P_NAME_TEMPLATE_JOHN_L_SMITH'), '' => GetMessage('MAIN_UL_P_NAME_TEMPLATE_SITE')); $arComponentParameters = array("PARAMETERS" => array("CACHE_TIME" => array("DEFAULT" => "7200"), "ID" => array("PARENT" => "BASE", "NAME" => GetMessage("MAIN_UL_P_USER_ID"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => ""), 'NAME_TEMPLATE' => array('TYPE' => 'LIST', 'NAME' => GetMessage('MAIN_UL_P_NAME_TEMPLATE'), 'VALUES' => $arNameTemplate, 'MULTIPLE' => 'N', 'ADDITIONAL_VALUES' => 'Y', 'DEFAULT' => "", 'PARENT' => 'BASE'), 'SHOW_LOGIN' => array('TYPE' => 'CHECKBOX', 'NAME' => GetMessage('MAIN_UL_P_SHOW_LOGIN'), 'VALUE' => 'Y', 'DEFAULT' => 'Y', 'PARENT' => 'BASE'), 'USE_THUMBNAIL_LIST' => array('TYPE' => 'CHECKBOX', 'NAME' => GetMessage('MAIN_UL_P_USE_THUMBNAIL_SMALL'), 'DEFAULT' => 'Y', 'PARENT' => 'BASE', "REFRESH" => 'Y'))); if ($arCurrentValues["USE_THUMBNAIL_LIST"] == "Y") { $arComponentParameters["PARAMETERS"]["THUMBNAIL_LIST_SIZE"] = array("PARENT" => "VISUAL", "NAME" => GetMessage("MAIN_UL_P_THUMBNAIL_SIZE_SMALL"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "30"); } if ($bSocNet && CModule::IncludeModule('socialnetwork')) { if (is_array($arCurrentValues['SHOW_FIELDS']) && in_array("PERSONAL_PHOTO", $arCurrentValues['SHOW_FIELDS'])) { $arComponentParameters["PARAMETERS"]["THUMBNAIL_DETAIL_SIZE"] = array("PARENT" => "VISUAL", "NAME" => GetMessage("MAIN_UL_P_THUMBNAIL_SIZE_LARGE"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "100"); } if (IsModuleInstalled('intranet')) { $arUserFieldsDef = array("EMAIL", "PERSONAL_MOBILE", "WORK_PHONE", "PERSONAL_ICQ", "PERSONAL_PHOTO", "PERSONAL_CITY", "WORK_COMPANY", "WORK_POSITION"); $arUserPropsDef = array("UF_DEPARTMENT", "UF_PHONE_INNER"); } else { $arUserFieldsDef = array("PERSONAL_ICQ", "PERSONAL_BIRTHDAY", "PERSONAL_PHOTO", "PERSONAL_CITY", "WORK_COMPANY", "WORK_POSITION"); $arUserPropsDef = array(); } $arComponentParameters["PARAMETERS"]["SHOW_FIELDS"] = array("PARENT" => "BASE", "NAME" => GetMessage("MAIN_UL_P_SHOW_FIELDS"), "TYPE" => "LIST", "VALUES" => $userProp1, "MULTIPLE" => "Y", "DEFAULT" => $arUserFieldsDef, "REFRESH" => 'Y'); $arComponentParameters["PARAMETERS"]["USER_PROPERTY"] = array("PARENT" => "BASE", "NAME" => GetMessage("MAIN_UL_P_USER_PROPERTY"), "TYPE" => "LIST", "VALUES" => $userProp, "MULTIPLE" => "Y", "DEFAULT" => $arUserPropsDef); $arComponentParameters["PARAMETERS"]["PATH_TO_SONET_USER_PROFILE"] = array("NAME" => GetMessage("MAIN_UL_P_PATH_TO_SONET_USER_PROFILE"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "", "COLS" => 25, "PARENT" => "URL_TEMPLATES"); $arComponentParameters["PARAMETERS"]["PROFILE_URL"] = array("NAME" => GetMessage("MAIN_UL_P_PROFILE_URL"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "", "COLS" => 25, "PARENT" => "BASE"); $arComponentParameters["PARAMETERS"]["DATE_TIME_FORMAT"] = array("PARENT" => "VISUAL", "NAME" => GetMessage("MAIN_UL_P_DATE_TIME_FORMAT"), "TYPE" => "LIST", "VALUES" => CSocNetTools::GetDateTimeFormat(), "MULTIPLE" => "N", "DEFAULT" => $GLOBALS["DB"]->DateFormatToPHP(CSite::GetDateFormat("FULL")), "ADDITIONAL_VALUES" => "Y"); $arComponentParameters["PARAMETERS"]["SHOW_YEAR"] = array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("MAIN_UL_P_SHOW_YEAR"), "TYPE" => "LIST", "VALUES" => array("Y" => GetMessage("MAIN_UL_P_SHOW_YEAR_VALUE_Y"), "M" => GetMessage("MAIN_UL_P_SHOW_YEAR_VALUE_M"), "N" => GetMessage("MAIN_UL_P_SHOW_YEAR_VALUE_N")), "MULTIPLE" => "N", "DEFAULT" => "Y"); }
public static function InitGroupTmp($groupID, $arParams, $bRSS = false) { $title = ""; $message = ""; $arGroup = CSocNetGroup::GetByID($groupID); if ($arGroup) { $pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arGroup["ID"])); if (!$bRSS) $title .= "<a href=\"".$pu."\">"; $title .= $arGroup["NAME"]; if (!$bRSS) $title .= "</a>"; if (intval($arGroup["IMAGE_ID"]) <= 0) $arGroup["IMAGE_ID"] = COption::GetOptionInt("socialnetwork", "default_group_picture", false, SITE_ID); $arImage = CSocNetTools::InitImage($arGroup["IMAGE_ID"], 100, "/bitrix/images/socialnetwork/nopic_group_100.gif", 100, $pu, true); $message = $arImage["IMG"]; } return array($title, $message); }
} elseif (in_array('PASSWORD', $arParams['EDITABLE_FIELDS'])) { $arParams['EDITABLE_FIELDS'][] = 'CONFIRM_PASSWORD'; } if (!is_array($arResult["User"])) { $arResult["FATAL_ERROR"] = GetMessage("SONET_P_USER_NO_USER"); } else { $arResult["GROUPS_CAN_EDIT"] = array(); if ($USER->CanDoOperation('edit_all_users') || $USER->CanDoOperation('edit_subordinate_users')) { if ($USER->CanDoOperation('edit_all_users')) { $dbGroup = CGroup::GetList($by = "c_sort", $order = "asc", array("ACTIVE" => "Y")); while ($arGroup = $dbGroup->Fetch()) { $arResult["GROUPS_CAN_EDIT"][$arGroup["ID"]] = $arGroup; $arGroupsCanEditID[] = $arGroup["ID"]; } } elseif ($USER->CanDoOperation('edit_subordinate_users')) { $arGroupsCanEditID = CSocNetTools::GetSubordinateGroups(); if (is_array($arGroupsCanEditID) && count($arGroupsCanEditID) > 0) { $dbGroup = CGroup::GetList($by = "c_sort", $order = "asc", array("ID" => implode(" | ", $arGroupsCanEditID), "ACTIVE" => "Y")); while ($arGroup = $dbGroup->Fetch()) { $arResult["GROUPS_CAN_EDIT"][$arGroup["ID"]] = $arGroup; } } } } else { foreach ($arParams['EDITABLE_FIELDS'] as $key => $value) { if ($value == 'GROUP_ID' || $value == 'ACTIVE') { unset($arParams['EDITABLE_FIELDS'][$key]); } } } if ($arParams['IS_FORUM'] == 'Y') {