CBlogUser::GetList: Bitrix method

      
<?php 
//  CBlogUser :: GetList()
//  /dist/bitrix/modules/blog/mysql/blog_user.php:246

    
public static function GetList($arOrder = Array("ID" => "DESC"), $arFilter = Array(), $arGroupBy false$arNavStartParams false$arSelectFields = array())
    {
        global 
$DB;

        if (
count($arSelectFields) <= 0)
            
$arSelectFields = array("ID""USER_ID""ALIAS""DESCRIPTION""AVATAR""INTERESTS""LAST_VISIT""DATE_REG""ALLOW_POST");

        
// FIELDS -->
        
$arFields = array(
            
"ID" => array("FIELD" => "B.ID""TYPE" => "int"),
            
"USER_ID" => array("FIELD" => "B.USER_ID""TYPE" => "int"),
            
"ALIAS" => array("FIELD" => "B.ALIAS""TYPE" => "string"),
            
"DESCRIPTION" => array("FIELD" => "B.DESCRIPTION""TYPE" => "string"),
            
"AVATAR" => array("FIELD" => "B.AVATAR""TYPE" => "int"),
            
"INTERESTS" => array("FIELD" => "B.INTERESTS""TYPE" => "string"),
            
"LAST_VISIT" => array("FIELD" => "B.LAST_VISIT""TYPE" => "datetime"),
            
"DATE_REG" => array("FIELD" => "B.DATE_REG""TYPE" => "datetime"),
            
"ALLOW_POST" => array("FIELD" => "B.ALLOW_POST""TYPE" => "char"),

            
"USER_LOGIN" => array("FIELD" => "U.LOGIN""TYPE" => "string""FROM" => "INNER JOIN b_user U ON (B.USER_ID = U.ID)"),
            
"USER_NAME" => array("FIELD" => "U.NAME""TYPE" => "string""FROM" => "INNER JOIN b_user U ON (B.USER_ID = U.ID)"),
            
"USER_LAST_NAME" => array("FIELD" => "U.LAST_NAME""TYPE" => "string""FROM" => "INNER JOIN b_user U ON (B.USER_ID = U.ID)"),
            
"USER_SECOND_NAME" => array("FIELD" => "U.SECOND_NAME""TYPE" => "string""FROM" => "INNER JOIN b_user U ON (B.USER_ID = U.ID)"),
            
"USER_EMAIL" => array("FIELD" => "U.EMAIL""TYPE" => "string""FROM" => "INNER JOIN b_user U ON (B.USER_ID = U.ID)"),
            
"USER" => array("FIELD" => "U.LOGIN,U.NAME,U.LAST_NAME,U.SECOND_NAME,U.EMAIL,U.ID""WHERE_ONLY" => "Y""TYPE" => "string""FROM" => "INNER JOIN b_user U ON (B.USER_ID = U.ID)"),

            
"GROUP_GROUP_ID" => array("FIELD" => "U2UG.USER_GROUP_ID""TYPE" => "int""FROM" => "INNER JOIN b_blog_user2user_group U2UG ON (B.USER_ID = U2UG.USER_ID)"),
            
"GROUP_BLOG_ID" => array("FIELD" => "U2UG.BLOG_ID""TYPE" => "int""FROM" => "INNER JOIN b_blog_user2user_group U2UG ON (B.USER_ID = U2UG.USER_ID)"),
        );
        
// <-- FIELDS

        
$arSqls CBlog::PrepareSql($arFields$arOrder$arFilter$arGroupBy$arSelectFields);

        
$arSqls["SELECT"] = str_replace("%%_DISTINCT_%%"""$arSqls["SELECT"]);

        if (
is_array($arGroupBy) && count($arGroupBy)==0)
        {
            
$strSql =
                
"SELECT ".$arSqls["SELECT"]." ".
                
"FROM b_blog_user B ".
                
"    ".$arSqls["FROM"]." ";
            if (
strlen($arSqls["WHERE"]) > 0)
                
$strSql .= "WHERE ".$arSqls["WHERE"]." ";
            if (
strlen($arSqls["GROUPBY"]) > 0)
                
$strSql .= "GROUP BY ".$arSqls["GROUPBY"]." ";

            
//echo "!1!=".htmlspecialcharsbx($strSql)."<br>";

            
$dbRes $DB->Query($strSqlfalse"File: ".__FILE__."<br>Line: ".__LINE__);
            if (
$arRes $dbRes->Fetch())
                return 
$arRes["CNT"];
            else
                return 
False;
        }

        
$strSql =
            
"SELECT ".$arSqls["SELECT"]." ".
            
"FROM b_blog_user B ".
            
"    ".$arSqls["FROM"]." ";
        if (
strlen($arSqls["WHERE"]) > 0)
            
$strSql .= "WHERE ".$arSqls["WHERE"]." ";
        if (
strlen($arSqls["GROUPBY"]) > 0)
            
$strSql .= "GROUP BY ".$arSqls["GROUPBY"]." ";
        if (
strlen($arSqls["ORDERBY"]) > 0)
            
$strSql .= "ORDER BY ".$arSqls["ORDERBY"]." ";

        if (
is_array($arNavStartParams) && IntVal($arNavStartParams["nTopCount"])<=0)
        {
            
$strSql_tmp =
                
"SELECT COUNT('x') as CNT ".
                
"FROM b_blog_user B ".
                
"    ".$arSqls["FROM"]." ";
            if (
strlen($arSqls["WHERE"]) > 0)
                
$strSql_tmp .= "WHERE ".$arSqls["WHERE"]." ";
            if (
strlen($arSqls["GROUPBY"]) > 0)
                
$strSql_tmp .= "GROUP BY ".$arSqls["GROUPBY"]." ";

            
//echo "!2.1!=".htmlspecialcharsbx($strSql_tmp)."<br>";

            
$dbRes $DB->Query($strSql_tmpfalse"File: ".__FILE__."<br>Line: ".__LINE__);
            
$cnt 0;
            if (
strlen($arSqls["GROUPBY"]) <= 0)
            {
                if (
$arRes $dbRes->Fetch())
                    
$cnt $arRes["CNT"];
            }
            else
            {
                
$cnt $dbRes->SelectedRowsCount();
            }

            
$dbRes = new CDBResult();

            
//echo "!2.2!=".htmlspecialcharsbx($strSql)."<br>";

            
$dbRes->NavQuery($strSql$cnt$arNavStartParams);
        }
        else
        {
            if (
is_array($arNavStartParams) && IntVal($arNavStartParams["nTopCount"]) > 0)
                
$strSql .= "LIMIT ".IntVal($arNavStartParams["nTopCount"]);

            
//echo "!3!=".htmlspecialcharsbx($strSql)."<br>";

            
$dbRes $DB->Query($strSqlfalse"File: ".__FILE__."<br>Line: ".__LINE__);
        }

        return 
$dbRes;
    }