本文整理汇总了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;
}
示例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;
}
示例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;
}