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


PHP CSocNetGroup::PrepareSql方法代码示例

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


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

示例1: GetList

 function GetList($arOrder = array(), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
 {
     if (func_num_args() <= 2) {
         $arSelectFields = $arFilter;
         $arFilter = $arOrder;
         $arOrder = array();
     }
     global $DB;
     if (count($arSelectFields) <= 0) {
         $arSelectFields = array("USER_ID", "SITE_ID", "GROUP_CODE", "PAGE_SIZE", "PAGE_NUM", "PAGE_LAST_DATE");
     }
     // FIELDS -->
     $arFields = array("USER_ID" => array("FIELD" => "SLP.USER_ID", "TYPE" => "int"), "SITE_ID" => array("FIELD" => "SLP.SITE_ID", "TYPE" => "string"), "GROUP_CODE" => array("FIELD" => "SLP.GROUP_CODE", "TYPE" => "string"), "PAGE_SIZE" => array("FIELD" => "SLP.PAGE_SIZE", "TYPE" => "int"), "PAGE_NUM" => array("FIELD" => "SLP.PAGE_NUM", "TYPE" => "int"), "PAGE_LAST_DATE" => array("FIELD" => "SLP.PAGE_LAST_DATE", "TYPE" => "datetime"));
     // <-- FIELDS
     $arSqls = CSocNetGroup::PrepareSql($arFields, $arOrder, $arFilter, false, $arSelectFields);
     $arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSqls["SELECT"]);
     $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_sonet_log_page SLP " . "\t" . $arSqls["FROM"] . " ";
     if (strlen($arSqls["WHERE"]) > 0) {
         $strSql .= "WHERE " . $arSqls["WHERE"] . " ";
     }
     if (strlen($arSqls["ORDERBY"]) > 0) {
         $strSql .= "ORDER BY " . $arSqls["ORDERBY"] . " ";
     }
     $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     return $dbRes;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:26,代码来源:log_pages.php

示例2: GetList

 function GetList($arOrder = array(), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
 {
     global $DB;
     if (count($arSelectFields) <= 0) {
         $arSelectFields = array("USER_ID", "TYPE");
     }
     // FIELDS -->
     $arFields = array("USER_ID" => array("FIELD" => "SLSF.USER_ID", "TYPE" => "int"), "TYPE" => array("FIELD" => "SLSF.TYPE", "TYPE" => "char"));
     // <-- FIELDS
     $arSqls = CSocNetGroup::PrepareSql($arFields, $arOrder, $arFilter, false, $arSelectFields);
     $arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSqls["SELECT"]);
     $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_sonet_log_smartfilter SLSF " . "\t" . $arSqls["FROM"] . " ";
     if (strlen($arSqls["WHERE"]) > 0) {
         $strSql .= "WHERE " . $arSqls["WHERE"] . " ";
     }
     if (strlen($arSqls["ORDERBY"]) > 0) {
         $strSql .= "ORDER BY " . $arSqls["ORDERBY"] . " ";
     }
     $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     return $dbRes;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:21,代码来源:log_smartfilter.php

示例3: GetList

 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", "GROUP_ID", "ROLE", "DATE_CREATE", "DATE_UPDATE", "INITIATED_BY_TYPE", "INITIATED_BY_USER_ID", "MESSAGE");
     }
     $online_interval = array_key_exists("ONLINE_INTERVAL", $arFilter) && intval($arFilter["ONLINE_INTERVAL"]) > 0 ? $arFilter["ONLINE_INTERVAL"] : 120;
     static $arFields1 = array("ID" => array("FIELD" => "UG.ID", "TYPE" => "int"), "USER_ID" => array("FIELD" => "UG.USER_ID", "TYPE" => "int"), "GROUP_ID" => array("FIELD" => "UG.GROUP_ID", "TYPE" => "int"), "ROLE" => array("FIELD" => "UG.ROLE", "TYPE" => "string"), "DATE_CREATE" => array("FIELD" => "UG.DATE_CREATE", "TYPE" => "datetime"), "DATE_UPDATE" => array("FIELD" => "UG.DATE_UPDATE", "TYPE" => "datetime"), "INITIATED_BY_TYPE" => array("FIELD" => "UG.INITIATED_BY_TYPE", "TYPE" => "string"), "INITIATED_BY_USER_ID" => array("FIELD" => "UG.INITIATED_BY_USER_ID", "TYPE" => "int"), "MESSAGE" => array("FIELD" => "UG.MESSAGE", "TYPE" => "string"), "GROUP_NAME" => array("FIELD" => "G.NAME", "TYPE" => "string", "FROM" => "INNER JOIN b_sonet_group G ON (UG.GROUP_ID = G.ID)"), "GROUP_DESCRIPTION" => array("FIELD" => "G.DESCRIPTION", "TYPE" => "string", "FROM" => "INNER JOIN b_sonet_group G ON (UG.GROUP_ID = G.ID)"), "GROUP_ACTIVE" => array("FIELD" => "G.ACTIVE", "TYPE" => "string", "FROM" => "INNER JOIN b_sonet_group G ON (UG.GROUP_ID = G.ID)"), "GROUP_IMAGE_ID" => array("FIELD" => "G.IMAGE_ID", "TYPE" => "int", "FROM" => "INNER JOIN b_sonet_group G ON (UG.GROUP_ID = G.ID)"), "GROUP_VISIBLE" => array("FIELD" => "G.VISIBLE", "TYPE" => "string", "FROM" => "INNER JOIN b_sonet_group G ON (UG.GROUP_ID = G.ID)"), "GROUP_OWNER_ID" => array("FIELD" => "G.OWNER_ID", "TYPE" => "int", "FROM" => "INNER JOIN b_sonet_group G ON (UG.GROUP_ID = G.ID)"), "GROUP_INITIATE_PERMS" => array("FIELD" => "G.INITIATE_PERMS", "TYPE" => "string", "FROM" => "INNER JOIN b_sonet_group G ON (UG.GROUP_ID = G.ID)"), "GROUP_OPENED" => array("FIELD" => "G.OPENED", "TYPE" => "string", "FROM" => "INNER JOIN b_sonet_group G ON (UG.GROUP_ID = G.ID)"), "GROUP_NUMBER_OF_MEMBERS" => array("FIELD" => "G.NUMBER_OF_MEMBERS", "TYPE" => "string", "FROM" => "INNER JOIN b_sonet_group G ON (UG.GROUP_ID = G.ID)"), "GROUP_DATE_ACTIVITY" => array("FIELD" => "G.DATE_ACTIVITY", "TYPE" => "datetime", "FROM" => "INNER JOIN b_sonet_group G ON (UG.GROUP_ID = G.ID)"), "GROUP_CLOSED" => array("FIELD" => "G.CLOSED", "TYPE" => "string", "FROM" => "INNER JOIN b_sonet_group G ON (UG.GROUP_ID = G.ID)"), "USER_ACTIVE" => array("FIELD" => "U.ACTIVE", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (UG.USER_ID = U.ID)"), "USER_NAME" => array("FIELD" => "U.NAME", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (UG.USER_ID = U.ID)"), "USER_LAST_NAME" => array("FIELD" => "U.LAST_NAME", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (UG.USER_ID = U.ID)"), "USER_SECOND_NAME" => array("FIELD" => "U.SECOND_NAME", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (UG.USER_ID = U.ID)"), "USER_WORK_POSITION" => array("FIELD" => "U.WORK_POSITION", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (UG.USER_ID = U.ID)"), "USER_LOGIN" => array("FIELD" => "U.LOGIN", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (UG.USER_ID = U.ID)"), "USER_EMAIL" => array("FIELD" => "U.EMAIL", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (UG.USER_ID = U.ID)"), "USER_CONFIRM_CODE" => array("FIELD" => "U.CONFIRM_CODE", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (UG.USER_ID = U.ID)"), "USER_PERSONAL_PHOTO" => array("FIELD" => "U.PERSONAL_PHOTO", "TYPE" => "int", "FROM" => "INNER JOIN b_user U ON (UG.USER_ID = U.ID)"), "USER_PERSONAL_GENDER" => array("FIELD" => "U.PERSONAL_GENDER", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (UG.USER_ID = U.ID)"), "USER_LID" => array("FIELD" => "U.LID", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (UG.USER_ID = U.ID)"), "INITIATED_BY_USER_NAME" => array("FIELD" => "U1.NAME", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U1 ON (UG.INITIATED_BY_USER_ID = U1.ID)"), "INITIATED_BY_USER_LAST_NAME" => array("FIELD" => "U1.LAST_NAME", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U1 ON (UG.INITIATED_BY_USER_ID = U1.ID)"), "INITIATED_BY_USER_SECOND_NAME" => array("FIELD" => "U1.SECOND_NAME", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U1 ON (UG.INITIATED_BY_USER_ID = U1.ID)"), "INITIATED_BY_USER_LOGIN" => array("FIELD" => "U1.LOGIN", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U1 ON (UG.INITIATED_BY_USER_ID = U1.ID)"), "INITIATED_BY_USER_EMAIL" => array("FIELD" => "U1.EMAIL", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U1 ON (UG.INITIATED_BY_USER_ID = U1.ID)"), "INITIATED_BY_USER_PHOTO" => array("FIELD" => "U1.PERSONAL_PHOTO", "TYPE" => "int", "FROM" => "LEFT JOIN b_user U1 ON (UG.INITIATED_BY_USER_ID = U1.ID)"), "INITIATED_BY_USER_GENDER" => array("FIELD" => "U1.PERSONAL_GENDER", "TYPE" => "string", "FROM" => "LEFT JOIN b_user U1 ON (UG.INITIATED_BY_USER_ID = U1.ID)"), "RAND" => array("FIELD" => "RAND()", "TYPE" => "string"));
     $arFields["USER_IS_ONLINE"] = array("FIELD" => "IF(U.LAST_ACTIVITY_DATE > DATE_SUB(NOW(), INTERVAL " . $online_interval . " SECOND), 'Y', 'N')", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (UG.USER_ID = U.ID)");
     if (array_key_exists("GROUP_SITE_ID", $arFilter)) {
         $arFields["GROUP_SITE_ID"] = array("FIELD" => "SGS.SITE_ID", "TYPE" => "string", "FROM" => "LEFT JOIN b_sonet_group_site SGS ON UG.GROUP_ID = SGS.GROUP_ID");
         $strDistinct = " DISTINCT ";
         foreach ($arSelectFields as $i => $strFieldTmp) {
             if ($strFieldTmp == "GROUP_SITE_ID") {
                 unset($arSelectFields[$i]);
             }
         }
         foreach ($arOrder as $by => $order) {
             if (!in_array($by, $arSelectFields)) {
                 $arSelectFields[] = $by;
             }
         }
     } else {
         $arFields["GROUP_SITE_ID"] = array("FIELD" => "G.SITE_ID", "TYPE" => "string", "FROM" => "INNER JOIN b_sonet_group G ON (UG.GROUP_ID = G.ID)");
         $strDistinct = " ";
     }
     $arFields = array_merge($arFields1, $arFields);
     $arSqls = CSocNetGroup::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields);
     $arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", $strDistinct, $arSqls["SELECT"]);
     if (is_array($arGroupBy) && count($arGroupBy) == 0) {
         $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_sonet_user2group UG " . "\t" . $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($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         return ($arRes = $dbRes->Fetch()) ? $arRes["CNT"] : false;
     }
     $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_sonet_user2group UG " . "\t" . $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_sonet_user2group UG " . "\t" . $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_tmp, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $cnt = 0;
         if (strlen($arSqls["GROUPBY"]) <= 0) {
             if ($arRes = $dbRes->Fetch()) {
                 $cnt = $arRes["CNT"];
             }
         } else {
             // рнкэйн дкъ MYSQL!!! дкъ ORACLE дпсцни йнд
             $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($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     }
     return $dbRes;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:82,代码来源:user_group.php

示例4: GetList

 /**
  * <p>Возвращает список прав.</p>
  *
  *
  *
  *
  * @param array $arOrder = array("ID" Порядок сортировки возвращаемого списка, заданный в виде
  * массива. Ключами в массиве являются поля для сортировки, а
  * значениями - ASC/DESC - порядок сортировки. Допустимые ключи: <b>ID</b>,
  * <b>FEATURE_ID</b>, <b>OPERATION_ID, ROLE</b>, <b>FEATURE_ENTITY_TYPE</b>, <b>FEATURE_ENTITY_ID</b>,
  * <b>FEATURE_FEATURE</b>, <b>FEATURE_FEATURE_NAME</b>,<b> FEATURE_ACTIVE</b>.
  *
  *
  *
  * @param DES $C  Массив, задающий фильтр на возвращаемый список. Ключами в массиве
  * являются названия полей, а значениями - их значения. Допустимые
  * поля:<b>ID</b>, <b>FEATURE_ID</b>, <b>OPERATION_ID, ROLE</b>, <b>FEATURE_ENTITY_TYPE</b>, <b>FEATURE_ENTITY_ID</b>,
  * <b>FEATURE_FEATURE</b>, <b>FEATURE_FEATURE_NAME</b>,<b> FEATURE_ACTIVE</b>.
  *
  *
  *
  * @param array $arFilter = array() Массив, задающий группировку результирующего списка. Если
  * параметр содержит массив названий полей, то по этим полям будет
  * произведена группировка. Если параметр содержит пустой массив,
  * то метод вернет количество записей, удовлетворяющих фильтру. По
  * умолчанию параметр равен false - не группировать.
  *
  *
  *
  * @param array $arGroupBy = false Массив, задающий условия выбора для организации постраничной
  * навигации.
  *
  *
  *
  * @param array $arNavStartParams = false Массив, задающий выбираемые поля. Содержит список полей, которые
  * должны быть возвращены методом. Если массив пустой, то выбираются
  * поля <b>ID</b>, <b>FEATURE_ID</b>, <b>OPERATION_ID</b>, <b>ROLE</b>. В массиве допустимы любые
  * поля из списка полей.
  *
  *
  *
  * @param array $arSelectFields = array() 
  *
  *
  *
  * @return CDBResult <p>Метод возвращает объект типа CDBResult, содержащий записи,
  * удовлетворяющие условию выборки.</p>
  *
  *
  * <h4>See Also</h4> 
  * <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/main/reference/cdbresult/index.php">CDBResult</a> </li> <li> <a
  * href="http://dev.1c-bitrix.ru/api_help/socialnetwork/classes/CSocNetFeaturesPerms/GetByID.php">CSocNetFeaturesPerms::GetById</a>
  * </li> </ul><br><br>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/socialnetwork/classes/CSocNetFeaturesPerms/GetList.php
  * @author Bitrix
  */
 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", "FEATURE_ID", "OPERATION_ID", "ROLE");
     }
     static $arFields = array("ID" => array("FIELD" => "GFP.ID", "TYPE" => "int"), "FEATURE_ID" => array("FIELD" => "GFP.FEATURE_ID", "TYPE" => "int"), "OPERATION_ID" => array("FIELD" => "GFP.OPERATION_ID", "TYPE" => "string"), "ROLE" => array("FIELD" => "GFP.ROLE", "TYPE" => "string"), "FEATURE_ENTITY_TYPE" => array("FIELD" => "GF.ENTITY_TYPE", "TYPE" => "string", "FROM" => "INNER JOIN b_sonet_features GF ON (GFP.FEATURE_ID = GF.ID)"), "FEATURE_ENTITY_ID" => array("FIELD" => "GF.ENTITY_ID", "TYPE" => "int", "FROM" => "INNER JOIN b_sonet_features GF ON (GFP.FEATURE_ID = GF.ID)"), "FEATURE_FEATURE" => array("FIELD" => "GF.FEATURE", "TYPE" => "string", "FROM" => "INNER JOIN b_sonet_features GF ON (GFP.FEATURE_ID = GF.ID)"), "FEATURE_FEATURE_NAME" => array("FIELD" => "GF.FEATURE_NAME", "TYPE" => "string", "FROM" => "INNER JOIN b_sonet_features GF ON (GFP.FEATURE_ID = GF.ID)"), "FEATURE_ACTIVE" => array("FIELD" => "GF.ACTIVE", "TYPE" => "string", "FROM" => "INNER JOIN b_sonet_features GF ON (GFP.FEATURE_ID = GF.ID)"));
     $arSqls = CSocNetGroup::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_sonet_features2perms GFP " . "\t" . $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($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         if ($arRes = $dbRes->Fetch()) {
             return $arRes["CNT"];
         } else {
             return False;
         }
     }
     $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_sonet_features2perms GFP " . "\t" . $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_sonet_features2perms GFP " . "\t" . $arSqls["FROM"] . " ";
         if (strlen($arSqls["WHERE"]) > 0) {
             $strSql_tmp .= "WHERE " . $arSqls["WHERE"] . " ";
         }
         if (strlen($arSqls["GROUPBY"]) > 0) {
//.........这里部分代码省略.........
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:group_features_perms.php

示例5: GetUsersAll

 public static function GetUsersAll($arParams)
 {
     global $DB, $USER;
     static $arFields = array("ID" => array("FIELD" => "U.ID", "TYPE" => "int"), "ACTIVE" => array("FIELD" => "U.ACTIVE", "TYPE" => "string"), "NAME" => array("FIELD" => "U.NAME", "TYPE" => "string"), "LAST_NAME" => array("FIELD" => "U.LAST_NAME", "TYPE" => "string"), "SECOND_NAME" => array("FIELD" => "U.SECOND_NAME", "TYPE" => "string"), "LOGIN" => array("FIELD" => "U.LOGIN", "TYPE" => "string"), "PERSONAL_PHOTO" => array("FIELD" => "U.PERSONAL_PHOTO", "TYPE" => "int"), "WORK_POSITION" => array("FIELD" => "U.WORK_POSITION", "TYPE" => "string"), "CONFIRM_CODE" => array("FIELD" => "U.CONFIRM_CODE", "TYPE" => "string"), "PERSONAL_PROFESSION" => array("FIELD" => "U.PERSONAL_PROFESSION", "TYPE" => "string"));
     $currentUserId = $USER->GetId();
     if (!$currentUserId) {
         return array();
     }
     $bExtranetEnabled = CModule::IncludeModule("extranet");
     $bExtranetUser = $bExtranetEnabled && !CExtranet::IsIntranetUser();
     $rsData = CUserTypeEntity::GetList(array("ID" => "ASC"), array("FIELD_NAME" => "UF_DEPARTMENT", "ENTITY_ID" => "USER"));
     if ($arRes = $rsData->Fetch()) {
         $UFId = intval($arRes["ID"]);
     } else {
         return array();
     }
     $arOrder = array("ID" => "ASC");
     $arFilter = array('ACTIVE' => 'Y');
     if (IsModuleInstalled("intranet") || COption::GetOptionString("main", "new_user_registration_email_confirmation", "N") == "Y") {
         $arFilter["CONFIRM_CODE"] = false;
     }
     $arGroupBy = false;
     $arSelectFields = array("ID", "NAME", "LAST_NAME", "SECOND_NAME", "LOGIN", "PERSONAL_PHOTO", "WORK_POSITION", "PERSONAL_PROFESSION");
     $arSqls = CSocNetGroup::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields);
     $arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "DISTINCT", $arSqls["SELECT"]);
     if (!$bExtranetUser) {
         $strJoin = "\n\t\t\t\tLEFT JOIN b_utm_user UM ON UM.VALUE_ID = U.ID and FIELD_ID = " . intval($UFId) . "\n\t\t\t\tLEFT JOIN b_sonet_user2group UG ON UG.USER_ID = U.ID\n\t\t\t\tLEFT JOIN b_sonet_user2group UG_MY ON UG_MY.GROUP_ID = UG.GROUP_ID AND UG_MY.USER_ID = " . intval($currentUserId) . "\n\t\t\t";
         $arSqls["WHERE"] .= (strlen($arSqls["WHERE"]) > 0 ? " AND " : "") . "\n\t\t\t\t(\n\t\t\t\t\tUM.VALUE_ID > 0\n\t\t\t\t\tOR UG_MY.ID IS NOT NULL\n\t\t\t\t)";
     } else {
         $strJoin = "\n\t\t\t\tINNER JOIN b_sonet_user2group UG ON UG.USER_ID = U.ID\n\t\t\t\tINNER JOIN b_sonet_user2group UG_MY ON UG_MY.GROUP_ID = UG.GROUP_ID AND UG_MY.USER_ID = " . intval($currentUserId) . "\n\t\t\t";
     }
     $strSql = "SELECT\n\t\t\t\t" . $arSqls["SELECT"] . "\n\t\t\tFROM b_user U\n\t\t\t\t" . $arSqls["FROM"] . " ";
     $strSql .= $strJoin . " ";
     if (strlen($arSqls["WHERE"]) > 0) {
         $strSql .= "WHERE " . $arSqls["WHERE"] . " ";
     }
     if (strlen($arSqls["ORDERBY"]) > 0) {
         $strSql .= "ORDER BY " . $arSqls["ORDERBY"] . " ";
     }
     //echo "!1!=".htmlspecialcharsbx($strSql)."<br>";
     $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     $maxCount = IsModuleInstalled('bitrix24') ? 200 : 500;
     $resultCount = 0;
     if ($bExtranetEnabled) {
         CSocNetTools::InitGlobalExtranetArrays();
     }
     while ($arUser = $dbRes->GetNext()) {
         if ($resultCount > $maxCount) {
             $countExceeded = true;
             break;
         }
         $sName = trim(CUser::FormatName(empty($arParams["NAME_TEMPLATE"]) ? CSite::GetNameFormat(false) : $arParams["NAME_TEMPLATE"], $arUser, true, false));
         if (empty($sName)) {
             $sName = $arUser["~LOGIN"];
         }
         $arFileTmp = CFile::ResizeImageGet($arUser["PERSONAL_PHOTO"], array('width' => 32, 'height' => 32), BX_RESIZE_IMAGE_EXACT, false);
         $arUsers['U' . $arUser["ID"]] = array('id' => 'U' . $arUser["ID"], 'entityId' => $arUser["ID"], 'name' => $sName, 'avatar' => empty($arFileTmp['src']) ? '' : $arFileTmp['src'], 'desc' => $arUser['WORK_POSITION'] ? $arUser['WORK_POSITION'] : ($arUser['PERSONAL_PROFESSION'] ? $arUser['PERSONAL_PROFESSION'] : '&nbsp;'), 'isExtranet' => isset($GLOBALS["arExtranetUserID"]) && is_array($GLOBALS["arExtranetUserID"]) && in_array($arUser["ID"], $GLOBALS["arExtranetUserID"]) ? "Y" : "N");
         $arUsers['U' . $arUser["ID"]]['checksum'] = md5(serialize($arUsers['U' . $arUser["ID"]]));
         $resultCount++;
     }
     if ($countExceeded) {
         return CSocNetLogDestination::GetUsers(array("id" => array($currentUserId)), true);
     }
     return $arUsers;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:65,代码来源:log_destination.php

示例6: GetList


//.........这里部分代码省略.........
		$arFields["RATING_ENTITY_ID"] = Array("FIELD" => "LC.RATING_ENTITY_ID", "TYPE" => "int");
		$arFields["RATING_TOTAL_VALUE"] = Array("FIELD" => $DB->IsNull('RG.TOTAL_VALUE', '0'), "TYPE" => "double", "FROM" => "LEFT JOIN b_rating_voting RG ON LC.RATING_TYPE_ID = RG.ENTITY_TYPE_ID AND LC.RATING_ENTITY_ID = RG.ENTITY_ID");
		$arFields["RATING_TOTAL_VOTES"] = Array("FIELD" => $DB->IsNull('RG.TOTAL_VOTES', '0'), "TYPE" => "double", "FROM" => "LEFT JOIN b_rating_voting RG ON LC.RATING_TYPE_ID = RG.ENTITY_TYPE_ID AND LC.RATING_ENTITY_ID = RG.ENTITY_ID");
		$arFields["RATING_TOTAL_POSITIVE_VOTES"] = Array("FIELD" => $DB->IsNull('RG.TOTAL_POSITIVE_VOTES', '0'), "TYPE" => "int", "FROM" => "LEFT JOIN b_rating_voting RG ON LC.RATING_TYPE_ID = RG.ENTITY_TYPE_ID AND LC.RATING_ENTITY_ID = RG.ENTITY_ID");
		$arFields["RATING_TOTAL_NEGATIVE_VOTES"] = Array("FIELD" => $DB->IsNull('RG.TOTAL_NEGATIVE_VOTES', '0'), "TYPE" => "int", "FROM" => "LEFT JOIN b_rating_voting RG ON LC.RATING_TYPE_ID = RG.ENTITY_TYPE_ID AND LC.RATING_ENTITY_ID = RG.ENTITY_ID");
		if (isset($USER) && is_object($USER))
			$arFields["RATING_USER_VOTE_VALUE"] = Array("FIELD" => $DB->IsNull('RV.VALUE', '0'), "TYPE" => "double", "FROM" => "LEFT JOIN b_rating_vote RV ON LC.RATING_TYPE_ID = RV.ENTITY_TYPE_ID AND LC.RATING_ENTITY_ID = RV.ENTITY_ID AND RV.USER_ID = ".intval($USER->GetId()));

		if (array_key_exists("LOG_RIGHTS", $arFilter))
		{
			$Rights = array();
			if(is_array($arFilter["LOG_RIGHTS"]))
			{
				foreach($arFilter["LOG_RIGHTS"] as $str)
					if(trim($str))
						$Rights[] = trim($str);
			}
			elseif(trim($arFilter["LOG_RIGHTS"]))
				$Rights = trim($arFilter["LOG_RIGHTS"]);

			unset($arFilter["LOG_RIGHTS"]);
			if((is_array($Rights) && !empty($Rights)) || !is_array($Rights))
			{
				$arFilter["LOG_RIGHTS"] = $Rights;
				$arFields["LOG_RIGHTS"] = Array("FIELD" => "SLR0.GROUP_CODE", "TYPE" => "string", "FROM" => "INNER JOIN b_sonet_log_right SLR0 ON LC.LOG_ID = SLR0.LOG_ID");
			}

			if(is_array($Rights) && count($Rights) > 1)
				$strDistinct = " DISTINCT ";
		}

		$arFields = array_merge($arFields1, $arFields);

		$arSqls = CSocNetGroup::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields, $obUserFieldsSql);

		$r = $obUserFieldsSql->GetFilter();
		if(strlen($r)>0)
			$strSqlUFFilter = " (".$r.") ";

		$arSqls["RIGHTS"] = "";
		$arSqls["CRM_RIGHTS"] = "";

		if (
			!empty($arParams)
			&& array_key_exists("CHECK_RIGHTS", $arParams)
			&& $arParams["CHECK_RIGHTS"] == "Y"
			&& !array_key_exists("USER_ID", $arParams)
			&& is_object($GLOBALS["USER"])
		)
			$arParams["USER_ID"] = $GLOBALS["USER"]->GetID();

		if (
			!empty($arParams)
			&& array_key_exists("USER_ID", $arParams)
		)
			$arParams["CHECK_RIGHTS"] = "Y";

		if (
			!empty($arParams)
			&& array_key_exists("USE_SUBSCRIBE", $arParams)
			&& $arParams["USE_SUBSCRIBE"] == "Y"
		)
		{
			if (!array_key_exists("SUBSCRIBE_USER_ID", $arParams))
			{
				if (
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:67,代码来源:log_comments.php

示例7: GetList

 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", "CODE");
     }
     // FIELDS -->
     $arFields = array("ID" => array("FIELD" => "SS.ID", "TYPE" => "int"), "USER_ID" => array("FIELD" => "SS.USER_ID", "TYPE" => "int"), "CODE" => array("FIELD" => "SS.CODE", "TYPE" => "string"));
     // <-- FIELDS
     $arSqls = CSocNetGroup::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_sonet_subscription SS " . "\t" . $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($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         if ($arRes = $dbRes->Fetch()) {
             return $arRes["CNT"];
         } else {
             return False;
         }
     }
     $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_sonet_subscription SS " . "\t" . $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_sonet_subscription SS " . "\t" . $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_tmp, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $cnt = 0;
         if (strlen($arSqls["GROUPBY"]) <= 0) {
             if ($arRes = $dbRes->Fetch()) {
                 $cnt = $arRes["CNT"];
             }
         } else {
             // ТОЛЬКО ДЛЯ MYSQL!!! ДЛЯ ORACLE ДРУГОЙ КОД
             $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($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     }
     return $dbRes;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:68,代码来源:subscription.php

示例8: GetList

	public static function GetList($arFilter = Array(), $arSelectFields = array())
	{
		global $DB;

		if (count($arSelectFields) <= 0)
			$arSelectFields = array("USER_ID", "CODE", "TYPE", "FOLLOW_DATE");

		// FIELDS -->
		$arFields = array(
			"USER_ID" => Array("FIELD" => "SLF.USER_ID", "TYPE" => "int"),
			"CODE" => Array("FIELD" => "SLF.CODE", "TYPE" => "string"),
			"REF_ID" => Array("FIELD" => "SLF.REF_ID", "TYPE" => "int"),
			"TYPE" => array("FIELD" => "SLF.TYPE", "TYPE" => "char"),
			"FOLLOW_DATE" => Array("FIELD" => "SLF.FOLLOW_DATE", "TYPE" => "datetime"),
		);
		// <-- FIELDS

		$arSqls = CSocNetGroup::PrepareSql($arFields, array(), $arFilter, false, $arSelectFields);

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

		$strSql =
			"SELECT ".$arSqls["SELECT"]." ".
			"FROM b_sonet_log_follow SLF ".
			"	".$arSqls["FROM"]." ";
		if (strlen($arSqls["WHERE"]) > 0)
			$strSql .= "WHERE ".$arSqls["WHERE"]." ";

		$dbRes = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);

		return $dbRes;
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:32,代码来源:log_follow.php

示例9: GetList


//.........这里部分代码省略.........
             $arFilter["ENTITY_TYPE"] = $arCBFilterEntityType;
         }
     }
     if (array_key_exists("LOG_RIGHTS", $arFilter)) {
         $Rights = array();
         if (is_array($arFilter["LOG_RIGHTS"])) {
             foreach ($arFilter["LOG_RIGHTS"] as $str) {
                 if (trim($str)) {
                     $Rights[] = trim($str);
                 }
             }
         } elseif (trim($arFilter["LOG_RIGHTS"])) {
             $Rights = trim($arFilter["LOG_RIGHTS"]);
         }
         unset($arFilter["LOG_RIGHTS"]);
         if (is_array($Rights) && !empty($Rights) || !is_array($Rights)) {
             $arFilter["LOG_RIGHTS"] = $Rights;
             $arFields["LOG_RIGHTS"] = array("FIELD" => "SLR0.GROUP_CODE", "TYPE" => "string", "FROM" => "INNER JOIN b_sonet_log_right SLR0 ON L.ID = SLR0.LOG_ID");
         }
         if (is_array($Rights) && count($Rights) > 1) {
             $strDistinct = " DISTINCT ";
         }
     }
     if (array_key_exists("USER_ID|COMMENT_USER_ID", $arFilter)) {
         $strDistinct = " DISTINCT ";
     }
     if ($arParams["IS_CRM"] == "Y") {
         $events = GetModuleEvents("socialnetwork", "OnFillSocNetLogFields");
         while ($arEvent = $events->Fetch()) {
             ExecuteModuleEventEx($arEvent, array(&$arFields));
         }
     }
     $arFields = array_merge($arFields1, $arFields);
     $arSqls = CSocNetGroup::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields, $obUserFieldsSql);
     $listEvents = GetModuleEvents("socialnetwork", "OnBuildSocNetLogSql");
     while ($arEvent = $listEvents->Fetch()) {
         ExecuteModuleEventEx($arEvent, array(&$arFields, &$arOrder, &$arFilter, &$arGroupBy, &$arSelectFields, &$arSqls));
     }
     $r = $obUserFieldsSql->GetFilter();
     if (strlen($r) > 0) {
         $strSqlUFFilter = " (" . $r . ") ";
     }
     $arSqls["RIGHTS"] = "";
     $arSqls["CRM_RIGHTS"] = "";
     if (!empty($arParams) && (array_key_exists("CHECK_RIGHTS", $arParams) && $arParams["CHECK_RIGHTS"] == "Y" || array_key_exists("CHECK_CRM_RIGHTS", $arParams) && $arParams["CHECK_CRM_RIGHTS"] == "Y") && !array_key_exists("USER_ID", $arParams) && is_object($USER)) {
         $arParams["USER_ID"] = $USER->GetID();
     }
     if (!empty($arParams) && array_key_exists("USER_ID", $arParams) && $arParams["CHECK_CRM_RIGHTS"] != "Y") {
         $arParams["CHECK_RIGHTS"] = "Y";
     }
     if (!empty($arParams) && ($arParams["USE_SUBSCRIBE"] == "Y" || $arParams["USE_FOLLOW"] == "Y")) {
         if (!array_key_exists("SUBSCRIBE_USER_ID", $arParams)) {
             if (array_key_exists("USER_ID", $arParams) && intval($arParams["USER_ID"]) > 0) {
                 $arParams["SUBSCRIBE_USER_ID"] = $arParams["USER_ID"];
             } elseif (is_object($USER)) {
                 $arParams["SUBSCRIBE_USER_ID"] = $USER->GetID();
             }
         }
         if ($arParams["USE_SUBSCRIBE"] == "Y" && !array_key_exists("MY_ENTITIES", $arParams)) {
             foreach ($arSocNetAllowedSubscribeEntityTypesDesc as $entity_type_tmp => $arEntityTypeTmp) {
                 if (array_key_exists("HAS_MY", $arEntityTypeTmp) && $arEntityTypeTmp["HAS_MY"] == "Y" && array_key_exists("CLASS_MY", $arEntityTypeTmp) && array_key_exists("METHOD_MY", $arEntityTypeTmp) && strlen($arEntityTypeTmp["CLASS_MY"]) > 0 && strlen($arEntityTypeTmp["METHOD_MY"]) > 0 && method_exists($arEntityTypeTmp["CLASS_MY"], $arEntityTypeTmp["METHOD_MY"])) {
                     $arMyEntities[$entity_type_tmp] = call_user_func(array($arEntityTypeTmp["CLASS_MY"], $arEntityTypeTmp["METHOD_MY"]));
                 }
             }
             $arParams["MY_ENTITIES"] = $arMyEntities;
         }
开发者ID:Satariall,项目名称:izurit,代码行数:67,代码来源:log.php

示例10: GetList

	/**
	 * <p>Метод возвращает список прав в соответствии с фильтром.</p>
	 *
	 *
	 *
	 *
	 * @param array $arOrder = array("ID" Порядок сортировки возвращаемого списка, заданный в виде
	 * массива. Ключами в массиве являются поля для сортировки, а
	 * значениями - ASC/DESC - порядок сортировки.
	 *
	 *
	 *
	 * @param DES $C  Массив, задающий фильтр на возвращаемый список. Ключами в массиве
	 * являются названия полей, а значениями - их значения.
	 *
	 *
	 *
	 * @param array $arFilter = array() Массив, задающий группировку результирующего списка. Если
	 * параметр содержит массив названий полей, то по этим полям будет
	 * произведена группировка. Если параметр содержит пустой массив,
	 * то метод вернет количество записей, удовлетворяющих фильтру. По
	 * умолчанию параметр равен false - не группировать.
	 *
	 *
	 *
	 * @param array $arGroupBy = false Массив, задающий условия выбора для организации постраничной
	 * навигации.
	 *
	 *
	 *
	 * @param array $arNavStartParams = false Массив, задающий выбираемые поля. Содержит список полей, которые
	 * должны быть возвращены методом.
	 *
	 *
	 *
	 * @param array $arSelectFields = array() 
	 *
	 *
	 *
	 * @return CDBResult <p>Метод возвращает объект типа CDBResult, содержащий записи,
	 * удовлетворяющие условию выборки.</p>
	 *
	 *
	 * <h4>See Also</h4> 
	 * <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/main/reference/cdbresult/index.php">CDBResult</a> </li> </ul>
	 *
	 *
	 * @static
	 * @link http://dev.1c-bitrix.ru/api_help/socialnetwork/classes/CSocNetUserPerms/GetList.php
	 * @author Bitrix
	 */
	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", "OPERATION_ID", "RELATION_TYPE");

		static $arFields = array(
			"ID" => Array("FIELD" => "UP.ID", "TYPE" => "int"),
			"USER_ID" => Array("FIELD" => "UP.USER_ID", "TYPE" => "int"),
			"OPERATION_ID" => Array("FIELD" => "UP.OPERATION_ID", "TYPE" => "string"),
			"RELATION_TYPE" => Array("FIELD" => "UP.RELATION_TYPE", "TYPE" => "string"),
			"USER_NAME" => Array("FIELD" => "U.NAME", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (UP.USER_ID = U.ID)"),
			"USER_LAST_NAME" => Array("FIELD" => "U.LAST_NAME", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (UP.USER_ID = U.ID)"),
			"USER_LOGIN" => Array("FIELD" => "U.LOGIN", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (UP.USER_ID = U.ID)"),
		);

		$arSqls = CSocNetGroup::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_sonet_user_perms UP ".
				"	".$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($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
			if ($arRes = $dbRes->Fetch())
				return $arRes["CNT"];
			else
				return False;
		}


		$strSql =
			"SELECT ".$arSqls["SELECT"]." ".
			"FROM b_sonet_user_perms UP ".
			"	".$arSqls["FROM"]." ";
		if (strlen($arSqls["WHERE"]) > 0)
			$strSql .= "WHERE ".$arSqls["WHERE"]." ";
		if (strlen($arSqls["GROUPBY"]) > 0)
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:user_perms.php

示例11: GetList

 public static function GetList($arOrder = array("ENTITY_ID" => "DESC"), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
 {
     global $DB;
     if (count($arSelectFields) <= 0) {
         $arSelectFields = array("ENTITY_TYPE", "ENTITY_ID", "EVENT_ID", "USER_ID", "USER_ANONYMOUS");
     }
     static $arFields = array("ENTITY_TYPE" => array("FIELD" => "EUV.ENTITY_TYPE", "TYPE" => "string"), "ENTITY_ID" => array("FIELD" => "EUV.ENTITY_ID", "TYPE" => "int"), "EVENT_ID" => array("FIELD" => "EUV.EVENT_ID", "TYPE" => "string"), "USER_ID" => array("FIELD" => "EUV.USER_ID", "TYPE" => "int"), "USER_ANONYMOUS" => array("FIELD" => "EUV.USER_ANONYMOUS", "TYPE" => "string"));
     $arSqls = CSocNetGroup::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_sonet_event_user_view EUV " . "\t" . $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($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         if ($arRes = $dbRes->Fetch()) {
             return $arRes["CNT"];
         } else {
             return False;
         }
     }
     $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_sonet_event_user_view EUV " . "\t" . $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_sonet_event_user_view EUV " . "\t" . $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_tmp, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $cnt = 0;
         if (strlen($arSqls["GROUPBY"]) <= 0) {
             if ($arRes = $dbRes->Fetch()) {
                 $cnt = $arRes["CNT"];
             }
         } else {
             // MYSQL ONLY!!!
             $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($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     }
     return $dbRes;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:66,代码来源:event_user_view.php

示例12: GetList

 function GetList($arFilter = array(), $arSelectFields = array())
 {
     global $DB;
     if (count($arSelectFields) <= 0) {
         $arSelectFields = array("LAST_DATE", "PAGE_SIZE", "PAGE_LAST_DATE_1");
     }
     // FIELDS -->
     $arFields = array("USER_ID" => array("FIELD" => "SLC.USER_ID", "TYPE" => "int"), "SITE_ID" => array("FIELD" => "SLC.SITE_ID", "TYPE" => "string"), "CODE" => array("FIELD" => "SLC.CODE", "TYPE" => "string"), "LAST_DATE" => array("FIELD" => "SLC.LAST_DATE", "TYPE" => "datetime"), "PAGE_SIZE" => array("FIELD" => "SLC.PAGE_SIZE", "TYPE" => "int"), "PAGE_LAST_DATE_1" => array("FIELD" => "SLC.PAGE_LAST_DATE_1", "TYPE" => "datetime"));
     // <-- FIELDS
     $arSqls = CSocNetGroup::PrepareSql($arFields, array(), $arFilter, false, $arSelectFields);
     $arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSqls["SELECT"]);
     $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_sonet_log_counter SLC " . "\t" . $arSqls["FROM"] . " ";
     if (strlen($arSqls["WHERE"]) > 0) {
         $strSql .= "WHERE " . $arSqls["WHERE"] . " ";
     }
     $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     return $dbRes;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:18,代码来源:log_counter.php

示例13: GetList

 /**
  * <p>Возвращает список смайлов в соответствии с фильтром.</p>
  *
  *
  *
  *
  * @param array $arOrder = array("ID" Порядок сортировки возвращаемого списка, заданный в виде
  * массива. Ключами в массиве являются поля для сортировки, а
  * значениями - ASC/DESC - порядок сортировки.
  *
  *
  *
  * @param DES $C  Массив, задающий фильтр на возвращаемый список. Ключами в массиве
  * являются названия полей, а значениями - их значения.
  *
  *
  *
  * @param array $arFilter = array() Массив, задающий группировку результирующего списка. Если
  * параметр содержит массив названий полей, то по этим полям будет
  * произведена группировка. Если параметр содержит пустой массив,
  * то метод вернет количество записей, удовлетворяющих фильтру. По
  * умолчанию параметр равен false - не группировать.
  *
  *
  *
  * @param array $arGroupBy = false Массив, задающий условия выбора для организации постраничной
  * навигации.
  *
  *
  *
  * @param array $arNavStartParams = false Массив, задающий выбираемые поля. Содержит список полей, которые
  * должны быть возвращены методом.
  *
  *
  *
  * @param array $arSelectFields = array() 
  *
  *
  *
  * @return CDBResult <p>Метод возвращает объект типа CDBResult, содержащий записи,
  * удовлетворяющие условию выборки.</p>
  *
  *
  * <h4>See Also</h4> 
  * <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/main/reference/cdbresult/index.php">CDBResult</a> </li>
  * </ul><br><br>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/socialnetwork/classes/CSocNetSmile/getlist.php
  * @author Bitrix
  */
 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", "SMILE_TYPE", "TYPING", "IMAGE", "DESCRIPTION", "CLICKABLE", "SORT", "IMAGE_WIDTH", "IMAGE_HEIGHT");
     }
     // FIELDS -->
     $arFields = array("ID" => array("FIELD" => "B.ID", "TYPE" => "int"), "SMILE_TYPE" => array("FIELD" => "B.SMILE_TYPE", "TYPE" => "char"), "TYPING" => array("FIELD" => "B.TYPING", "TYPE" => "string"), "IMAGE" => array("FIELD" => "B.IMAGE", "TYPE" => "string"), "DESCRIPTION" => array("FIELD" => "B.DESCRIPTION", "TYPE" => "string"), "CLICKABLE" => array("FIELD" => "B.CLICKABLE", "TYPE" => "char"), "SORT" => array("FIELD" => "B.SORT", "TYPE" => "int"), "IMAGE_WIDTH" => array("FIELD" => "B.IMAGE_WIDTH", "TYPE" => "int"), "IMAGE_HEIGHT" => array("FIELD" => "B.IMAGE_HEIGHT", "TYPE" => "int"), "LANG_ID" => array("FIELD" => "BL.ID", "TYPE" => "int", "FROM" => "LEFT JOIN b_sonet_smile_lang BL ON (B.ID = BL.SMILE_ID" . (isset($arFilter["LANG_LID"]) && strlen($arFilter["LANG_LID"]) > 0 ? " AND BL.LID = '" . $arFilter["LANG_LID"] . "'" : "") . ")"), "LANG_SMILE_ID" => array("FIELD" => "BL.SMILE_ID", "TYPE" => "int", "FROM" => "LEFT JOIN b_sonet_smile_lang BL ON (B.ID = BL.SMILE_ID" . (isset($arFilter["LANG_LID"]) && strlen($arFilter["LANG_LID"]) > 0 ? " AND BL.LID = '" . $arFilter["LANG_LID"] . "'" : "") . ")"), "LANG_LID" => array("FIELD" => "BL.LID", "TYPE" => "string", "FROM" => "LEFT JOIN b_sonet_smile_lang BL ON (B.ID = BL.SMILE_ID" . (isset($arFilter["LANG_LID"]) && strlen($arFilter["LANG_LID"]) > 0 ? " AND BL.LID = '" . $arFilter["LANG_LID"] . "'" : "") . ")"), "LANG_NAME" => array("FIELD" => "BL.NAME", "TYPE" => "string", "FROM" => "LEFT JOIN b_sonet_smile_lang BL ON (B.ID = BL.SMILE_ID" . (isset($arFilter["LANG_LID"]) && strlen($arFilter["LANG_LID"]) > 0 ? " AND BL.LID = '" . $arFilter["LANG_LID"] . "'" : "") . ")"));
     // <-- FIELDS
     $arSqls = CSocNetGroup::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_sonet_smile B " . "\t" . $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($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         if ($arRes = $dbRes->Fetch()) {
             return $arRes["CNT"];
         } else {
             return False;
         }
     }
     $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_sonet_smile B " . "\t" . $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_sonet_smile B " . "\t" . $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_tmp, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $cnt = 0;
//.........这里部分代码省略.........
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:smile.php

示例14: GetList

 function GetList($arOrder = array("ID" => "DESC"), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array(), $arParams = array())
 {
     global $DB;
     if (count($arSelectFields) <= 0) {
         $arSelectFields = array("ID", "USER_ID", "ENTITY_TYPE", "ENTITY_ID", "ENTITY_CB", "ENTITY_MY", "EVENT_ID", "SITE_ID", "MAIL_EVENT", "TRANSPORT", "VISIBLE");
     }
     static $arFields1 = array("ID" => array("FIELD" => "LE.ID", "TYPE" => "int"), "USER_ID" => array("FIELD" => "LE.USER_ID", "TYPE" => "int"), "ENTITY_TYPE" => array("FIELD" => "LE.ENTITY_TYPE", "TYPE" => "string"), "ENTITY_ID" => array("FIELD" => "LE.ENTITY_ID", "TYPE" => "int"), "ENTITY_CB" => array("FIELD" => "LE.ENTITY_CB", "TYPE" => "string"), "ENTITY_MY" => array("FIELD" => "LE.ENTITY_MY", "TYPE" => "string"), "EVENT_ID" => array("FIELD" => "LE.EVENT_ID", "TYPE" => "string"), "SITE_ID" => array("FIELD" => "LE.SITE_ID", "TYPE" => "string"), "MAIL_EVENT" => array("FIELD" => "LE.MAIL_EVENT", "TYPE" => "string"), "TRANSPORT" => array("FIELD" => "LE.TRANSPORT", "TYPE" => "string"), "VISIBLE" => array("FIELD" => "LE.VISIBLE", "TYPE" => "string"), "USER_NAME" => array("FIELD" => "U.NAME", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (LE.USER_ID = U.ID)"), "USER_LAST_NAME" => array("FIELD" => "U.LAST_NAME", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (LE.USER_ID = U.ID)"), "USER_LOGIN" => array("FIELD" => "U.LOGIN", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (LE.USER_ID = U.ID)"), "USER_LID" => array("FIELD" => "U.LID", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (LE.USER_ID = U.ID)"), "USER_EMAIL" => array("FIELD" => "U.EMAIL", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (LE.USER_ID = U.ID)"), "USER_ACTIVE" => array("FIELD" => "U.ACTIVE", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (LE.USER_ID = U.ID)"));
     if (array_key_exists("GROUP_SITE_ID", $arFilter) || array_key_exists("COMMON_GROUP_SITE_ID", $arFilter)) {
         $arFields["GROUP_SITE_ID"] = array("FIELD" => "SGS.SITE_ID", "TYPE" => "string", "FROM" => "INNER JOIN b_sonet_group G on G.ID = LE.ENTITY_ID LEFT JOIN b_sonet_group_site SGS on SGS.GROUP_ID = G.ID");
         $arFields["COMMON_GROUP_SITE_ID"] = array("FIELD" => "SGS.SITE_ID", "TYPE" => "string_or_null", "FROM" => "LEFT JOIN b_sonet_group G ON G.ID = LE.ENTITY_ID LEFT JOIN b_sonet_group_site SGS on SGS.GROUP_ID = G.ID");
         $strDistinct = " DISTINCT ";
         foreach ($arSelectFields as $i => $strFieldTmp) {
             if (in_array($strFieldTmp, array("GROUP_SITE_ID", "COMMON_GROUP_SITE_ID"))) {
                 unset($arSelectFields[$i]);
             }
         }
         foreach ($arOrder as $by => $order) {
             if (!in_array($by, $arSelectFields)) {
                 $arSelectFields[] = $by;
             }
         }
     } else {
         $arFields["GROUP_SITE_ID"] = array("FIELD" => "G.SITE_ID", "TYPE" => "string", "FROM" => "INNER JOIN b_sonet_group G on G.ID = LE.ENTITY_ID");
         $arFields["COMMON_GROUP_SITE_ID"] = array("FIELD" => "G.SITE_ID", "TYPE" => "string_or_null", "FROM" => "LEFT JOIN b_sonet_group G ON G.ID = LE.ENTITY_ID");
         $strDistinct = " ";
     }
     $arFields = array_merge($arFields1, $arFields);
     $arSqls = CSocNetGroup::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields);
     if (!empty($arParams) && array_key_exists("ENTITY_TYPE", $arParams) && array_key_exists("ENTITY_ID", $arParams) && array_key_exists("EVENT_ID", $arParams) && (array_key_exists("TRANSPORT", $arParams) || array_key_exists("VISIBLE", $arParams))) {
         $arSqls["SUBSCRIBE"] = CSocNetLogEvents::GetSQLForEvent($arParams["ENTITY_TYPE"], $arParams["ENTITY_ID"], $arParams["EVENT_ID"], $arParams["USER_ID"], $arParams["TRANSPORT"], $arParams["VISIBLE"], $arParams["OF_ENTITIES"]);
     }
     $arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", $strDistinct, $arSqls["SELECT"]);
     if (is_array($arGroupBy) && count($arGroupBy) == 0) {
         $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_sonet_log_events LE " . "\t" . $arSqls["FROM"] . " ";
         if (strlen($arSqls["WHERE"]) > 0) {
             $strSql .= "WHERE " . $arSqls["WHERE"] . " ";
             if (strlen($arSqls["SUBSCRIBE"]) > 0) {
                 $strSql .= $arSqls["SUBSCRIBE"] . " ";
             }
         }
         if (strlen($arSqls["GROUPBY"]) > 0) {
             $strSql .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
         }
         //echo "!1!=".htmlspecialcharsbx($strSql)."<br>";
         $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         if ($arRes = $dbRes->Fetch()) {
             return $arRes["CNT"];
         } else {
             return False;
         }
     }
     $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_sonet_log_events LE " . "\t" . $arSqls["FROM"] . " ";
     if (strlen($arSqls["WHERE"]) > 0) {
         $strSql .= "WHERE " . $arSqls["WHERE"] . " ";
         if (strlen($arSqls["SUBSCRIBE"]) > 0) {
             $strSql .= $arSqls["SUBSCRIBE"] . " ";
         }
     }
     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_sonet_log_events LE " . "\t" . $arSqls["FROM"] . " ";
         if (strlen($arSqls["WHERE"]) > 0) {
             $strSql_tmp .= "WHERE " . $arSqls["WHERE"] . " ";
             if (strlen($arSqls["SUBSCRIBE"]) > 0) {
                 $strSql .= $arSqls["SUBSCRIBE"] . " ";
             }
         }
         if (strlen($arSqls["GROUPBY"]) > 0) {
             $strSql_tmp .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
         }
         //echo "!2.1!=".htmlspecialcharsbx($strSql_tmp)."<br>";
         $dbRes = $DB->Query($strSql_tmp, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $cnt = 0;
         if (strlen($arSqls["GROUPBY"]) <= 0) {
             if ($arRes = $dbRes->Fetch()) {
                 $cnt = $arRes["CNT"];
             }
         } else {
             // рнкэйн дкъ MYSQL!!! дкъ ORACLE дпсцни йнд
             $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($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     }
     return $dbRes;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:98,代码来源:log_events.php

示例15: GetList

 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", "EVENT_ID", "ACTIVE", "SITE_ID");
     }
     static $arFields = array("ID" => array("FIELD" => "UE.ID", "TYPE" => "int"), "USER_ID" => array("FIELD" => "UE.USER_ID", "TYPE" => "int"), "EVENT_ID" => array("FIELD" => "UE.EVENT_ID", "TYPE" => "string"), "ACTIVE" => array("FIELD" => "UE.ACTIVE", "TYPE" => "string"), "SITE_ID" => array("FIELD" => "UE.SITE_ID", "TYPE" => "string"), "USER_NAME" => array("FIELD" => "U.NAME", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (UE.USER_ID = U.ID)"), "USER_LAST_NAME" => array("FIELD" => "U.LAST_NAME", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (UE.USER_ID = U.ID)"), "USER_LOGIN" => array("FIELD" => "U.LOGIN", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (UE.USER_ID = U.ID)"));
     $arSqls = CSocNetGroup::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_sonet_user_events UE " . "\t" . $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($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         if ($arRes = $dbRes->Fetch()) {
             return $arRes["CNT"];
         } else {
             return False;
         }
     }
     $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_sonet_user_events UE " . "\t" . $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_sonet_user_events UE " . "\t" . $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_tmp, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $cnt = 0;
         if (strlen($arSqls["GROUPBY"]) <= 0) {
             if ($arRes = $dbRes->Fetch()) {
                 $cnt = $arRes["CNT"];
             }
         } else {
             // рнкэйн дкъ MYSQL!!! дкъ ORACLE дпсцни йнд
             $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($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     }
     return $dbRes;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:66,代码来源:user_events.php


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