diff --git a/_prepend.php b/_prepend.php index e80a1a6..28b3ec7 100644 --- a/_prepend.php +++ b/_prepend.php @@ -6,7 +6,7 @@ if (!defined('DC_RC_PATH')) { Clearbricks::lib()->autoload([ 'dcTemplator' => __DIR__ . '/inc/class.templator.php', 'templatorMedia' => __DIR__ . '/inc/class.templator.media.php', - 'pagerTemplator' => __DIR__ . '/inc/admin.pager.templator.php', + 'templatorPager' => __DIR__ . '/inc/class.templator.pager.php', ]); dcCore::app()->templator = new dcTemplator(); diff --git a/inc/class.templator.pager.php b/inc/class.templator.pager.php index 8441c15..315a964 100644 --- a/inc/class.templator.pager.php +++ b/inc/class.templator.pager.php @@ -14,7 +14,7 @@ if (!defined('DC_RC_PATH')) { return; } -class pagerTemplator +class templatorPager { public static function templatorItemLine($f, $i) { diff --git a/index.php b/index.php index c3fc431..1d162f8 100644 --- a/index.php +++ b/index.php @@ -13,15 +13,12 @@ $part = $_REQUEST['part'] ?? ''; ### grab info ### if (in_array($part, ['files', 'delete'])) { - $page = !empty($_GET['page']) ? $_GET['page'] : 1; - $nb_per_page = 20; - + //Extend dcMedia to change settings to allow .html vs media_exclusion $media = new templatorMedia(); $media->chdir(dcCore::app()->templator->template_dir_name); // For users with only templator permission, we use sudo. dcCore::app()->auth->sudo([$media,'getDir']); $dir = $media->dir; - //if files did not appear in this list, check blog->settings->media_exclusion $items = array_values($dir['files']); } @@ -308,23 +305,24 @@ if (!dcCore::app()->templator->canUseRessources(true)) { if (count($items) == 0) { echo '
' . __('No template.') . '
'; } else { - $pager = new pager($page, count($items), $nb_per_page, 10); + // reuse "used templatro template" filter settings + $filter = new adminGenericFilterV2('templator'); + $filter->add(dcAdminFilters::getPageFilter()); + + $pager = new dcPager($filter->page, count($items), $filter->nb, 10); $pager->html_prev = __('«prev.'); $pager->html_next = __('next»'); echo - '' . - '' . __('Page(s)') . ' : ' . $pager->getLinks() . '
'; + $pager->getLinks(); for ($i = $pager->index_start, $j = 0; $i <= $pager->index_end; $i++, $j++) { - echo pagerTemplator::templatorItemLine($items[$i], $j); + echo templatorPager::templatorItemLine($items[$i], $j); } echo - '' . __('Page(s)') . ' : ' . $pager->getLinks() . '
' . + $pager->getLinks() . '