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


PHP Paginator::Offset方法代码示例

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


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

示例1: GetList

 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;
 }
开发者ID:r3c130n,项目名称:scriptacid,代码行数:30,代码来源:lib.CatalogElement.php

示例2: GetList

 public function GetList($arFilter = array(), $arPaginator = array())
 {
     global $DB;
     // Постраничка
     if (!empty($arPaginator)) {
         $page = !empty($arPaginator['PAGE']) ? (int) $arPaginator['PAGE'] : 1;
         $per_page = $arPaginator['PAGE_COUNT'];
         $total_count = $this->GetCount();
         $pagination = new Paginator($page, $per_page, $total_count);
         $arFiles['PAGINATOR'] = $pagination->GetHtml();
     }
     // TODO: Добавить фильтр
     $sql = "SELECT * FROM `" . self::$file_db . "`";
     if (!empty($arPaginator)) {
         $sql .= "LIMIT {$per_page} ";
         $sql .= "OFFSET {$pagination->Offset()}";
     }
     $DB->Query($sql);
     while ($arFile = $DB->Fetch()) {
         $arFiles['FILES'][] = $arFile;
     }
     if (empty($arFiles)) {
         return false;
     }
     return $arFiles;
 }
开发者ID:r3c130n,项目名称:scriptacid,代码行数:26,代码来源:class.File.php

示例3: GetList

 /**
  * Получить список пользователей по фильтру
  * @global object $DB
  * @param array $arFilter
  * @param array $arPaginator
  * @return array
  */
 public function GetList($arFilter = array(), $arPaginator = array())
 {
     $DB = App::DB();
     // Постраничка
     if (!empty($arPaginator)) {
         $page = !empty($arPaginator['PAGE']) ? (int) $arPaginator['PAGE'] : 1;
         $per_page = $arPaginator['PAGE_COUNT'];
         $total_count = $this->GetCount();
         $pagination = new Paginator($page, $per_page, $total_count);
         $arUsers['PAGINATOR'] = $pagination->GetHtml();
     }
     // TODO: Добавить фильтр
     $sql = "SELECT * FROM `b_user`";
     if (!empty($arPaginator)) {
         $sql .= "LIMIT {$per_page} ";
         $sql .= "OFFSET {$pagination->Offset()}";
     }
     $DB->Query($sql);
     while ($arUser = $DB->Fetch()) {
         $arUsers['USERS'][] = $arUser;
     }
     if (empty($arUsers)) {
         return false;
     }
     foreach ($arUsers as $k => $user) {
         $sqlg = "SELECT * FROM `b_user_group` WHERE `USER_ID` = '" . $user["ID"] . "';";
         $DB->Query($sqlg);
         while ($arGroup = $DB->Fetch()) {
             $arUsers['USERS'][$k]["GROUPS"][] = $arGroup["GROUP_ID"];
         }
     }
     return $arUsers;
 }
开发者ID:r3c130n,项目名称:scriptacid,代码行数:40,代码来源:class.User.php


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