bug fixes, improves on paginator, admin url filter

This commit is contained in:
Diego Najar 2017-07-30 14:25:16 +02:00
parent efe9b742c7
commit e1866d05d5
7 changed files with 26 additions and 14 deletions

View File

@ -140,8 +140,8 @@ define('EXTREME_FRIENDLY_URL', FALSE);
// Permissions for new directories
define('DIR_PERMISSIONS', 0755);
// Admin URI filter
define('ADMIN_URI_FILTER', '/admin/');
// Admin URI filter to access to the admin panel
define('ADMIN_URI_FILTER', 'admin');
// Default language file, in this case is English
define('DEFAULT_LANGUAGE_FILE', 'en_US.json');
@ -247,7 +247,7 @@ define('HTML_PATH_THEME_CSS', HTML_PATH_THEME.'css/');
define('HTML_PATH_THEME_JS', HTML_PATH_THEME.'js/');
define('HTML_PATH_THEME_IMG', HTML_PATH_THEME.'img/');
define('HTML_PATH_ADMIN_ROOT', HTML_PATH_ROOT.'admin/');
define('HTML_PATH_ADMIN_ROOT', HTML_PATH_ROOT.ADMIN_URI_FILTER.'/');
define('HTML_PATH_ADMIN_THEME', HTML_PATH_ROOT.'bl-kernel/admin/themes/'.$Site->adminTheme().'/');
define('HTML_PATH_ADMIN_THEME_JS', HTML_PATH_ADMIN_THEME.'js/');
define('HTML_PATH_ADMIN_THEME_CSS', HTML_PATH_ADMIN_THEME.'css/');

View File

@ -62,7 +62,7 @@ class dbSite extends dbJSON
// or returns a string with the filter defined on $filter
public function uriFilters($filter='')
{
$filters['admin'] = ADMIN_URI_FILTER;
$filters['admin'] = '/'.ADMIN_URI_FILTER;
$filters['page'] = $this->getField('uriPage');
$filters['tag'] = $this->getField('uriTag');
$filters['category'] = $this->getField('uriCategory');

View File

@ -58,29 +58,29 @@ class Paginator {
// Returns the absolute URL for the first page
public static function firstPageUrl()
{
return self::absoluteUrl( self::firstPage() );
return self::numberUrl( self::firstPage() );
}
// Returns the absolute URL for the last page
public static function lastPageUrl()
{
return self::absoluteUrl( self::amountOfPages() );
return self::numberUrl( self::amountOfPages() );
}
// Returns the absolute URL for the next page
public static function nextPageUrl()
{
return self::absoluteUrl( self::nextPage() );
return self::numberUrl( self::nextPage() );
}
// Returns the absolute URL for the previous page
public static function prevPageUrl()
{
return self::absoluteUrl( self::prevPage() );
return self::numberUrl( self::prevPage() );
}
// Return the absoulte URL with the current filter
public static function absoluteUrl($pageNumber)
// Return the absoulte URL with the page number
public static function numberUrl($pageNumber)
{
global $Url;

View File

@ -14,8 +14,7 @@ class Redirect {
public static function page($page)
{
$base = ltrim(ADMIN_URI_FILTER, '/');
self::url(HTML_PATH_ROOT.$base.$page);
self::url(HTML_PATH_ROOT.ADMIN_URI_FILTER.'/'.$page);
}
public static function home()

View File

@ -36,7 +36,6 @@ class Theme {
{
global $Site;
$siteUrl = $Site->url();
$siteUrl = rtrim($siteUrl, '/');
return $siteUrl.ADMIN_URI_FILTER;
}

View File

@ -68,3 +68,17 @@
<?php endforeach; ?>
<!-- Pagination -->
<ul class="actions pagination">
<?php
// Show previus page link
if(Paginator::showPrev()) {
echo '<li><a href="'.Paginator::prevPageUrl().'" class="button big previous">Previous Page</a></li>';
}
// Show next page link
if(Paginator::showNext()) {
echo '<li><a href="'.Paginator::nextPageUrl().'" class="button big next">Next Page</a></li>';
}
?>
</ul>

View File

@ -42,7 +42,7 @@
}
for($i=1; $i<=Paginator::amountOfPages(); $i++) {
echo '<a href='.Paginator::absoluteUrl($i).' class="page">'.$i.'</a>';
echo '<a href='.Paginator::numberUrl($i).' class="page">'.$i.'</a>';
}
// Show next page link