本文整理汇总了PHP中CSocNetLogTools::FormatEvent_CreateAvatar方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetLogTools::FormatEvent_CreateAvatar方法的具体用法?PHP CSocNetLogTools::FormatEvent_CreateAvatar怎么用?PHP CSocNetLogTools::FormatEvent_CreateAvatar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetLogTools
的用法示例。
在下文中一共展示了CSocNetLogTools::FormatEvent_CreateAvatar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __SLEGetLogCommentRecord
function __SLEGetLogCommentRecord($arComments, $arParams, &$arAssets)
{
// for the same post log_update - time only, if not - date and time
$timestamp = MakeTimeStamp(array_key_exists("LOG_DATE_FORMAT", $arComments) ? $arComments["LOG_DATE_FORMAT"] : $arComments["LOG_DATE"]);
$timeFormated = FormatDateFromDB($arComments["LOG_DATE"], stripos($arParams["DATE_TIME_FORMAT"], 'a') || ($arParams["DATE_TIME_FORMAT"] == 'FULL' && IsAmPmMode()) !== false ? strpos(FORMAT_DATETIME, 'TT') !== false ? 'G:MI TT' : 'G:MI T' : 'HH:MI');
$dateTimeFormated = FormatDate(!empty($arParams['DATE_TIME_FORMAT']) ? $arParams['DATE_TIME_FORMAT'] == 'FULL' ? $GLOBALS['DB']->DateFormatToPHP(str_replace(':SS', '', FORMAT_DATETIME)) : $arParams['DATE_TIME_FORMAT'] : $GLOBALS['DB']->DateFormatToPHP(FORMAT_DATETIME), $timestamp);
if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) {
$dateTimeFormated = ToLower($dateTimeFormated);
}
// strip current year
if (!empty($arParams['DATE_TIME_FORMAT']) && ($arParams['DATE_TIME_FORMAT'] == 'j F Y G:i' || $arParams['DATE_TIME_FORMAT'] == 'j F Y g:i a')) {
$dateTimeFormated = ltrim($dateTimeFormated, '0');
$curYear = date('Y');
$dateTimeFormated = str_replace(array('-' . $curYear, '/' . $curYear, ' ' . $curYear, '.' . $curYear), '', $dateTimeFormated);
}
$path2Entity = $arComments["ENTITY_TYPE"] == SONET_ENTITY_GROUP ? CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arComments["ENTITY_ID"])) : CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComments["ENTITY_ID"]));
if (intval($arComments["USER_ID"]) > 0) {
$suffix = is_array($GLOBALS["arExtranetUserID"]) && in_array($arComments["USER_ID"], $GLOBALS["arExtranetUserID"]) ? GetMessage("SONET_LOG_EXTRANET_SUFFIX") : "";
$arTmpUser = array("NAME" => $arComments["~CREATED_BY_NAME"], "LAST_NAME" => $arComments["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arComments["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arComments["~CREATED_BY_LOGIN"]);
$bUseLogin = $arParams["SHOW_LOGIN"] != "N" ? true : false;
$arCreatedBy = array("FORMATTED" => CUser::FormatName($arParams["NAME_TEMPLATE"], $arTmpUser, $bUseLogin) . $suffix, "URL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComments["USER_ID"], "id" => $arComments["USER_ID"])));
$arCreatedBy["TOOLTIP_FIELDS"] = array("ID" => $arComments["USER_ID"], "NAME" => $arComments["~CREATED_BY_NAME"], "LAST_NAME" => $arComments["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arComments["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arComments["~CREATED_BY_LOGIN"], "USE_THUMBNAIL_LIST" => "N", "PATH_TO_SONET_MESSAGES_CHAT" => $arParams["PATH_TO_MESSAGES_CHAT"], "PATH_TO_SONET_USER_PROFILE" => $arParams["PATH_TO_USER"], "PATH_TO_VIDEO_CALL" => $arParams["PATH_TO_VIDEO_CALL"], "DATE_TIME_FORMAT" => $arParams["DATE_TIME_FORMAT"], "SHOW_YEAR" => $arParams["SHOW_YEAR"], "CACHE_TYPE" => $arParams["CACHE_TYPE"], "CACHE_TIME" => $arParams["CACHE_TIME"], "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"] . $suffix, "SHOW_LOGIN" => $arParams["SHOW_LOGIN"], "PATH_TO_CONPANY_DEPARTMENT" => $arParams["PATH_TO_CONPANY_DEPARTMENT"], "INLINE" => "Y");
} else {
$arCreatedBy = array("FORMATTED" => GetMessage("SONET_C73_CREATED_BY_ANONYMOUS"));
}
$arTmpUser = array("NAME" => $arComments["~USER_NAME"], "LAST_NAME" => $arComments["~USER_LAST_NAME"], "SECOND_NAME" => $arComments["~USER_SECOND_NAME"], "LOGIN" => $arComments["~USER_LOGIN"]);
$arParamsTmp = $arParams;
$arParamsTmp["AVATAR_SIZE"] = isset($arParams["AVATAR_SIZE_COMMON"]) ? $arParams["AVATAR_SIZE_COMMON"] : $arParams["AVATAR_SIZE"];
$arTmpCommentEvent = array("EVENT" => $arComments, "LOG_DATE" => $arComments["LOG_DATE"], "LOG_DATE_TS" => MakeTimeStamp($arComments["LOG_DATE"]), "LOG_DATE_DAY" => ConvertTimeStamp(MakeTimeStamp($arComments["LOG_DATE"]), "SHORT"), "LOG_TIME_FORMAT" => $timeFormated, "LOG_DATETIME_FORMAT" => $dateTimeFormated, "TITLE_TEMPLATE" => "", "TITLE" => "", "TITLE_FORMAT" => "", "ENTITY_NAME" => $arComments["ENTITY_TYPE"] == SONET_ENTITY_GROUP ? $arComments["GROUP_NAME"] : CUser::FormatName($arParams['NAME_TEMPLATE'], $arTmpUser, $bUseLogin), "ENTITY_PATH" => $path2Entity, "CREATED_BY" => $arCreatedBy, "AVATAR_SRC" => CSocNetLogTools::FormatEvent_CreateAvatar($arComments, $arParamsTmp));
$arEvent = CSocNetLogTools::FindLogCommentEventByID($arComments["EVENT_ID"]);
if ($arEvent && array_key_exists("CLASS_FORMAT", $arEvent) && array_key_exists("METHOD_FORMAT", $arEvent)) {
$arLog = $arParams["USER_COMMENTS"] == "Y" ? array() : array("TITLE" => $arComments["~LOG_TITLE"], "URL" => $arComments["~LOG_URL"], "PARAMS" => $arComments["~LOG_PARAMS"]);
$arFIELDS_FORMATTED = call_user_func(array($arEvent["CLASS_FORMAT"], $arEvent["METHOD_FORMAT"]), $arComments, $arParams, false, $arLog);
if ($arParams["USE_COMMENTS"] != "Y") {
if (array_key_exists("CREATED_BY", $arFIELDS_FORMATTED) && isset($arFIELDS_FORMATTED["CREATED_BY"]["TOOLTIP_FIELDS"])) {
$arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"] = $arFIELDS_FORMATTED["CREATED_BY"]["TOOLTIP_FIELDS"];
}
}
}
$message = $arFIELDS_FORMATTED && array_key_exists("EVENT_FORMATTED", $arFIELDS_FORMATTED) && array_key_exists("MESSAGE", $arFIELDS_FORMATTED["EVENT_FORMATTED"]) ? $arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"] : $arTmpCommentEvent["EVENT"]["MESSAGE"];
if (strlen($message) > 0) {
$arFIELDS_FORMATTED["EVENT_FORMATTED"]["FULL_MESSAGE_CUT"] = CSocNetTextParser::closetags(htmlspecialcharsback($message));
}
if (is_array($arTmpCommentEvent)) {
$arFIELDS_FORMATTED["EVENT_FORMATTED"]["DATETIME"] = $arTmpCommentEvent["LOG_DATE_DAY"] == ConvertTimeStamp() ? $timeFormated : $dateTimeFormated;
$arTmpCommentEvent["EVENT_FORMATTED"] = $arFIELDS_FORMATTED["EVENT_FORMATTED"];
if (isset($arComments["UF"]["UF_SONET_COM_URL_PRV"]) && !empty($arComments["UF"]["UF_SONET_COM_URL_PRV"]["VALUE"])) {
$arCss = $GLOBALS["APPLICATION"]->sPath2css;
$arJs = $GLOBALS["APPLICATION"]->arHeadScripts;
ob_start();
$GLOBALS["APPLICATION"]->IncludeComponent("bitrix:system.field.view", $arComments["UF"]["UF_SONET_COM_URL_PRV"]["USER_TYPE_ID"], array("arUserField" => $arComments["UF"]["UF_SONET_COM_URL_PRV"], "arAddField" => array("NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"], "PATH_TO_USER" => $arParams["~PATH_TO_USER"])), null, array("HIDE_ICONS" => "Y"));
$urlPreviewText = ob_get_clean();
$arTmpCommentEvent["EVENT_FORMATTED"]["FULL_MESSAGE_CUT"] .= $urlPreviewText;
$arAssets["CSS"] = array_merge($arAssets["CSS"], array_diff($GLOBALS["APPLICATION"]->sPath2css, $arCss));
$arAssets["JS"] = array_merge($arAssets["JS"], array_diff($GLOBALS["APPLICATION"]->arHeadScripts, $arJs));
unset($arComments["UF"]["UF_SONET_COM_URL_PRV"]);
}
$arTmpCommentEvent["UF"] = $arComments["UF"];
if (isset($arTmpCommentEvent["EVENT_FORMATTED"]) && is_array($arTmpCommentEvent["EVENT_FORMATTED"])) {
$arFields2Cache = array("DATETIME", "MESSAGE", "FULL_MESSAGE_CUT", "ERROR_MSG");
foreach ($arTmpCommentEvent["EVENT_FORMATTED"] as $field => $value) {
if (!in_array($field, $arFields2Cache)) {
unset($arTmpCommentEvent["EVENT_FORMATTED"][$field]);
}
}
}
if (isset($arTmpCommentEvent["EVENT"]) && is_array($arTmpCommentEvent["EVENT"])) {
if (!empty($arTmpCommentEvent["EVENT"]["URL"])) {
$arTmpCommentEvent["EVENT"]["URL"] = str_replace("#GROUPS_PATH#", COption::GetOptionString("socialnetwork", "workgroups_page", "/workgroups/", SITE_ID), $arTmpCommentEvent["EVENT"]["URL"]);
}
$arFields2Cache = array("ID", "SOURCE_ID", "EVENT_ID", "USER_ID", "LOG_DATE", "RATING_TYPE_ID", "RATING_ENTITY_ID", "URL");
foreach ($arTmpCommentEvent["EVENT"] as $field => $value) {
if (!in_array($field, $arFields2Cache)) {
unset($arTmpCommentEvent["EVENT"][$field]);
}
}
}
if (isset($arTmpCommentEvent["CREATED_BY"]) && is_array($arTmpCommentEvent["CREATED_BY"])) {
$arFields2Cache = array("TOOLTIP_FIELDS", "FORMATTED", "URL");
foreach ($arTmpCommentEvent["CREATED_BY"] as $field => $value) {
if (!in_array($field, $arFields2Cache)) {
unset($arTmpCommentEvent["CREATED_BY"][$field]);
}
}
if (isset($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"]) && is_array($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"])) {
$arFields2Cache = array("ID", "PATH_TO_SONET_USER_PROFILE", "NAME", "LAST_NAME", "SECOND_NAME", "LOGIN", "EMAIL");
foreach ($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"] as $field => $value) {
if (!in_array($field, $arFields2Cache)) {
unset($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"][$field]);
}
}
}
}
}
foreach ($arTmpCommentEvent["EVENT"] as $key => $value) {
if (strpos($key, "~") === 0) {
unset($arTmpCommentEvent["EVENT"][$key]);
}
}
return $arTmpCommentEvent;
//.........这里部分代码省略.........
示例2: createAvatar
/**
* @param $fields
* @param $params
* @param $siteId
* @return string|null
*/
public static function createAvatar($fields, $params = array(), $siteId = SITE_ID)
{
if (!isset($params['AVATAR_SIZE'])) {
$params['AVATAR_SIZE'] = 30;
}
if (CModule::IncludeModule('socialnetwork')) {
return CSocNetLogTools::FormatEvent_CreateAvatar($fields, $params, '', $siteId);
}
static $cachedAvatars = array();
if (intval($fields['PERSONAL_PHOTO']) > 0) {
if (empty($cachedAvatars[$params['AVATAR_SIZE']][$fields['PERSONAL_PHOTO']])) {
$imageFile = CFile::getFileArray($fields['PERSONAL_PHOTO']);
if ($imageFile !== false) {
$file = CFile::resizeImageGet($imageFile, array("width" => $params['AVATAR_SIZE'], "height" => $params['AVATAR_SIZE']), BX_RESIZE_IMAGE_EXACT, false);
$avatarPath = $file['src'];
$cachedAvatars[$params['AVATAR_SIZE']][$fields['PERSONAL_PHOTO']] = $avatarPath;
}
}
}
return empty($cachedAvatars[$params['AVATAR_SIZE']][$fields['PERSONAL_PHOTO']]) ? null : $cachedAvatars[$params['AVATAR_SIZE']][$fields['PERSONAL_PHOTO']];
}
示例3: FormatEvent_CreateAvatar
public static function FormatEvent_CreateAvatar($arFields, $arParams, $source = "CREATED_BY_")
{
return CSocNetLogTools::FormatEvent_CreateAvatar($arFields, $arParams, $source);
}
示例4: elseif
if ($arElementProperty["CODE"] == "USERS" && intval($arElementProperty["VALUE"]) > 0) {
$arGrat["USERS"][] = $arElementProperty["VALUE"];
} elseif ($arElementProperty["CODE"] == "GRATITUDE") {
$arGrat["TYPE"] = array("VALUE_ENUM" => $arElementProperty["VALUE_ENUM"], "XML_ID" => $arElementProperty["VALUE_XML_ID"]);
}
}
if (count($arGrat["USERS"]) > 0) {
if ($arParams["CACHE_TIME"] > 0 && defined("BX_COMP_MANAGED_CACHE")) {
foreach ($arGrat["USERS"] as $i => $grat_user_id) {
$GLOBALS["CACHE_MANAGER"]->RegisterTag("USER_NAME_" . intval($grat_user_id));
}
}
$arGratUsers = array();
$rsUser = CUser::GetList($by = "", $ord = "", array("ID" => implode("|", $arGrat["USERS"])), array("FIELDS" => array("ID", "PERSONAL_GENDER", "PERSONAL_PHOTO", "LOGIN", "NAME", "LAST_NAME", "SECOND_NAME", "EMAIL", "WORK_POSITION")));
while ($arGratUser = $rsUser->Fetch()) {
$arGratUser["AVATAR_SRC"] = CSocNetLogTools::FormatEvent_CreateAvatar($arGratUser, array("AVATAR_SIZE" => isset($arParams["AVATAR_SIZE_COMMON"]) ? $arParams["AVATAR_SIZE_COMMON"] : 58), "");
$arGratUser["AVATAR_SIZE"] = $arParams["MOBILE"] == "Y" ? 58 : (count($arGrat["USERS"]) <= 4 ? 50 : 26);
$arGratUser["URL"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arGratUser["ID"]));
$arGratUsers[] = $arGratUser;
}
$arGrat["USERS_FULL"] = $arGratUsers;
}
if (count($arGrat["USERS_FULL"]) > 0) {
$arResult["GRATITUDE"] = $arGrat;
}
}
}
} else {
$arPostField["EDIT_FORM_LABEL"] = strLen($arPostField["EDIT_FORM_LABEL"]) > 0 ? $arPostField["EDIT_FORM_LABEL"] : $arPostField["FIELD_NAME"];
$arPostField["EDIT_FORM_LABEL"] = htmlspecialcharsEx($arPostField["EDIT_FORM_LABEL"]);
$arPostField["~EDIT_FORM_LABEL"] = $arPostField["EDIT_FORM_LABEL"];
示例5: FormatEvent_Data
function FormatEvent_Data($arFields, $arParams, $bMail = false)
{
$arResult = array("EVENT" => $arFields, "URL" => "");
if (!CModule::IncludeModule("socialnetwork")) {
return $arResult;
}
if (in_array($arFields["ENTITY_TYPE"], array(SONET_SUBSCRIBE_ENTITY_GROUP, SONET_SUBSCRIBE_ENTITY_USER))) {
$arResult["ENTITY"] = CSocNetLogTools::FormatEvent_GetEntity($arFields, $arParams, $bMail);
$rsRight = CSocNetLogRights::GetList(array(), array("LOG_ID" => $arFields["ID"]));
$arRights = array();
while ($arRight = $rsRight->Fetch()) {
$arRights[] = $arRight["GROUP_CODE"];
}
$arDestination = CSocNetLogTools::FormatDestinationFromRights($arRights, $arParams, $iMoreCount);
}
$title = "";
$arEventParams = unserialize(strlen($arFields["~PARAMS"]) > 0 ? $arFields["~PARAMS"] : $arFields["PARAMS"]);
if (in_array($arFields["ENTITY_TYPE"], array(SONET_SUBSCRIBE_ENTITY_GROUP, SONET_SUBSCRIBE_ENTITY_USER)) && is_array($arEventParams) && count($arEventParams) > 0 && array_key_exists("ENTITY_NAME", $arEventParams) && strlen($arEventParams["ENTITY_NAME"]) > 0) {
if (!$bMail && strlen($arFields["URL"]) > 0) {
$title_tmp = '<a href="' . $arFields["URL"] . '">' . $arEventParams["ENTITY_NAME"] . '</a>';
} else {
$title_tmp = $arEventParams["ENTITY_NAME"];
}
} else {
if (!$bMail && strlen($arFields["URL"]) > 0) {
$title_tmp = '<a href="' . $arFields["URL"] . '">' . $arFields["TITLE"] . '</a>';
} else {
$title_tmp = $arFields["TITLE"];
}
}
$title = str_replace(array("#TITLE#", "#ENTITY#"), array($title_tmp, $bMail ? $arResult["ENTITY"]["FORMATTED"] : $arResult["ENTITY"]["FORMATTED"]["NAME"]), $bMail ? GetMessage("LFP_SOCNET_LOG_DATA_" . $arFields["ENTITY_TYPE"] . "_TITLE_MAIL") : GetMessage("LFP_SOCNET_LOG_DATA_TITLE"));
$url = false;
if (strlen($arFields["URL"]) > 0) {
$url = $arFields["URL"];
}
if (in_array($arFields["ENTITY_TYPE"], array(SONET_SUBSCRIBE_ENTITY_GROUP, SONET_SUBSCRIBE_ENTITY_USER))) {
if (!$bMail) {
$message = $arFields["MESSAGE"];
} else {
$message = $arFields["TITLE"] . "#BR##BR#" . $arFields["MESSAGE"];
}
} else {
$message = $arFields["MESSAGE"];
}
$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);
$twitInfo = unserialize($arFields['~PARAMS']);
$arResult["EVENT_FORMATTED"] = array("TITLE" => $arFields["TITLE"], "TITLE_24" => "", "MESSAGE" => "<a target=\"_blank\" style=\"text-decoration: none; color: #5C6470; font-weight: bold; font-size: 12px\" href=\"https://twitter.com/" . $twitInfo['SCREEN_NAME'] . "/status/" . $twitInfo['TWIT_ID'] . "\">" . $arFields["TITLE"] . "</a><p>" . ($bMail ? CSocNetTextParser::killAllTags($message) : $message), "IS_IMPORTANT" => false, "STYLE" => "", "DESTINATION" => $arDestination);
if (intval($iMoreCount) > 0) {
$arResult["EVENT_FORMATTED"]["DESTINATION_MORE"] = $iMoreCount;
}
if (is_array($arEventParams) && array_key_exists("SOURCE_TIMESTAMP", $arEventParams)) {
$arResult["EVENT_FORMATTED"]["LOG_DATE_FORMAT"] = ConvertTimeStamp($arEventParams["SOURCE_TIMESTAMP"], "FULL");
}
if (strlen($url) > 0) {
$arResult["EVENT_FORMATTED"]["URL"] = $url;
}
if (!$bMail) {
if ($arFields["ENTITY_TYPE"] == SONET_SUBSCRIBE_ENTITY_GROUP) {
$arGroup = array("IMAGE_ID" => $arFields["GROUP_IMAGE_ID"]);
$arResult["AVATAR_SRC"] = CSocNetLogTools::FormatEvent_CreateAvatarGroup($arGroup, $arParams);
} elseif ($arFields["ENTITY_TYPE"] == SONET_SUBSCRIBE_ENTITY_USER) {
$arResult["AVATAR_SRC"] = CSocNetLogTools::FormatEvent_CreateAvatar($arFields, $arParams, "USER_");
} elseif ($arFields["ENTITY_TYPE"] == "N") {
$arResult["EVENT_FORMATTED"]["AVATAR_STYLE"] = "avatar-info";
}
$parserLog = new logTextParser(false, $arParams["PATH_TO_SMILE"]);
$arAllow = array("HTML" => "Y", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "LOG_IMG" => "N", "QUOTE" => "Y", "LOG_QUOTE" => "N", "CODE" => "Y", "LOG_CODE" => "N", "FONT" => "Y", "LOG_FONT" => "N", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N", "MULTIPLE_BR" => "Y", "VIDEO" => "Y", "LOG_VIDEO" => "N");
$arResult["EVENT_FORMATTED"]["SHORT_MESSAGE"] = $parserLog->html_cut($parserLog->convert(htmlspecialcharsback(str_replace("#CUT#", "", $arResult["EVENT_FORMATTED"]["MESSAGE"])), array(), $arAllow), 500);
$arAllow = array("HTML" => "Y", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N", "MULTIPLE_BR" => "Y", "VIDEO" => "Y", "LOG_VIDEO" => "N");
$arResult["EVENT_FORMATTED"]["MESSAGE"] = htmlspecialcharsbx($parserLog->convert(htmlspecialcharsback($arResult["EVENT_FORMATTED"]["MESSAGE"]), array(), $arAllow));
if ($arParams["MOBILE"] != "Y" && $arParams["NEW_TEMPLATE"] != "Y") {
$arResult["EVENT_FORMATTED"]["IS_MESSAGE_SHORT"] = CSocNetLogTools::FormatEvent_IsMessageShort($arResult["EVENT_FORMATTED"]["MESSAGE"], $arResult["EVENT_FORMATTED"]["SHORT_MESSAGE"]);
}
}
return $arResult;
}
示例6: intval
$arResult["LOG_COUNTER"] = intval($arCounters[$arResult["COUNTER_TYPE"]]);
} else {
$bEmptyCounter = true;
$arResult["LOG_COUNTER"] = 0;
}
}
if ($GLOBALS["USER"]->IsAuthorized() && $arParams["SET_LOG_COUNTER"] == "Y" && (intval($arResult["LOG_COUNTER"]) > 0 || $bEmptyCounter)) {
CUserCounter::ClearByUser($GLOBALS["USER"]->GetID(), array(SITE_ID, "**"), $arResult["COUNTER_TYPE"]);
}
if ($GLOBALS["USER"]->IsAuthorized() && $arParams["SET_LOG_PAGE_CACHE"] == "Y" && $dateLastPage && (!$dateLastPageStart || $dateLastPageStart != $dateLastPage || $bNeedSetLogPage)) {
CSocNetLogPages::Set($GLOBALS["USER"]->GetID(), $dateLastPage, $arParams["PAGE_SIZE"], $arResult["PAGE_NUMBER"], SITE_ID, strlen($arResult["COUNTER_TYPE"]) > 0 ? $arResult["COUNTER_TYPE"] : "**");
}
} else {
$rsCurrentUser = CUser::GetByID($GLOBALS["USER"]->GetID());
if ($arCurrentUser = $rsCurrentUser->Fetch()) {
$arResult["EmptyComment"] = array("AVATAR_SRC" => CSocNetLogTools::FormatEvent_CreateAvatar($arCurrentUser, $arParams, ""), "AUTHOR_NAME" => CUser::FormatName($arParams["NAME_TEMPLATE"], $arCurrentUser, $bUseLogin));
}
}
if ($GLOBALS["USER"]->IsAuthorized() && $arParams["USE_FOLLOW"] == "Y") {
$rsFollow = CSocNetLogFollow::GetList(array("USER_ID" => $GLOBALS["USER"]->GetID(), "CODE" => "**"), array("TYPE"));
if ($arFollow = $rsFollow->Fetch()) {
$arResult["FOLLOW_DEFAULT"] = $arFollow["TYPE"];
} else {
$arResult["FOLLOW_DEFAULT"] = COption::GetOptionString("socialnetwork", "follow_default_type", "Y");
}
}
$bAllowToAll = COption::GetOptionString("socialnetwork", "allow_livefeed_toall", "Y") == "Y";
if ($bAllowToAll) {
$arToAllRights = unserialize(COption::GetOptionString("socialnetwork", "livefeed_toall_rights", 'a:1:{i:0;s:2:"AU";}'));
if (!$arToAllRights) {
$arToAllRights = array("AU");
示例7: array
"URL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComment["USER_ID"], "id" => $arComment["USER_ID"]))
);
}
else
$arCreatedBy = array("FORMATTED" => GetMessage("SONET_C73_CREATED_BY_ANONYMOUS"));
$arTmpCommentEvent = array(
"LOG_DATE" => $arComment["LOG_DATE"],
"LOG_DATE_FORMAT" => $arComment["LOG_DATE_FORMAT"],
"LOG_DATE_DAY" => ConvertTimeStamp(MakeTimeStamp($arComment["LOG_DATE"]), "SHORT"),
"LOG_TIME_FORMAT" => $timeFormated,
"MESSAGE" => $arComment["MESSAGE"],
"MESSAGE_FORMAT" => $arComment["~MESSAGE"],
"CREATED_BY" => $arCreatedBy,
"AVATAR_SRC" => CSocNetLogTools::FormatEvent_CreateAvatar($arUser, $arParams, ""),
"USER_ID" => $arComment["USER_ID"]
);
$arEventTmp = CSocNetLogTools::FindLogCommentEventByID($arComment["EVENT_ID"]);
if (
$arEventTmp
&& array_key_exists("CLASS_FORMAT", $arEventTmp)
&& array_key_exists("METHOD_FORMAT", $arEventTmp)
)
{
$arFIELDS_FORMATTED = call_user_func(array($arEventTmp["CLASS_FORMAT"], $arEventTmp["METHOD_FORMAT"]), $arComment, $arParams);
$arTmpCommentEvent["MESSAGE_FORMAT"] = htmlspecialcharsback($arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"]);
}
$arResult["arCommentFormatted"] = $arTmpCommentEvent;
示例8: FormatEvent_System
function FormatEvent_System($arFields, $arParams, $bMail = false)
{
if ($bMail && strlen($arFields["MAIL_LANGUAGE_ID"]) > 0) {
IncludeModuleLangFile(__FILE__, $arFields["MAIL_LANGUAGE_ID"]);
}
$arResult = array("EVENT" => $arFields, "CREATED_BY" => array(), "ENTITY" => array(), "EVENT_FORMATTED" => array());
if (intval($arFields["ENTITY_ID"]) > 0) {
$suffix = is_array($GLOBALS["arExtranetGroupID"]) && in_array($arFields["ENTITY_ID"], $GLOBALS["arExtranetGroupID"]) ? GetMessage("SONET_LOG_EXTRANET_SUFFIX") : "";
if ($bMail) {
$arResult["ENTITY"]["FORMATTED"] = $arFields["GROUP_NAME"] . $suffix;
$arResult["ENTITY"]["TYPE_MAIL"] = GetMessage("SONET_GL_EVENT_ENTITY_G");
} elseif (strpos($arFields["MESSAGE"], ",") > 0) {
$arResult["ENTITY"] = CSocNetLogTools::FormatEvent_GetEntity($arFields, $arParams, false);
}
}
if (in_array($arFields["TITLE"], array("moderate", "unmoderate", "join", "unjoin"))) {
if (strpos($arFields["MESSAGE"], ",") !== false) {
$arResult["CREATED_BY"] = false;
$arGroup = array("IMAGE_ID" => $arFields["GROUP_IMAGE_ID"]);
$arResult["AVATAR_SRC"] = CSocNetLogTools::FormatEvent_CreateAvatarGroup($arGroup, $arParams);
// group avatar
} else {
$suffix = is_array($GLOBALS["arExtranetUserID"]) && in_array($arFields["MESSAGE"], $GLOBALS["arExtranetUserID"]) ? GetMessage("SONET_LOG_EXTRANET_SUFFIX") : "";
$dbUser = CUser::GetByID($arFields["MESSAGE"]);
if ($arUser = $dbUser->Fetch()) {
$arFieldsTooltip = array("ID" => $arUser["ID"], "NAME" => $arUser["NAME"], "LAST_NAME" => $arUser["LAST_NAME"], "SECOND_NAME" => $arUser["SECOND_NAME"], "LOGIN" => $arUser["LOGIN"]);
$oldNameTemplate = $arParams["NAME_TEMPLATE"];
$arParams["NAME_TEMPLATE"] .= $suffix;
$arResult["CREATED_BY"]["TOOLTIP_FIELDS"] = CSocNetLogTools::FormatEvent_FillTooltip($arFieldsTooltip, $arParams);
$arParams["NAME_TEMPLATE"] = $oldNameTemplate;
if (!$bMail) {
$arResult["AVATAR_SRC"] = CSocNetLogTools::FormatEvent_CreateAvatar($arUser, $arParams, "");
}
}
}
} else {
$suffix = is_array($GLOBALS["arExtranetUserID"]) && in_array($arFields["USER_ID"], $GLOBALS["arExtranetUserID"]) ? GetMessage("SONET_LOG_EXTRANET_SUFFIX") : "";
$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"]);
$oldNameTemplate = $arParams["NAME_TEMPLATE"];
$arParams["NAME_TEMPLATE"] .= $suffix;
$arResult["CREATED_BY"]["TOOLTIP_FIELDS"] = CSocNetLogTools::FormatEvent_FillTooltip($arFieldsTooltip, $arParams);
$arParams["NAME_TEMPLATE"] = $oldNameTemplate;
if (!$bMail) {
$arResult["AVATAR_SRC"] = CSocNetLogTools::FormatEvent_CreateAvatar($arFields, $arParams, "CREATED_BY_");
}
}
if (strlen($arFields["MESSAGE"]) > 0) {
$arUsersID = explode(",", $arFields["MESSAGE"]);
$bFirst = true;
$count = 0;
$user_tmp = "";
if ($bMail) {
$dbUser = CUser::GetList($by = "last_name", $order = "asc", array("ID" => implode(" | ", $arUsersID)));
while ($arUser = $dbUser->Fetch()) {
$suffix = is_array($GLOBALS["arExtranetUserID"]) && in_array($arUser["ID"], $GLOBALS["arExtranetUserID"]) ? GetMessage("SONET_LOG_EXTRANET_SUFFIX") : "";
$count++;
if (!$bFirst) {
$user_tmp .= ", ";
}
if (strlen($arUser["NAME"]) > 0 || strlen($arUser["LAST_NAME"]) > 0) {
$user_tmp .= $arUser["NAME"] . " " . $arUser["LAST_NAME"] . $suffix;
} else {
$user_tmp .= $arUser["LOGIN"] . $suffix;
}
$bFirst = false;
}
} else {
$ajax_page = $GLOBALS["APPLICATION"]->GetCurPageParam("", array("bxajaxid", "logout"));
$dbUser = CUser::GetList($by = "last_name", $order = "asc", array("ID" => implode(" | ", $arUsersID)), array("FIELDS" => array("ID", "NAME", "LAST_NAME", "SECOND_NAME", "LOGIN", "PERSONAL_GENDER")));
while ($arUser = $dbUser->Fetch()) {
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->RegisterTag("USER_NAME_" . intval($arUser["ID"]));
}
$suffix = is_array($GLOBALS["arExtranetUserID"]) && in_array($arUser["ID"], $GLOBALS["arExtranetUserID"]) ? GetMessage("SONET_LOG_EXTRANET_SUFFIX") : "";
$count++;
if (!$bFirst) {
$user_tmp .= ", ";
}
$oldNameTemplate = $arParams["NAME_TEMPLATE"];
$arParams["NAME_TEMPLATE"] .= $suffix;
$anchor_id = RandString(8);
if ($arParams["MOBILE"] == "Y") {
$user_tmp .= '<a href="' . str_replace(array("#user_id#", "#USER_ID#", "#id#", "#ID#"), $arUser["ID"], $arParams["~PATH_TO_USER"]) . '">' . CUser::FormatName($arParams["NAME_TEMPLATE"], $arUser, $arParams["SHOW_LOGIN"] != "N" ? true : false) . '</a>';
} else {
$user_tmp .= '<a class="" id="anchor_' . $anchor_id . '" href="' . str_replace(array("#user_id#", "#USER_ID#", "#id#", "#ID#"), $arUser["ID"], $arParams["~PATH_TO_USER"]) . '">' . CUser::FormatName($arParams["NAME_TEMPLATE"], $arUser, $arParams["SHOW_LOGIN"] != "N" ? true : false) . '</a>';
$user_tmp .= '<script type="text/javascript">';
$user_tmp .= 'BX.tooltip(' . $arUser["ID"] . ', "anchor_' . $anchor_id . '", "' . CUtil::JSEscape($ajax_page) . '");';
$user_tmp .= '</script>';
}
$arParams["NAME_TEMPLATE"] = $oldNameTemplate;
$bFirst = false;
$arLastUser = $arUser;
}
}
}
if ($bMail) {
$title_tmp = GetMessage("SONET_GL_EVENT_TITLE_SYSTEM_" . strtoupper($arFields["TITLE"]) . "_" . ($count > 1 ? "2" : "1") . "_MAIL");
} else {
if (in_array($arFields["TITLE"], array("moderate", "unmoderate", "join", "unjoin"))) {
if ($count == 1 && $arLastUser) {
//.........这里部分代码省略.........
示例9: __SLMAjaxGetComment
function __SLMAjaxGetComment($comment_id, $arParams, $bCheckRights = false)
{
if ($arComment = CSocNetLogComments::GetByID($comment_id)) {
if ($bCheckRights) {
if (strpos($arComment["ENTITY_TYPE"], "CRM") === 0 && IsModuleInstalled("crm")) {
$arListParams = array("IS_CRM" => "Y", "CHECK_CRM_RIGHTS" => "Y");
} else {
$arListParams = array("CHECK_RIGHTS" => "Y", "USE_SUBSCRIBE" => "N");
}
if (intval($arComment["LOG_ID"]) <= 0 || !($rsLog = CSocNetLog::GetList(array(), array("ID" => $arComment["LOG_ID"]), false, false, array("ID"), $arListParams)) || !($arLog = $rsLog->Fetch())) {
return false;
}
}
$arParams["DATE_TIME_FORMAT"] = $_REQUEST["dtf"];
$dateFormated = FormatDate($GLOBALS['DB']->DateFormatToPHP(FORMAT_DATE), MakeTimeStamp($arComment["LOG_DATE"]));
$timeFormated = FormatDateFromDB($arComment["LOG_DATE"], stripos($arParams["DATE_TIME_FORMAT"], 'a') || ($arParams["DATE_TIME_FORMAT"] == 'FULL' && IsAmPmMode()) !== false ? 'H:MI T' : 'HH:MI');
$dateTimeFormated = FormatDate(!empty($arParams['DATE_TIME_FORMAT']) ? $arParams['DATE_TIME_FORMAT'] == 'FULL' ? $GLOBALS['DB']->DateFormatToPHP(str_replace(':SS', '', FORMAT_DATETIME)) : $arParams['DATE_TIME_FORMAT'] : $GLOBALS['DB']->DateFormatToPHP(FORMAT_DATETIME), MakeTimeStamp($arComment["LOG_DATE"]));
if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) {
$dateFormated = ToLower($dateFormated);
$dateTimeFormated = ToLower($dateTimeFormated);
}
// strip current year
if (!empty($arParams['DATE_TIME_FORMAT']) && ($arParams['DATE_TIME_FORMAT'] == 'j F Y G:i' || $arParams['DATE_TIME_FORMAT'] == 'j F Y g:i a')) {
$dateTimeFormated = ltrim($dateTimeFormated, '0');
$curYear = date('Y');
$dateTimeFormated = str_replace(array('-' . $curYear, '/' . $curYear, ' ' . $curYear, '.' . $curYear), '', $dateTimeFormated);
}
if (intval($arComment["USER_ID"]) > 0) {
$arParams = array("PATH_TO_USER" => $_REQUEST["p_user"], "NAME_TEMPLATE" => $_REQUEST["nt"], "SHOW_LOGIN" => $_REQUEST["sl"], "AVATAR_SIZE" => $as, "PATH_TO_SMILE" => $_REQUEST["p_smile"]);
$arUser = array("ID" => $arComment["USER_ID"], "NAME" => $arComment["~CREATED_BY_NAME"], "LAST_NAME" => $arComment["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arComment["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arComment["~CREATED_BY_LOGIN"], "PERSONAL_PHOTO" => $arComment["~CREATED_BY_PERSONAL_PHOTO"], "PERSONAL_GENDER" => $arComment["~CREATED_BY_PERSONAL_GENDER"]);
$bUseLogin = $arParams["SHOW_LOGIN"] != "N" ? true : false;
$arCreatedBy = array("FORMATTED" => CUser::FormatName($arParams["NAME_TEMPLATE"], $arUser, $bUseLogin), "URL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComment["USER_ID"], "id" => $arComment["USER_ID"])));
} else {
$arCreatedBy = array("FORMATTED" => GetMessage("SONET_SLM_CREATED_BY_ANONYMOUS"));
}
$arTmpCommentEvent = array("LOG_DATE" => $arComment["LOG_DATE"], "LOG_DATE_FORMAT" => $arComment["LOG_DATE_FORMAT"], "LOG_DATE_DAY" => ConvertTimeStamp(MakeTimeStamp($arComment["LOG_DATE"]), "SHORT"), "LOG_TIME_FORMAT" => $timeFormated, "MESSAGE" => $arComment["MESSAGE"], "MESSAGE_FORMAT" => $arComment["~MESSAGE"], "CREATED_BY" => $arCreatedBy, "AVATAR_SRC" => CSocNetLogTools::FormatEvent_CreateAvatar($arUser, $arParams, ""), "USER_ID" => $arComment["USER_ID"]);
$arEventTmp = CSocNetLogTools::FindLogCommentEventByID($arComment["EVENT_ID"]);
if ($arEventTmp && array_key_exists("CLASS_FORMAT", $arEventTmp) && array_key_exists("METHOD_FORMAT", $arEventTmp)) {
$arComment["UF"] = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("SONET_COMMENT", $arComment["ID"], LANGUAGE_ID);
$arFIELDS_FORMATTED = call_user_func(array($arEventTmp["CLASS_FORMAT"], $arEventTmp["METHOD_FORMAT"]), $arComment, array_merge($arParams, array("MOBILE" => "N", "PATH_TO_USER" => COption::GetOptionString("main", "TOOLTIP_PATH_TO_USER", SITE_DIR . "company/personal/user/#user_id#/", SITE_ID))));
$arTmpCommentEvent["MESSAGE_FORMAT"] = htmlspecialcharsback($arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"]);
$arFIELDS_FORMATTED = call_user_func(array($arEventTmp["CLASS_FORMAT"], $arEventTmp["METHOD_FORMAT"]), $arComment, array_merge($arParams, array("MOBILE" => "Y", "PATH_TO_USER" => SITE_DIR . "mobile/users/?user_id=#user_id#")));
$arTmpCommentEvent["MESSAGE_FORMAT_MOBILE"] = htmlspecialcharsback($arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"]);
}
return $arTmpCommentEvent;
}
}
示例10: FormatTask4SocialNetwork
public static function FormatTask4SocialNetwork($arFields, $arParams, $bMail = false)
{
/** @global CMain $APPLICATION */
global $APPLICATION;
$task_datetime = null;
if (!CModule::IncludeModule('socialnetwork')) {
return false;
}
$APPLICATION->SetAdditionalCSS('/bitrix/js/tasks/css/tasks.css');
if (isset($arFields['~PARAMS']) && $arFields['~PARAMS']) {
$arFields['PARAMS'] = unserialize($arFields['~PARAMS']);
} elseif (isset($arFields['PARAMS']) && $arFields['PARAMS']) {
$arFields['PARAMS'] = unserialize($arFields['PARAMS']);
} else {
$arFields['PARAMS'] = array();
}
$arResult = array('EVENT' => $arFields, 'CREATED_BY' => CSocNetLogTools::FormatEvent_GetCreatedBy($arFields, $arParams, $bMail), 'ENTITY' => CSocNetLogTools::FormatEvent_GetEntity($arFields, $arParams, $bMail), 'EVENT_FORMATTED' => array(), 'CACHED_CSS_PATH' => '/bitrix/js/tasks/css/tasks.css');
if (!$bMail) {
$arResult["AVATAR_SRC"] = CSocNetLogTools::FormatEvent_CreateAvatar($arFields, $arParams);
}
if (!$bMail && $arParams["MOBILE"] != "Y" && array_key_exists("URL", $arFields) && strlen($arFields["URL"]) > 0) {
$taskHtmlTitle = '<a href="' . $arFields["URL"] . '" onclick="if (taskIFramePopup.isLeftClick(event)) {taskIFramePopup.view(' . $arFields["SOURCE_ID"] . '); return false;}">' . $arFields["TITLE"] . '</a>';
} else {
$taskHtmlTitle = $arFields["TITLE"];
}
$actorUserId = null;
$actorUserName = '';
$actorMaleSuffix = '';
$eventTitlePhraseSuffix = '_DEFAULT';
if (isset($arParams['NAME_TEMPLATE'])) {
$nameTemplate = $arParams['NAME_TEMPLATE'];
} else {
$nameTemplate = CSite::GetNameFormat();
}
if (isset($arFields["PARAMS"], $arFields['PARAMS']['TYPE'])) {
if ($arFields["PARAMS"]["TYPE"] === "create") {
$eventTitlePhraseSuffix = '_CREATE_24';
if (isset($arFields["PARAMS"]["CREATED_BY"])) {
$actorUserId = $arFields["PARAMS"]["CREATED_BY"];
}
} elseif ($arFields["PARAMS"]["TYPE"] === 'modify') {
$eventTitlePhraseSuffix = '_MODIFY_24';
if (isset($arFields["PARAMS"]["CHANGED_BY"])) {
$actorUserId = $arFields["PARAMS"]["CHANGED_BY"];
}
} elseif ($arFields["PARAMS"]["TYPE"] === 'status') {
$eventTitlePhraseSuffix = '_STATUS_24';
if (isset($arFields["PARAMS"]["CHANGED_BY"])) {
$actorUserId = $arFields["PARAMS"]["CHANGED_BY"];
}
} elseif ($arFields["PARAMS"]["TYPE"] === 'comment') {
$eventTitlePhraseSuffix = '';
}
}
if ($actorUserId) {
$rsUser = CUser::GetList($by = 'id', $order = 'asc', array('ID_EQUAL_EXACT' => (int) $actorUserId), array('FIELDS' => array('ID', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'LOGIN', 'PERSONAL_GENDER')));
if ($arUser = $rsUser->fetch()) {
if (isset($arUser['PERSONAL_GENDER'])) {
switch ($arUser['PERSONAL_GENDER']) {
case "F":
case "M":
$actorMaleSuffix = '_' . $arUser['PERSONAL_GENDER'];
break;
}
}
$actorUserName = CUser::FormatName($nameTemplate, $arUser);
}
}
$eventTitleTemplate = GetMessage('TASKS_SONET_GL_EVENT_TITLE_TASK' . $eventTitlePhraseSuffix . $actorMaleSuffix);
$eventTitle = str_replace(array('#USER_NAME#', '#TITLE#'), array($actorUserName, $taskHtmlTitle), $eventTitleTemplate);
$eventTitleWoTaskName = str_replace(array('#USER_NAME#', '#TITLE#'), array($actorUserName, ''), $eventTitleTemplate);
$title_tmp = str_replace("#TITLE#", $taskHtmlTitle, GetMessage("TASKS_SONET_GL_EVENT_TITLE_TASK"));
if ($arFields["PARAMS"] && $arFields["PARAMS"]["CREATED_BY"]) {
$suffix = is_array($GLOBALS["arExtranetUserID"]) && in_array($arFields["PARAMS"]["CREATED_BY"], $GLOBALS["arExtranetUserID"]) ? GetMessage("TASKS_SONET_LOG_EXTRANET_SUFFIX") : "";
$rsUser = CUser::GetList($by = 'id', $order = 'asc', array('ID_EQUAL_EXACT' => (int) $arFields['PARAMS']['CREATED_BY']), array('FIELDS' => array('PERSONAL_GENDER', 'ID', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'LOGIN')));
if ($arUser = $rsUser->Fetch()) {
$title_tmp .= " (" . str_replace("#USER_NAME#", CUser::FormatName(CSite::GetNameFormat(false), $arUser) . $suffix, GetMessage("TASKS_SONET_GL_EVENT_TITLE_TASK_CREATED")) . ")";
}
}
if ($bMail) {
$title = str_replace(array("#TASK#", "#ENTITY#", "#CREATED_BY#"), array($title_tmp, $arResult["ENTITY"]["FORMATTED"], $bMail ? $arResult["CREATED_BY"]["FORMATTED"] : ""), GetMessage("SONET_GL_EVENT_TITLE_" . ($arFields["ENTITY_TYPE"] == SONET_SUBSCRIBE_ENTITY_GROUP ? "GROUP" : "USER") . "_TASK_MAIL"));
} else {
$title = $title_tmp;
$title_24 = $eventTitle;
}
if (!$bMail && in_array($arFields["PARAMS"]["TYPE"], array("create", "status", 'modify', 'comment'), true)) {
if (!(isset($arFields['PARAMS']['CHANGED_FIELDS']) && is_array($arFields['PARAMS']['CHANGED_FIELDS']))) {
$arFields['PARAMS']['CHANGED_FIELDS'] = array();
}
$rsTask = CTasks::GetByID($arFields["SOURCE_ID"], false);
if ($arTask = $rsTask->Fetch()) {
$task_datetime = $arTask["CHANGED_DATE"];
if ($arFields["PARAMS"]["TYPE"] == "create") {
if ($arParams["MOBILE"] == "Y") {
$title_24 = GetMessage("TASKS_SONET_GL_TASKS2_NEW_TASK_MESSAGE");
$message_24_1 = $taskHtmlTitle;
} else {
$message = $message_24_1 = $eventTitle;
$message_24_2 = $changes_24 = "";
}
//.........这里部分代码省略.........
示例11: array
$arListParams = array("CHECK_RIGHTS" => "Y", "USE_SUBSCRIBE" => "N");
}
if (intval($arComment["LOG_ID"]) > 0 && ($rsLog = CSocNetLog::GetList(array(), array("ID" => $arComment["LOG_ID"]), false, false, array("ID", "EVENT_ID"), $arListParams)) && ($arLog = $rsLog->Fetch())) {
$arResult["arComment"] = $arComment;
$dateFormated = FormatDate($GLOBALS['DB']->DateFormatToPHP(FORMAT_DATE), MakeTimeStamp(array_key_exists("LOG_DATE_FORMAT", $arComment) ? $arComment["LOG_DATE_FORMAT"] : $arComment["LOG_DATE"]));
$timeFormat = isset($_REQUEST["dtf"]) ? $_REQUEST["dtf"] : CSite::GetTimeFormat();
$timeFormated = FormatDateFromDB(array_key_exists("LOG_DATE_FORMAT", $arComment) ? $arComment["LOG_DATE_FORMAT"] : $arComment["LOG_DATE"], stripos($timeFormat, 'a') || ($timeFormat == 'FULL' && (strpos(FORMAT_DATETIME, 'T') !== false || strpos(FORMAT_DATETIME, 'TT') !== false)) !== false ? strpos(FORMAT_DATETIME, 'TT') !== false ? 'H:MI TT' : 'H:MI T' : 'HH:MI');
if (intval($arComment["USER_ID"]) > 0) {
$arParams = array("PATH_TO_USER" => $_REQUEST["p_user"], "NAME_TEMPLATE" => $_REQUEST["nt"], "SHOW_LOGIN" => $_REQUEST["sl"], "AVATAR_SIZE" => $_REQUEST["as"], "PATH_TO_SMILE" => $_REQUEST["p_smile"]);
$arUser = array("ID" => $arComment["USER_ID"], "NAME" => $arComment["~CREATED_BY_NAME"], "LAST_NAME" => $arComment["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arComment["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arComment["~CREATED_BY_LOGIN"], "PERSONAL_PHOTO" => $arComment["~CREATED_BY_PERSONAL_PHOTO"], "PERSONAL_GENDER" => $arComment["~CREATED_BY_PERSONAL_GENDER"]);
$bUseLogin = $arParams["SHOW_LOGIN"] != "N" ? true : false;
$arCreatedBy = array("FORMATTED" => CUser::FormatName($arParams["NAME_TEMPLATE"], $arUser, $bUseLogin), "URL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComment["USER_ID"], "id" => $arComment["USER_ID"])));
} else {
$arCreatedBy = array("FORMATTED" => GetMessage("SONET_C73_CREATED_BY_ANONYMOUS"));
}
$arTmpCommentEvent = array("LOG_DATE" => $arComment["LOG_DATE"], "LOG_DATE_FORMAT" => $arComment["LOG_DATE_FORMAT"], "LOG_DATE_DAY" => ConvertTimeStamp(MakeTimeStamp($arComment["LOG_DATE"]), "SHORT"), "LOG_TIME_FORMAT" => $timeFormated, "MESSAGE" => $arComment["MESSAGE"], "MESSAGE_FORMAT" => $arComment["~MESSAGE"], "CREATED_BY" => $arCreatedBy, "AVATAR_SRC" => CSocNetLogTools::FormatEvent_CreateAvatar($arUser, $arParams, ""), "USER_ID" => $arComment["USER_ID"]);
$arEventTmp = CSocNetLogTools::FindLogCommentEventByID($arComment["EVENT_ID"]);
if ($arEventTmp && array_key_exists("CLASS_FORMAT", $arEventTmp) && array_key_exists("METHOD_FORMAT", $arEventTmp)) {
$arFIELDS_FORMATTED = call_user_func(array($arEventTmp["CLASS_FORMAT"], $arEventTmp["METHOD_FORMAT"]), $arComment, $arParams);
$arTmpCommentEvent["MESSAGE_FORMAT"] = htmlspecialcharsback($arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"]);
}
$arResult["arCommentFormatted"] = $arTmpCommentEvent;
}
}
} elseif ($action == "get_comments") {
$arResult["arComments"] = array();
$log_tmp_id = $_REQUEST["logid"];
$log_entity_type = $entity_type;
$arListParams = strpos($log_entity_type, "CRM") === 0 && IsModuleInstalled("crm") ? array("IS_CRM" => "Y", "CHECK_CRM_RIGHTS" => "Y") : array("CHECK_RIGHTS" => "Y", "USE_SUBSCRIBE" => "N");
if (intval($log_tmp_id) > 0 && ($rsLog = CSocNetLog::GetList(array(), array("ID" => $log_tmp_id), false, false, array("ID", "EVENT_ID", "SOURCE_ID"), $arListParams)) && ($arLog = $rsLog->Fetch())) {
$arParams = array("PATH_TO_USER" => $_REQUEST["p_user"], "PATH_TO_GROUP" => $_REQUEST["p_group"], "PATH_TO_CONPANY_DEPARTMENT" => $_REQUEST["p_dep"], "PATH_TO_LOG_ENTRY" => $_REQUEST["p_le"], "NAME_TEMPLATE" => $_REQUEST["nt"], "NAME_TEMPLATE_WO_NOBR" => str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $_REQUEST["nt"]), "SHOW_LOGIN" => $_REQUEST["sl"], "DATE_TIME_FORMAT" => isset($_REQUEST["dtf"]) ? $_REQUEST["dtf"] : CSite::GetDateFormat(), "TIME_FORMAT" => isset($_REQUEST["tf"]) ? $_REQUEST["tf"] : CSite::GetTimeFormat(), "AVATAR_SIZE" => $_REQUEST["as"]);
示例12: FormatEvent_Files
static function FormatEvent_Files($arFields, $arParams, $bMail = false)
{
if (!CModule::IncludeModule("socialnetwork")) {
return null;
}
$arResult = array("EVENT" => $arFields, "CREATED_BY" => CSocNetLogTools::FormatEvent_GetCreatedBy($arFields, $arParams, $bMail), "ENTITY" => self::GetEntity_Files($arFields, $bMail), "URL" => "");
if (!$bMail) {
$arResult["AVATAR_SRC"] = CSocNetLogTools::FormatEvent_CreateAvatar($arFields, $arParams);
switch ($arFields["CREATED_BY_PERSONAL_GENDER"]) {
case "M":
$suffix = "_M";
break;
case "F":
$suffix = "_F";
break;
default:
$suffix = "";
}
$title_tmp_24 = GetMessage("WEBDAV_SONET_EVENT_TITLE_FILE_24" . $suffix);
}
$title = "";
if (strlen($arFields["TITLE"]) > 0) {
if (!$bMail && strlen($arFields["URL"]) > 0) {
$title_tmp = '<a href="' . $arFields["URL"] . '">' . $arFields["TITLE"] . '</a>';
} else {
$title_tmp = $arFields["TITLE"];
}
$title = str_replace(array("#TITLE#", "#ENTITY#"), array($title_tmp, $bMail ? $arResult["ENTITY"]["FORMATTED"] : $arResult["ENTITY"]["FORMATTED"]["NAME"]), $bMail ? GetMessage("WEBDAV_SOCNET_LOG_FILES_TITLE_MAIL") : GetMessage("WEBDAV_SOCNET_LOG_FILES_TITLE"));
} else {
$title_tmp = "";
}
$url = false;
if (strlen($arFields["URL"]) > 0 && strlen($arFields["SITE_ID"]) > 0) {
$rsSites = CSite::GetByID($arFields["SITE_ID"]);
$arSite = $rsSites->Fetch();
if (strlen($arSite["SERVER_NAME"]) > 0) {
$server_name = $arSite["SERVER_NAME"];
} else {
$server_name = COption::GetOptionString("main", "server_name", $GLOBALS["SERVER_NAME"]);
}
$protocol = CMain::IsHTTPS() ? "https" : "http";
$url = $protocol . "://" . $server_name . $arFields["URL"];
}
if ($arParams["MOBILE"] == "Y") {
$arResult["EVENT_FORMATTED"] = array("TITLE_24" => GetMessage("WEBDAV_SONET_EVENT_TITLE_FILE_24_MOBILE"), "MESSAGE" => $arFields["MESSAGE"]);
} else {
$arResult["EVENT_FORMATTED"] = array("TITLE" => $title, "MESSAGE_TITLE_24" => $title_tmp_24, "MESSAGE" => $bMail ? $arFields["TEXT_MESSAGE"] : $arFields["MESSAGE"]);
}
if (!$bMail) {
$arResult["EVENT_FORMATTED"]["IS_MESSAGE_SHORT"] = true;
}
if (strlen($url) > 0) {
$arResult["EVENT_FORMATTED"]["URL"] = $url;
}
$arResult["HAS_COMMENTS"] = "N";
if (intval($arFields["SOURCE_ID"]) > 0 && array_key_exists("PARAMS", $arFields) && strlen($arFields["PARAMS"]) > 0) {
$arFieldsParams = explode("&", $arFields["PARAMS"]);
if (is_array($arFieldsParams) && count($arFieldsParams) > 0) {
foreach ($arFieldsParams as $tmp) {
list($key, $value) = explode("=", $tmp);
if ($key == "forum_id") {
$arResult["HAS_COMMENTS"] = "Y";
break;
}
}
}
}
if (!$bMail) {
$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"])), $iMoreCount);
if (intval($iMoreCount) > 0) {
$arResult["EVENT_FORMATTED"]["DESTINATION_MORE"] = $iMoreCount;
}
}
return $arResult;
}
示例13: __SLEGetLogCommentRecord
function __SLEGetLogCommentRecord($arComments, $arParams, $arCurrentUserSubscribe, $bTooltip = true)
{
// for the same post log_update - time only, if not - date and time
$dateFormated = FormatDate($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATE), MakeTimeStamp(array_key_exists("LOG_DATE_FORMAT", $arComments) ? $arComments["LOG_DATE_FORMAT"] : $arComments["LOG_DATE"]));
$timeFormated = FormatDateFromDB(array_key_exists("LOG_DATE_FORMAT", $arComments) ? $arComments["LOG_DATE_FORMAT"] : $arComments["LOG_DATE"], stripos($arParams["DATE_TIME_FORMAT"], 'a') || ($arParams["DATE_TIME_FORMAT"] == 'FULL' && IsAmPmMode()) !== false ? 'H:MI T' : 'HH:MI');
$dateTimeFormated = FormatDate(!empty($arParams['DATE_TIME_FORMAT']) ? $arParams['DATE_TIME_FORMAT'] == 'FULL' ? $GLOBALS['DB']->DateFormatToPHP(str_replace(':SS', '', FORMAT_DATETIME)) : $arParams['DATE_TIME_FORMAT'] : $GLOBALS['DB']->DateFormatToPHP(FORMAT_DATETIME), MakeTimeStamp(array_key_exists("LOG_DATE_FORMAT", $arComments) ? $arComments["LOG_DATE_FORMAT"] : $arComments["LOG_DATE"]));
if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) {
$dateFormated = ToLower($dateFormated);
$dateTimeFormated = ToLower($dateTimeFormated);
}
// strip current year
if (!empty($arParams['DATE_TIME_FORMAT']) && ($arParams['DATE_TIME_FORMAT'] == 'j F Y G:i' || $arParams['DATE_TIME_FORMAT'] == 'j F Y g:i a')) {
$dateTimeFormated = ltrim($dateTimeFormated, '0');
$curYear = date('Y');
$dateTimeFormated = str_replace(array('-' . $curYear, '/' . $curYear, ' ' . $curYear, '.' . $curYear), '', $dateTimeFormated);
}
if ($arComments["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
$path2Entity = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arComments["ENTITY_ID"]));
} else {
$path2Entity = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComments["ENTITY_ID"]));
}
if (intval($arComments["USER_ID"]) > 0) {
$suffix = is_array($GLOBALS["arExtranetUserID"]) && in_array($arComments["USER_ID"], $GLOBALS["arExtranetUserID"]) ? GetMessage("SONET_LOG_EXTRANET_SUFFIX") : "";
$arTmpUser = array("NAME" => $arComments["~CREATED_BY_NAME"], "LAST_NAME" => $arComments["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arComments["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arComments["~CREATED_BY_LOGIN"]);
$bUseLogin = $arParams["SHOW_LOGIN"] != "N" ? true : false;
$arCreatedBy = array("FORMATTED" => CUser::FormatName($arParams["NAME_TEMPLATE"], $arTmpUser, $bUseLogin) . $suffix, "URL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComments["USER_ID"], "id" => $arComments["USER_ID"])));
if ($bTooltip) {
$arCreatedBy["TOOLTIP_FIELDS"] = array("ID" => $arComments["USER_ID"], "NAME" => $arComments["~CREATED_BY_NAME"], "LAST_NAME" => $arComments["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arComments["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arComments["~CREATED_BY_LOGIN"], "USE_THUMBNAIL_LIST" => "N", "PATH_TO_SONET_MESSAGES_CHAT" => $arParams["PATH_TO_MESSAGES_CHAT"], "PATH_TO_SONET_USER_PROFILE" => $arParams["PATH_TO_USER"], "PATH_TO_VIDEO_CALL" => $arParams["PATH_TO_VIDEO_CALL"], "DATE_TIME_FORMAT" => $arParams["DATE_TIME_FORMAT"], "SHOW_YEAR" => $arParams["SHOW_YEAR"], "CACHE_TYPE" => $arParams["CACHE_TYPE"], "CACHE_TIME" => $arParams["CACHE_TIME"], "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"] . $suffix, "SHOW_LOGIN" => $arParams["SHOW_LOGIN"], "PATH_TO_CONPANY_DEPARTMENT" => $arParams["PATH_TO_CONPANY_DEPARTMENT"], "INLINE" => "Y");
}
} else {
$arCreatedBy = array("FORMATTED" => GetMessage("SONET_C73_CREATED_BY_ANONYMOUS"));
}
$arTmpUser = array("NAME" => $arComments["~USER_NAME"], "LAST_NAME" => $arComments["~USER_LAST_NAME"], "SECOND_NAME" => $arComments["~USER_SECOND_NAME"], "LOGIN" => $arComments["~USER_LOGIN"]);
$arParamsTmp = $arParams;
$arParamsTmp["AVATAR_SIZE"] = $arParams["AVATAR_SIZE_COMMENT"];
$arTmpCommentEvent = array("EVENT" => $arComments, "LOG_DATE" => $arComments["LOG_DATE"], "LOG_DATE_TS" => MakeTimeStamp($arComments["LOG_DATE"]), "LOG_DATE_DAY" => ConvertTimeStamp(MakeTimeStamp($arComments["LOG_DATE"]), "SHORT"), "LOG_TIME_FORMAT" => $timeFormated, "TITLE_TEMPLATE" => "", "TITLE" => "", "TITLE_FORMAT" => "", "ENTITY_NAME" => $arComments["ENTITY_TYPE"] == SONET_ENTITY_GROUP ? $arComments["GROUP_NAME"] : CUser::FormatName($arParams['NAME_TEMPLATE'], $arTmpUser, $bUseLogin), "ENTITY_PATH" => $path2Entity, "CREATED_BY" => $arCreatedBy, "AVATAR_SRC" => CSocNetLogTools::FormatEvent_CreateAvatar($arComments, $arParamsTmp));
// if (is_array($arCurrentUserSubscribe) && $arParams["USER_COMMENTS"] != "Y")
// $arTmpCommentEvent["TRANSPORT"] = __SLEGetTransport($arComments, $arCurrentUserSubscribe);
$arEvent = CSocNetLogTools::FindLogCommentEventByID($arComments["EVENT_ID"]);
if ($arEvent && array_key_exists("CLASS_FORMAT", $arEvent) && array_key_exists("METHOD_FORMAT", $arEvent)) {
if ($arParams["USER_COMMENTS"] == "Y") {
$arLog = array();
} else {
$arLog = array("TITLE" => $arComments["~LOG_TITLE"], "URL" => $arComments["~LOG_URL"], "PARAMS" => $arComments["~LOG_PARAMS"]);
}
$arFIELDS_FORMATTED = call_user_func(array($arEvent["CLASS_FORMAT"], $arEvent["METHOD_FORMAT"]), $arComments, $arParams, false, $arLog);
if ($arParams["USE_COMMENTS"] != "Y") {
if (array_key_exists("CREATED_BY", $arFIELDS_FORMATTED) && is_array($arFIELDS_FORMATTED["CREATED_BY"]) && array_key_exists("TOOLTIP_FIELDS", $arFIELDS_FORMATTED["CREATED_BY"])) {
$arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"] = $arFIELDS_FORMATTED["CREATED_BY"]["TOOLTIP_FIELDS"];
}
// $arTmpCommentEvent["ENTITY"] = $arFIELDS_FORMATTED["ENTITY"];
}
}
$message = $arFIELDS_FORMATTED && array_key_exists("EVENT_FORMATTED", $arFIELDS_FORMATTED) && array_key_exists("MESSAGE", $arFIELDS_FORMATTED["EVENT_FORMATTED"]) ? $arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"] : $arTmpCommentEvent["EVENT"]["MESSAGE"];
if (strlen($message) > 0) {
$arFIELDS_FORMATTED["EVENT_FORMATTED"]["FULL_MESSAGE_CUT"] = CSocNetTextParser::closetags(htmlspecialcharsback($message));
}
if (is_array($arTmpCommentEvent)) {
if ($arTmpCommentEvent["LOG_DATE_DAY"] == ConvertTimeStamp()) {
$arFIELDS_FORMATTED["EVENT_FORMATTED"]["DATETIME"] = $timeFormated;
} else {
$arFIELDS_FORMATTED["EVENT_FORMATTED"]["DATETIME"] = $dateTimeFormated;
}
$arTmpCommentEvent["EVENT_FORMATTED"] = $arFIELDS_FORMATTED["EVENT_FORMATTED"];
if (isset($arTmpCommentEvent["EVENT_FORMATTED"]) && is_array($arTmpCommentEvent["EVENT_FORMATTED"])) {
$arFields2Cache = array("DATETIME", "MESSAGE", "FULL_MESSAGE_CUT", "ERROR_MSG");
foreach ($arTmpCommentEvent["EVENT_FORMATTED"] as $field => $value) {
if (!in_array($field, $arFields2Cache)) {
unset($arTmpCommentEvent["EVENT_FORMATTED"][$field]);
}
}
}
if (isset($arTmpCommentEvent["EVENT"]) && is_array($arTmpCommentEvent["EVENT"])) {
$arFields2Cache = array("ID", "USER_ID", "LOG_DATE", "RATING_TYPE_ID", "RATING_ENTITY_ID");
foreach ($arTmpCommentEvent["EVENT"] as $field => $value) {
if (!in_array($field, $arFields2Cache)) {
unset($arTmpCommentEvent["EVENT"][$field]);
}
}
}
if (isset($arTmpCommentEvent["CREATED_BY"]) && is_array($arTmpCommentEvent["CREATED_BY"])) {
$arFields2Cache = array("TOOLTIP_FIELDS", "FORMATTED", "URL");
foreach ($arTmpCommentEvent["CREATED_BY"] as $field => $value) {
if (!in_array($field, $arFields2Cache)) {
unset($arTmpCommentEvent["CREATED_BY"][$field]);
}
}
if (isset($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"]) && is_array($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"])) {
$arFields2Cache = array("ID", "PATH_TO_SONET_USER_PROFILE", "NAME", "LAST_NAME", "SECOND_NAME", "LOGIN", "EMAIL");
foreach ($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"] as $field => $value) {
if (!in_array($field, $arFields2Cache)) {
unset($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"][$field]);
}
}
}
}
}
foreach ($arTmpCommentEvent["EVENT"] as $key => $value) {
if (strpos($key, "~") === 0) {
unset($arTmpCommentEvent["EVENT"][$key]);
//.........这里部分代码省略.........
示例14: elseif
$arGrat["USERS"][] = $arElementProperty["VALUE"];
} elseif ($arElementProperty["CODE"] == "GRATITUDE") {
$arGrat["TYPE"] = array("VALUE_ENUM" => $arElementProperty["VALUE_ENUM"], "XML_ID" => $arElementProperty["VALUE_XML_ID"]);
}
}
if (count($arGrat["USERS"]) > 0) {
$grat_avatar_size = $arParams["MOBILE"] == "Y" ? 58 : (count($arGrat["USERS"]) <= 4 ? 42 : 17);
if ($arParams["CACHE_TIME"] > 0 && defined("BX_COMP_MANAGED_CACHE")) {
foreach ($arGrat["USERS"] as $i => $grat_user_id) {
$GLOBALS["CACHE_MANAGER"]->RegisterTag("USER_CARD_" . intval($grat_user_id / 100));
}
}
$arGratUsers = array();
$rsUser = CUser::GetList($by = "", $ord = "", array("ID" => implode("|", $arGrat["USERS"])), array("FIELDS" => array("ID", "PERSONAL_GENDER", "PERSONAL_PHOTO", "LOGIN", "NAME", "LAST_NAME", "SECOND_NAME", "EMAIL", "WORK_POSITION")));
while ($arGratUser = $rsUser->Fetch()) {
$arGratUser["AVATAR_SRC"] = CSocNetLogTools::FormatEvent_CreateAvatar($arGratUser, array("AVATAR_SIZE" => $grat_avatar_size), "");
$arGratUser["URL"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arGratUser["ID"]));
$arGratUsers[] = $arGratUser;
}
$arGrat["USERS_FULL"] = $arGratUsers;
}
if (count($arGrat["USERS_FULL"]) > 0) {
$arResult["GRATITUDE"] = $arGrat;
}
}
}
} else {
$arPostField["EDIT_FORM_LABEL"] = strLen($arPostField["EDIT_FORM_LABEL"]) > 0 ? $arPostField["EDIT_FORM_LABEL"] : $arPostField["FIELD_NAME"];
$arPostField["EDIT_FORM_LABEL"] = htmlspecialcharsEx($arPostField["EDIT_FORM_LABEL"]);
$arPostField["~EDIT_FORM_LABEL"] = $arPostField["EDIT_FORM_LABEL"];
$arResult["POST_PROPERTIES"]["DATA"][$FIELD_NAME] = $arPostField;
示例15: __SLMGetLogCommentRecord
function __SLMGetLogCommentRecord($arComments, $arParams, $arCurrentUserSubscribe, $arMyEntities, &$arTmpComments)
{
$arParams["MOBILE"] = "Y";
$arParams["NEW_TEMPLATE"] = "Y";
$dateFormated = FormatDate($GLOBALS['DB']->DateFormatToPHP(FORMAT_DATE), MakeTimeStamp(array_key_exists("LOG_DATE_FORMAT", $arComments) ? $arComments["LOG_DATE_FORMAT"] : $arComments["LOG_DATE"]));
$timestamp = MakeTimeStamp(array_key_exists("LOG_DATE_FORMAT", $arComments) ? $arComments["LOG_DATE_FORMAT"] : $arComments["LOG_DATE"]);
$timeFormated = FormatDate(GetMessage("SONET_SLM_FORMAT_TIME"), $timestamp);
/*
if (strlen($arParams["DATE_TIME_FORMAT"]) <= 0)
$dateTimeFormated = __SMLFormatDate($timestamp);
else
*/
$dateTimeFormated = FormatDate($arParams["DATE_TIME_FORMAT"] == "FULL" ? $GLOBALS["DB"]->DateFormatToPHP(str_replace(":SS", "", FORMAT_DATETIME)) : $arParams["DATE_TIME_FORMAT"], $timestamp);
if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) {
$dateFormated = ToLower($dateFormated);
$dateTimeFormated = ToLower($dateTimeFormated);
}
// strip current year
if (!empty($arParams['DATE_TIME_FORMAT']) && ($arParams['DATE_TIME_FORMAT'] == 'j F Y G:i' || $arParams['DATE_TIME_FORMAT'] == 'j F Y g:i a')) {
$dateTimeFormated = ltrim($dateTimeFormated, '0');
$curYear = date('Y');
$dateTimeFormated = str_replace(array('-' . $curYear, '/' . $curYear, ' ' . $curYear, '.' . $curYear), '', $dateTimeFormated);
}
$title = "";
if ($arComments["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
$path2Entity = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arComments["ENTITY_ID"]));
} else {
$path2Entity = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComments["ENTITY_ID"]));
}
if (intval($arComments["USER_ID"]) > 0) {
$suffix = is_array($GLOBALS["arExtranetUserID"]) && in_array($arComments["USER_ID"], $GLOBALS["arExtranetUserID"]) ? GetMessage("SONET_LOG_EXTRANET_SUFFIX") : "";
$arTmpUser = array("NAME" => $arComments["~CREATED_BY_NAME"], "LAST_NAME" => $arComments["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arComments["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arComments["~CREATED_BY_LOGIN"]);
$bUseLogin = $arParams["SHOW_LOGIN"] != "N" ? true : false;
$arCreatedBy = array("FORMATTED" => CUser::FormatName($arParams["NAME_TEMPLATE"], $arTmpUser, $bUseLogin) . $suffix, "URL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComments["USER_ID"], "id" => $arComments["USER_ID"])));
} else {
$arCreatedBy = array("FORMATTED" => GetMessage("SONET_C73_CREATED_BY_ANONYMOUS"));
}
$arTmpUser = array("NAME" => $arComments["~USER_NAME"], "LAST_NAME" => $arComments["~USER_LAST_NAME"], "SECOND_NAME" => $arComments["~USER_SECOND_NAME"], "LOGIN" => $arComments["~USER_LOGIN"]);
$arParamsTmp = $arParams;
$arParamsTmp["AVATAR_SIZE"] = $arParams["AVATAR_SIZE_COMMENT"];
if (is_array($arComments)) {
unset($arComments["~MESSAGE"]);
unset($arComments["TEXT_MESSAGE"]);
unset($arComments["~TEXT_MESSAGE"]);
}
$arTmpCommentEvent = array("EVENT" => $arComments, "LOG_DATE" => $arComments["LOG_DATE"], "LOG_DATE_TS" => MakeTimeStamp($arComments["LOG_DATE"]), "LOG_DATE_DAY" => ConvertTimeStamp(MakeTimeStamp($arComments["LOG_DATE"]), "SHORT"), "LOG_TIME_FORMAT" => $timeFormated, "TITLE_TEMPLATE" => $title, "TITLE" => $title, "TITLE_FORMAT" => $title, "ENTITY_NAME" => $arComments["ENTITY_TYPE"] == SONET_ENTITY_GROUP ? $arComments["GROUP_NAME"] : CUser::FormatName($arParams['NAME_TEMPLATE'], $arTmpUser, $bUseLogin), "ENTITY_PATH" => $path2Entity, "CREATED_BY" => $arCreatedBy, "AVATAR_SRC" => CSocNetLogTools::FormatEvent_CreateAvatar($arComments, $arParamsTmp));
$arEvent = CSocNetLogTools::FindLogCommentEventByID($arComments["EVENT_ID"]);
if ($arEvent && array_key_exists("CLASS_FORMAT", $arEvent) && array_key_exists("METHOD_FORMAT", $arEvent)) {
$arFIELDS_FORMATTED = call_user_func(array($arEvent["CLASS_FORMAT"], $arEvent["METHOD_FORMAT"]), $arComments, $arParams, false, array());
}
$message = $arFIELDS_FORMATTED && array_key_exists("EVENT_FORMATTED", $arFIELDS_FORMATTED) && array_key_exists("MESSAGE", $arFIELDS_FORMATTED["EVENT_FORMATTED"]) ? $arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"] : $arTmpCommentEvent["MESSAGE"];
$bToday = $arTmpCommentEvent["LOG_DATE_DAY"] == ConvertTimeStamp();
if ($bToday || intval((time() - $timestamp) / 60 / 60) < 24) {
$arFIELDS_FORMATTED["EVENT_FORMATTED"]["DATETIME"] = $timeFormated;
} else {
$arFIELDS_FORMATTED["EVENT_FORMATTED"]["DATETIME"] = $dateTimeFormated;
}
$arFIELDS_FORMATTED["EVENT_FORMATTED"]["ALLOW_VOTE"] = CRatings::CheckAllowVote(array("ENTITY_TYPE_ID" => $arComments["RATING_TYPE_ID"], "OWNER_ID" => $arComments["USER_ID"]));
$arTmpCommentEvent["EVENT_FORMATTED"] = $arFIELDS_FORMATTED["EVENT_FORMATTED"];
$arTmpComments[] = $arTmpCommentEvent;
}