Example #1
0
 public static function GetList()
 {
     global $DB;
     $sql = getListSql(array("t1" => self::$table, "t2" => self::$table_lang), false, array("t1.ID" => "t2.CATALOG_TYPE_ID"), "**");
     $DB->Query($sql);
     while ($ar_res = $DB->fetchAssoc()) {
         $arResult[] = $ar_res;
     }
     if ($DB->Error()) {
         dbError($DB->Error());
     }
     return empty($arResult) ? false : $arResult;
 }
Example #2
0
 public static function GetList($arOrder = false, $arFilter = false, $arSelect = false, $arLimit = false)
 {
     global $DB;
     $sql = getListSql(self::$table, $arOrder, $arFilter, $arSelect, $arLimit);
     $DB->Query($sql);
     while ($ar_res = $DB->fetchAssoc()) {
         $arResult[] = $ar_res;
     }
     if ($DB->Error()) {
         dbError($DB->Error());
     }
     return empty($arResult) ? false : $arResult;
 }
 /**
  * Список элементов
  * @param array $arOrder
  * @param array $arFilter
  * @param array $arSelect
  * @param array $arLimit
  * @return DBResult
  */
 public static function GetList($arOrder = array(), $arFilter = array(), $arSelect = array(), $arLimit = array())
 {
     global $DB;
     if ($arFilter["CATALOG_SECTION_ID"] === 0) {
         $arFilter["CATALOG_SECTION_ID"] = 'NULL';
     }
     $sql = getListSql(self::$table, $arOrder, $arFilter, $arSelect, $arLimit);
     d($sql);
     $res = $DB->Query($sql, "\\ScriptAcid\\CatalogSectionResult");
     if ($DB->Error()) {
         dbError($DB->Error());
         return false;
     }
     parent::$result = $res;
     return $res;
 }
Example #4
0
 public static function GetList($arOrder = array(), $arFilter = array(), $arSelect = array(), $arLimit = array())
 {
     global $DB;
     $sql = getListSql(self::$table, $arOrder, $arFilter, $arSelect, $arLimit);
     $DB->Query($sql);
     while ($ar_res = $DB->fetchAssoc()) {
         $arResult[] = $ar_res;
         if ($DB->Error()) {
             dbError($DB->Error());
         }
     }
     if (!empty($arResult)) {
         foreach ($arResult as $ID => $arItem) {
             $DB->Query("SELECT * FROM `" . self::$table_props . "` WHERE `CATALOG_ID` = '" . intval($arItem["ID"]) . "';");
             while ($ar_prop = $DB->Fetch()) {
                 $arResult[$ID]["PROPERTIES"][$ar_prop["ID"]] = $ar_prop;
             }
         }
     }
     if ($DB->Error()) {
         dbError($DB->Error());
     }
     return empty($arResult) ? false : $arResult;
 }
 public static function GetList($arOrder = array(), $arFilter = array(), $arSelect = array(), $arLimit = array())
 {
     $DB = App::DB();
     $arFilter = self::GetFilter($arFilter);
     if (empty($arOrder)) {
         $arOrder = array("SORT" => "ASC");
     }
     $arOrder = self::GetSort($arOrder);
     $tables = array("CATALOG" => self::$table_catalog, "ELEMENT" => self::$table);
     if (is_array($arLimit) and !empty($arLimit)) {
         $page = !empty($arLimit['PAGE']) ? (int) $arLimit['PAGE'] : 1;
         $total_count = self::GetCount($arFilter);
         $arLimit['COUNT'] = $arLimit['COUNT'] > 0 ? $arLimit['COUNT'] : 3;
         $pagination = new Paginator($arLimit['PAGE'], $arLimit['COUNT'], $total_count);
         self::$pagination = $pagination->GetHtml();
         $arLimit['OFFSET'] = $pagination->Offset();
     } else {
         $arLimit = array();
         self::$pagination = '';
     }
     $sql = getListSql($tables, $arOrder, $arFilter, $arSelect, $arLimit);
     //d($sql);
     $res = $DB->Query($sql, "ScriptAcid\\CatalogElementResult");
     if ($DB->Error()) {
         dbError($DB->Error());
         return false;
     }
     parent::$result = $res;
     return $res;
 }