當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CIBlockElement::_check_rights_sql方法代碼示例

本文整理匯總了PHP中CIBlockElement::_check_rights_sql方法的典型用法代碼示例。如果您正苦於以下問題:PHP CIBlockElement::_check_rights_sql方法的具體用法?PHP CIBlockElement::_check_rights_sql怎麽用?PHP CIBlockElement::_check_rights_sql使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CIBlockElement的用法示例。


在下文中一共展示了CIBlockElement::_check_rights_sql方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: MkFilter

 function MkFilter($arFilter, &$arJoinProps, &$arAddWhereFields, $level = 0, $bPropertyLeftJoin = false)
 {
     global $DB, $USER;
     $arSqlSearch = array();
     $permSQL = "";
     $arSectionFilter = array("LOGIC" => "", "BE" => array(), "BS" => array());
     $strSqlSearch = "";
     if (!is_array($arFilter)) {
         $arFilter = array();
     }
     foreach ($arFilter as $key => $val) {
         $key = strtoupper($key);
         $p = strpos($key, "PROPERTY_");
         if ($p !== false && $p < 4) {
             $arFilter[substr($key, 0, $p) . "PROPERTY"][substr($key, $p + 9)] = $val;
             unset($arFilter[$key]);
         }
     }
     if (array_key_exists("LOGIC", $arFilter) && $arFilter["LOGIC"] == "OR") {
         $Logic = "OR";
         unset($arFilter["LOGIC"]);
         $bPropertyLeftJoin = true;
     } else {
         $Logic = "AND";
     }
     if ($Logic === "AND" && $level === 0) {
         $f = new \Bitrix\Iblock\PropertyIndex\QueryBuilder($arFilter["IBLOCK_ID"]);
         if ($f->isValid()) {
             $arJoinProps["FC"] = $f->getFilterSql($arFilter, $arSqlSearch);
             $arJoinProps["FC_DISTINCT"] = $f->getDistinct();
         }
     }
     foreach ($arFilter as $orig_key => $val) {
         $res = CIBlock::MkOperationFilter($orig_key);
         $key = $res["FIELD"];
         $cOperationType = $res["OPERATION"];
         //it was done before $key = strtoupper($key);
         switch ($key . "") {
             case "ACTIVE":
             case "DETAIL_TEXT_TYPE":
             case "PREVIEW_TEXT_TYPE":
                 $arSqlSearch[] = CIBlock::FilterCreateEx("BE." . $key, $val, "string_equal", $bFullJoinTmp, $cOperationType);
                 break;
             case "NAME":
             case "XML_ID":
             case "TMP_ID":
             case "DETAIL_TEXT":
             case "SEARCHABLE_CONTENT":
             case "PREVIEW_TEXT":
             case "CODE":
             case "TAGS":
             case "WF_COMMENTS":
                 $arSqlSearch[] = CIBlock::FilterCreateEx("BE." . $key, $val, "string", $bFullJoinTmp, $cOperationType);
                 break;
             case "ID":
                 if (is_object($val)) {
                     $arSqlSearch[] = $val->_sql_in("BE." . $key, $cOperationType);
                 } else {
                     $arSqlSearch[] = CIBlock::FilterCreateEx("BE." . $key, $val, "number", $bFullJoinTmp, $cOperationType);
                 }
                 break;
             case "SHOW_COUNTER":
             case "WF_PARENT_ELEMENT_ID":
             case "WF_STATUS_ID":
             case "SORT":
             case "CREATED_BY":
             case "PREVIEW_PICTURE":
             case "DETAIL_PICTURE":
                 $arSqlSearch[] = CIBlock::FilterCreateEx("BE." . $key, $val, "number", $bFullJoinTmp, $cOperationType);
                 break;
             case "IBLOCK_ID":
                 $arSqlSearch[] = CIBlock::FilterCreateEx("BE." . $key, $val, "number", $bFullJoinTmp, $cOperationType);
                 break;
             case "TIMESTAMP_X":
             case "DATE_CREATE":
             case "SHOW_COUNTER_START":
                 $arSqlSearch[] = CIBlock::FilterCreateEx("BE." . $key, $val, "date", $bFullJoinTmp, $cOperationType);
                 break;
             case "EXTERNAL_ID":
                 $arSqlSearch[] = CIBlock::FilterCreateEx("BE.XML_ID", $val, "string", $bFullJoinTmp, $cOperationType);
                 break;
             case "IBLOCK_TYPE":
                 $flt = CIBlock::FilterCreateEx("B.IBLOCK_TYPE_ID", $val, "string", $bFullJoinTmp, $cOperationType);
                 $arSqlSearch[] = $flt;
                 break;
             case "CHECK_PERMISSIONS":
                 if ($val == "Y" && (!is_object($USER) || !$USER->IsAdmin())) {
                     $permSQL = CIBlockElement::_check_rights_sql($arFilter["MIN_PERMISSION"]);
                 }
                 break;
             case "CHECK_BP_PERMISSIONS":
                 if (IsModuleInstalled('bizproc') && (!is_object($USER) || !$USER->IsAdmin())) {
                     if (is_array($val)) {
                         $MODULE_ID = $DB->ForSQL($val["MODULE_ID"]);
                         $ENTITY = $DB->ForSQL($val["ENTITY"]);
                         $PERMISSION = $DB->ForSQL($val["PERMISSION"]);
                         $arUserGroups = array();
                         if (is_array($val["GROUPS"])) {
                             $USER_ID = intval($val["USER_ID"]);
                             foreach ($val["GROUPS"] as $GROUP_ID) {
//.........這裏部分代碼省略.........
開發者ID:DarneoStudio,項目名稱:bitrix,代碼行數:101,代碼來源:iblockelement.php


注:本文中的CIBlockElement::_check_rights_sql方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。