本文整理汇总了PHP中CIBlockSectionRights::GetGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockSectionRights::GetGroups方法的具体用法?PHP CIBlockSectionRights::GetGroups怎么用?PHP CIBlockSectionRights::GetGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockSectionRights
的用法示例。
在下文中一共展示了CIBlockSectionRights::GetGroups方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UpdateSearch
function UpdateSearch($ID, $bOverWrite = false)
{
if (!CModule::IncludeModule("search")) {
return;
}
global $DB;
$ID = Intval($ID);
static $arGroups = array();
static $arSITE = array();
$strSql = "\n\t\t\tSELECT BS.ID, BS.NAME, BS.DESCRIPTION_TYPE, BS.DESCRIPTION, BS.XML_ID as EXTERNAL_ID,\n\t\t\t\tBS.CODE, BS.IBLOCK_ID, B.IBLOCK_TYPE_ID,\n\t\t\t\t" . $DB->DateToCharFunction("BS.TIMESTAMP_X") . " as LAST_MODIFIED,\n\t\t\t\tB.CODE as IBLOCK_CODE, B.XML_ID as IBLOCK_EXTERNAL_ID, B.SECTION_PAGE_URL,\n\t\t\t\tB.ACTIVE as ACTIVE1,\n\t\t\t\tBS.GLOBAL_ACTIVE as ACTIVE2,\n\t\t\t\tB.INDEX_SECTION, B.RIGHTS_MODE\n\t\t\tFROM b_iblock_section BS, b_iblock B\n\t\t\tWHERE BS.IBLOCK_ID=B.ID\n\t\t\t\tAND BS.ID=" . $ID;
$dbrIBlockSection = $DB->Query($strSql);
if ($arIBlockSection = $dbrIBlockSection->Fetch()) {
$IBLOCK_ID = $arIBlockSection["IBLOCK_ID"];
$SECTION_URL = "=ID=" . $arIBlockSection["ID"] . "&EXTERNAL_ID=" . $arIBlockSection["EXTERNAL_ID"] . "&IBLOCK_TYPE_ID=" . $arIBlockSection["IBLOCK_TYPE_ID"] . "&IBLOCK_ID=" . $arIBlockSection["IBLOCK_ID"] . "&IBLOCK_CODE=" . $arIBlockSection["IBLOCK_CODE"] . "&IBLOCK_EXTERNAL_ID=" . $arIBlockSection["IBLOCK_EXTERNAL_ID"] . "&CODE=" . $arIBlockSection["CODE"];
if ($arIBlockSection["ACTIVE1"] != "Y" || $arIBlockSection["ACTIVE2"] != "Y" || $arIBlockSection["INDEX_SECTION"] != "Y") {
CSearch::DeleteIndex("iblock", "S" . $arIBlockSection["ID"]);
return;
}
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;
}
}
}
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 = $arIBlockSection["DESCRIPTION_TYPE"] == "html" ? CSearch::KillTags($arIBlockSection["DESCRIPTION"]) : $arIBlockSection["DESCRIPTION"];
$BODY .= $GLOBALS["USER_FIELD_MANAGER"]->OnSearchIndex("IBLOCK_" . $arIBlockSection["IBLOCK_ID"] . "_SECTION", $arIBlockSection["ID"]);
if ($arIBlockSection["RIGHTS_MODE"] !== "E") {
$arPermissions = $arGroups[$IBLOCK_ID];
} else {
$obSectionRights = new CIBlockSectionRights($IBLOCK_ID, $arIBlockSection["ID"]);
$arPermissions = $obSectionRights->GetGroups(array("section_read"));
}
CSearch::Index("iblock", "S" . $ID, array("LAST_MODIFIED" => $arIBlockSection["LAST_MODIFIED"], "TITLE" => $arIBlockSection["NAME"], "PARAM1" => $arIBlockSection["IBLOCK_TYPE_ID"], "PARAM2" => $IBLOCK_ID, "SITE_ID" => $arSITE[$IBLOCK_ID], "PERMISSIONS" => $arPermissions, "URL" => $SECTION_URL, "BODY" => $BODY), $bOverWrite);
}
}
示例2: IndexIBlockSection
function IndexIBlockSection($arFields, $entity_id, $entity_type, $feature, $operation, $path_template)
{
$rSection = CIBlockSection::GetByID($arFields['ID']);
$arSection = $rSection->Fetch();
$path = array();
$rsPath = CIBlockSection::GetNavChain($arFields["IBLOCK_ID"], $arFields['ID']);
while ($arPath = $rsPath->Fetch()) {
$path[] = $arPath['NAME'];
}
$path = implode("/", array_slice($path, 1));
$ID = intval($arFields["ID"]);
$IBLOCK_ID = intval($arFields["IBLOCK_ID"]);
$arItem = array();
if ($entity_type == "G") {
$url = str_replace(array("#group_id#", "#user_alias#", "#section_id#", "#element_id#", "#action#", "#task_id#", "#name#", "#path#"), array($entity_id, "group_" . $entity_id, $arFields["IBLOCK_SECTION"], $arFields["ID"], "view", $arFields["ID"], urlencode($arFields["NAME"]), $path), $path_template);
} else {
$url = str_replace(array("#user_id#", "#user_alias#", "#section_id#", "#element_id#", "#action#", "#task_id#", "#path#"), array($entity_id, "user_" . $entity_id, $arFields["IBLOCK_SECTION"], $arFields["ID"], "view", $arFields["ID"], $path), $path_template);
}
$body = "";
$title = $arFields["NAME"];
$arPermissions = $this->GetSearchGroups($entity_type, $entity_id, $feature, $operation);
if (CIBlock::GetArrayByID($IBLOCK_ID, "RIGHTS_MODE") == "E") {
$obSectionRights = new CIBlockSectionRights($IBLOCK_ID, $arFields["ID"]);
$arPermissions = $obSectionRights->GetGroups(array("section_read"));
}
$arSearchIndexParams = $this->GetSearchParams($entity_type, $entity_id, $feature, $operation);
CSearch::Index("socialnetwork", 'S' . $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" => "", "PERMISSIONS" => $arPermissions, "PARAMS" => $arSearchIndexParams), true);
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_search_" . $entity_type . "_" . $entity_id);
}
}
示例3: 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) {
//.........这里部分代码省略.........