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


PHP CIBlockElement::__GetFileContent方法代码示例

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


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

示例1: IBlockElementUpdate

 function IBlockElementUpdate(&$arFields)
 {
     //Do not index workflow history
     $WF_PARENT_ELEMENT_ID = intval($arFields["WF_PARENT_ELEMENT_ID"]);
     if ($WF_PARENT_ELEMENT_ID > 0 && $WF_PARENT_ELEMENT_ID != intval($arFields["ID"])) {
         return;
     }
     if (!CModule::IncludeModule('search')) {
         return;
     }
     //And do not index wf drafts
     $rsElement = CIBlockElement::GetList(array(), array("=ID" => $arFields["ID"]), false, false, array("ID", "NAME", "IBLOCK_SECTION_ID", "WF_PARENT_ELEMENT_ID", "WF_STATUS_ID"));
     $dbElement = $rsElement->Fetch();
     if (!$dbElement) {
         return;
     }
     if (!isset($arFields["NAME"])) {
         $arFields["NAME"] = $dbElement["NAME"];
     }
     if (!isset($arFields["IBLOCK_SECTION"])) {
         $arFields["IBLOCK_SECTION"] = $dbElement["IBLOCK_SECTION_ID"];
     } elseif (is_array($arFields["IBLOCK_SECTION"]) && isset($arFields["IBLOCK_SECTION"][0])) {
         $arFields["IBLOCK_SECTION"] = $arFields["IBLOCK_SECTION"][0];
     }
     switch (intval($arFields["IBLOCK_ID"])) {
         case intval($this->_params["PHOTO_GROUP_IBLOCK_ID"]):
             $path_template = trim($this->_params["PATH_TO_GROUP_PHOTO_ELEMENT"]);
             if (strlen($path_template)) {
                 $this->IndexIBlockElement($arFields, $this->_group_id, "G", "photo", "view", $path_template, array("PREVIEW_TEXT"));
             }
             break;
         case intval($this->_params["PHOTO_USER_IBLOCK_ID"]):
             $path_template = trim($this->_params["PATH_TO_USER_PHOTO_ELEMENT"]);
             if (strlen($path_template)) {
                 $this->IndexIBlockElement($arFields, $this->_user_id, "U", "photo", "view", $path_template, array("PREVIEW_TEXT"));
             }
             break;
         case intval($this->_params["CALENDAR_GROUP_IBLOCK_ID"]):
             $path_template = trim($this->_params["PATH_TO_GROUP_CALENDAR_ELEMENT"]);
             if (strlen($path_template)) {
                 $this->IndexIBlockElement($arFields, $this->_group_id, "G", "calendar", "view", $path_template, array("DETAIL_TEXT"));
             }
             break;
         case intval($this->_params["TASK_IBLOCK_ID"]):
             if (is_array($arFields["IBLOCK_SECTION"])) {
                 foreach ($arFields["IBLOCK_SECTION"] as $section_id) {
                     break;
                 }
             } else {
                 $section_id = $arFields["IBLOCK_SECTION"];
             }
             $section_id = intval($section_id);
             if ($section_id) {
                 $rsPath = CIBlockSection::GetNavChain($arFields["IBLOCK_ID"], $section_id);
                 $arSection = $rsPath->Fetch();
                 if ($arSection) {
                     if ($arSection["EXTERNAL_ID"] == "users_tasks") {
                         $rsAssigned = CIBlockElement::GetProperty($arFields["IBLOCK_ID"], $arFields["ID"], "sort", "asc", array("CODE" => "TASKASSIGNEDTO", "EMPTY" => "N"));
                         $arAssigned = $rsAssigned->Fetch();
                         $path_template = trim($this->_params["PATH_TO_USER_TASK_ELEMENT"]);
                         if ($arAssigned && strlen($path_template)) {
                             $this->IndexIBlockElement($arFields, $arAssigned["VALUE"], "U", "tasks", "view_all", $path_template, array("DETAIL_TEXT"));
                         }
                     } elseif (intval($arSection["EXTERNAL_ID"]) > 0) {
                         $path_template = trim($this->_params["PATH_TO_GROUP_TASK_ELEMENT"]);
                         if (strlen($path_template)) {
                             $this->IndexIBlockElement($arFields, intval($arSection["EXTERNAL_ID"]), "G", "tasks", "view", $path_template, array("DETAIL_TEXT"));
                         }
                     }
                 }
             }
             break;
         case intval($this->_params["FILES_GROUP_IBLOCK_ID"]):
             $path_template = trim($this->_params["PATH_TO_GROUP_FILES_ELEMENT"]);
             if (strlen($path_template)) {
                 $property = strtoupper(trim($this->_params["FILES_PROPERTY_CODE"]));
                 if (strlen($property) <= 0) {
                     $property = "FILE";
                 }
                 $rsFile = CIBlockElement::GetProperty($arFields["IBLOCK_ID"], $arFields["ID"], "sort", "asc", array("CODE" => $property, "EMPTY" => "N"));
                 $arFile = $rsFile->Fetch();
                 if ($arFile) {
                     $arFile = CIBlockElement::__GetFileContent($arFile["VALUE"]);
                     if (is_array($arFile)) {
                         $arFields["FILE_CONTENT"] = $arFile["CONTENT"];
                         if (strlen($arFields["TAGS"])) {
                             $arFields["TAGS"] .= "," . $arFile["PROPERTIES"][COption::GetOptionString("search", "page_tag_property")];
                         } else {
                             $arFields["TAGS"] = $arFile["PROPERTIES"][COption::GetOptionString("search", "page_tag_property")];
                         }
                     }
                 }
                 $this->IndexIBlockElement($arFields, $this->_group_id, "G", "files", "view", $path_template, array("FILE_CONTENT", "DETAIL_TEXT"));
             }
             break;
         case intval($this->_params["FILES_USER_IBLOCK_ID"]):
             $path_template = trim($this->_params["PATH_TO_USER_FILES_ELEMENT"]);
             if (strlen($path_template)) {
                 $property = strtoupper(trim($this->_params["FILES_PROPERTY_CODE"]));
                 if (strlen($property) <= 0) {
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:search.php

示例2: OnSearchReindex

 public static function OnSearchReindex($NS = array(), $oCallback = NULL, $callback_method = "")
 {
     /** @global CUserTypeManager $USER_FIELD_MANAGER */
     global $USER_FIELD_MANAGER;
     /** $global CDatabase $DB */
     global $DB;
     $strNSJoin1 = "";
     $strNSFilter1 = "";
     $strNSFilter2 = "";
     $strNSFilter3 = "";
     $arResult = array();
     if ($NS["MODULE"] == "iblock" && strlen($NS["ID"]) > 0) {
         $arrTmp = explode(".", $NS["ID"]);
         $strNSFilter1 = " AND B.ID>=" . IntVal($arrTmp[0]) . " ";
         if (substr($arrTmp[1], 0, 1) != 'S') {
             $strNSFilter2 = " AND BE.ID>" . IntVal($arrTmp[1]) . " ";
         } else {
             $strNSFilter2 = false;
             $strNSFilter3 = " AND BS.ID>" . IntVal(substr($arrTmp[1], 1)) . " ";
         }
     }
     if ($NS["SITE_ID"] != "") {
         $strNSJoin1 .= " INNER JOIN b_iblock_site BS ON BS.IBLOCK_ID=B.ID ";
         $strNSFilter1 .= " AND BS.SITE_ID='" . $DB->ForSQL($NS["SITE_ID"]) . "' ";
     }
     $strSql = "\n\t\t\tSELECT B.ID, B.IBLOCK_TYPE_ID, B.INDEX_ELEMENT, B.INDEX_SECTION, B.RIGHTS_MODE,\n\t\t\t\tB.IBLOCK_TYPE_ID, B.CODE as IBLOCK_CODE, B.XML_ID as IBLOCK_EXTERNAL_ID\n\t\t\tFROM b_iblock B\n\t\t\t" . $strNSJoin1 . "\n\t\t\tWHERE B.ACTIVE = 'Y'\n\t\t\t\tAND (B.INDEX_ELEMENT='Y' OR B.INDEX_SECTION='Y')\n\t\t\t\t" . $strNSFilter1 . "\n\t\t\tORDER BY B.ID\n\t\t";
     $dbrIBlock = $DB->Query($strSql);
     while ($arIBlock = $dbrIBlock->Fetch()) {
         $IBLOCK_ID = $arIBlock["ID"];
         $arGroups = array();
         $strSql = "SELECT GROUP_ID " . "FROM b_iblock_group " . "WHERE IBLOCK_ID= " . $IBLOCK_ID . " " . "\tAND PERMISSION>='R' " . "\tAND GROUP_ID>1 " . "ORDER BY GROUP_ID";
         $dbrIBlockGroup = $DB->Query($strSql);
         while ($arIBlockGroup = $dbrIBlockGroup->Fetch()) {
             $arGroups[] = $arIBlockGroup["GROUP_ID"];
             if ($arIBlockGroup["GROUP_ID"] == 2) {
                 break;
             }
         }
         $arSITE = array();
         $strSql = "SELECT SITE_ID " . "FROM b_iblock_site " . "WHERE IBLOCK_ID= " . $IBLOCK_ID;
         $dbrIBlockSite = $DB->Query($strSql);
         while ($arIBlockSite = $dbrIBlockSite->Fetch()) {
             $arSITE[] = $arIBlockSite["SITE_ID"];
         }
         if ($arIBlock["INDEX_ELEMENT"] == 'Y' && $strNSFilter2 !== false) {
             $strSql = "SELECT BE.ID, BE.NAME, BE.TAGS, " . "\t" . $DB->DateToCharFunction("BE.ACTIVE_FROM") . " as DATE_FROM, " . "\t" . $DB->DateToCharFunction("BE.ACTIVE_TO") . " as DATE_TO, " . "\t" . $DB->DateToCharFunction("BE.TIMESTAMP_X") . " as LAST_MODIFIED, " . "\tBE.PREVIEW_TEXT_TYPE, BE.PREVIEW_TEXT, " . "\tBE.DETAIL_TEXT_TYPE, BE.DETAIL_TEXT, " . "\tBE.XML_ID as EXTERNAL_ID, BE.CODE, " . "\tBE.IBLOCK_SECTION_ID " . "FROM b_iblock_element BE " . "WHERE BE.IBLOCK_ID=" . $IBLOCK_ID . " " . "\tAND BE.ACTIVE='Y' " . CIBlockElement::WF_GetSqlLimit("BE.", "N") . $strNSFilter2 . "ORDER BY BE.ID ";
             //For MySQL we have to solve client out of memory
             //problem by limiting the query
             if ($DB->type == "MYSQL") {
                 $limit = 1000;
                 $strSql .= " LIMIT " . $limit;
             } else {
                 $limit = false;
             }
             $dbrIBlockElement = $DB->Query($strSql);
             while ($arIBlockElement = $dbrIBlockElement->Fetch()) {
                 $DETAIL_URL = "=ID=" . $arIBlockElement["ID"] . "&EXTERNAL_ID=" . $arIBlockElement["EXTERNAL_ID"] . "&CODE=" . $arIBlockElement["CODE"] . "&IBLOCK_SECTION_ID=" . $arIBlockElement["IBLOCK_SECTION_ID"] . "&IBLOCK_TYPE_ID=" . $arIBlock["IBLOCK_TYPE_ID"] . "&IBLOCK_ID=" . $IBLOCK_ID . "&IBLOCK_CODE=" . $arIBlock["IBLOCK_CODE"] . "&IBLOCK_EXTERNAL_ID=" . $arIBlock["IBLOCK_EXTERNAL_ID"];
                 $BODY = ($arIBlockElement["PREVIEW_TEXT_TYPE"] == "html" ? CSearch::KillTags($arIBlockElement["PREVIEW_TEXT"]) : $arIBlockElement["PREVIEW_TEXT"]) . "\r\n" . ($arIBlockElement["DETAIL_TEXT_TYPE"] == "html" ? CSearch::KillTags($arIBlockElement["DETAIL_TEXT"]) : $arIBlockElement["DETAIL_TEXT"]);
                 $dbrProperties = CIBlockElement::GetProperty($IBLOCK_ID, $arIBlockElement["ID"], "sort", "asc", array("ACTIVE" => "Y", "SEARCHABLE" => "Y"));
                 while ($arProperties = $dbrProperties->Fetch()) {
                     $BODY .= "\r\n";
                     if (strlen($arProperties["USER_TYPE"]) > 0) {
                         $UserType = CIBlockProperty::GetUserType($arProperties["USER_TYPE"]);
                     } else {
                         $UserType = array();
                     }
                     if (array_key_exists("GetSearchContent", $UserType)) {
                         $BODY .= CSearch::KillTags(call_user_func_array($UserType["GetSearchContent"], array($arProperties['ID'], array("VALUE" => $arProperties["VALUE"]), array())));
                     } elseif (array_key_exists("GetPublicViewHTML", $UserType)) {
                         $BODY .= CSearch::KillTags(call_user_func_array($UserType["GetPublicViewHTML"], array($arProperties['ID'], array("VALUE" => $arProperties["VALUE"]), array())));
                     } elseif ($arProperties["PROPERTY_TYPE"] == 'L') {
                         $BODY .= $arProperties["VALUE_ENUM"];
                     } elseif ($arProperties["PROPERTY_TYPE"] == 'F') {
                         $arFile = CIBlockElement::__GetFileContent($arProperties["VALUE"]);
                         if (is_array($arFile)) {
                             $BODY .= $arFile["CONTENT"];
                             $arIBlockElement["TAGS"] .= "," . $arFile["PROPERTIES"][COption::GetOptionString("search", "page_tag_property")];
                         }
                     } else {
                         $BODY .= $arProperties["VALUE"];
                     }
                 }
                 if ($arIBlock["RIGHTS_MODE"] !== "E") {
                     $arPermissions = $arGroups;
                 } else {
                     $obElementRights = new CIBlockElementRights($IBLOCK_ID, $arIBlockElement["ID"]);
                     $arPermissions = $obElementRights->GetGroups(array("element_read"));
                 }
                 $Result = array("ID" => $arIBlockElement["ID"], "LAST_MODIFIED" => strlen($arIBlockElement["DATE_FROM"]) > 0 ? $arIBlockElement["DATE_FROM"] : $arIBlockElement["LAST_MODIFIED"], "TITLE" => $arIBlockElement["NAME"], "BODY" => $BODY, "TAGS" => $arIBlockElement["TAGS"], "SITE_ID" => $arSITE, "PARAM1" => $arIBlock["IBLOCK_TYPE_ID"], "PARAM2" => $IBLOCK_ID, "DATE_FROM" => strlen($arIBlockElement["DATE_FROM"]) > 0 ? $arIBlockElement["DATE_FROM"] : false, "DATE_TO" => strlen($arIBlockElement["DATE_TO"]) > 0 ? $arIBlockElement["DATE_TO"] : false, "PERMISSIONS" => $arPermissions, "URL" => $DETAIL_URL);
                 if ($oCallback) {
                     $res = call_user_func(array($oCallback, $callback_method), $Result);
                     if (!$res) {
                         return $IBLOCK_ID . "." . $arIBlockElement["ID"];
                     }
                 } else {
                     $arResult[] = $Result;
                 }
                 if ($limit !== false) {
                     $limit--;
                     if ($limit <= 0) {
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:iblock.php

示例3: UpdateSearch

 function UpdateSearch($ID, $bOverWrite = false)
 {
     if (!CModule::IncludeModule("search")) {
         return;
     }
     global $DB;
     $ID = Intval($ID);
     static $strElementSql = false;
     if (!$strElementSql) {
         $strElementSql = "\n\t\t\t\tSELECT BE.ID, BE.NAME, BE.XML_ID as EXTERNAL_ID,\n\t\t\t\t\tBE.PREVIEW_TEXT_TYPE, BE.PREVIEW_TEXT, BE.CODE,\n\t\t\t\t\tBE.TAGS,\n\t\t\t\t\tBE.DETAIL_TEXT_TYPE, BE.DETAIL_TEXT, BE.IBLOCK_ID, B.IBLOCK_TYPE_ID,\n\t\t\t\t\t" . $DB->DateToCharFunction("BE.TIMESTAMP_X") . " as LAST_MODIFIED,\n\t\t\t\t\t" . $DB->DateToCharFunction("BE.ACTIVE_FROM") . " as DATE_FROM,\n\t\t\t\t\t" . $DB->DateToCharFunction("BE.ACTIVE_TO") . " as DATE_TO,\n\t\t\t\t\tBE.IBLOCK_SECTION_ID,\n\t\t\t\t\tB.CODE as IBLOCK_CODE, B.XML_ID as IBLOCK_EXTERNAL_ID, B.DETAIL_PAGE_URL,\n\t\t\t\t\tB.VERSION, B.RIGHTS_MODE, B.SOCNET_GROUP_ID\n\t\t\t\tFROM b_iblock_element BE, b_iblock B\n\t\t\t\tWHERE BE.IBLOCK_ID=B.ID\n\t\t\t\t\tAND B.ACTIVE='Y'\n\t\t\t\t\tAND BE.ACTIVE='Y'\n\t\t\t\t\tAND B.INDEX_ELEMENT='Y'\n\t\t\t\t\t" . CIBlockElement::WF_GetSqlLimit("BE.", "N") . "\n\t\t\t\t\tAND BE.ID=";
     }
     $dbrIBlockElement = $DB->Query($strElementSql . $ID);
     if ($arIBlockElement = $dbrIBlockElement->Fetch()) {
         $IBLOCK_ID = $arIBlockElement["IBLOCK_ID"];
         $DETAIL_URL = "=ID=" . urlencode($arIBlockElement["ID"]) . "&EXTERNAL_ID=" . urlencode($arIBlockElement["EXTERNAL_ID"]) . "&IBLOCK_SECTION_ID=" . urlencode($arIBlockElement["IBLOCK_SECTION_ID"]) . "&IBLOCK_TYPE_ID=" . urlencode($arIBlockElement["IBLOCK_TYPE_ID"]) . "&IBLOCK_ID=" . urlencode($arIBlockElement["IBLOCK_ID"]) . "&IBLOCK_CODE=" . urlencode($arIBlockElement["IBLOCK_CODE"]) . "&IBLOCK_EXTERNAL_ID=" . urlencode($arIBlockElement["IBLOCK_EXTERNAL_ID"]) . "&CODE=" . urlencode($arIBlockElement["CODE"]);
         static $arGroups = array();
         if (!array_key_exists($IBLOCK_ID, $arGroups)) {
             $arGroups[$IBLOCK_ID] = array();
             $strSql = "SELECT GROUP_ID " . "FROM b_iblock_group " . "WHERE IBLOCK_ID= " . $IBLOCK_ID . " " . "\tAND PERMISSION>='R' " . "ORDER BY GROUP_ID";
             $dbrIBlockGroup = $DB->Query($strSql);
             while ($arIBlockGroup = $dbrIBlockGroup->Fetch()) {
                 $arGroups[$IBLOCK_ID][] = $arIBlockGroup["GROUP_ID"];
                 if ($arIBlockGroup["GROUP_ID"] == 2) {
                     break;
                 }
             }
         }
         static $arSITE = array();
         if (!array_key_exists($IBLOCK_ID, $arSITE)) {
             $arSITE[$IBLOCK_ID] = array();
             $strSql = "SELECT SITE_ID " . "FROM b_iblock_site " . "WHERE IBLOCK_ID= " . $IBLOCK_ID;
             $dbrIBlockSite = $DB->Query($strSql);
             while ($arIBlockSite = $dbrIBlockSite->Fetch()) {
                 $arSITE[$IBLOCK_ID][] = $arIBlockSite["SITE_ID"];
             }
         }
         $BODY = ($arIBlockElement["PREVIEW_TEXT_TYPE"] == "html" ? CSearch::KillTags($arIBlockElement["PREVIEW_TEXT"]) : $arIBlockElement["PREVIEW_TEXT"]) . "\r\n" . ($arIBlockElement["DETAIL_TEXT_TYPE"] == "html" ? CSearch::KillTags($arIBlockElement["DETAIL_TEXT"]) : $arIBlockElement["DETAIL_TEXT"]);
         static $arProperties = array();
         if (!array_key_exists($IBLOCK_ID, $arProperties)) {
             $arProperties[$IBLOCK_ID] = array();
             $rsProperties = CIBlockProperty::GetList(array("sort" => "asc", "id" => "asc"), array("IBLOCK_ID" => $IBLOCK_ID, "ACTIVE" => "Y", "SEARCHABLE" => "Y", "CHECK_PERMISSIONS" => "N"));
             while ($ar = $rsProperties->Fetch()) {
                 if (strlen($ar["USER_TYPE"]) > 0) {
                     $arUT = CIBlockProperty::GetUserType($ar["USER_TYPE"]);
                     if (array_key_exists("GetSearchContent", $arUT)) {
                         $ar["GetSearchContent"] = $arUT["GetSearchContent"];
                     } elseif (array_key_exists("GetPublicViewHTML", $arUT)) {
                         $ar["GetSearchContent"] = $arUT["GetPublicViewHTML"];
                     }
                 }
                 $arProperties[$IBLOCK_ID][$ar["ID"]] = $ar;
             }
         }
         //Read current property values from database
         $strProperties = "";
         if (count($arProperties[$IBLOCK_ID]) > 0) {
             if ($arIBlockElement["VERSION"] == 1) {
                 $rs = $DB->Query("\n\t\t\t\t\t\tselect *\n\t\t\t\t\t\tfrom b_iblock_element_property\n\t\t\t\t\t\twhere IBLOCK_ELEMENT_ID=" . $arIBlockElement["ID"] . "\n\t\t\t\t\t\tAND IBLOCK_PROPERTY_ID in (" . implode(", ", array_keys($arProperties[$IBLOCK_ID])) . ")\n\t\t\t\t\t");
                 while ($ar = $rs->Fetch()) {
                     $strProperties .= "\r\n";
                     $arProperty = $arProperties[$IBLOCK_ID][$ar["IBLOCK_PROPERTY_ID"]];
                     if ($arProperty["GetSearchContent"]) {
                         $strProperties .= CSearch::KillTags(call_user_func_array($arProperty["GetSearchContent"], array($arProperty, array("VALUE" => $ar["VALUE"]), array())));
                     } elseif ($arProperty["PROPERTY_TYPE"] == 'L') {
                         $arEnum = CIBlockPropertyEnum::GetByID($ar["VALUE"]);
                         if ($arEnum !== false) {
                             $strProperties .= $arEnum["VALUE"];
                         }
                     } elseif ($arProperty["PROPERTY_TYPE"] == 'F') {
                         $arFile = CIBlockElement::__GetFileContent($ar["VALUE"]);
                         if (is_array($arFile)) {
                             $strProperties .= $arFile["CONTENT"];
                             $arIBlockElement["TAGS"] .= "," . $arFile["PROPERTIES"][COption::GetOptionString("search", "page_tag_property")];
                         }
                     } else {
                         $strProperties .= $ar["VALUE"];
                     }
                 }
             } else {
                 $rs = $DB->Query("\n\t\t\t\t\t\tselect *\n\t\t\t\t\t\tfrom b_iblock_element_prop_m" . $IBLOCK_ID . "\n\t\t\t\t\t\twhere IBLOCK_ELEMENT_ID=" . $arIBlockElement["ID"] . "\n\t\t\t\t\t\tAND IBLOCK_PROPERTY_ID in (" . implode(", ", array_keys($arProperties[$IBLOCK_ID])) . ")\n\t\t\t\t\t");
                 while ($ar = $rs->Fetch()) {
                     $strProperties .= "\r\n";
                     $arProperty = $arProperties[$IBLOCK_ID][$ar["IBLOCK_PROPERTY_ID"]];
                     if ($arProperty["GetSearchContent"]) {
                         $strProperties .= CSearch::KillTags(call_user_func_array($arProperty["GetSearchContent"], array($arProperty, array("VALUE" => $ar["VALUE"]), array())));
                     } elseif ($arProperty["PROPERTY_TYPE"] == 'L') {
                         $arEnum = CIBlockPropertyEnum::GetByID($ar["VALUE"]);
                         if ($arEnum !== false) {
                             $strProperties .= $arEnum["VALUE"];
                         }
                     } elseif ($arProperty["PROPERTY_TYPE"] == 'F') {
                         $arFile = CIBlockElement::__GetFileContent($ar["VALUE"]);
                         if (is_array($arFile)) {
                             $strProperties .= $arFile["CONTENT"];
                             $arIBlockElement["TAGS"] .= "," . $arFile["PROPERTIES"][COption::GetOptionString("search", "page_tag_property")];
                         }
                     } else {
                         $strProperties .= $ar["VALUE"];
                     }
                 }
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:iblockelement.php

示例4: ReindexIBlock

 function ReindexIBlock($iblock_id, $entity_type, $feature, $operation, $path_template, $arFieldList, $last_id)
 {
     global $DB;
     if (!CModule::IncludeModule("iblock")) {
         return false;
     }
     $arSections = array();
     $rsElements = CIBlockElement::GetList(array("ID" => "asc"), array("IBLOCK_ID" => $iblock_id, ">ID" => intval($last_id), "CHECK_PERMISSIONS" => "N"), false, false, array_merge(array("ID", "IBLOCK_ID", "IBLOCK_TYPE_ID", "NAME", "TAGS", "TIMESTAMP_X", "IBLOCK_SECTION_ID"), $arFieldList));
     while ($arFields = $rsElements->Fetch()) {
         if (!array_key_exists($arFields["IBLOCK_SECTION_ID"], $arSections)) {
             $rsPath = CIBlockSection::GetNavChain($arFields["IBLOCK_ID"], $arFields["IBLOCK_SECTION_ID"]);
             $arSection = $rsPath->Fetch();
             if ($entity_type == "G") {
                 $arSections[$arFields["IBLOCK_SECTION_ID"]] = intval($arSection["SOCNET_GROUP_ID"]);
             } else {
                 $arSections[$arFields["IBLOCK_SECTION_ID"]] = intval($arSection["CREATED_BY"]);
             }
         }
         $entity_id = $arSections[$arFields["IBLOCK_SECTION_ID"]];
         if ($entity_id) {
             $url = str_replace(array("#user_id#", "#group_id#", "#user_alias#", "#section_id#", "#element_id#", "#task_id#", "#name#"), array($entity_id, $entity_id, ($entity_type == "G" ? "group_" : "user_") . $entity_id, $arFields["IBLOCK_SECTION_ID"], $arFields["ID"], $arFields["ID"], urlencode($arFields["NAME"])), $path_template);
             $body = "";
             if ($feature == "wiki") {
                 $CWikiParser = new CWikiParser();
             }
             foreach ($arFieldList as $field) {
                 $text = "";
                 if ($field == "PREVIEW_TEXT" || $field == "DETAIL_TEXT") {
                     if (isset($CWikiParser)) {
                         $text = HTMLToTxt($CWikiParser->parseForSearch($arFields[$field]));
                     } elseif (isset($arFields[$field . "_TYPE"]) && $arFields[$field . "_TYPE"] === "html") {
                         $text = HTMLToTxt($arFields[$field]);
                     } else {
                         $text = $arFields[$field];
                     }
                 } elseif ($field == $this->_file_property) {
                     $arFile = CIBlockElement::__GetFileContent($arFields[$this->_file_property . "_VALUE"]);
                     if (is_array($arFile)) {
                         $text = $arFile["CONTENT"];
                         $arFields["TAGS"] .= "," . $arFile["PROPERTIES"][COption::GetOptionString("search", "page_tag_property")];
                     }
                 } elseif ($field == "PROPERTY_FORUM_TOPIC_ID") {
                     $topic_id = intval($arFields["PROPERTY_FORUM_TOPIC_ID_VALUE"]);
                     if ($topic_id) {
                         $this->UpdateForumTopicIndex($topic_id, $entity_type, $entity_id, $feature, $operation, $this->Url($url, array("MID" => "#message_id#"), "message#message_id#"));
                     }
                 }
                 $body .= $text . "\n\r";
             }
             if (isset($CWikiParser)) {
                 $title = preg_replace('/^category:/i' . BX_UTF_PCRE_MODIFIER, GetMessage('CATEGORY_NAME') . ':', $arFields['NAME']);
             } else {
                 $title = $arFields["NAME"];
             }
             $arPermissions = $this->GetSearchGroups($entity_type, $entity_id, $feature, $operation);
             if (CIBlock::GetArrayByID($arFields["IBLOCK_ID"], "RIGHTS_MODE") == "E") {
                 $obElementRights = new CIBlockElementRights($arFields["IBLOCK_ID"], $arFields["ID"]);
                 $arPermissions = $obElementRights->GetGroups(array("element_read"));
             }
             CSearch::Index("socialnetwork", $arFields["ID"], array("LAST_MODIFIED" => $arFields["TIMESTAMP_X"], "TITLE" => $title, "BODY" => $body, "SITE_ID" => array(SITE_ID => $url), "PARAM1" => $arFields["IBLOCK_TYPE_ID"], "PARAM2" => $arFields["IBLOCK_ID"], "PARAM3" => $entity_id, "TAGS" => $arFields["TAGS"], "PERMISSIONS" => $arPermissions, "PARAMS" => $this->GetSearchParams($entity_type, $entity_id, $feature, $operation), "REINDEX_FLAG" => true), true, $this->_sess_id);
             $this->_counter++;
         }
         if ($this->_end_time && $this->_end_time <= time()) {
             return $arFields["ID"];
         }
     }
     return false;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:68,代码来源:search_reindex.php


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