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


PHP CSearch::GetContentItemParams方法代码示例

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


在下文中一共展示了CSearch::GetContentItemParams方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: OnAddRatingVote

 public static function OnAddRatingVote($id, $arParams)
 {
     $bSocialnetworkInstalled = CModule::IncludeModule("socialnetwork");
     if ($arParams['ENTITY_TYPE_ID'] == 'LISTS_NEW_ELEMENT' && CModule::IncludeModule("socialnetwork")) {
         $rsLog = CSocNetLog::GetList(array(), array("RATING_TYPE_ID" => $arParams['ENTITY_TYPE_ID'], "RATING_ENTITY_ID" => $arParams['ENTITY_ID']), false, false, array("ID", "USER_ID", "TITLE_TEMPLATE", "TITLE"));
         if ($arLog = $rsLog->Fetch()) {
             if ($arLog['USER_ID'] != $arParams['USER_ID']) {
                 $url = COption::GetOptionString("socialnetwork", "log_entry_page", $arSites[$user_site_id]["DIR"] . "company/personal/log/#log_id#/", SITE_ID);
                 $url = str_replace("#log_id#", $arLog["ID"], $url);
                 $arParams['ENTITY_LINK'] = $url;
                 $arParams['ENTITY_TITLE'] = htmlspecialcharsback($arLog["TITLE"]);
                 $arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => intval($arLog['USER_ID']), "FROM_USER_ID" => intval($arParams['USER_ID']), "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "main", "NOTIFY_EVENT" => "rating_vote", "NOTIFY_TAG" => "RATING|" . ($arParams['VALUE'] >= 0 ? "" : "DL|") . $arParams['ENTITY_TYPE_ID'] . "|" . $arParams['ENTITY_ID'], "NOTIFY_MESSAGE" => self::GetMessageRatingVote($arParams), "NOTIFY_MESSAGE_OUT" => self::GetMessageRatingVote($arParams, true));
                 CIMNotify::Add($arMessageFields);
             }
         }
     } elseif ($arParams['ENTITY_TYPE_ID'] == 'LOG_COMMENT') {
         if ($arComment = CSocNetLogComments::GetByID($arParams['ENTITY_ID'])) {
             preg_match_all("/\\[user\\s*=\\s*([^\\]]*)\\](.+?)\\[\\/user\\]/ies" . BX_UTF_PCRE_MODIFIER, $arComment["TEXT_MESSAGE"], $arMention);
             if (!empty($arMention)) {
                 $arMentionedUserID = $arMention[1];
             }
             if ($arComment['USER_ID'] == $arParams['USER_ID'] && empty($arMentionedUserID)) {
                 return false;
             }
             $arEventTmp = CSocNetLogTools::FindLogCommentEventByID($arComment["EVENT_ID"]);
             if ($arEventTmp && array_key_exists("CLASS_FORMAT", $arEventTmp) && array_key_exists("METHOD_FORMAT", $arEventTmp)) {
                 $arComment["MESSAGE"] = preg_replace(array('|\\[DISK\\sFILE\\sID=[n]*\\d+\\]|', '|\\[DOCUMENT\\sID=[n]*\\d+\\]|'), '', $arComment["MESSAGE"]);
                 $arComment["MESSAGE"] = preg_replace('|\\[QUOTE\\](.+?)\\[\\/QUOTE\\]|is' . BX_UTF_PCRE_MODIFIER, '"\\1"', $arComment["MESSAGE"]);
                 $arFIELDS_FORMATTED = call_user_func(array($arEventTmp["CLASS_FORMAT"], $arEventTmp["METHOD_FORMAT"]), $arComment, array("IM" => "Y"));
                 $CCTP = new CTextParser();
                 $CCTP->MaxStringLen = 200;
                 $CCTP->allow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "Y", "NL2BR" => "Y", "VIDEO" => "N", "TABLE" => "N", "CUT_ANCHOR" => "N", "ALIGN" => "N");
                 $arComment["MESSAGE"] = $CCTP->convertText($arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"]);
             }
             $arComment["MESSAGE"] = preg_replace(array('|\\[DISK\\sFILE\\sID=[n]*\\d+\\]|', '|\\[DOCUMENT\\sID=[n]*\\d+\\]|'), '', $arComment["MESSAGE"]);
             $arParams["ENTITY_TITLE"] = strip_tags(str_replace(array("<br>", "<br/>", "<br />", "#BR#"), array(" ", " ", " ", " "), htmlspecialcharsback($arComment["MESSAGE"])));
             $bExtranetInstalled = CModule::IncludeModule("extranet");
             if ($bExtranetInstalled) {
                 $arSites = array();
                 $extranet_site_id = CExtranet::GetExtranetSiteID();
                 $intranet_site_id = CSite::GetDefSite();
                 $dbSite = CSite::GetList($by = "sort", $order = "desc", array("ACTIVE" => "Y"));
                 while ($arSite = $dbSite->Fetch()) {
                     $arSites[$arSite["ID"]] = array("DIR" => strlen(trim($arSite["DIR"])) > 0 ? $arSite["DIR"] : "/", "SERVER_NAME" => strlen(trim($arSite["SERVER_NAME"])) > 0 ? $arSite["SERVER_NAME"] : COption::GetOptionString("main", "server_name", $_SERVER["HTTP_HOST"]));
                 }
             }
             if ($arComment['USER_ID'] != $arParams['USER_ID']) {
                 $followValue = "Y";
                 if ($bSocialnetworkInstalled) {
                     $followValue = CSocNetLogFollow::GetExactValueByRating($arComment['USER_ID'], trim($arParams["ENTITY_TYPE_ID"]), intval($arParams["ENTITY_ID"]));
                 }
                 if ($followValue != "N") {
                     $arParams['ENTITY_LINK'] = self::GetMessageRatingLogCommentURL($arComment, intval($arComment['USER_ID']), $arSites, $intranet_site_id, $extranet_site_id);
                     $arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => intval($arComment['USER_ID']), "FROM_USER_ID" => intval($arParams['USER_ID']), "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "main", "NOTIFY_EVENT" => "rating_vote", "NOTIFY_TAG" => "RATING|" . ($arParams['VALUE'] >= 0 ? "" : "DL|") . $arParams['ENTITY_TYPE_ID'] . "|" . $arParams['ENTITY_ID'], "NOTIFY_MESSAGE" => self::GetMessageRatingVote($arParams), "NOTIFY_MESSAGE_OUT" => self::GetMessageRatingVote($arParams, true));
                     CIMNotify::Add($arMessageFields);
                 }
             }
             if (!empty($arMentionedUserID) && is_array($arMentionedUserID)) {
                 $arParams["MENTION"] = true;
                 // for self::GetMessageRatingVote()
                 foreach ($arMentionedUserID as $mentioned_user_id) {
                     if ($mentioned_user_id != $arParams['USER_ID'] && CSocNetLogRights::CheckForUserOnly($arComment["LOG_ID"], $mentioned_user_id)) {
                         $followValue = "Y";
                         if ($bSocialnetworkInstalled) {
                             $followValue = CSocNetLogFollow::GetExactValueByRating(intval($mentioned_user_id), trim($arParams["ENTITY_TYPE_ID"]), intval($arParams["ENTITY_ID"]));
                         }
                         if ($followValue != "N") {
                             $arParams['ENTITY_LINK'] = self::GetMessageRatingLogCommentURL($arComment, intval($mentioned_user_id), $arSites, $intranet_site_id, $extranet_site_id);
                             $arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => intval($mentioned_user_id), "FROM_USER_ID" => intval($arParams['USER_ID']), "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "main", "NOTIFY_EVENT" => "rating_vote_mentioned", "NOTIFY_TAG" => "RATING_MENTION|" . ($arParams['VALUE'] >= 0 ? "" : "DL|") . $arParams['ENTITY_TYPE_ID'] . "|" . $arParams['ENTITY_ID'], "NOTIFY_MESSAGE" => self::GetMessageRatingVote($arParams), "NOTIFY_MESSAGE_OUT" => self::GetMessageRatingVote($arParams, true));
                             CIMNotify::Add($arMessageFields);
                         }
                     }
                 }
             }
         }
     } else {
         if (!CModule::IncludeModule("search") || BX_SEARCH_VERSION <= 1) {
             return false;
         }
         $CSI = new CSearchItem();
         $arFSearch = array('=ENTITY_TYPE_ID' => $arParams['ENTITY_TYPE_ID'], '=ENTITY_ID' => $arParams['ENTITY_ID']);
         if (defined("SITE_ID") && strlen(SITE_ID) > 0) {
             $arFSearch["=SITE_ID"] = SITE_ID;
         }
         $res = $CSI->GetList(array(), $arFSearch, array('ID', 'URL', 'TITLE', 'BODY', 'PARAM1'));
         if ($arItem = $res->GetNext(true, false)) {
             // notify mentioned users
             $arSearchItemParams = CSearch::GetContentItemParams($arItem['ID'], 'mentioned_user_id');
             if (is_array($arSearchItemParams) && array_key_exists('mentioned_user_id', $arSearchItemParams) && is_array($arSearchItemParams['mentioned_user_id'])) {
                 $arMentionedUserID = $arSearchItemParams['mentioned_user_id'];
             }
             // send to author
             if ($arParams['OWNER_ID'] != $arParams['USER_ID'] || $arMentionedUserID) {
                 $arParams["ENTITY_LINK"] = $arItem['URL'];
                 $arParams["ENTITY_PARAM"] = $arItem['PARAM1'];
                 $arParams["ENTITY_TITLE"] = trim(strip_tags(str_replace(array("\r\n", "\n", "\r"), ' ', htmlspecialcharsback($arItem['TITLE']))));
                 $arParams["ENTITY_MESSAGE"] = trim(strip_tags(str_replace(array("\r\n", "\n", "\r"), ' ', htmlspecialcharsback($arItem['BODY']))));
                 if ((strlen($arParams["ENTITY_TITLE"]) > 0 || strlen($arParams["ENTITY_MESSAGE"]) > 0) && strlen($arParams["ENTITY_LINK"]) > 0) {
                     $originalLink = $arParams["ENTITY_LINK"];
                     $bExtranetInstalled = CModule::IncludeModule("extranet");
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:im_event.php


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