本文整理汇总了PHP中CSocNetLog::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetLog::GetList方法的具体用法?PHP CSocNetLog::GetList怎么用?PHP CSocNetLog::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetLog
的用法示例。
在下文中一共展示了CSocNetLog::GetList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UnInstallDB
function UnInstallDB($arParams = array())
{
global $DB, $APPLICATION;
$errors = null;
if (CModule::IncludeModule("socialnetwork")) {
$dbLog = CSocNetLog::GetList(array(), array("ENTITY_TYPE" => array("R", "T"), "EVENT_ID" => array("timeman_entry", "report")), false, false, array("ID"));
while ($arLog = $dbLog->Fetch()) {
CSocNetLog::Delete($arLog["ID"]);
}
}
if (true == array_key_exists("savedata", $arParams) && $arParams["savedata"] != 'Y') {
$errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/' . $this->MODULE_ID . '/install/db/' . strtolower($DB->type) . '/uninstall.sql');
if (!empty($errors)) {
$APPLICATION->ThrowException(implode("", $errors));
return false;
}
$this->UnInstallTasks();
}
UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetLogEvents', 'timeman', 'CReportNotifications', 'AddEvent');
UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetAllowedSubscribeEntityTypes', 'timeman', 'CReportNotifications', 'OnFillSocNetAllowedSubscribeEntityTypes');
UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetLogEvents', 'timeman', 'CTimeManNotify', 'OnFillSocNetLogEvents');
UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetAllowedSubscribeEntityTypes', 'timeman', 'CTimeManNotify', 'OnFillSocNetAllowedSubscribeEntityTypes');
UnRegisterModuleDependences("im", "OnGetNotifySchema", "timeman", "CTimemanNotifySchema", "OnGetNotifySchema");
UnRegisterModuleDependences('main', 'OnAfterUserUpdate', 'timeman', 'CTimeManNotify', 'OnAfterUserUpdate');
UnRegisterModuleDependences('main', 'OnAfterUserUpdate', 'timeman', 'CReportNotifications', 'OnAfterUserUpdate');
UnRegisterModule($this->MODULE_ID);
return true;
}
示例2: Set
function Set($user_id, $code = "**", $type = "Y", $follow_date = false, $site_id = SITE_ID)
{
static $LOG_CACHE;
if (strlen($code) <= 0) {
$code = "**";
}
if ($type != "Y") {
$type = "N";
}
if (intval($user_id) <= 0) {
$user_id = $GLOBALS["USER"]->GetID();
}
$arFollows = array();
$rsFollow = CSocNetLogFollow::GetList(array("USER_ID" => $user_id, "CODE" => array_unique(array("**", $code))));
while ($arFollow = $rsFollow->Fetch()) {
$arFollows[$arFollow["CODE"]] = array("TYPE" => $arFollow["TYPE"], "FOLLOW_DATE" => $arFollow["FOLLOW_DATE"]);
}
if (array_key_exists("**", $arFollows)) {
$default_type = $arFollows["**"]["TYPE"];
} else {
$default_type = COption::GetOptionString("socialnetwork", "follow_default_type", "Y");
}
if (preg_match('/^L(\\d+)$/', $code, $matches)) {
$log_id = intval($matches[1]);
if ($log_id > 0) {
if (isset($LOG_CACHE[$log_id])) {
$arLog = $LOG_CACHE[$log_id];
} else {
$rsLog = CSocNetLog::GetList(array("ID" => "DESC"), array("ID" => $log_id), false, false, array("ID", "LOG_UPDATE", "LOG_DATE"), array("CHECK_RIGHTS" => "N", "USE_SUBSCRIBE" => "N", "USE_FOLLOW" => "N"));
if ($arLog = $rsLog->Fetch()) {
$LOG_CACHE[$log_id] = $arLog;
}
}
if ($arLog) {
$log_date = strlen($arLog["LOG_DATE"]) > 0 ? $arLog["LOG_DATE"] : false;
$log_update = strlen($arLog["LOG_UPDATE"]) > 0 ? $arLog["LOG_UPDATE"] : false;
if (array_key_exists($code, $arFollows)) {
// already in the follows table
$res = CSocNetLogFollow::Update($user_id, $code, $type, strlen($arFollows[$code]["FOLLOW_DATE"]) > 0 ? $arFollows[$code]["FOLLOW_DATE"] : ($type == "N" ? $log_update : $log_date));
} elseif ($type != $default_type) {
// new record in the follow table only if not equal to default type
$res = CSocNetLogFollow::Add($user_id, $code, $type, $follow_date ? $follow_date : ($type == "N" ? $log_update : $log_date));
}
}
}
} else {
if (array_key_exists($code, $arFollows)) {
$res = CSocNetLogFollow::Update($user_id, $code, $type, false);
} else {
$res = CSocNetLogFollow::Add($user_id, $code, $type, false);
}
}
return $res;
}
示例3: toggleFavorites
public static function toggleFavorites(array $params)
{
$params['TASK_ID'] = intval($params['TASK_ID']);
$params['USER_ID'] = intval($params['USER_ID']);
if ($params['TASK_ID'] && $params['USER_ID'] && static::includeModule()) {
// get all soc net log records considering this task and user
$res = \CSocNetLog::GetList(array(), array('SOURCE_ID' => $params['TASK_ID'], 'USER_ID' => $params['USER_ID']));
while ($item = $res->fetch()) {
// add them to favorite
if ($params['OPERATION'] == 'ADD') {
\CSocNetLogFavorites::Add($item['USER_ID'], $item['ID'], array('TRIGGER_EVENT' => false));
} else {
\CSocNetLogFavorites::Change($item['USER_ID'], $item['ID'], array('TRIGGER_EVENT' => false));
}
}
}
}
示例4: LocalRedirectHandler
function LocalRedirectHandler(&$url)
{
$bSuccess = false;
if (strpos($url, "?") > 0) {
$arUrlParam = explode("&", substr($url, strpos($url, "?") + 1));
foreach ($arUrlParam as $url_param) {
list($key, $val) = explode("=", $url_param, 2);
if ($key == "new_post_id") {
$new_post_id = $val;
break;
}
}
}
if (strpos($url, "success=Y") > 0 && intval($new_post_id) > 0) {
unset($_SESSION["MFU_UPLOADED_FILES"]);
unset($_SESSION["MFU_UPLOADED_DOCS"]);
unset($_SESSION["MFU_UPLOADED_FILES_" . $GLOBALS["USER"]->GetId()]);
unset($_SESSION["MFU_UPLOADED_DOCS_" . $GLOBALS["USER"]->GetId()]);
$GLOBALS["APPLICATION"]->RestartBuffer();
$rsLogSrc = CSocNetLog::GetList(array(), array("EVENT_ID" => array("blog_post", "blog_post_important"), "SOURCE_ID" => $new_post_id), false, false, array("ID"), array("CHECK_RIGHTS" => "Y", "USE_SUBSCRIBE" => "N"));
if ($arLogSrc = $rsLogSrc->Fetch()) {
ob_start();
$GLOBALS["APPLICATION"]->IncludeComponent("bitrix:mobile.socialnetwork.log.ex", ".default", array("NEW_LOG_ID" => intval($arLogSrc["ID"]), "PATH_TO_LOG_ENTRY" => SITE_DIR . "mobile/log/?detail_log_id=#log_id#", "PATH_TO_LOG_ENTRY_EMPTY" => SITE_DIR . "mobile/log/?empty=Y", "PATH_TO_USER" => SITE_DIR . "mobile/users/?user_id=#user_id#", "SET_LOG_CACHE" => "N", "IMAGE_MAX_WIDTH" => 550, "DATE_TIME_FORMAT" => ""), false, array("HIDE_ICONS" => "Y"));
$postText = ob_get_contents();
ob_end_clean();
$bSuccess = true;
}
}
$GLOBALS["APPLICATION"]->RestartBuffer();
if (!$bSuccess) {
echo $_POST["response_type"] == "json" ? CUtil::PhpToJSObject(array("error" => "*")) : "*";
} else {
echo $_POST["response_type"] == "json" ? CUtil::PhpToJSObject(array("text" => $postText)) : $postText;
}
die;
}
示例5: __SLEGetLogRecord
function __SLEGetLogRecord($logID, $arParams, $arCurrentUserSubscribe, $current_page_date)
{
static $isExtranetInstalled, $isExtranetSite, $isExtranetUser, $arUserIdVisible, $arAvailableExtranetUserID, $isExtranetAdmin, $bCurrentUserIsAdmin, $arSocNetFeaturesSettings;
if (!$isExtranetInstalled) {
$isExtranetInstalled = CModule::IncludeModule("extranet") ? "Y" : "N";
$isExtranetSite = $isExtranetInstalled == "Y" && CExtranet::IsExtranetSite() ? "Y" : "N";
$isExtranetUser = $isExtranetInstalled == "Y" && !CExtranet::IsIntranetUser() ? "Y" : "N";
$isExtranetAdmin = $isExtranetInstalled == "Y" && CExtranet::IsExtranetAdmin() ? "Y" : "N";
$bCurrentUserIsAdmin = CSocNetUser::IsCurrentUserModuleAdmin();
$arSocNetFeaturesSettings = CSocNetAllowed::GetAllowedFeatures();
if ($isExtranetUser == "Y") {
$arUserIdVisible = CExtranet::GetMyGroupsUsersSimple(SITE_ID);
} elseif ($isExtranetInstalled == "Y" && $isExtranetUser != "Y") {
if ($isExtranetAdmin == "Y" && $bCurrentUserIsAdmin) {
$arAvailableExtranetUserID = CExtranet::GetMyGroupsUsers(SITE_ID);
} else {
$arAvailableExtranetUserID = CExtranet::GetMyGroupsUsersSimple(CExtranet::GetExtranetSiteID());
}
}
}
$cache_time = 31536000;
$arEvent = array();
$cache = new CPHPCache();
$arCacheID = array();
$arKeys = array("AVATAR_SIZE", "DESTINATION_LIMIT", "CHECK_PERMISSIONS_DEST", "NAME_TEMPLATE", "NAME_TEMPLATE_WO_NOBR", "SHOW_LOGIN", "DATE_TIME_FORMAT", "PATH_TO_USER", "PATH_TO_GROUP", "PATH_TO_CONPANY_DEPARTMENT");
foreach ($arKeys as $param_key) {
if (array_key_exists($param_key, $arParams)) {
$arCacheID[$param_key] = $arParams[$param_key];
} else {
$arCacheID[$param_key] = false;
}
}
$cache_id = "log_post_" . $logID . "_" . md5(serialize($arCacheID)) . "_" . SITE_TEMPLATE_ID . "_" . SITE_ID . "_" . LANGUAGE_ID . "_" . FORMAT_DATETIME . "_" . CTimeZone::GetOffset();
$cache_path = "/sonet/log/" . intval(intval($logID) / 1000) . "/" . $logID . "/entry/";
if (is_object($cache) && $cache->InitCache($cache_time, $cache_id, $cache_path)) {
$arCacheVars = $cache->GetVars();
$arEvent["FIELDS_FORMATTED"] = $arCacheVars["FIELDS_FORMATTED"];
if (array_key_exists("CACHED_CSS_PATH", $arEvent["FIELDS_FORMATTED"])) {
if (!is_array($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"]) && strlen($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"]) > 0) {
$GLOBALS['APPLICATION']->SetAdditionalCSS($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"]);
} elseif (is_array($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"])) {
foreach ($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"] as $css_path) {
$GLOBALS['APPLICATION']->SetAdditionalCSS($css_path);
}
}
}
if (array_key_exists("CACHED_JS_PATH", $arEvent["FIELDS_FORMATTED"])) {
if (!is_array($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"]) && $arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"] !== '') {
$GLOBALS['APPLICATION']->AddHeadScript($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"]);
} elseif (is_array($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"])) {
foreach ($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"] as $js_path) {
$GLOBALS['APPLICATION']->AddHeadScript($js_path);
}
}
}
} else {
if (is_object($cache)) {
$cache->StartDataCache($cache_time, $cache_id, $cache_path);
}
$arFilter = array("ID" => $logID);
$arListParams = array("CHECK_RIGHTS" => "N", "USE_FOLLOW" => "N", "USE_SUBSCRIBE" => "N");
$arSelect = array("ID", "TMP_ID", "ENTITY_TYPE", "ENTITY_ID", "USER_ID", "EVENT_ID", "LOG_DATE", "LOG_UPDATE", "TITLE_TEMPLATE", "TITLE", "MESSAGE", "TEXT_MESSAGE", "URL", "MODULE_ID", "CALLBACK_FUNC", "EXTERNAL_ID", "SITE_ID", "PARAMS", "COMMENTS_COUNT", "ENABLE_COMMENTS", "SOURCE_ID", "GROUP_NAME", "GROUP_OWNER_ID", "GROUP_INITIATE_PERMS", "GROUP_VISIBLE", "GROUP_OPENED", "GROUP_IMAGE_ID", "USER_NAME", "USER_LAST_NAME", "USER_SECOND_NAME", "USER_LOGIN", "USER_PERSONAL_PHOTO", "USER_PERSONAL_GENDER", "CREATED_BY_NAME", "CREATED_BY_LAST_NAME", "CREATED_BY_SECOND_NAME", "CREATED_BY_LOGIN", "CREATED_BY_PERSONAL_PHOTO", "CREATED_BY_PERSONAL_GENDER", "RATING_TYPE_ID", "RATING_ENTITY_ID", "SOURCE_TYPE");
$dbEvent = CSocNetLog::GetList(array(), $arFilter, false, false, $arSelect, $arListParams);
if ($arEvent = $dbEvent->GetNext()) {
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->StartTagCache($cache_path);
$GLOBALS["CACHE_MANAGER"]->RegisterTag("USER_NAME_" . intval($arEvent["USER_ID"]));
$GLOBALS["CACHE_MANAGER"]->RegisterTag("SONET_LOG_" . intval($arEvent["ID"]));
if ($arEvent["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
$GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_group_" . $arEvent["ENTITY_ID"]);
}
}
$arEvent["EVENT_ID_FULLSET"] = CSocNetLogTools::FindFullSetEventIDByEventID($arEvent["EVENT_ID"]);
if ($arEvent["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
static $arSiteWorkgroupsPage;
if (!$arSiteWorkgroupsPage && (IsModuleInstalled("extranet") || is_set($arEvent["URL"]) && strpos($arEvent["URL"], "#GROUPS_PATH#") !== false)) {
$rsSite = CSite::GetList($by = "sort", $order = "desc", array("ACTIVE" => "Y"));
while ($arSite = $rsSite->Fetch()) {
$arSiteWorkgroupsPage[$arSite["ID"]] = COption::GetOptionString("socialnetwork", "workgroups_page", $arSite["DIR"] . "workgroups/", $arSite["ID"]);
}
}
if (is_set($arEvent["URL"]) && isset($arSiteWorkgroupsPage[SITE_ID])) {
$arEvent["URL"] = str_replace("#GROUPS_PATH#", $arSiteWorkgroupsPage[SITE_ID], $arEvent["URL"]);
}
}
$arEventTmp = CSocNetLogTools::FindLogEventByID($arEvent["EVENT_ID"]);
if ($arEventTmp && isset($arEventTmp["CLASS_FORMAT"]) && isset($arEventTmp["METHOD_FORMAT"])) {
$arEvent["UF"] = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("SONET_LOG", $arEvent["ID"], LANGUAGE_ID);
$arEvent["FIELDS_FORMATTED"] = call_user_func(array($arEventTmp["CLASS_FORMAT"], $arEventTmp["METHOD_FORMAT"]), $arEvent, $arParams);
if (is_array($arEvent["FIELDS_FORMATTED"])) {
if (isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"])) {
if (in_array($arEvent["EVENT_ID"], array('calendar'))) {
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"] = htmlspecialcharsback($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"]);
} else {
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"] = CSocNetTextParser::closetags(htmlspecialcharsback($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"]));
}
}
if (isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"])) {
$arFields2Cache = array("URL", "STYLE", "DESTINATION", "DESTINATION_MORE", "TITLE_24", "TITLE_24_2", "TITLE_24_2_STYLE", "IS_IMPORTANT", "MESSAGE", "FOOTER_MESSAGE", "MESSAGE_TITLE_24", "DATETIME_FORMATTED", "LOG_DATE_FORMAT", "MENU", "COMMENT_URL");
foreach ($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"] as $field => $value) {
//.........这里部分代码省略.........
示例6: UnInstallDB
function UnInstallDB($arParams = array())
{
global $DB, $APPLICATION;
CAgent::RemoveModuleAgents('calendar');
$errors = null;
if ((true == array_key_exists("savedata", $arParams)) && ($arParams["savedata"] != 'Y'))
{
$GLOBALS["USER_FIELD_MANAGER"]->OnEntityDelete("CALENDAR_EVENT");
$errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"].'/bitrix/modules/'.$this->MODULE_ID.'/install/db/'.strtolower($DB->type).'/uninstall.sql');
if (!empty($errors))
{
$APPLICATION->ThrowException(implode("", $errors));
return false;
}
$this->UnInstallTasks();
}
UnRegisterModuleDependences("pull", "OnGetDependentModule", "calendar", "CCalendarPullSchema", "OnGetDependentModule");
UnRegisterModuleDependences("im", "OnGetNotifySchema", "calendar", "CCalendarNotifySchema", "OnGetNotifySchema");
UnRegisterModuleDependences("im", "OnBeforeConfirmNotify", "calendar", "CCalendar", "HandleImCallback");
UnRegisterModuleDependences('intranet', 'OnPlannerInit', 'calendar', 'CCalendarEventHandlers', 'OnPlannerInit');
UnRegisterModuleDependences('intranet', 'OnPlannerAction', 'calendar', 'CCalendarEventHandlers', 'OnPlannerAction');
UnRegisterModuleDependences('rest', 'OnRestServiceBuildDescription', 'calendar', 'CCalendarRestService', 'OnRestServiceBuildDescription');
UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetFeaturesList', 'calendar', 'CCalendarLiveFeed', 'AddEvent');
UnRegisterModuleDependences('socialnetwork', 'OnSonetLogEntryMenuCreate', 'calendar', 'CCalendarLiveFeed', 'OnSonetLogEntryMenuCreate');
UnRegisterModuleDependences('socialnetwork', 'OnAfterSonetLogEntryAddComment', 'calendar', 'CCalendarLiveFeed', 'OnAfterSonetLogEntryAddComment');
UnRegisterModuleDependences('socialnetwork', 'OnForumCommentIMNotify', 'calendar', 'CCalendarLiveFeed', 'OnForumCommentIMNotify');
UnRegisterModuleDependences('socialnetwork', 'onAfterCommentAddAfter', 'calendar', 'CCalendarLiveFeed', 'onAfterCommentAddAfter');
UnRegisterModuleDependences('socialnetwork', 'onAfterCommentUpdateAfter', 'calendar', 'CCalendarLiveFeed', 'onAfterCommentUpdateAfter');
UnRegisterModuleDependences('search', 'BeforeIndex', 'calendar', 'CCalendarLiveFeed', 'FixForumCommentURL');
UnRegisterModule("calendar");
// Clear cache
$arPath = array(
'access_tasks',
'type_list',
'section_list',
'attendees_list',
'event_list'
);
$cache = new CPHPCache;
foreach($arPath as $path)
if ($path != '')
$cache->CleanDir("calendar/".$path);
// Remove tasks from LiveFeed
if (
IsModuleInstalled('socialnetwork')
&& CModule::IncludeModule('socialnetwork')
)
{
$dbRes = CSocNetLog::GetList(
array(),
array("EVENT_ID" => "calendar"),
false,
false,
array("ID")
);
if ($dbRes)
{
while ($arRes = $dbRes->Fetch())
CSocNetLog::Delete($arRes["ID"]);
}
}
// Remove tasks from IM
if (IsModuleInstalled('im') && CModule::IncludeModule('im'))
{
if (method_exists('CIMNotify', 'DeleteByModule'))
CIMNotify::DeleteByModule('calendar');
}
return true;
}
示例7: BXClearCache
if ($comId = CBlogComment::Add($arComFields)) {
BXClearCache(true, "/blog/comment/" . intval($arParams["ID"] / 100) . "/" . $arParams["ID"] . "/");
if (is_callable("CBlogComment::AddLiveComment")) {
CBlogComment::addLiveComment($comId, "", array());
}
if ($arPost["AUTHOR_ID"] != $user_id) {
$arFieldsIM = array("TYPE" => "SHARE", "TITLE" => htmlspecialcharsback($arPost["TITLE"]), "URL" => CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_POST"]), array("post_id" => $arParams["ID"], "user_id" => $arPost["AUTHOR_ID"])), "ID" => $arParams["ID"], "FROM_USER_ID" => $user_id, "TO_USER_ID" => array($arPost["AUTHOR_ID"]));
CBlogPost::NotifyIm($arFieldsIM);
}
if (!empty($arUsers2Notify)) {
$arFieldsIM = array("TYPE" => "SHARE2USERS", "TITLE" => htmlspecialcharsback($arPost["TITLE"]), "URL" => CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_POST"]), array("post_id" => $arParams["ID"], "user_id" => $arPost["AUTHOR_ID"])), "ID" => $arParams["ID"], "FROM_USER_ID" => $user_id, "TO_USER_ID" => $arUsers2Notify);
CBlogPost::NotifyIm($arFieldsIM);
}
}
/* update socnet log rights*/
$dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => array("blog_post", "blog_post_important"), "SOURCE_ID" => $arPost["ID"]), false, false, array("ID", "ENTITY_TYPE", "ENTITY_ID"));
if ($arRes = $dbRes->Fetch()) {
$arLogSites = array();
$rsLogSite = CSocNetLog::GetSite($arRes["ID"]);
while ($arLogSite = $rsLogSite->Fetch()) {
$arLogSites[] = $arLogSite["LID"];
}
$arLogSitesNew = array_merge($arLogSitesNew, $arLogSites);
$socnetPerms = CBlogPost::GetSocNetPermsCode($arPost["ID"]);
if (!in_array("U" . $arPost["AUTHOR_ID"], $socnetPerms)) {
$socnetPerms[] = "U" . $arPost["AUTHOR_ID"];
}
$socnetPerms[] = "SA";
// socnet admin
if (in_array("AU", $socnetPerms) || in_array("G2", $socnetPerms)) {
$socnetPermsAdd = array();
示例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: elseif
} elseif ($action == "get_comments") {
$arResult["arComments"] = array();
$log_tmp_id = $_REQUEST["logid"];
$last_comment_id = intval($_REQUEST["last_comment_id"]);
$last_comment_ts = intval($_REQUEST["last_comment_ts"]);
if ($arLog = CSocNetLog::GetByID($log_tmp_id)) {
$log_entity_type = $arLog["ENTITY_TYPE"];
if (strpos($log_entity_type, "CRM") === 0 && IsModuleInstalled("crm")) {
$arListParams = array("IS_CRM" => "Y", "CHECK_CRM_RIGHTS" => "Y");
} else {
$arListParams = array("CHECK_RIGHTS" => "Y", "USE_SUBSCRIBE" => "N");
}
} else {
$log_tmp_id = 0;
}
if (intval($log_tmp_id) > 0 && ($rsLog = CSocNetLog::GetList(array(), array("ID" => $log_tmp_id), false, false, array("ID", "EVENT_ID"), $arListParams)) && ($arLog = $rsLog->Fetch())) {
$arCommentEvent = CSocNetLogTools::FindLogCommentEventByLogEventID($arLog["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"]));
$arParams = array("PATH_TO_USER" => $_REQUEST["p_user"], "NAME_TEMPLATE" => $_REQUEST["nt"], "SHOW_LOGIN" => $_REQUEST["sl"], "AVATAR_SIZE_COMMENT" => $as, "PATH_TO_SMILE" => $_REQUEST["p_smile"], "DATE_TIME_FORMAT" => $_REQUEST["dtf"]);
$cache_time = 31536000;
$cache = new CPHPCache();
$arCacheID = array();
$arKeys = array("AVATAR_SIZE_COMMENT", "NAME_TEMPLATE", "NAME_TEMPLATE_WO_NOBR", "SHOW_LOGIN", "DATE_TIME_FORMAT", "PATH_TO_USER", "PATH_TO_GROUP", "PATH_TO_CONPANY_DEPARTMENT");
foreach ($arKeys as $param_key) {
$arCacheID[$param_key] = array_key_exists($param_key, $arParams) ? $arParams[$param_key] : false;
}
$cache_id = "log_comments_" . $log_tmp_id . "_" . md5(serialize($arCacheID)) . "_mobile_app_" . SITE_ID . "_" . LANGUAGE_ID . "_" . FORMAT_DATETIME . "_" . CTimeZone::GetOffset();
$cache_path = "/sonet/log/" . intval(intval($log_tmp_id) / 1000) . "/" . $log_tmp_id . "/comments/";
if (is_object($cache) && $cache->InitCache($cache_time, $cache_id, $cache_path)) {
$arCacheVars = $cache->GetVars();
示例10: OnUserDelete
function OnUserDelete($USER_ID)
{
$arIBlockList = array('iblock_absence', 'iblock_honour', 'iblock_state_history');
foreach ($arIBlockList as $var_name) {
$IBLOCK_ID = COption::GetOptionInt('intranet', $var_name);
if ($IBLOCK_ID > 0) {
$dbRes = CIBlockElement::GetList(array(), array('IBLOCK_ID' => $IBLOCK_ID, 'PROPERTY_USER' => $USER_ID), false, false, array('ID', 'IBLOCK_ID'));
while ($arRes = $dbRes->Fetch()) {
CIBlockElement::Delete($arRes['ID']);
}
}
}
if (CModule::IncludeModule('socialnetwork')) {
$dbRes = CSocNetLog::GetList(array(), array('ENTITY_TYPE' => SONET_INTRANET_NEW_USER_ENTITY, 'EVENT_ID' => SONET_INTRANET_NEW_USER_EVENT_ID, 'ENTITY_ID' => $USER_ID, 'SOURCE_ID' => $USER_ID), false, array('ID'));
$arRes = $dbRes->Fetch();
if ($arRes) {
CSocNetLog::Delete($arRes['ID']);
}
}
if (CModule::IncludeModule('iblock')) {
$IBLOCK_ID = COption::GetOptionInt('intranet', 'iblock_structure');
if ($IBLOCK_ID > 0) {
$dbRes = CIBlockSection::GetList(array(), array('IBLOCK_ID' => $IBLOCK_ID, 'UF_HEAD' => $USER_ID), false, array('ID', 'IBLOCK_ID'));
$obSection = new CIBlockSection();
while ($arRes = $dbRes->Fetch()) {
$obSection->Update($arRes['ID'], array('UF_HEAD' => ''));
}
}
}
}
示例11: GetLogEventLastUpdateTime
public static function GetLogEventLastUpdateTime($ID, $useTimeZome = true)
{
if (!$useTimeZome) {
CTimeZone::Disable();
}
$dbResult = CSocNetLog::GetList(array(), array('ID' => $ID), false, false, array('ID', 'LOG_UPDATE'));
$arFields = is_object($dbResult) ? $dbResult->Fetch() : null;
$result = isset($arFields['LOG_UPDATE']) ? $arFields['LOG_UPDATE'] : '';
if (!$useTimeZome) {
CTimeZone::Enable();
}
return $result;
}
示例12: OnSendMentionGetEntityFields
public static function OnSendMentionGetEntityFields($arCommentFields)
{
if (!in_array($arCommentFields["EVENT_ID"], array("lists_new_element_comment"))) {
return false;
}
if (!CModule::IncludeModule("socialnetwork")) {
return true;
}
$dbLog = CSocNetLog::GetList(array(), array("ID" => $arCommentFields["LOG_ID"]), false, false, array("ID", "TITLE", "SOURCE_ID", "PARAMS"));
if ($arLog = $dbLog->GetNext()) {
$genderSuffix = "";
$dbUser = CUser::GetByID($arCommentFields["USER_ID"]);
if ($arUser = $dbUser->Fetch()) {
$genderSuffix = $arUser["PERSONAL_GENDER"];
}
$params = unserialize($arLog["~PARAMS"]);
$title = $arLog["TITLE"] . " - " . $params["ELEMENT_NAME"];
$entityName = GetMessage("LISTS_LF_COMMENT_MENTION_TITLE", array("#PROCESS#" => $title));
$notifyMessage = GetMessage("LISTS_LF_COMMENT_MENTION" . (strlen($genderSuffix) > 0 ? "_" . $genderSuffix : ""), array("#title#" => "<a href=\"#url#\" class=\"bx-notifier-item-action\">" . $entityName . "</a>"));
$notifyMessageOut = GetMessage("LISTS_LF_COMMENT_MENTION" . (strlen($genderSuffix) > 0 ? "_" . $genderSuffix : ""), array("#title#" => $entityName)) . " (" . "#server_name##url#)";
$strPathToLogEntry = str_replace("#log_id#", $arLog["ID"], COption::GetOptionString("socialnetwork", "log_entry_page", "/company/personal/log/#log_id#/", SITE_ID));
$strPathToLogEntryComment = $strPathToLogEntry . (strpos($strPathToLogEntry, "?") !== false ? "&" : "?") . "commentID=" . $arCommentFields["ID"] . "#com" . $arCommentFields["ID"];
$arReturn = array("URL" => $strPathToLogEntryComment, "NOTIFY_MODULE" => "lists", "NOTIFY_TAG" => "LISTS|COMMENT_MENTION|" . $arCommentFields["ID"], "NOTIFY_MESSAGE" => $notifyMessage, "NOTIFY_MESSAGE_OUT" => $notifyMessageOut);
return $arReturn;
} else {
return false;
}
}
示例13: RemoveMessage
private function RemoveMessage($MessageId = false)
{
$arNotification = $this->Notify->getNotification();
//Remove comments
$oComment = CBlogComment::GetList(
array(),
array(
"POST_ID" => $MessageId?$MessageId:$arNotification["ID"],
),
false,
false,
array("ID")
);
while ($arComment = $oComment->Fetch())
$this->RemoveComment($arComment["ID"]);
//Remove message
$oLogMessage = CSocNetLog::GetList(
array("ID" => "DESC"),
array("SOURCE_ID" => $MessageId?$MessageId:$arNotification["ID"]),
false,
false,
array("ID")
);
while($arLogMessage = $oLogMessage->Fetch())
CSocNetLog::Delete($arLogMessage["ID"]);
}
示例14: RegisterLiveFeedEvent
private static function RegisterLiveFeedEvent(&$arFields)
{
$ID = isset($arFields['ID']) ? intval($arFields['ID']) : 0;
if ($ID <= 0) {
$arFields['ERROR'] = 'Could not find activity ID.';
return false;
}
$ownerTypeID = isset($arFields['OWNER_TYPE_ID']) ? intval($arFields['OWNER_TYPE_ID']) : CCrmOwnerType::Undefined;
if (!CCrmOwnerType::IsDefined($ownerTypeID)) {
$arFields['ERROR'] = 'Could not find owner type ID.';
return false;
}
$ownerID = isset($arFields['OWNER_ID']) ? intval($arFields['OWNER_ID']) : 0;
if ($ownerID <= 0) {
$arFields['ERROR'] = 'Could not find owner ID.';
return false;
}
$arOwners = array(array("OWNER_TYPE_ID" => $ownerTypeID, "OWNER_ID" => $ownerID));
$authorID = isset($arFields['AUTHOR_ID']) ? intval($arFields['AUTHOR_ID']) : 0;
$editorID = isset($arFields['EDITOR_ID']) ? intval($arFields['EDITOR_ID']) : 0;
$userID = $authorID > 0 ? $authorID : $editorID;
if ($userID <= 0) {
$userID = CCrmSecurityHelper::GetCurrentUserID();
}
// Params are not assigned - we will use current activity only.
$liveFeedFields = array('ENTITY_TYPE_ID' => CCrmOwnerType::Activity, 'ENTITY_ID' => $ID, 'USER_ID' => $userID, 'MESSAGE' => '', 'TITLE' => '');
$bindings = isset($arFields['BINDINGS']) && is_array($arFields['BINDINGS']) ? $arFields['BINDINGS'] : array();
if (!empty($bindings)) {
$liveFeedFields['PARENTS'] = $bindings;
$liveFeedFields['PARENT_OPTIONS'] = array('ENTITY_TYPE_ID_KEY' => 'OWNER_TYPE_ID', 'ENTITY_ID_KEY' => 'OWNER_ID');
$ownerInfoOptions = array('ENTITY_TYPE_ID_KEY' => 'OWNER_TYPE_ID', 'ENTITY_ID_KEY' => 'OWNER_ID', 'ADDITIONAL_DATA' => array('LEVEL' => 2));
$additionalParents = array();
foreach ($bindings as &$binding) {
$ownerTypeID = isset($binding['OWNER_TYPE_ID']) ? intval($binding['OWNER_TYPE_ID']) : CCrmOwnerType::Undefined;
$ownerID = isset($binding['OWNER_ID']) ? intval($binding['OWNER_ID']) : 0;
if ($ownerTypeID != CCrmOwnerType::Undefined && $ownerID > 0) {
$arOwners[] = array("OWNER_TYPE_ID" => $ownerTypeID, "OWNER_ID" => $ownerID);
}
if ($ownerTypeID === CCrmOwnerType::Contact && $ownerID > 0) {
$owners = array();
if (CCrmOwnerType::TryGetOwnerInfos(CCrmOwnerType::Contact, $ownerID, $owners, $ownerInfoOptions)) {
$additionalParents = array_merge($additionalParents, $owners);
}
}
}
unset($binding);
if (!empty($additionalParents)) {
$liveFeedFields['PARENTS'] = array_merge($bindings, $additionalParents);
}
$arOwners = array_unique($arOwners);
}
self::PrepareStorageElementIDs($arFields);
$arStorageElementID = $arFields["STORAGE_ELEMENT_IDS"];
if (!empty($arStorageElementID)) {
if ($arFields["STORAGE_TYPE_ID"] == StorageType::WebDav) {
$liveFeedFields["UF_SONET_LOG_DOC"] = $arStorageElementID;
} else {
if ($arFields["STORAGE_TYPE_ID"] == StorageType::Disk) {
$liveFeedFields["UF_SONET_LOG_DOC"] = array();
//We have to add prefix Bitrix\Disk\Uf\FileUserType::NEW_FILE_PREFIX to file ID
foreach ($arStorageElementID as $elementID) {
$liveFeedFields["UF_SONET_LOG_DOC"][] = "n{$elementID}";
}
} else {
$liveFeedFields["UF_SONET_LOG_FILE"] = $arStorageElementID;
}
}
}
if ($arFields['TYPE_ID'] == CCrmActivityType::Task && isset($arFields["ASSOCIATED_ENTITY_ID"]) && intval($arFields["ASSOCIATED_ENTITY_ID"]) > 0 && CModule::IncludeModule("tasks")) {
$dbTask = CTasks::GetByID($arFields["ASSOCIATED_ENTITY_ID"], false);
if ($arTask = $dbTask->Fetch()) {
$ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("TASKS_TASK", "UF_TASK_WEBDAV_FILES", $arTask["ID"], LANGUAGE_ID);
if ($ufDocID) {
$liveFeedFields["UF_SONET_LOG_DOC"] = $ufDocID;
}
}
}
$bConvert = false;
if ($arTask) {
$rsLog = CSocNetLog::GetList(array(), array("EVENT_ID" => "tasks", "SOURCE_ID" => $arTask["ID"]), array("ID"));
if ($arLog = $rsLog->Fetch()) {
$eventID = CCrmLiveFeed::ConvertTasksLogEvent(array("LOG_ID" => $arLog["ID"], "ACTIVITY_ID" => $ID));
$bConvert = true;
}
}
if (!$bConvert) {
$eventID = CCrmLiveFeed::CreateLogEvent($liveFeedFields, CCrmLiveFeedEvent::Add);
}
if (!(is_int($eventID) && $eventID > 0) && isset($liveFeedFields['ERROR'])) {
$arFields['ERROR'] = $liveFeedFields['ERROR'];
} else {
if ($arTask) {
$arTaskParticipant = CTaskNotifications::GetRecipientsIDs($arTask, false);
$arSocnetRights = CTaskNotifications::__UserIDs2Rights($arTaskParticipant);
if (isset($arTask['GROUP_ID']) && intval($arTask['GROUP_ID']) > 0) {
$perm = CSocNetFeaturesPerms::GetOperationPerm(SONET_ENTITY_GROUP, $arTask['GROUP_ID'], "tasks", "view");
$arSocnetRights = array_merge($arSocnetRights, array('SG' . $arTask['GROUP_ID'], 'SG' . $arTask['GROUP_ID'] . '_' . $perm));
}
CSocNetLogRights::DeleteByLogID($eventID);
CSocNetLogRights::Add($eventID, $arSocnetRights);
//.........这里部分代码省略.........
示例15: OnSendMentionGetEntityFields_Forum
public static function OnSendMentionGetEntityFields_Forum($arCommentFields)
{
if ($arCommentFields["EVENT_ID"] != "forum") {
return false;
}
$dbLog = CSocNetLog::GetList(array(), array("ID" => $arCommentFields["LOG_ID"], "EVENT_ID" => "forum"), false, false, array("ID", "TITLE"));
if ($arLog = $dbLog->Fetch()) {
$genderSuffix = "";
$dbUsers = CUser::GetList($by = "ID", $order = "desc", array("ID" => $arCommentFields["USER_ID"]), array("PERSONAL_GENDER", "LOGIN", "NAME", "LAST_NAME", "SECOND_NAME"));
if ($arUser = $dbUsers->Fetch()) {
$genderSuffix = $arUser["PERSONAL_GENDER"];
}
$strPathToLogEntry = str_replace("#log_id#", $arLog["ID"], COption::GetOptionString("socialnetwork", "log_entry_page", "/company/personal/log/#log_id#/", SITE_ID));
$strPathToLogEntryComment = $strPathToLogEntry . (strpos($strPathToLogEntry, "?") !== false ? "&" : "?") . "commentID=" . $arCommentFields["ID"];
$title = str_replace(array("\r\n", "\n"), " ", $arLog["TITLE"]);
$title = TruncateText($title, 100);
$title_out = TruncateText($title, 255);
$arReturn = array("URL" => $strPathToLogEntryComment, "NOTIFY_TAG" => "FORUM|COMMENT_MENTION|" . $arCommentFields["ID"], "NOTIFY_MESSAGE" => GetMessage("SONET_GLC_FORUM_MENTION" . (strlen($genderSuffix) > 0 ? "_" . $genderSuffix : ""), array("#title#" => "<a href=\"#url#\" class=\"bx-notifier-item-action\">" . $title . "</a>")), "NOTIFY_MESSAGE_OUT" => GetMessage("SONET_GLC_FORUM_MENTION" . (strlen($genderSuffix) > 0 ? "_" . $genderSuffix : ""), array("#title#" => $title_out)) . " (" . "#server_name##url#)");
return $arReturn;
} else {
return false;
}
}