优化ctms-api语法、修复已知BUG;
主要修复ctms-api、dacms对PHP新版本的支持问题
This commit is contained in:
Executable
+59
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace backend\widgets\common;
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\LinkPager;
|
||||
|
||||
class LinkPages extends LinkPager
|
||||
{
|
||||
/**
|
||||
* Renders the page buttons.
|
||||
* @return string the rendering result
|
||||
*/
|
||||
protected function renderPageButtons()
|
||||
{
|
||||
$pageCount = $this->pagination->getPageCount();
|
||||
if ($pageCount < 2 && $this->hideOnSinglePage) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$buttons = [];
|
||||
$currentPage = $this->pagination->getPage();
|
||||
|
||||
// first page
|
||||
if ($this->firstPageLabel !== FALSE) {
|
||||
$buttons[] = $this->renderPageButton($this->firstPageLabel, 0, $this->firstPageCssClass, $currentPage <= 0, FALSE);
|
||||
}
|
||||
|
||||
// prev page
|
||||
if ($this->prevPageLabel !== FALSE) {
|
||||
if (($page = $currentPage - 1) < 0) {
|
||||
$page = 0;
|
||||
}
|
||||
$buttons[] = $this->renderPageButton($this->prevPageLabel, $page, $this->prevPageCssClass, $currentPage <= 0, FALSE);
|
||||
}
|
||||
|
||||
// internal pages
|
||||
list($beginPage, $endPage) = $this->getPageRange();
|
||||
for ($i = $beginPage; $i <= $endPage; ++$i) {
|
||||
$buttons[] = $this->renderPageButton($i + 1, $i, NULL, FALSE, $i == $currentPage);
|
||||
}
|
||||
|
||||
// next page
|
||||
if ($this->nextPageLabel !== FALSE) {
|
||||
if (($page = $currentPage + 1) >= $pageCount - 1) {
|
||||
$page = $pageCount - 1;
|
||||
}
|
||||
$buttons[] = $this->renderPageButton($this->nextPageLabel, $page, $this->nextPageCssClass, $currentPage >= $pageCount - 1, FALSE);
|
||||
}
|
||||
|
||||
// last page
|
||||
if ($this->lastPageLabel !== FALSE) {
|
||||
$buttons[] = $this->renderPageButton($this->lastPageLabel, $pageCount - 1, $this->lastPageCssClass, $currentPage >= $pageCount - 1, FALSE);
|
||||
}
|
||||
|
||||
return html::tag('div', Html::tag('ul', implode("\n", $buttons), $this->options), ['class' => 'dataTables_paginate paging_bootstrap pagination']);
|
||||
//return Html::tag('ul', implode("\n", $buttons), $this->options);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user