本文整理汇总了PHP中CSocNetLogComments类的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetLogComments类的具体用法?PHP CSocNetLogComments怎么用?PHP CSocNetLogComments使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CSocNetLogComments类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addComment
public function addComment($authorId, array $data)
{
$this->loadBlogPostData();
$commentFields = array("POST_ID" => $this->entityId, "BLOG_ID" => $this->blogPostData['BLOG_ID'], "POST_TEXT" => $data['text'], "DATE_CREATE" => new DateTime(), "PARENT_ID" => false, "AUTHOR_ID" => $authorId, "HAS_PROPS" => 'Y');
if (!empty($data['fileId'])) {
$commentFields['UF_BLOG_COMMENT_FILE'] = array($data['fileId']);
} elseif (!empty($data['versionId'])) {
$commentFields['UF_BLOG_COMMENT_FH'] = $data['versionId'];
}
$comId = \CBlogComment::add($commentFields);
if (!$comId) {
return;
}
if (method_exists("CBlogComment", "addLiveComment")) {
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
\CBlogComment::addLiveComment($comId, array("MODE" => "PULL_MESSAGE"));
}
BXClearCache(true, "/blog/comment/" . $this->entityId . "/");
if (!Loader::includeModule('socialnetwork')) {
return;
}
$query = \CSocNetLog::getList(array("ID" => "DESC"), array("EVENT_ID" => array("blog_post", "blog_post_important"), "SOURCE_ID" => $this->entityId), false, false, array("ID", "TMP_ID"));
$row = $query->fetch();
if (!$row) {
return;
}
$fieldsForSocnet = array("ENTITY_TYPE" => SONET_ENTITY_USER, "ENTITY_ID" => $this->blogPostData["AUTHOR_ID"], "EVENT_ID" => "blog_comment", "=LOG_DATE" => Application::getInstance()->getConnection()->getSqlHelper()->getCurrentDateTimeFunction(), "MESSAGE" => "file", "TEXT_MESSAGE" => "file", "URL" => "", "MODULE_ID" => false, "SOURCE_ID" => $comId, "LOG_ID" => $row["ID"], "RATING_TYPE_ID" => "BLOG_COMMENT", "RATING_ENTITY_ID" => $comId, "USER_ID" => $authorId);
\CSocNetLogComments::add($fieldsForSocnet, false, false, false);
}
示例2: OnUserDelete
public static function OnUserDelete($ID)
{
global $DB;
if (!CSocNetGroup::__ValidateID($ID)) {
return false;
}
$ID = IntVal($ID);
$bSuccess = True;
if (!CSocNetGroup::DeleteNoDemand($ID)) {
if ($ex = $GLOBALS["APPLICATION"]->GetException()) {
$err = $ex->GetString();
}
$GLOBALS["APPLICATION"]->ThrowException($err);
$bSuccess = false;
}
if ($bSuccess) {
CSocNetUserRelations::DeleteNoDemand($ID);
CSocNetUserPerms::DeleteNoDemand($ID);
CSocNetUserEvents::DeleteNoDemand($ID);
CSocNetMessages::DeleteNoDemand($ID);
CSocNetUserToGroup::DeleteNoDemand($ID);
CSocNetLogEvents::DeleteNoDemand($ID);
CSocNetLog::DeleteNoDemand($ID);
CSocNetLogComments::DeleteNoDemand($ID);
CSocNetFeatures::DeleteNoDemand($ID);
CSocNetSubscription::DeleteEx($ID);
CUserOptions::DeleteOption("socialnetwork", "~menu_" . SONET_ENTITY_USER . "_" . $ID, false, 0);
}
return $bSuccess;
}
示例3: OnAfterSocNetLogCommentAdd
public static function OnAfterSocNetLogCommentAdd($ID, $arFields)
{
if (!IsModuleInstalled('bitrix24')) {
if ($arFields['ENTITY_TYPE'] == SONET_INTRANET_NEW_USER_ENTITY && $arFields['EVENT_ID'] == SONET_INTRANET_NEW_USER_COMMENT_EVENT_ID) {
$arUpdateFields = array('RATING_TYPE_ID' => 'INTRANET_NEW_USER_COMMENT', 'RATING_ENTITY_ID' => $ID);
CSocNetLogComments::Update($ID, $arUpdateFields);
}
}
}
示例4: loadLogCommentData
protected function loadLogCommentData()
{
$queryLogComment = \CSocNetLogComments::getList(array(), array("ID" => $this->entityId), false, false, array("ID", "ENTITY_TYPE", "ENTITY_ID", "EVENT_ID", "SOURCE_ID", "LOG_ID"));
return $this->logCommentData = $queryLogComment->fetch();
}
示例5: RemoveComment
private function RemoveComment($CommentId = false)
{
$arNotification = $this->Notify->getNotification();
$oLogComment = CSocNetLogComments::GetList(
array("ID" => "DESC"),
array(
"SOURCE_ID" => $CommentId?$CommentId:$arNotification["ID"],
"EVENT_ID" => 'idea_comment',
),
false,
false,
array("ID")
);
while($arLogComment = $oLogComment->Fetch())
CSocNetLogComments::Delete($arLogComment["ID"]);
}
示例6: GetMessage
}
} else {
$arResult["ERROR_MESSAGE"] = GetMessage("B_B_PC_MES_ERROR_SESSION");
}
}
$arResult["ERROR_MESSAGE"] = GetMessage("B_B_PC_MES_ERROR_DELETE");
}
} elseif (IntVal($_GET["show_comment_id"]) > 0) {
$arComment = CBlogComment::GetByID(IntVal($_GET["show_comment_id"]));
if ($arResult["Perm"] >= BLOG_PERMS_MODERATE && !empty($arComment)) {
if ($arComment["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_READY) {
$arResult["ERROR_MESSAGE"] = GetMessage("B_B_PC_MES_ERROR_SHOW");
} else {
if (check_bitrix_sessid()) {
if ($commentID = CBlogComment::Update($arComment["ID"], array("PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH))) {
$dbLogComment = CSocNetLogComments::GetList(array("ID" => "DESC"), array("EVENT_ID" => array("idea_comment"), "SOURCE_ID" => $commentID), false, false, array("ID"));
$arLogComment = $dbLogComment->Fetch();
if (!$arLogComment) {
$Notify = CIdeaManagment::getInstance()->Notification(array("TYPE" => 'IDEA_COMMENT', "ACTION" => 'ADD', "ID" => $commentID, "POST_ID" => $arPost["ID"], "AUTHOR_ID" => $arComment["AUTHOR_ID"], "PATH" => $arComment["PATH"], "POST_TEXT" => $arComment["POST_TEXT"], "LOG_DATE" => $arComment["DATE_CREATE"]))->getSonetNotify()->Send();
}
BXClearCache(True, "/" . SITE_ID . "/idea/" . $arBlog["ID"] . "/first_page/");
BXClearCache(True, "/" . SITE_ID . "/idea/" . $arBlog["ID"] . "/comment/" . $arComment["POST_ID"] . "/");
BXClearCache(True, "/" . SITE_ID . "/idea/" . $arBlog["ID"] . "/post/" . $arComment["POST_ID"] . "/");
LocalRedirect($APPLICATION->GetCurPageParam("", $arRemoveUriParams));
}
} else {
$arResult["ERROR_MESSAGE"] = GetMessage("B_B_PC_MES_ERROR_SESSION");
}
}
}
$arResult["ERROR_MESSAGE"] = GetMessage("B_B_PC_MES_ERROR_SHOW");
示例7: UpdateLogData
function UpdateLogData($log_id, $bSetDate = true, $bSetDateByLastComment = false)
{
$dbResult = CSocNetLogComments::GetList(array(), array("LOG_ID" => $log_id), array());
$comments_count = $dbResult;
$dbResult = CSocNetLog::GetList(array(), array("ID" => $log_id), false, false, array("ID", "COMMENTS_COUNT", "LOG_DATE"));
while ($arResult = $dbResult->Fetch()) {
$arFields = array("COMMENTS_COUNT" => $comments_count);
if ($bSetDateByLastComment) {
$dbComment = CSocNetLogComments::GetList(array("LOG_DATE" => "DESC"), array("LOG_ID" => $log_id), false, false, array("ID", "LOG_DATE"));
if ($arComment = $dbComment->Fetch()) {
$arFields["LOG_UPDATE"] = $arComment["LOG_DATE"];
} else {
$arFields["LOG_UPDATE"] = $arResult["LOG_DATE"];
}
} elseif ($bSetDate) {
$arFields["=LOG_UPDATE"] = $GLOBALS["DB"]->CurrentTimeFunction();
}
CSocNetLog::Update($arResult["ID"], $arFields);
CSocNetLogFollow::DeleteByLogID($log_id, "Y", true);
}
}
示例8: AddCommentToLog
public static function AddCommentToLog($arFields)
{
global $DB, $USER;
CModule::IncludeModule("socialnetwork");
$result = false;
$dbLog = CSocNetLog::GetList(array(), array("SOURCE_ID" => $arFields["REPORT_ID"], "EVENT_ID" => "report"));
if (!($arLog = $dbLog->Fetch())) {
$LOG_ID = CReportNotifications::SendMessage($arFields["REPORT_ID"], false);
} else {
$LOG_ID = $arLog["ID"];
}
$arMessFields = array("EVENT_ID" => "report_comment", "ENTITY_ID" => $arFields["REPORT_OWNER"], "TEXT_MESSAGE" => $arFields["COMMENT_TEXT"], "MESSAGE" => $arFields["COMMENT_TEXT"], "USER_ID" => $arFields["USER_ID"], "ENTITY_TYPE" => "R", "LOG_ID" => $LOG_ID, "=LOG_DATE" => $DB->CurrentTimeFunction());
$result = CSocNetLogComments::Add($arMessFields, true, false);
CSocNetLog::CounterIncrement($result, false, false, "LC");
$curUser = $USER->GetID();
$dbLogRights = CSocNetLogRights::GetList(array(), array("LOG_ID" => $LOG_ID));
while ($arRight = $dbLogRights->Fetch()) {
$arRights[] = $arRight["GROUP_CODE"];
}
if (!in_array("U" . $curUser, $arRights)) {
CSocNetLogRights::Add($LOG_ID, "U" . $curUser);
}
return $result;
}
示例9: elseif
CSocNetLogRights::SetForSonet($logID, $arSonetFields["ENTITY_TYPE"], $arSonetFields["ENTITY_ID"], "forum", "view", true);
CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
}
} elseif ($arParams["MESSAGE_TYPE"] == "EDIT") {
$dbRes = CSocNetLog::GetList(array(), array("EVENT_ID" => "forum", "SOURCE_ID" => $MID1), false, false, array("ID"));
if ($arRes = $dbRes->Fetch()) {
// topic
$arSonetFields = array_intersect_key($arSonetFields, array_flip(array("TITLE_TEMPLATE", "TITLE", "MESSAGE", "TEXT_MESSAGE", "PARAMS")));
CSocNetLog::Update($arRes["ID"], $arSonetFields);
CSocNetLogRights::SetForSonet($arRes["ID"], $arParams["MODE"] == "GROUP" ? SONET_ENTITY_GROUP : SONET_ENTITY_USER, $arParams["MODE"] == "GROUP" ? $arParams["SOCNET_GROUP_ID"] : $arParams["USER_ID"], "forum", "view");
} else {
$dbRes = CSocNetLogComments::GetList(array(), array("EVENT_ID" => "forum", "SOURCE_ID" => $MID1), false, false, array("ID"));
if ($arRes = $dbRes->Fetch()) {
// message/comment
$arSonetFields = array_intersect_key($arSonetFields, array_flip(array("MESSAGE", "TEXT_MESSAGE", "PARAMS")));
CSocNetLogComments::Update($arRes["ID"], $arSonetFields);
}
}
}
$url = ForumAddPageParams(CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("FID" => $arParams["FID"], "TID" => $arParams["TID"], "MID" => intVal($arParams["MID"]), "UID" => $arParams["USER_ID"], "GID" => $arParams["SOCNET_GROUP_ID"])), array("result" => $arNote["code"]));
LocalRedirect($url);
} elseif (intVal($arFieldsG["PARAM2"]) > 0 && $arFieldsG["PARAM1"] == "VT") {
CVote::Delete($arFieldsG["PARAM2"]);
}
}
if (!empty($strErrorMessage)) {
$arError[] = array("id" => $arParams["MESSAGE_TYPE"], "text" => $strErrorMessage);
}
} elseif ($arResult["VIEW"] == "Y") {
$bVarsFromForm = true;
$arFields = array("FORUM_ID" => intVal($arParams["FID"]), "TOPIC_ID" => intVal($arParams["TID"]), "MESSAGE_ID" => intVal($arParams["MID"]), "USER_ID" => intVal($GLOBALS["USER"]->GetID()));
示例10: GetSubSelect
function GetSubSelect($entityId, $entity_type = false, $entity_id = false, $event_id = false, $created_by_id = false, $arOfEntities = false, $arAdmin = false, $transport = false, $visible = "Y", $type = "L", $params = array(), $bDecrement = false, $bForAllAccess = false)
{
global $DB;
if (is_array($entityId) && isset($entityId["LOG_ID"])) {
$arFields = $entityId;
$entityId = intval($arFields["LOG_ID"]);
$entity_type = isset($arFields["ENTITY_TYPE"]) ? $arFields["ENTITY_TYPE"] : false;
$entity_id = isset($arFields["ENTITY_ID"]) ? $arFields["ENTITY_ID"] : false;
$event_id = isset($arFields["EVENT_ID"]) ? $arFields["EVENT_ID"] : false;
$created_by_id = isset($arFields["CREATED_BY_ID"]) ? $arFields["CREATED_BY_ID"] : false;
$arOfEntities = isset($arFields["ENTITIES"]) ? $arFields["ENTITIES"] : false;
$transport = isset($arFields["TRANSPORT"]) ? $arFields["TRANSPORT"] : false;
$visible = isset($arFields["VISIBLE"]) ? $arFields["VISIBLE"] : "Y";
$type = isset($arFields["TYPE"]) ? $arFields["TYPE"] : "L";
$code = isset($arFields["CODE"]) ? $arFields["CODE"] : false;
$params = isset($arFields["PARAMS"]) ? $arFields["PARAMS"] : array();
$bDecrement = isset($arFields["DECREMENT"]) ? $arFields["DECREMENT"] : false;
$bMultiple = isset($arFields["MULTIPLE"]) && $arFields["MULTIPLE"] == "Y";
$IsForAllAccessOnly = false;
if (isset($arFields["FOR_ALL_ACCESS_ONLY"])) {
$IsForAllAccessOnly = $arFields["FOR_ALL_ACCESS_ONLY"] ? "Y" : "N";
}
$bForAllAccess = $IsForAllAccessOnly == "Y" ? true : (isset($arFields["FOR_ALL_ACCESS"]) ? $arFields["FOR_ALL_ACCESS"] : false);
$tagSet = isset($arFields["TAG_SET"]) ? $arFields["TAG_SET"] : false;
}
if (intval($entityId) <= 0) {
return false;
}
$arSocNetAllowedSubscribeEntityTypesDesc = CSocNetAllowed::GetAllowedEntityTypesDesc();
$bGroupCounters = $type === "group";
$params = is_array($params) ? $params : array();
$params['CODE'] = !empty($params['CODE']) ? $params['CODE'] : ($code ? $code : ($bGroupCounters ? "SLR0.GROUP_CODE" : "'**" . ($bMultiple ? $type . $entityId : "") . "'"));
if ($type == "L" && ($arLog = CSocNetLog::GetByID($entityId))) {
$logId = $entityId;
$entity_type = $arLog["ENTITY_TYPE"];
$entity_id = $arLog["ENTITY_ID"];
$event_id = $arLog["EVENT_ID"];
$created_by_id = $arLog["USER_ID"];
$log_user_id = $arLog["USER_ID"];
} elseif ($type == "LC" && ($arLogComment = CSocNetLogComments::GetByID($entityId))) {
$entity_type = $arLogComment["ENTITY_TYPE"];
$entity_id = $arLogComment["ENTITY_ID"];
$event_id = $arLogComment["EVENT_ID"];
$created_by_id = $arLogComment["USER_ID"];
$logId = $arLogComment["LOG_ID"];
// recalculate log_id
$log_user_id = $arLogComment["LOG_USER_ID"];
} else {
$logId = $entityId;
}
if (!in_array($entity_type, CSocNetAllowed::GetAllowedEntityTypes()) || intval($entity_id) <= 0 || strlen($event_id) <= 0) {
return false;
}
if (!$arOfEntities) {
if (array_key_exists($entity_type, $arSocNetAllowedSubscribeEntityTypesDesc) && array_key_exists("HAS_MY", $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]) && $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["HAS_MY"] == "Y" && array_key_exists("CLASS_OF", $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]) && array_key_exists("METHOD_OF", $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]) && strlen($arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["CLASS_OF"]) > 0 && strlen($arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["METHOD_OF"]) > 0 && method_exists($arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["CLASS_OF"], $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["METHOD_OF"])) {
$arOfEntities = call_user_func(array($arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["CLASS_OF"], $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["METHOD_OF"]), $entity_id);
} else {
$arOfEntities = array();
}
}
if ((!defined("DisableSonetLogVisibleSubscr") || DisableSonetLogVisibleSubscr !== true) && $visible && strlen($visible) > 0) {
$key_res = CSocNetGroup::GetFilterOperation($visible);
$strField = $key_res["FIELD"];
$strNegative = $key_res["NEGATIVE"];
$strOperation = $key_res["OPERATION"];
$visibleFilter = "AND (" . ($strNegative == "Y" ? " SLE.VISIBLE IS NULL OR NOT " : "") . "(SLE.VISIBLE " . $strOperation . " '" . $DB->ForSql($strField) . "'))";
$transportFilter = "";
} else {
$visibleFilter = "";
if ($transport && strlen($transport) > 0) {
$key_res = CSocNetGroup::GetFilterOperation($transport);
$strField = $key_res["FIELD"];
$strNegative = $key_res["NEGATIVE"];
$strOperation = $key_res["OPERATION"];
$transportFilter = "AND (" . ($strNegative == "Y" ? " SLE.TRANSPORT IS NULL OR NOT " : "") . "(SLE.TRANSPORT " . $strOperation . " '" . $DB->ForSql($strField) . "'))";
} else {
$transportFilter = "";
}
}
if ($type == "LC" && (!defined("DisableSonetLogFollow") || DisableSonetLogFollow !== true)) {
$default_follow = COption::GetOptionString("socialnetwork", "follow_default_type", "Y");
if ($default_follow == "Y") {
$followJoin = " LEFT JOIN b_sonet_log_follow LFW ON LFW.USER_ID = U.ID AND (LFW.CODE = 'L" . $logId . "' OR LFW.CODE = '**') ";
$followWhere = "AND (LFW.USER_ID IS NULL OR LFW.TYPE = 'Y')";
} else {
$followJoin = " \n\t\t\t\t\tINNER JOIN b_sonet_log_follow LFW ON LFW.USER_ID = U.ID AND (LFW.CODE = 'L" . $logId . "' OR LFW.CODE = '**')\n\t\t\t\t\tLEFT JOIN b_sonet_log_follow LFW2 ON LFW2.USER_ID = U.ID AND (LFW2.CODE = 'L" . $logId . "' AND LFW2.TYPE = 'N')\n\t\t\t\t";
$followWhere = "\n\t\t\t\t\tAND (LFW.USER_ID IS NOT NULL AND LFW.TYPE = 'Y')\n\t\t\t\t\tAND LFW2.USER_ID IS NULL\n\t\t\t\t";
}
}
$strOfEntities = is_array($arOfEntities) && count($arOfEntities) > 0 ? "U.ID IN (" . implode(",", $arOfEntities) . ")" : "";
$strSQL = "\n\t\tSELECT DISTINCT\n\t\t\tU.ID as ID\n\t\t\t," . ($bDecrement ? "-1" : "1") . " as CNT\n\t\t\t," . $DB->IsNull("SLS.SITE_ID", "'**'") . " as SITE_ID\n\t\t\t," . $params['CODE'] . " as CODE,\n\t\t\t0 as SENT\n\t\t\t" . ($tagSet ? ", '" . $DB->ForSQL($tagSet) . "' as TAG" : "") . "\n\t\tFROM\n\t\t\tb_user U \n\t\t\tINNER JOIN b_sonet_log_right SLR ON SLR.LOG_ID = " . $logId . "\n\t\t\t" . ($bGroupCounters ? "INNER JOIN b_sonet_log_right SLR0 ON SLR0.LOG_ID = SLR.LOG_ID " : "") . "\n\t\t\t" . (!$bForAllAccess ? "INNER JOIN b_user_access UA ON UA.USER_ID = U.ID" : "") . "\n\t\t\tLEFT JOIN b_sonet_log_site SLS ON SLS.LOG_ID = SLR.LOG_ID\n\t\t\t" . (strlen($followJoin) > 0 ? $followJoin : "") . "\n\t\t\t" . (!$bGroupCounters && !IsModuleInstalled("intranet") ? "LEFT JOIN b_sonet_log_smartfilter SLSF ON SLSF.USER_ID = U.ID " : "") . "\n\t\t\t\n\t\tWHERE\n\t\t\tU.ACTIVE = 'Y'\n\t\t\tAND U.LAST_ACTIVITY_DATE IS NOT NULL\n\t\t\tAND\tU.LAST_ACTIVITY_DATE > " . CSocNetLogCounter::dbWeeksAgo(2) . "\n\t\t\t" . (($type == "LC" || array_key_exists("USE_CB_FILTER", $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]) && $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["USE_CB_FILTER"] == "Y") && intval($created_by_id) > 0 ? "AND U.ID <> " . $created_by_id : "") . "\n\t\t\t" . ($bGroupCounters ? "AND (SLR0.GROUP_CODE like 'SG%' AND SLR0.GROUP_CODE NOT LIKE 'SG%\\_%')" : "") . (!$bGroupCounters && !IsModuleInstalled("intranet") ? COption::GetOptionString("socialnetwork", "sonet_log_smart_filter", "N") == "Y" ? "\n\t\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t\t0=1 \n\t\t\t\t\t\t\t\t\tOR (\n\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\tSLSF.USER_ID IS NULL \n\t\t\t\t\t\t\t\t\t\t\tOR SLSF.TYPE = 'Y'\n\t\t\t\t\t\t\t\t\t\t) \n\t\t\t\t\t\t\t\t\t\t" . (!$bForAllAccess ? "AND (UA.ACCESS_CODE = SLR.GROUP_CODE)" : "") . "\n\t\t\t\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t\t\t\tSLR.GROUP_CODE LIKE 'SG%'\n\t\t\t\t\t\t\t\t\t\t\tOR SLR.GROUP_CODE = 'U" . $log_user_id . "' \n\t\t\t\t\t\t\t\t\t\t\tOR SLR.GROUP_CODE = " . $DB->Concat("'U'", $DB->type == "MSSQL" ? "CAST(U.ID as varchar(17))" : "U.ID") . " \n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\tOR (\n\t\t\t\t\t\t\t\t\t\tSLSF.TYPE <> 'Y'\n\t\t\t\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t\t\t\tSLR.GROUP_CODE IN ('AU', 'G2')\n\t\t\t\t\t\t\t\t\t\t\t" . (!$bForAllAccess ? "OR (UA.ACCESS_CODE = SLR.GROUP_CODE)" : "") . "\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t" : "\n\t\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t\t0=1 \n\t\t\t\t\t\t\t\t\tOR (\n\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\tSLSF.USER_ID IS NULL \n\t\t\t\t\t\t\t\t\t\t\tOR SLSF.TYPE <> 'Y'\n\t\t\t\t\t\t\t\t\t\t) \n\t\t\t\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t\t\t\tSLR.GROUP_CODE IN ('AU', 'G2')\n\t\t\t\t\t\t\t\t\t\t\t" . ($bForAllAccess ? "" : " OR (UA.ACCESS_CODE = SLR.GROUP_CODE)") . "\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\tOR (\n\t\t\t\t\t\t\t\t\t\tSLSF.TYPE = 'Y' \n\t\t\t\t\t\t\t\t\t\t" . ($bForAllAccess ? "" : "AND (UA.ACCESS_CODE = SLR.GROUP_CODE)") . "\n\t\t\t\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t\t\t\tSLR.GROUP_CODE LIKE 'SG%'\n\t\t\t\t\t\t\t\t\t\t\tOR SLR.GROUP_CODE = 'U" . $log_user_id . "'\n\t\t\t\t\t\t\t\t\t\t\tOR SLR.GROUP_CODE = " . $DB->Concat("'U'", $DB->type == "MSSQL" ? "CAST(U.ID as varchar(17))" : "U.ID") . " \n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t" : "\n\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t0=1\n\t\t\t\t\t\t\t" . ($IsForAllAccessOnly != "N" || $bForAllAccess ? "OR (SLR.GROUP_CODE IN ('AU', 'G2'))" : "") . "\n\t\t\t\t\t\t\t" . (!$bForAllAccess && $IsForAllAccessOnly != "Y" ? " OR (UA.ACCESS_CODE = SLR.GROUP_CODE) " : "") . "\n\t\t\t\t\t\t)\n\t\t\t\t\t") . " " . (strlen($followWhere) > 0 ? $followWhere : "") . "\n\t\t";
if ($bGroupCounters) {
return $strSQL;
}
if (strlen($visibleFilter) > 0 || strlen($transportFilter) > 0) {
$strSQL .= "\n\t\t\t\tAND\t\n\t\t\t\t(\n\t\t\t\t\tEXISTS(\n\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\tAND SLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\t\t\t\tAND SLE.ENTITY_CB = 'N'\n\t\t\t\t\t\t\tAND SLE.ENTITY_ID = " . $entity_id . "\n\t\t\t\t\t\t\tAND SLE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t\t\t\t" . $transportFilter . "\n\t\t\t\t\t\t\t" . $visibleFilter . "\n\t\t\t\t\t)";
if (array_key_exists("USE_CB_FILTER", $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]) && $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["USE_CB_FILTER"] == "Y" && intval($created_by_id) > 0) {
$strSQL .= "\n\t\t\t\tOR\n\t\t\t\t(\n\t\t\t\t\tEXISTS(\n\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\tAND SLE.ENTITY_CB = 'Y'\n\t\t\t\t\t\t\tAND SLE.ENTITY_ID = " . $created_by_id . "\n\t\t\t\t\t\t\tAND SLE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t\t\t\t" . $transportFilter . "\n\t\t\t\t\t\t\t" . $visibleFilter . "\n\t\t\t\t\t)\n\t\t\t\t)";
}
$strSQL .= "\n\t\t\tOR\n\t\t\t(\n\t\t\t\t(\n\t\t\t\t\tNOT EXISTS(\n\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\tAND SLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\t\t\t\tAND SLE.ENTITY_CB = 'N'\n\t\t\t\t\t\t\tAND SLE.ENTITY_ID = " . $entity_id . "\n\t\t\t\t\t\t\tAND SLE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t\t)\n\t\t\t\t\tOR\n\t\t\t\t\tEXISTS(\n\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\tAND SLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\t\t\t\tAND SLE.ENTITY_CB = 'N'\n\t\t\t\t\t\t\tAND SLE.ENTITY_ID = " . $entity_id . "\n\t\t\t\t\t\t\tAND SLE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t\t\t\tAND " . ($visibleFilter ? "SLE.VISIBLE = 'I'" : "SLE.TRANSPORT = 'I'") . "\n\t\t\t\t\t)\n\t\t\t\t)";
//.........这里部分代码省略.........
示例11: onAfterForumMessageDelete
function onAfterForumMessageDelete($ID, $arFields)
{
$val = COption::GetOptionString("intranet", "sonet_log_news_iblock_forum");
if (strlen($val) > 0) {
$arIBlockForum = unserialize($val);
} else {
$arIBlockForum = array();
}
if (CModule::IncludeModule("socialnetwork") && in_array($arFields["FORUM_ID"], $arIBlockForum)) {
$dbRes = CSocNetLogComments::GetList(array("ID" => "DESC"), array("EVENT_ID" => "news_comment", "SOURCE_ID" => $ID), false, false, array("ID"));
if ($arRes = $dbRes->Fetch()) {
CSocNetLogComments::Delete($arRes["ID"]);
}
}
}
示例12: onAfterCommentUpdate
public static function onAfterCommentUpdate($entityType, $entityId, $arData)
{
$log_event_id = CSocNetForumComments::FindLogEventIDByForumEntityID($entityType);
if (!$log_event_id)
return false;
$arLogCommentEvent = CSocNetLogTools::FindLogCommentEventByLogEventID($log_event_id);
if (!$arLogCommentEvent)
return false;
$arLogEvent = CSocNetLogTools::FindLogEventByID($log_event_id);
$entityId = intval($entityId);
if ($entityId <= 0)
return;
if (empty($arData["MESSAGE_ID"]))
return;
$parser = new CTextParser();
$parser->allow = array("HTML" => 'N',"ANCHOR" => 'Y',"BIU" => 'Y',"IMG" => "Y","VIDEO" => "Y","LIST" => 'N',"QUOTE" => 'Y',"CODE" => 'Y',"FONT" => 'Y',"SMILES" => "N","UPLOAD" => 'N',"NL2BR" => 'N',"TABLE" => "Y");
switch ($arData["ACTION"])
{
case "DEL":
case "HIDE":
$dbLogComment = CSocNetLogComments::GetList(
array("ID" => "DESC"),
array(
"EVENT_ID" => array($arLogCommentEvent["EVENT_ID"]),
"SOURCE_ID" => intval($arData["MESSAGE_ID"])
),
false,
false,
array("ID")
);
while ($arLogComment = $dbLogComment->Fetch())
CSocNetLogComments::Delete($arLogComment["ID"]);
break;
case "SHOW":
$dbLogComment = CSocNetLogComments::GetList(
array("ID" => "DESC"),
array(
"EVENT_ID" => array($arLogCommentEvent["EVENT_ID"]),
"SOURCE_ID" => intval($arData["MESSAGE_ID"])
),
false,
false,
array("ID")
);
$arLogComment = $dbLogComment->Fetch();
if (!$arLogComment)
{
$arMessage = CForumMessage::GetByID(intval($arData["MESSAGE_ID"]));
if ($arMessage)
{
$dbLog = CSocNetLog::GetList(
array("ID" => "DESC"),
array(
"EVENT_ID" => $log_event_id,
"SOURCE_ID" => $entityId
),
false,
false,
array("ID", "ENTITY_TYPE", "ENTITY_ID")
);
if ($arLog = $dbLog->Fetch())
{
$log_id = $arLog["ID"];
$entity_type = $arLog["ENTITY_TYPE"];
$entity_id = $arLog["ENTITY_ID"];
$sText = (COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $arMessage["POST_MESSAGE_FILTER"] : $arMessage["POST_MESSAGE"]);
$strURL = $GLOBALS['APPLICATION']->GetCurPageParam("", array("IFRAME", "MID", "SEF_APPLICATION_CUR_PAGE_URL", BX_AJAX_PARAM_ID, "result"));
$strURL = ForumAddPageParams(
$strURL,
array(
"MID" => intval($arData["MESSAGE_ID"]),
"result" => "reply"
),
false,
false
);
$arFieldsForSocnet = array(
"ENTITY_TYPE" => $entity_type,
"ENTITY_ID" => $entity_id,
"EVENT_ID" => $arLogCommentEvent["EVENT_ID"],
"MESSAGE" => $sText,
"TEXT_MESSAGE" => $parser->convert4mail($sText),
"URL" => str_replace("?IFRAME=Y", "", str_replace("&IFRAME=Y", "", str_replace("IFRAME=Y&", "", $strURL))),
"MODULE_ID" => (array_key_exists("MODULE_ID", $arLogCommentEvent) && strlen($arLogCommentEvent["MODULE_ID"]) > 0 ? $arLogCommentEvent["MODULE_ID"] : ""),
"SOURCE_ID" => intval($arData["MESSAGE_ID"]),
"LOG_ID" => $log_id,
"RATING_TYPE_ID" => "FORUM_POST",
"RATING_ENTITY_ID" => intval($arData["MESSAGE_ID"])
);
$arFieldsForSocnet["USER_ID"] = $arMessage["AUTHOR_ID"];
//.........这里部分代码省略.........
示例13: array
if (is_object($cache) && $cache->InitCache($cache_time, $cache_id, $cache_path)) {
$arCacheVars = $cache->GetVars();
$arCommentsFullList = $arCacheVars["COMMENTS_FULL_LIST"];
} else {
$arCommentsFullList = array();
if (is_object($cache)) {
$cache->StartDataCache($cache_time, $cache_id, $cache_path);
}
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->StartTagCache($cache_path);
}
$arFilter = array("LOG_ID" => $arParams["LOG_ID"]);
$arSelect = array("ID", "LOG_ID", "SOURCE_ID", "ENTITY_TYPE", "ENTITY_ID", "USER_ID", "EVENT_ID", "LOG_DATE", "MESSAGE", "TEXT_MESSAGE", "URL", "MODULE_ID", "GROUP_NAME", "GROUP_OWNER_ID", "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", "LOG_SITE_ID", "LOG_SOURCE_ID", "RATING_TYPE_ID", "RATING_ENTITY_ID", "UF_*");
$arListParams = array("USE_SUBSCRIBE" => "N", "CHECK_RIGHTS" => "N");
$arUFMeta = __SLMGetUFMeta();
$dbComments = CSocNetLogComments::GetList(array("LOG_DATE" => "DESC"), $arFilter, false, array("nTopCount" => $nTopCount), $arSelect, $arListParams);
while ($arComments = $dbComments->GetNext()) {
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->RegisterTag("USER_NAME_" . intval($arComments["USER_ID"]));
}
$arComments["UF"] = $arUFMeta;
foreach ($arUFMeta as $field_name => $arUF) {
if (array_key_exists($field_name, $arComments)) {
$arComments["UF"][$field_name]["VALUE"] = $arComments[$field_name];
$arComments["UF"][$field_name]["ENTITY_VALUE_ID"] = $arComments["ID"];
}
}
$arCommentsFullList[] = __SLMGetLogCommentRecord($arComments, $arParams, false);
}
if (is_object($cache)) {
$arCacheData = array("COMMENTS_FULL_LIST" => $arCommentsFullList);
示例14: AddCommentToLog
function AddCommentToLog($arFields)
{
global $DB, $USER;
CModule::IncludeModule("socialnetwork");
$result = false;
$LOG_ID = CTimeManNotify::SendMessage($arFields["ENTRY_ID"], 'A');
$arMessFields = array("EVENT_ID" => "timeman_entry_comment", "ENTITY_ID" => $arFields["USER_ID"], "TEXT_MESSAGE" => $arFields["COMMENT_TEXT"], "MESSAGE" => $arFields["COMMENT_TEXT"], "USER_ID" => $arFields["USER_ID"], "ENTITY_TYPE" => SONET_TIMEMAN_ENTRY_ENTITY, "LOG_ID" => $LOG_ID, "=LOG_DATE" => $DB->CurrentTimeFunction());
$result = CSocNetLogComments::Add($arMessFields, true, false);
CSocNetLog::CounterIncrement($result, false, false, "LC");
$curUser = $USER->GetID();
$dbLogRights = CSocNetLogRights::GetList(array(), array("LOG_ID" => $LOG_ID));
while ($arRight = $dbLogRights->Fetch()) {
$arRights[] = $arRight["GROUP_CODE"];
}
if (!in_array("U" . $curUser, $arRights)) {
CSocNetLogRights::Add($LOG_ID, "U" . $curUser);
}
return $result;
}
示例15: __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;
}
}