当前位置: 首页>>代码示例>>PHP>>正文


PHP CSocNetLogComments::add方法代码示例

本文整理汇总了PHP中CSocNetLogComments::add方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetLogComments::add方法的具体用法?PHP CSocNetLogComments::add怎么用?PHP CSocNetLogComments::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSocNetLogComments的用法示例。


在下文中一共展示了CSocNetLogComments::add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:29,代码来源:blogpostconnector.php

示例2: addComment

 public function addComment($authorId, array $data)
 {
     $return = null;
     if (($res = $this->getDataToShow($authorId)) && !empty($res) && ($res2 = $this->getDataToCheck($this->entityId)) && !empty($res2)) {
         list($message, $topic, $forum) = $res2;
         $messageFields = array("POST_MESSAGE" => $data["text"], "PARAM2" => $this->entityId, "APPROVED" => "Y", "PERMISSION_EXTERNAL" => "I", "PERMISSION" => "I");
         if ($forum["DEDUPLICATION"] == "Y") {
             \CForumNew::update($forum["ID"], array("DEDUPLICATION" => "N"), false);
         }
         if (!empty($data['fileId'])) {
             $messageFields['UF_FORUM_MESSAGE_DOC'] = array($data['fileId']);
             $GLOBALS["UF_FORUM_MESSAGE_DOC"] = array($data['fileId']);
         } elseif (!empty($data['versionId'])) {
             $messageFields['UF_FORUM_MESSAGE_VER'] = $data['versionId'];
             $GLOBALS["UF_FORUM_MESSAGE_VER"] = $data['versionId'];
         }
         $comId = ForumAddMessage("REPLY", $message["FORUM_ID"], $message["TOPIC_ID"], 0, $messageFields, $strErrorMessage, $strOKMessage);
         if ($res['DUPLICATE_TO_SOCNET'] == "Y" && $comId > 0 && Loader::includeModule("socialnetwork")) {
             if ($res['DUPLICATE_TO_SOCNET'] == "Y") {
                 $arFieldsForSocnet = array("USER_ID" => $authorId, '=LOG_DATE' => $GLOBALS['DB']->currentTimeFunction(), "ENTITY_TYPE" => $res["ENTITY_TYPE"], "ENTITY_ID" => $res["ENTITY_ID"], "EVENT_ID" => $res["EVENT_ID"], "MESSAGE" => $data["text"], "TEXT_MESSAGE" => $data["text"], "URL" => $res["DETAIL_URL"], "MODULE_ID" => $res["MODULE_ID"], "SOURCE_ID" => $comId, "LOG_ID" => $res["LOG_ID"], "RATING_TYPE_ID" => "FORUM_POST", "RATING_ENTITY_ID" => $comId);
                 if (!empty($data['fileId'])) {
                     $arFieldsForSocnet['UF_SONET_COM_DOC'] = array($data['fileId']);
                     $GLOBALS["UF_SONET_COM_DOC"] = array($data['fileId']);
                 } elseif (!empty($data['versionId'])) {
                     $arFieldsForSocnet['UF_SONET_COM_VER'] = $data['versionId'];
                     $GLOBALS["UF_SONET_COM_VER"] = $data['versionId'];
                 }
                 \CSocNetLogComments::add($arFieldsForSocnet, false, false, false);
             }
         }
         if ($comId > 0 && Loader::includeModule("pull") && \CPullOptions::getNginxStatus() && $res["DETAIL_URL"] !== null) {
             \CPullWatch::addToStack("UNICOMMENTS" . $topic["XML_ID"], array('module_id' => "unicomments", 'command' => "comment", 'params' => array("AUTHOR_ID" => $authorId, "ID" => $comId, "POST_ID" => $this->entityId, "TS" => time(), "ACTION" => "REPLY", "URL" => array("LINK" => str_replace("MID=" . $this->entityId, "MID=" . $comId, $res["DETAIL_URL"])), "ENTITY_XML_ID" => $topic["XML_ID"], "APPROVED" => "Y", "NEED_REQUEST" => "Y")));
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:35,代码来源:forummessageconnector.php


注:本文中的CSocNetLogComments::add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。