本文整理汇总了PHP中CSocNetLogTools类的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetLogTools类的具体用法?PHP CSocNetLogTools怎么用?PHP CSocNetLogTools使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CSocNetLogTools类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FormatEvent
public static function FormatEvent($arFields, $arParams, $bMail = false)
{
global $APPLICATION, $CACHE_MANAGER;
$arResult = array("EVENT" => $arFields);
if (defined("BX_COMP_MANAGED_CACHE")) {
$CACHE_MANAGER->RegisterTag("CALENDAR_EVENT_" . intval($arFields["SOURCE_ID"]));
$CACHE_MANAGER->RegisterTag("CALENDAR_EVENT_LIST");
}
$eventViewResult = $APPLICATION->IncludeComponent('bitrix:calendar.livefeed.view', '', array("EVENT_ID" => $arFields["SOURCE_ID"], "USER_ID" => $arFields["USER_ID"], "PATH_TO_USER" => $arParams["PATH_TO_USER"], "MOBILE" => $arParams["MOBILE"]), null, array('HIDE_ICONS' => 'Y'));
$arResult["EVENT_FORMATTED"] = array("TITLE" => GetMessage("EC_EDEV_EVENT"), "TITLE_24" => GetMessage("EC_EDEV_EVENT"), "URL" => "javascript:BX.StartSlider(" . $arFields["USER_ID"] . "," . $arFields["SOURCE_ID"] . ");", "MESSAGE" => $eventViewResult['MESSAGE'], "FOOTER_MESSAGE" => $eventViewResult['FOOTER_MESSAGE'], "IS_IMPORTANT" => false, "STYLE" => "calendar-confirm");
$eventId = $arFields["SOURCE_ID"];
if (!$eventId) {
$eventId = 0;
}
$editUrl = CCalendar::GetPath('user', $arFields["USER_ID"]);
$editUrl = $editUrl . (strpos($editUrl, "?") === false ? '?' : '&') . 'EVENT_ID=EDIT' . $eventId;
$arRights = array();
$dbRight = CSocNetLogRights::GetList(array(), array("LOG_ID" => $arFields["ID"]));
while ($arRight = $dbRight->Fetch()) {
$arRights[] = $arRight["GROUP_CODE"];
}
$arResult["EVENT_FORMATTED"]["DESTINATION"] = CSocNetLogTools::FormatDestinationFromRights($arRights, array_merge($arParams, array("CREATED_BY" => $arFields["USER_ID"])));
if (isset($eventViewResult['CACHED_JS_PATH'])) {
$arResult['CACHED_JS_PATH'] = $eventViewResult['CACHED_JS_PATH'];
}
$arResult['ENTITY']['FORMATTED']["NAME"] = "ENTITY FORMATTED NAME";
$arResult['ENTITY']['FORMATTED']["URL"] = COption::GetOptionString("timeman", "WORK_REPORT_PATH", "/company/work_report.php");
$arResult['AVATAR_SRC'] = CSocNetLog::FormatEvent_CreateAvatar($arFields, $arParams, 'CREATED_BY');
$arFieldsTooltip = array('ID' => $arFields['USER_ID'], 'NAME' => $arFields['~CREATED_BY_NAME'], 'LAST_NAME' => $arFields['~CREATED_BY_LAST_NAME'], 'SECOND_NAME' => $arFields['~CREATED_BY_SECOND_NAME'], 'LOGIN' => $arFields['~CREATED_BY_LOGIN']);
$arResult['CREATED_BY']['TOOLTIP_FIELDS'] = CSocNetLog::FormatEvent_FillTooltip($arFieldsTooltip, $arParams);
return $arResult;
}
示例2: array
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
echo "B_PROLOG_INCLUDED error!";
die;
}
if (!CModule::IncludeModule("xdimport") || !CModule::IncludeModule("socialnetwork")) {
echo "Error loading modules!";
return;
}
if (strlen($_POST["hash"]) > 0) {
$rsScheme = CXDILFScheme::GetList(array(), array("ACTIVE" => "Y", "HASH" => $_POST["hash"]));
if ($arScheme = $rsScheme->Fetch()) {
if (strlen($_POST["title"]) > 0 && strlen($_POST["message"]) > 0) {
if (XDI_DEBUG) {
CXDImport::WriteToLog("Successful POST request, scheme ID: " . $arScheme["ID"], "RXML");
}
$arEventTmp = CSocNetLogTools::FindLogEventByID($arScheme["EVENT_ID"]);
if (array_key_exists("REAL_EVENT_ID", $arEventTmp) && strlen($arEventTmp["REAL_EVENT_ID"]) > 0) {
$arScheme["EVENT_ID"] = $arEventTmp["REAL_EVENT_ID"];
}
if ($arScheme["EVENT_ID"] == "news" && CModule::IncludeModule("iblock")) {
$arLogParams = array("SCHEME_ID" => $arScheme["ID"]);
$strParams = CharsetConverter::ConvertCharset($_POST["params"], CXDImport::DetectUTF8($_POST["params"]) ? "utf-8" : "windows-1251", SITE_CHARSET);
$arParamPairs = explode("&", $strParams);
if (is_array($arParamPairs)) {
foreach ($arParamPairs as $strPair) {
list($key, $value) = explode("=", $strPair);
if (strlen($key) > 0 && strlen($value) > 0) {
$arLogParams[$key] = $value;
}
}
}
示例3: GetUserCache
public static function GetUserCache($user_id)
{
return CSocNetLogTools::GetUserCache("log", $user_id);
}
示例4: BeforeIndexForum
function BeforeIndexForum($arFields, $entity_type, $entity_id, $feature, $operation, $path_template)
{
global $USER;
static $arSiteData;
$SECTION_ID = "";
$ELEMENT_ID = intval($_REQUEST["photo_element_id"]);
if (empty($ELEMENT_ID)) {
$ELEMENT_ID = intval($_REQUEST["ELEMENT_ID"]);
}
if ($ELEMENT_ID > 0 && CModule::IncludeModule('iblock')) {
$rsSections = CIBlockElement::GetElementGroups($ELEMENT_ID, true);
$arSection = $rsSections->Fetch();
if ($arSection) {
$SECTION_ID = $arSection["ID"];
}
}
if (count($arFields["LID"]) > 1 && ($entity_type == SONET_ENTITY_GROUP && CModule::IncludeModule("extranet") || $entity_type == SONET_ENTITY_USER)) {
if (!$arSiteData) {
$arSiteData = CSocNetLogTools::GetSiteData();
}
foreach ($arSiteData as $siteId => $arUrl) {
if ($entity_type == SONET_ENTITY_GROUP && strpos($path_template, $arUrl["GROUPS_PATH"]) === 0) {
$path_template = str_replace($arUrl["GROUPS_PATH"], "#GROUP_PATH#", $path_template);
break;
} elseif ($entity_type == SONET_ENTITY_USER && strpos($path_template, $arUrl["USER_PATH"]) === 0) {
$path_template = str_replace($arUrl["USER_PATH"], "#USER_PATH#", $path_template);
break;
}
}
}
foreach ($arFields["LID"] as $site_id => $url) {
$arFields["URL"] = $arFields["LID"][$site_id] = str_replace(array("#user_id#", "#group_id#", "#topic_id#", "#message_id#", "#action#", "#user_alias#", "#section_id#", "#element_id#", "#task_id#", "#GROUP_PATH#", "#USER_PATH#"), array($this->_user_id > 0 ? $this->_user_id : $USER->GetID(), $this->_group_id, $arFields["PARAM2"], $arFields["ITEM_ID"], "view", ($entity_type == "G" ? "group_" : "user_") . $entity_id, $SECTION_ID, $ELEMENT_ID, $ELEMENT_ID, $arSiteData ? $arSiteData[$site_id]["GROUPS_PATH"] : "", $arSiteData ? $arSiteData[$site_id]["USER_PATH"] : ""), $path_template);
}
if ($feature == 'tasks' && COption::GetOptionString("intranet", "use_tasks_2_0", "N") == 'Y' && $arFields["PARAM1"] == COption::GetOptionString("tasks", "task_forum_id", 0) && CModule::IncludeModule('tasks')) {
if (!preg_match('/^EVENT_[0-9]+/', $arFields["TITLE"], $match)) {
$rsTask = CTasks::GetList(array(), array("FORUM_TOPIC_ID" => $arFields['PARAM2']));
if ($arTask = $rsTask->Fetch()) {
$arFields['PERMISSIONS'] = CTasks::__GetSearchPermissions($arTask);
}
}
} else {
$arFields["PERMISSIONS"] = $this->GetSearchGroups($entity_type, $entity_id, $feature, $operation);
$paramsTmp = $this->GetSearchParams($entity_type, $entity_id, $feature, $operation);
$arFields["PARAMS"] = !empty($arFields["PARAMS"]) ? array_merge($paramsTmp, $arFields["PARAMS"]) : $paramsTmp;
}
return $arFields;
}
示例5: SetSource
function SetSource($arFields)
{
$arCallback = false;
$arEvent = CSocNetLogTools::FindLogCommentEventByID($arFields["EVENT_ID"]);
if ($arEvent) {
$arCallback = $arEvent["ADD_CALLBACK"];
}
if ($arCallback && is_callable($arCallback)) {
$arSource = call_user_func_array($arCallback, array($arFields));
}
return $arSource;
}
示例6: NotifyImToModerators
function NotifyImToModerators($arNotifyParams)
{
if (!CModule::IncludeModule("im")) {
return;
}
if (!is_array($arNotifyParams) || !array_key_exists("TYPE", $arNotifyParams) || !in_array($arNotifyParams["TYPE"], array("join", "unjoin", "exclude", "moderate", "unmoderate", "owner")) || !array_key_exists("USER_ID", $arNotifyParams) || intval($arNotifyParams["USER_ID"]) <= 0 || !array_key_exists("GROUP_ID", $arNotifyParams) || intval($arNotifyParams["GROUP_ID"]) <= 0 || !array_key_exists("RELATION_ID", $arNotifyParams) || intval($arNotifyParams["RELATION_ID"]) <= 0 || !array_key_exists("GROUP_NAME", $arNotifyParams) || strlen($arNotifyParams["GROUP_NAME"]) <= 0) {
return;
}
switch ($arNotifyParams["TYPE"]) {
case "join":
$from_user_id = $arNotifyParams["USER_ID"];
$message_code = "SONET_UG_IM_JOIN";
$schema_code = "inout_group";
$notify_tag = "INOUT_GROUP";
break;
case "unjoin":
$from_user_id = $arNotifyParams["USER_ID"];
$message_code = "SONET_UG_IM_UNJOIN";
$schema_code = "inout_group";
$notify_tag = "INOUT_GROUP";
break;
case "exclude":
$from_user_id = $arNotifyParams["USER_ID"];
$message_code = "SONET_UG_IM_EXCLUDE";
$schema_code = "inout_group";
$notify_tag = "INOUT_GROUP";
break;
case "moderate":
$from_user_id = $arNotifyParams["USER_ID"];
$message_code = "SONET_UG_IM_MODERATE";
$schema_code = "moderators_group";
$notify_tag = "MOD_GROUP";
break;
case "unmoderate":
$from_user_id = $arNotifyParams["USER_ID"];
$message_code = "SONET_UG_IM_UNMODERATE";
$schema_code = "moderators_group";
$notify_tag = "MOD_GROUP";
break;
case "owner":
$from_user_id = $arNotifyParams["USER_ID"];
$message_code = "SONET_UG_IM_OWNER";
$schema_code = "owner_group";
$notify_tag = "OWNER_GROUP";
break;
default:
}
$rsUser = CUser::GetByID($arNotifyParams["USER_ID"]);
if ($arUser = $rsUser->Fetch()) {
switch ($arUser["PERSONAL_GENDER"]) {
case "M":
$gender_suffix = "_M";
break;
case "F":
$gender_suffix = "_F";
break;
default:
$gender_suffix = "";
}
}
$arToUserID = array();
$rsUserToGroup = CSocNetUserToGroup::GetList(array(), array("GROUP_ID" => $arNotifyParams["GROUP_ID"], "USER_ACTIVE" => "Y", "<=ROLE" => SONET_ROLES_MODERATOR), false, false, array("USER_ID"));
while ($arUserToGroup = $rsUserToGroup->Fetch()) {
$arToUserID[] = $arUserToGroup["USER_ID"];
}
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "FROM_USER_ID" => $from_user_id, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "socialnetwork", "NOTIFY_EVENT" => $schema_code, "LOG_ID" => $arEntry["LOG_ID"], "NOTIFY_TAG" => "SOCNET|" . $notify_tag . "|" . intval($arNotifyParams["USER_ID"]) . "|" . intval($arNotifyParams["GROUP_ID"]) . "|" . intval($arNotifyParams["RELATION_ID"]));
$groups_path = COption::GetOptionString("socialnetwork", "workgroups_page", SITE_DIR . "workgroups/");
$group_url_template = str_replace($groups_path, "#GROUPS_PATH#", COption::GetOptionString("socialnetwork", "group_path_template", SITE_DIR . "workgroups/group/#group_id#/"));
$groupUrl = str_replace("#group_id#", $arNotifyParams["GROUP_ID"], $group_url_template);
foreach ($arToUserID as $to_user_id) {
if (is_array($arNotifyParams["EXCLUDE_USERS"]) && in_array($to_user_id, $arNotifyParams["EXCLUDE_USERS"]) || $to_user_id == $from_user_id) {
continue;
}
$arMessageFields["TO_USER_ID"] = $to_user_id;
$arTmp = CSocNetLogTools::ProcessPath(array("GROUP_PAGE" => $groupUrl), $to_user_id, SITE_ID);
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage($message_code . $gender_suffix, array("#group_name#" => "<a href=\"" . $arTmp["URLS"]["GROUP_PAGE"] . "\" class=\"bx-notifier-item-action\">" . $arNotifyParams["GROUP_NAME"] . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage($message_code . $gender_suffix, array("#group_name#" => $arNotifyParams["GROUP_NAME"])) . " (" . $arTmp["SERVER_NAME"] . $arTmp["URLS"]["GROUP_PAGE"] . ")";
CIMNotify::Add($arMessageFields);
}
}
示例7: NotifyGroup
public static function NotifyGroup($arFields)
{
if (!CModule::IncludeModule("im")) {
return;
}
if (!is_array($arFields["GROUP_ID"])) {
$arFields["GROUP_ID"] = array($arFields["GROUP_ID"]);
}
if (empty($arFields["GROUP_ID"])) {
return;
}
if (empty($arFields["EXCLUDE_USERS"])) {
$arFields["EXCLUDE_USERS"] = array();
}
if (intval($arFields["LOG_ID"]) > 0) {
$rsUnFollower = CSocNetLogFollow::GetList(array("CODE" => "L" . intval($arFields["LOG_ID"]), "TYPE" => "N"), array("USER_ID"));
while ($arUnFollower = $rsUnFollower->Fetch()) {
$arFields["EXCLUDE_USERS"][] = $arUnFollower["USER_ID"];
}
$arFields["EXCLUDE_USERS"] = array_unique($arFields["EXCLUDE_USERS"]);
}
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "socialnetwork", "NOTIFY_EVENT" => "sonet_group_event", "NOTIFY_TAG" => "SONET|EVENT|" . (intval($arFields["LOG_ID"]) > 0 ? $arFields["LOG_ID"] : rand()));
if (intval($arFields["FROM_USER_ID"]) > 0) {
$arMessageFields["FROM_USER_ID"] = $arFields["FROM_USER_ID"];
}
$arUserToSend = array();
$arUserIDToSend = array();
$arGroupID = array();
$arCodes = array();
foreach ($arFields["GROUP_ID"] as $group_id) {
$arCodes[] = "SG" . $group_id;
}
$rsSubscriber = CSocNetSubscription::GetList(array(), array("CODE" => $arCodes), false, false, array("USER_ID", "CODE"));
while ($arSubscriber = $rsSubscriber->Fetch()) {
if (!in_array($arSubscriber["USER_ID"], $arFields["EXCLUDE_USERS"]) && !in_array($arSubscriber["USER_ID"], $arUserIDToSend)) {
if (preg_match('/^SG(\\d+)$/', $arSubscriber["CODE"], $matches)) {
$arUserToSend[] = array("USER_ID" => $arSubscriber["USER_ID"], "GROUP_ID" => $matches[1]);
$arUserIDToSend[] = $arSubscriber["USER_ID"];
$arGroupID[] = $matches[1];
}
}
}
$rsGroup = CSocNetGroup::GetList(array(), array("ID" => $arGroupID), false, false, array("ID", "NAME", "OWNER_ID"));
while ($arGroup = $rsGroup->GetNext()) {
$arGroups[$arGroup["ID"]] = $arGroup;
}
$workgroupsPage = COption::GetOptionString("socialnetwork", "workgroups_page", "/workgroups/", SITE_ID);
$groupUrlTemplate = COption::GetOptionString("socialnetwork", "group_path_template", "/workgroups/group/#group_id#/", SITE_ID);
$groupUrlTemplate = "#GROUPS_PATH#" . substr($groupUrlTemplate, strlen($workgroupsPage), strlen($groupUrlTemplate) - strlen($workgroupsPage));
foreach ($arUserToSend as $arUser) {
$arMessageFields["TO_USER_ID"] = $arUser["USER_ID"];
$arTmp = CSocNetLogTools::ProcessPath(array("URL" => $arFields["URL"], "GROUP_URL" => str_replace(array("#group_id#", "#GROUP_ID#"), $arUser["GROUP_ID"], $groupUrlTemplate)), $arUser["USER_ID"]);
$url = $arTmp["URLS"]["URL"];
if (strpos($url, "http://") === 0 || strpos($url, "https://") === 0) {
$serverName = "";
} else {
$serverName = $arTmp["SERVER_NAME"];
}
$groupUrl = $serverName . $arTmp["URLS"]["GROUP_URL"];
$group_name = array_key_exists($arUser["GROUP_ID"], $arGroups) ? $arGroups[$arUser["GROUP_ID"]]["NAME"] : "";
$arMessageFields["NOTIFY_MESSAGE"] = str_replace(array("#URL#", "#url#", "#group_name#", "#GROUP_ID#", "#group_id#"), array($url, $url, "<a href=\"" . $groupUrl . "\" class=\"bx-notifier-item-action\">" . $group_name . "</a>", $arUser["GROUP_ID"], $arUser["GROUP_ID"]), $arFields["MESSAGE"]);
$arMessageFields["NOTIFY_MESSAGE_OUT"] = str_replace(array("#URL#", "#url#", "#group_name#"), array($serverName . $url, $serverName . $url, $group_name), $arFields["MESSAGE_OUT"]);
$arMessageFields2Send = $arMessageFields;
if (!is_set($arMessageFields2Send["FROM_USER_ID"]) || intval($arMessageFields2Send["FROM_USER_ID"]) <= 0) {
$arMessageFields2Send["NOTIFY_TYPE"] = IM_NOTIFY_SYSTEM;
$arMessageFields2Send["FROM_USER_ID"] = 0;
}
CIMNotify::Add($arMessageFields2Send);
}
}
示例8: NotifyIm
public static function NotifyIm($arParams)
{
if (!CModule::IncludeModule("im")) {
return;
}
$arUsers = array();
$arUserIDSent = array();
if (!empty($arParams["TO_USER_ID"])) {
foreach ($arParams["TO_USER_ID"] as $val) {
$val = IntVal($val);
if ($val > 0 && $val != $arParams["FROM_USER_ID"]) {
$arUsers[] = $val;
}
}
}
if (!empty($arParams["TO_SOCNET_RIGHTS"])) {
foreach ($arParams["TO_SOCNET_RIGHTS"] as $v) {
if (substr($v, 0, 1) == "U") {
$u = IntVal(substr($v, 1));
if ($u > 0 && !in_array($u, $arUsers) && (!array_key_exists("U", $arParams["TO_SOCNET_RIGHTS_OLD"]) || empty($arParams["TO_SOCNET_RIGHTS_OLD"]["U"][$u])) && $u != $arParams["FROM_USER_ID"]) {
$arUsers[] = $u;
}
}
}
}
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => "", "FROM_USER_ID" => $arParams["FROM_USER_ID"], "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "blog");
$aditGM = "";
if (IntVal($arParams["FROM_USER_ID"]) > 0) {
$dbUser = CUser::GetByID($arParams["FROM_USER_ID"]);
if ($arUser = $dbUser->Fetch()) {
if ($arUser["PERSONAL_GENDER"] == "F") {
$aditGM = "_FEMALE";
}
}
}
if (CModule::IncludeModule("socialnetwork")) {
$rsLog = CSocNetLog::GetList(array(), array("EVENT_ID" => array("blog_post", "blog_post_important", "blog_post_micro"), "SOURCE_ID" => $arParams["ID"]), false, false, array("ID"));
if ($arLog = $rsLog->Fetch()) {
$arMessageFields["LOG_ID"] = $arLog["ID"];
}
}
$arParams["TITLE"] = str_replace(array("\r\n", "\n"), " ", $arParams["TITLE"]);
$arParams["TITLE"] = TruncateText($arParams["TITLE"], 100);
$arParams["TITLE_OUT"] = TruncateText($arParams["TITLE"], 255);
$serverName = (CMain::IsHTTPS() ? "https" : "http") . "://" . (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0 ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name", ""));
if (IsModuleInstalled("extranet")) {
$user_path = COption::GetOptionString("socialnetwork", "user_page", false, SITE_ID);
if (strpos($arParams["URL"], $user_path) === 0) {
$arParams["URL"] = str_replace($user_path, "#USER_PATH#", $arParams["URL"]);
}
}
if ($arParams["TYPE"] == "POST") {
$arMessageFields["NOTIFY_EVENT"] = "post";
$arMessageFields["NOTIFY_TAG"] = "BLOG|POST|" . $arParams["ID"];
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_1" . $aditGM, array("#title#" => "<a href=\"" . $arParams["URL"] . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_1" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $arParams["URL"] . "";
} elseif ($arParams["TYPE"] == "COMMENT") {
$arMessageFields["NOTIFY_EVENT"] = "comment";
$arMessageFields["NOTIFY_TAG"] = "BLOG|COMMENT|" . $arParams["ID"];
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_4" . $aditGM, array("#title#" => "<a href=\"" . $arParams["URL"] . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_4" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $arParams["URL"] . "\n\n" . $arParams["BODY"];
$arMessageFields["NOTIFY_MESSAGE_AUTHOR"] = GetMessage("BLG_GP_IM_5" . $aditGM, array("#title#" => "<a href=\"" . $arParams["URL"] . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_AUTHOR_OUT"] = GetMessage("BLG_GP_IM_5" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $arParams["URL"] . "\n\n" . $arParams["BODY"];
} elseif ($arParams["TYPE"] == "SHARE") {
$arMessageFields["NOTIFY_EVENT"] = "share";
$arMessageFields["NOTIFY_TAG"] = "BLOG|SHARE|" . $arParams["ID"];
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_8" . $aditGM, array("#title#" => "<a href=\"" . $arParams["URL"] . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_8" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $arParams["URL"] . "";
} elseif ($arParams["TYPE"] == "SHARE2USERS") {
$arMessageFields["NOTIFY_EVENT"] = "share2users";
$arMessageFields["NOTIFY_TAG"] = "BLOG|SHARE2USERS|" . $arParams["ID"];
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_9" . $aditGM, array("#title#" => "<a href=\"" . $arParams["URL"] . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_9" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $arParams["URL"] . "";
}
foreach ($arUsers as $v) {
if (!empty($arParams["EXCLUDE_USERS"]) && IntVal($arParams["EXCLUDE_USERS"][$v]) > 0) {
continue;
}
if (IsModuleInstalled("extranet")) {
$arTmp = CSocNetLogTools::ProcessPath(array("URL" => $arParams["URL"]), $v);
$url = $arTmp["URLS"]["URL"];
if (strpos($url, "http://") === 0 || strpos($url, "https://") === 0) {
$serverName = "";
} else {
$serverName = $arTmp["SERVER_NAME"];
}
if ($arParams["TYPE"] == "POST") {
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_1" . $aditGM, array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_1" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " (" . $serverName . $url . ")";
} elseif ($arParams["TYPE"] == "COMMENT") {
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_4" . $aditGM, array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_4" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $url . "\n\n" . $arParams["BODY"];
$arMessageFields["NOTIFY_MESSAGE_AUTHOR"] = GetMessage("BLG_GP_IM_5" . $aditGM, array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_AUTHOR_OUT"] = GetMessage("BLG_GP_IM_5" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $url . "\n\n" . $arParams["BODY"];
} elseif ($arParams["TYPE"] == "SHARE") {
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_8" . $aditGM, array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_8" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $url . "";
} elseif ($arParams["TYPE"] == "SHARE2USERS") {
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_9" . $aditGM, array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_9" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $url . "";
//.........这里部分代码省略.........
示例9: getDestinations
protected function getDestinations()
{
$isExtranetInstalled = Loader::includeModule("extranet");
$members = array();
if ($this->blogPostData["HAS_SOCNET_ALL"] != "Y") {
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
$perm = \CBlogPost::getSocnetPermsName($this->entityId);
foreach ($perm as $type => $v) {
foreach ($v as $vv) {
if ($type == "SG") {
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
if ($socNetGroup = \CSocNetGroup::getByID($vv["ENTITY_ID"])) {
$name = $socNetGroup["~NAME"];
$link = \CComponentEngine::makePathFromTemplate($this->getPathToGroup(), array("group_id" => $vv["ENTITY_ID"]));
$groupSiteID = false;
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
$queryGroupSite = \CSocNetGroup::getSite($vv["ENTITY_ID"]);
while ($groupSite = $queryGroupSite->fetch()) {
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
if (!$isExtranetInstalled || $groupSite["LID"] != \CExtranet::getExtranetSiteID()) {
$groupSiteID = $groupSite["LID"];
break;
}
}
if ($groupSiteID) {
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
$tmp = \CSocNetLogTools::processPath(array("GROUP_URL" => $link), $this->getUser()->getId(), $groupSiteID);
// user_id is not important parameter
$link = strlen($tmp["URLS"]["GROUP_URL"]) > 0 ? $tmp["URLS"]["GROUP_URL"] : $link;
}
$isExtranet = is_array($GLOBALS["arExtranetGroupID"]) && in_array($vv["ENTITY_ID"], $GLOBALS["arExtranetGroupID"]);
$members[] = array("NAME" => $name, "LINK" => $link, 'AVATAR_SRC' => Ui\Avatar::getGroup($socNetGroup['IMAGE_ID']), "IS_EXTRANET" => $isExtranet ? "Y" : "N");
}
} elseif ($type == "U") {
if (in_array("US" . $vv["ENTITY_ID"], $vv["ENTITY"])) {
array_unshift($members, array("NAME" => Loc::getMessage('DISK_UF_BLOG_POST_CONNECTOR_MEMBERS_ALL'), "LINK" => null, 'AVATAR_SRC' => Ui\Avatar::getDefaultGroup(), "IS_EXTRANET" => "N"));
} else {
$name = \CUser::formatName('#NAME# #LAST_NAME#', array("NAME" => $vv["~U_NAME"], "LAST_NAME" => $vv["~U_LAST_NAME"], "SECOND_NAME" => $vv["~U_SECOND_NAME"], "LOGIN" => $vv["~U_LOGIN"], "NAME_LIST_FORMATTED" => ""), false);
$isExtranet = is_array($GLOBALS["arExtranetUserID"]) && in_array($vv["ENTITY_ID"], $GLOBALS["arExtranetUserID"]);
$members[] = array("NAME" => $name, "LINK" => \CComponentEngine::makePathFromTemplate($this->getPathToUser(), array("user_id" => $vv["ENTITY_ID"])), 'AVATAR_SRC' => Ui\Avatar::getPerson($vv['U_PERSONAL_PHOTO']), "IS_EXTRANET" => $isExtranet ? "Y" : "N");
}
} elseif ($type == "DR") {
$members[] = array("NAME" => $vv["EL_NAME"], "LINK" => null, 'AVATAR_SRC' => Ui\Avatar::getDefaultGroup(), "IS_EXTRANET" => "N");
}
}
}
} else {
$members[] = array("NAME" => Loc::getMessage('DISK_UF_BLOG_POST_CONNECTOR_MEMBERS_ALL'), "LINK" => null, 'AVATAR_SRC' => Ui\Avatar::getDefaultGroup(), "IS_EXTRANET" => "N");
}
return $members;
}
示例10: CreateLogMessage
public static function CreateLogMessage(&$fields, $options = array())
{
if (!CModule::IncludeModule('socialnetwork')) {
return false;
}
global $APPLICATION, $DB;
if (!is_array($options)) {
$options = array();
}
$entityTypeID = isset($fields['ENTITY_TYPE_ID']) ? intval($fields['ENTITY_TYPE_ID']) : CCrmOwnerType::Undefined;
if (!CCrmOwnerType::IsDefined($entityTypeID)) {
$fields['ERROR'] = GetMessage('CRM_LF_MSG_ENTITY_TYPE_NOT_FOUND');
return false;
}
$entityType = CCrmOwnerType::ResolveName($entityTypeID);
$entityID = isset($fields['ENTITY_ID']) ? intval($fields['ENTITY_ID']) : 0;
if ($entityID < 0) {
$fields['ERROR'] = GetMessage('CRM_LF_MSG_ENTITY_TYPE_NOT_FOUND');
return false;
}
$message = isset($fields['MESSAGE']) && is_string($fields['MESSAGE']) ? $fields['MESSAGE'] : '';
if ($message === '') {
$fields['ERROR'] = GetMessage('CRM_LF_MSG_EMPTY');
return false;
}
$title = isset($fields['TITLE']) && is_string($fields['TITLE']) ? $fields['TITLE'] : '';
if ($title === '') {
$title = self::UntitledMessageStub;
}
$userID = isset($fields['USER_ID']) ? intval($fields['USER_ID']) : 0;
if ($userID <= 0) {
$userID = CCrmSecurityHelper::GetCurrentUserID();
}
$bbCodeParser = new CTextParser();
$bbCodeParser->allow["HTML"] = "Y";
$eventText = $bbCodeParser->convert4mail($message);
$CCrmEvent = new CCrmEvent();
$eventID = $CCrmEvent->Add(array('ENTITY_TYPE' => $entityType, 'ENTITY_ID' => $entityID, 'EVENT_ID' => 'INFO', 'EVENT_TYPE' => 0, 'EVENT_TEXT_1' => $eventText, 'DATE_CREATE' => ConvertTimeStamp(time() + CTimeZone::GetOffset(), 'FULL', SITE_ID), 'FILES' => array()));
if (is_string($eventID)) {
//MS SQL RETURNS STRING INSTEAD INT
$eventID = intval($eventID);
}
if (!(is_int($eventID) && $eventID > 0)) {
$fields['ERROR'] = 'Could not create event';
return false;
}
$liveFeedEntityType = CCrmLiveFeedEntity::GetByEntityTypeID($entityTypeID);
$eventID = CCrmLiveFeedEvent::GetEventID($liveFeedEntityType, CCrmLiveFeedEvent::Message);
$eventFields = array('EVENT_ID' => $eventID, '=LOG_DATE' => $DB->CurrentTimeFunction(), 'TITLE' => $title, 'MESSAGE' => $message, 'TEXT_MESSAGE' => '', 'MODULE_ID' => 'crm_shared', 'CALLBACK_FUNC' => false, 'ENABLE_COMMENTS' => 'Y', 'PARAMS' => '', 'USER_ID' => $userID, 'ENTITY_TYPE' => $liveFeedEntityType, 'ENTITY_ID' => $entityID, 'SOURCE_ID' => $eventID, 'URL' => CCrmUrlUtil::AddUrlParams(CCrmOwnerType::GetShowUrl($entityTypeID, $entityID), array()));
if (isset($fields['WEB_DAV_FILES']) && is_array($fields['WEB_DAV_FILES'])) {
$eventFields = array_merge($eventFields, $fields['WEB_DAV_FILES']);
}
$sendMessage = isset($options['SEND_MESSAGE']) && is_bool($options['SEND_MESSAGE']) ? $options['SEND_MESSAGE'] : false;
$logEventID = CSocNetLog::Add($eventFields, $sendMessage);
if (is_int($logEventID) && $logEventID > 0) {
$arSocnetRights = $fields["RIGHTS"];
if (!empty($arSocnetRights)) {
$socnetPermsAdd = array();
foreach ($arSocnetRights as $perm_tmp) {
if (preg_match('/^SG(\\d+)$/', $perm_tmp, $matches)) {
if (!in_array("SG" . $matches[1] . "_" . SONET_ROLES_USER, $arSocnetRights)) {
$socnetPermsAdd[] = "SG" . $matches[1] . "_" . SONET_ROLES_USER;
}
if (!in_array("SG" . $matches[1] . "_" . SONET_ROLES_MODERATOR, $arSocnetRights)) {
$socnetPermsAdd[] = "SG" . $matches[1] . "_" . SONET_ROLES_MODERATOR;
}
if (!in_array("SG" . $matches[1] . "_" . SONET_ROLES_OWNER, $arSocnetRights)) {
$socnetPermsAdd[] = "SG" . $matches[1] . "_" . SONET_ROLES_OWNER;
}
}
}
if (count($socnetPermsAdd) > 0) {
$arSocnetRights = array_merge($arSocnetRights, $socnetPermsAdd);
}
CSocNetLogRights::DeleteByLogID($logEventID);
CSocNetLogRights::Add($logEventID, $arSocnetRights);
if (array_key_exists("UF_SONET_LOG_DOC", $eventFields) && is_array($eventFields["UF_SONET_LOG_DOC"]) && count($eventFields["UF_SONET_LOG_DOC"]) > 0) {
if (!in_array("U" . $userID, $arSocnetRights)) {
$arSocnetRights[] = "U" . $userID;
}
CSocNetLogTools::SetUFRights($eventFields["UF_SONET_LOG_DOC"], $arSocnetRights);
}
}
$arUpdateFields = array("RATING_TYPE_ID" => "LOG_ENTRY", "RATING_ENTITY_ID" => $logEventID);
CSocNetLog::Update($logEventID, $arUpdateFields);
self::RegisterOwnershipRelations($logEventID, $eventID, $fields);
$eventFields["LOG_ID"] = $logEventID;
CCrmLiveFeed::CounterIncrement($eventFields);
return $logEventID;
}
$ex = $APPLICATION->GetException();
$fields['ERROR'] = $ex->GetString();
return false;
}
示例11: formatListsElement
public static function formatListsElement($fields, $params, $mail = false)
{
$element = array('EVENT' => $fields, 'CREATED_BY' => array(), 'ENTITY' => array(), 'EVENT_FORMATTED' => array());
$userObject = CUser::getByID($fields['ENTITY_ID']);
$user = $userObject->fetch();
if ($user) {
if (!$mail) {
global $APPLICATION;
$rights = array();
$rightsQuery = CSocNetLogRights::getList(array(), array('LOG_ID' => $fields['ID']));
while ($right = $rightsQuery->fetch()) {
$rights[] = $right['GROUP_CODE'];
}
if (defined('BX_COMP_MANAGED_CACHE')) {
$GLOBALS['CACHE_MANAGER']->registerTag('LISTS_ELEMENT_LIVE_FEED');
}
$componentResult = $APPLICATION->includeComponent('bitrix:bizproc.workflow.livefeed', '', array('WORKFLOW_ID' => $fields['MESSAGE']), null, array('HIDE_ICONS' => 'Y'));
$siteDir = rtrim(SITE_DIR, '/');
$url = CSocNetLogTools::formatEvent_GetURL($fields, true);
$url = str_replace('#SITE_DIR#', $siteDir, $url);
$url .= '' . $fields['ID'] . '/';
$element = array('EVENT' => $fields, 'EVENT_FORMATTED' => array('TITLE_24' => '<a href="' . $fields['TITLE_TEMPLATE'] . '" class="bx-lists-live-feed-title-link">' . $fields['TITLE'] . '</a>', 'MESSAGE' => $fields['TEXT_MESSAGE'] . $componentResult['MESSAGE'], 'IS_IMPORTANT' => false, 'STYLE' => 'new-employee', 'AVATAR_STYLE' => 'avatar-info', 'DESTINATION' => CSocNetLogTools::formatDestinationFromRights($rights, array_merge($params, array('CREATED_BY' => $fields['USER_ID']))), 'URL' => $url), 'CREATED_BY' => CSocNetLogTools::formatEvent_GetCreatedBy($fields, $params, $mail), 'AVATAR_SRC' => CSocNetLog::formatEvent_CreateAvatar($fields, $params), 'CACHED_JS_PATH' => $componentResult['CACHED_JS_PATH'], 'CACHED_CSS_PATH' => $componentResult['CACHED_CSS_PATH']);
if ($params['MOBILE'] == 'Y') {
$element['EVENT_FORMATTED']['TITLE_24'] = Loc::getMessage('LISTS_LF_MOBILE_DESTINATION');
$element['EVENT_FORMATTED']['TITLE_24_2'] = $fields['TITLE'];
}
if (CModule::IncludeModule('bizproc')) {
$workflowId = \CBPStateService::getWorkflowByIntegerId($element['EVENT']['SOURCE_ID']);
}
if ($workflowId) {
$element['EVENT']['SOURCE_ID'] = $workflowId;
}
}
return $element;
}
}
示例12: FormatMessage
public static function FormatMessage($arFields, $arParams, $bMail = false)
{
$arResult = CSocNetLogTools::FormatEvent_Blog($arFields, $arParams, $bMail);
$arResult["EVENT_FORMATTED"]["TITLE_24"] = GetMessage("IDEA_SONET_NOTIFY_TITLE_24");
return $arResult;
}
示例13: getBlogPost
public static function getBlogPost($arFields, $n, $server)
{
$result = array();
if (!CModule::IncludeModule("blog")) {
return $result;
}
$tzOffset = CTimeZone::GetOffset();
$arOrder = array("LOG_UPDATE" => "DESC");
$arAccessCodes = $GLOBALS["USER"]->GetAccessCodes();
foreach ($arAccessCodes as $i => $code) {
if (!preg_match("/^(U|D|DR)/", $code)) {
unset($arAccessCodes[$i]);
}
}
$arEventId = array("blog_post", "blog_post_important");
$arEventIdFullset = array();
foreach ($arEventId as $eventId) {
$arEventIdFullset = array_merge($arEventIdFullset, CSocNetLogTools::FindFullSetByEventID($eventId));
}
$arFilter = array("LOG_RIGHTS" => $arAccessCodes, "EVENT_ID" => array_unique($arEventIdFullset), "SITE_ID" => array('s1', false), "<=LOG_DATE" => "NOW");
$arListParams = array("CHECK_RIGHTS" => "Y", "USE_FOLLOW" => "N", "USE_SUBSCRIBE" => "N");
$dbLog = CSocNetLog::GetList($arOrder, $arFilter, false, self::getNavData($n), array("ID", "SOURCE_ID"), $arListParams);
while ($arLog = $dbLog->Fetch()) {
$arPostId[] = $arLog["SOURCE_ID"];
}
$arPostIdToGet = array();
$cacheTtl = 2592000;
foreach ($arPostId as $key => $postId) {
$cacheId = 'blog_post_socnet_rest_' . $postId . '_ru' . ($tzOffset != 0 ? '_' . $tzOffset : '');
$cacheDir = '/blog/socnet_post/gen/' . intval($postId / 100) . '/' . $postId;
$obCache = new CPHPCache();
if ($obCache->InitCache($cacheTtl, $cacheId, $cacheDir)) {
$result[$key] = $obCache->GetVars();
} else {
$arPostIdToGet[$key] = $postId;
}
$obCache->EndDataCache();
}
if (!empty($arPostIdToGet)) {
foreach ($arPostIdToGet as $key => $postId) {
$cacheId = 'blog_post_socnet_rest_' . $postId . '_ru' . ($tzOffset != 0 ? '_' . $tzOffset : '');
$cacheDir = '/blog/socnet_post/gen/' . intval($postId / 100) . '/' . $postId;
$obCache = new CPHPCache();
$obCache->InitCache($cacheTtl, $cacheId, $cacheDir);
$obCache->StartDataCache();
$dbPost = CBlogPost::GetList(array(), array("ID" => $postId), false, false, array("ID", "BLOG_ID", "PUBLISH_STATUS", "TITLE", "AUTHOR_ID", "ENABLE_COMMENTS", "NUM_COMMENTS", "VIEWS", "CODE", "MICRO", "DETAIL_TEXT", "DATE_PUBLISH", "CATEGORY_ID", "HAS_SOCNET_ALL", "HAS_TAGS", "HAS_IMAGES", "HAS_PROPS", "HAS_COMMENT_IMAGES"));
if ($arPost = $dbPost->Fetch()) {
if ($arPost["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH) {
unset($arPost);
} else {
if ($arPost["HAS_PROPS"] != "N") {
$arPostFields = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("BLOG_POST", $arPost["ID"], LANGUAGE_ID);
$arPost = array_merge($arPost, $arPostFields);
}
$result[$key] = $arPost;
}
}
$obCache->EndDataCache($arPost);
}
}
ksort($result);
return self::setNavData($result, $dbLog);
}
示例14: intval
<div class="feed-comments-block" id="feed_comments_block_<?php
echo $arEvent["EVENT"]["ID"];
?>
" style="display: <?php
echo intval($arEvent["COMMENTS_COUNT"]) > 0 ? "block" : "none";
?>
"><?php
$arRecords = array();
if (!!$component && !!$component->__parent && !!$component->__parent->arResult) {
$component->__parent->arResult["ENTITIES_XML_ID"] = !!$component->__parent->arResult["ENTITIES_XML_ID"] ? $component->__parent->arResult["ENTITIES_XML_ID"] : array();
$component->__parent->arResult["ENTITIES_XML_ID"][$arEvent["COMMENTS_PARAMS"]["ENTITY_XML_ID"]] = array($arEvent["COMMENTS_PARAMS"]["ENTITY_TYPE"], $arEvent["EVENT"]["SOURCE_ID"]);
$component->__parent->arResult["ENTITIES_CORRESPONDENCE"] = !!$component->__parent->arResult["ENTITIES_CORRESPONDENCE"] ? $component->__parent->arResult["ENTITIES_CORRESPONDENCE"] : array();
$component->__parent->arResult["ENTITIES_CORRESPONDENCE"][$arEvent["COMMENTS_PARAMS"]["ENTITY_XML_ID"] . "-0"] = array($arEvent["EVENT"]["ID"], 0);
}
if (!empty($arEvent["COMMENTS"])) {
$arCommentEvent = CSocNetLogTools::FindLogCommentEventByLogEventID($arEvent["EVENT"]["EVENT_ID"]);
$bHasEditCallback = is_array($arCommentEvent) && isset($arCommentEvent["UPDATE_CALLBACK"]) && ($arCommentEvent["UPDATE_CALLBACK"] == "NO_SOURCE" || is_callable($arCommentEvent["UPDATE_CALLBACK"]));
$bHasDeleteCallback = is_array($arCommentEvent) && isset($arCommentEvent["DELETE_CALLBACK"]) && ($arCommentEvent["DELETE_CALLBACK"] == "NO_SOURCE" || is_callable($arCommentEvent["DELETE_CALLBACK"]));
foreach ($arEvent["COMMENTS"] as $key => $arComment) {
$commentId = !!$arComment["EVENT"]["SOURCE_ID"] ? $arComment["EVENT"]["SOURCE_ID"] : $arComment["EVENT"]["ID"];
if (!!$component && !!$component->__parent && !!$component->__parent->arResult) {
$component->__parent->arResult["ENTITIES_CORRESPONDENCE"][$arEvent["COMMENTS_PARAMS"]["ENTITY_XML_ID"] . "-" . $commentId] = array($arEvent["EVENT"]["ID"], $arComment["EVENT"]["ID"]);
}
$event_date_log_ts = isset($arComment["EVENT"]["LOG_DATE_TS"]) ? $arComment["EVENT"]["LOG_DATE_TS"] : MakeTimeStamp($arComment["EVENT"]["LOG_DATE"]) - intval($arResult["TZ_OFFSET"]);
$canEdit = $bHasEditCallback && (CSocNetUser::IsCurrentUserModuleAdmin() || $arComment["EVENT"]["USER_ID"] == $GLOBALS["USER"]->GetID() && (IsModuleInstalled("intranet") || $key === 0)) ? "Y" : "N";
$canDelete = $bHasDeleteCallback && $canEdit == "Y" ? "Y" : "N";
$arRecords[$commentId] = array("ID" => $commentId, "NEW" => $GLOBALS["USER"]->IsAuthorized() && $arEvent["EVENT"]["FOLLOW"] != "N" && $arComment["EVENT"]["USER_ID"] != $GLOBALS["USER"]->GetID() && intval($arResult["LAST_LOG_TS"]) > 0 && $event_date_log_ts > $arResult["LAST_LOG_TS"] && ($arResult["COUNTER_TYPE"] == "**" || $arResult["COUNTER_TYPE"] == "CRM_**" || $arResult["COUNTER_TYPE"] == "blog_post") ? "Y" : "N", "AUTHOR" => array("ID" => $arComment["EVENT"]["USER_ID"], "NAME" => CUser::FormatName($arParams["NAME_TEMPLATE"], $arComment["CREATED_BY"]["TOOLTIP_FIELDS"], $arParams["SHOW_LOGIN"] != "N" ? true : false), "URL" => str_replace(array("#user_id#", "#USER_ID#", "#id#", "#ID#"), $arComment["CREATED_BY"]["TOOLTIP_FIELDS"]["ID"], $arComment["CREATED_BY"]["TOOLTIP_FIELDS"]["PATH_TO_SONET_USER_PROFILE"]), "AVATAR" => $arComment["AVATAR_SRC"], "IS_EXTRANET" => is_array($GLOBALS["arExtranetUserID"]) && in_array($arComment["EVENT"]["USER_ID"], $GLOBALS["arExtranetUserID"]) ? "Y" : "N"), "APPROVED" => "Y", "POST_TIMESTAMP" => $arComment["LOG_DATE_TS"], "POST_TIME" => $arComment["LOG_TIME_FORMAT"], "POST_DATE" => $arComment["LOG_DATETIME_FORMAT"], "POST_MESSAGE_TEXT" => array_key_exists("FULL_MESSAGE_CUT", $arComment["EVENT_FORMATTED"]) ? $arComment["EVENT_FORMATTED"]["FULL_MESSAGE_CUT"] : "", "~POST_MESSAGE_TEXT" => "", "URL" => array("LINK" => isset($arComment["EVENT"]["URL"]) && strlen($arComment["EVENT"]["URL"]) > 0 ? $arComment["EVENT"]["URL"] : (isset($arParams["PATH_TO_LOG_ENTRY"]) && strlen($arParams["PATH_TO_LOG_ENTRY"]) > 0 ? CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_LOG_ENTRY"], array("log_id" => $arEvent["EVENT"]["ID"])) . "?commentId=" . $arComment["EVENT"]["ID"] : ""), "EDIT" => "__logEditComment('" . $arEvent["COMMENTS_PARAMS"]["ENTITY_XML_ID"] . "', '" . $arComment["EVENT"]["ID"] . "', '" . $arEvent["EVENT"]["ID"] . "');", "DELETE" => '/bitrix/components/bitrix/socialnetwork.log.entry/ajax.php?lang=' . LANGUAGE_ID . '&action=delete_comment&delete_comment_id=' . $arComment["EVENT"]["ID"] . '&post_id=' . $arEvent["EVENT"]["ID"] . '&site=' . SITE_ID), "PANELS" => array("EDIT" => $canEdit, "MODERATE" => "N", "DELETE" => $canDelete));
if (strlen($arComment["EVENT"]["RATING_TYPE_ID"]) > 0 && $arComment["EVENT"]["RATING_ENTITY_ID"] > 0 && $arParams["SHOW_RATING"] == "Y") {
ob_start();
$RATING_ENTITY_ID = $arComment["EVENT"]["RATING_ENTITY_ID"];
?>
示例15: NotifyIm
public static function NotifyIm($arParams)
{
if (!CModule::IncludeModule("im") || intval($arParams["PHOTO_AUTHOR_ID"]) <= 0 || $arParams["PHOTO_AUTHOR_ID"] == intval($arParams["COMMENT_AUTHOR_ID"])) {
return;
}
if (!array_key_exists("SECTION_NAME", $arParams)) {
$arParams["SECTION_NAME"] = "";
}
if (!array_key_exists("SECTION_URL", $arParams)) {
$arParams["SECTION_URL"] = 0;
}
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $arParams["PHOTO_AUTHOR_ID"], "FROM_USER_ID" => $arParams["COMMENT_AUTHOR_ID"], "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "photogallery", "NOTIFY_EVENT" => "comment");
$rsLog = CSocNetLog::GetList(array(), array("EVENT_ID" => array("photo_photo"), "SOURCE_ID" => $arParams["ID"]), false, false, array("ID"));
if ($arLog = $rsLog->Fetch()) {
$rsUnFollower = CSocNetLogFollow::GetList(array("USER_ID" => $arParams["PHOTO_AUTHOR_ID"], "CODE" => "L" . $arLog["ID"], "TYPE" => "N"), array("USER_ID"));
if ($arUnFollower = $rsUnFollower->Fetch()) {
return;
}
$arMessageFields["LOG_ID"] = $arLog["ID"];
}
$arParams["TITLE"] = str_replace(array("\r\n", "\n"), " ", $arParams["TITLE"]);
$arParams["TITLE"] = TruncateText($arParams["TITLE"], 100);
$arParams["TITLE_OUT"] = TruncateText($arParams["TITLE"], 255);
$arTmp = CSocNetLogTools::ProcessPath(array("PHOTO_URL" => $arParams["URL"], "SECTION_URL" => $arParams["SECTION_URL"]), $arParams["PHOTO_AUTHOR_ID"]);
$serverName = $arTmp["SERVER_NAME"];
$arParams["URL"] = $arTmp["URLS"]["PHOTO_URL"];
$arParams["SECTION_URL"] = $arTmp["URLS"]["SECTION_URL"];
$arMessageFields["NOTIFY_TAG"] = "PHOTO|COMMENT|" . $arParams["ID"];
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("SONET_PHOTO_IM_COMMENT", array("#photo_title#" => "<a href=\"" . $arParams["URL"] . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>", "#album_title#" => "<a href=\"" . $arParams["SECTION_URL"] . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["SECTION_NAME"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("SONET_PHOTO_IM_COMMENT", array("#photo_title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]), "#album_title#" => htmlspecialcharsbx($arParams["SECTION_NAME"]))) . " (" . $serverName . $arParams["URL"] . ")#BR##BR#" . $arParams["MESSAGE"];
$ID = CIMNotify::Add($arMessageFields);
if (!empty($arParams["COMMENT_MENTION_ID"])) {
//
}
}