本文整理汇总了PHP中CIBlockElementRights::GetGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockElementRights::GetGroups方法的具体用法?PHP CIBlockElementRights::GetGroups怎么用?PHP CIBlockElementRights::GetGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockElementRights
的用法示例。
在下文中一共展示了CIBlockElementRights::GetGroups方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: IndexIBlockElement
function IndexIBlockElement($arFields, $entity_id, $entity_type, $feature, $operation, $path_template, $arFieldList)
{
$ID = intval($arFields["ID"]);
$IBLOCK_ID = intval($arFields["IBLOCK_ID"]);
$IBLOCK_SECTION_ID = is_array($arFields["IBLOCK_SECTION"]) ? $arFields["IBLOCK_SECTION"][0] : $arFields["IBLOCK_SECTION"];
$arItem = array();
if ($entity_type == "G") {
$url = str_replace(array("#group_id#", "#user_alias#", "#section_id#", "#element_id#", "#action#", "#task_id#", "#name#"), array($entity_id, "group_" . $entity_id, $IBLOCK_SECTION_ID, $arFields["ID"], "view", $arFields["ID"], urlencode($arFields["NAME"])), $path_template);
} else {
$url = str_replace(array("#user_id#", "#user_alias#", "#section_id#", "#element_id#", "#action#", "#task_id#"), array($entity_id, "user_" . $entity_id, $IBLOCK_SECTION_ID, $arFields["ID"], "view", $arFields["ID"]), $path_template);
}
$body = "";
if ($feature == "wiki") {
$CWikiParser = new CWikiParser();
}
foreach ($arFieldList as $field) {
if ($field == "PREVIEW_TEXT" || $field == "DETAIL_TEXT") {
if (isset($CWikiParser)) {
$arFields[$field] = HTMLToTxt($CWikiParser->parseForSearch($arFields[$field]));
} elseif (isset($arFields[$field . "_TYPE"]) && $arFields[$field . "_TYPE"] === "html") {
$arFields[$field] = HTMLToTxt($arFields[$field]);
}
}
$body .= $arFields[$field] . "\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($IBLOCK_ID, "RIGHTS_MODE") == "E") {
$obElementRights = new CIBlockElementRights($IBLOCK_ID, $arFields["ID"]);
$arPermissions = $obElementRights->GetGroups(array("element_read"));
}
$arSearchIndexParams = $this->GetSearchParams($entity_type, $entity_id, $feature, $operation);
CSearch::Index("socialnetwork", $ID, array("LAST_MODIFIED" => ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL"), "TITLE" => $title, "BODY" => $body, "SITE_ID" => array(SITE_ID => $url), "PARAM1" => CIBlock::GetArrayByID($IBLOCK_ID, "IBLOCK_TYPE_ID"), "PARAM2" => $IBLOCK_ID, "PARAM3" => $feature, "TAGS" => $arFields["TAGS"], "PERMISSIONS" => $arPermissions, "PARAMS" => $arSearchIndexParams), true);
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_search_" . $entity_type . "_" . $entity_id);
}
}
示例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) {
//.........这里部分代码省略.........
示例3: UpdateSearch
//.........这里部分代码省略.........
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"];
}
}
$rs = $DB->Query("\n\t\t\t\t\t\tselect *\n\t\t\t\t\t\tfrom b_iblock_element_prop_s" . $IBLOCK_ID . "\n\t\t\t\t\t\twhere IBLOCK_ELEMENT_ID=" . $arIBlockElement["ID"] . "\n\t\t\t\t\t");
if ($ar = $rs->Fetch()) {
foreach ($arProperties[$IBLOCK_ID] as $property_id => $property) {
if (array_key_exists("PROPERTY_" . $property_id, $ar) && $property["MULTIPLE"] == "N" && strlen($ar["PROPERTY_" . $property_id]) > 0) {
$strProperties .= "\r\n";
if ($property["GetSearchContent"]) {
$strProperties .= CSearch::KillTags(call_user_func_array($property["GetSearchContent"], array($property, array("VALUE" => $ar["PROPERTY_" . $property_id]), array())));
} elseif ($property["PROPERTY_TYPE"] == 'L') {
$arEnum = CIBlockPropertyEnum::GetByID($ar["PROPERTY_" . $property_id]);
if ($arEnum !== false) {
$strProperties .= $arEnum["VALUE"];
}
} elseif ($property["PROPERTY_TYPE"] == 'F') {
$arFile = CIBlockElement::__GetFileContent($ar["PROPERTY_" . $property_id]);
if (is_array($arFile)) {
$strProperties .= $arFile["CONTENT"];
$arIBlockElement["TAGS"] .= "," . $arFile["PROPERTIES"][COption::GetOptionString("search", "page_tag_property")];
}
} else {
$strProperties .= $ar["PROPERTY_" . $property_id];
}
}
}
}
}
}
$BODY .= $strProperties;
if ($arIBlockElement["RIGHTS_MODE"] !== "E") {
$arPermissions = $arGroups[$IBLOCK_ID];
} else {
$obElementRights = new CIBlockElementRights($IBLOCK_ID, $arIBlockElement["ID"]);
$arPermissions = $obElementRights->GetGroups(array("element_read"));
}
$arFields = array("LAST_MODIFIED" => strlen($arIBlockElement["DATE_FROM"]) > 0 ? $arIBlockElement["DATE_FROM"] : $arIBlockElement["LAST_MODIFIED"], "DATE_FROM" => strlen($arIBlockElement["DATE_FROM"]) > 0 ? $arIBlockElement["DATE_FROM"] : false, "DATE_TO" => strlen($arIBlockElement["DATE_TO"]) > 0 ? $arIBlockElement["DATE_TO"] : false, "TITLE" => $arIBlockElement["NAME"], "PARAM1" => $arIBlockElement["IBLOCK_TYPE_ID"], "PARAM2" => $IBLOCK_ID, "SITE_ID" => $arSITE[$IBLOCK_ID], "PERMISSIONS" => $arPermissions, "URL" => $DETAIL_URL, "BODY" => $BODY, "TAGS" => $arIBlockElement["TAGS"]);
if ($arIBlockElement["SOCNET_GROUP_ID"] > 0) {
$arFields["PARAMS"] = array("socnet_group" => $arIBlockElement["SOCNET_GROUP_ID"]);
}
CSearch::Index("iblock", $ID, $arFields, $bOverWrite);
} else {
CSearch::DeleteIndex("iblock", $ID);
}
}
示例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;
}