mirror of
https://github.com/Mibew/mibew.git
synced 2025-02-01 05:44:41 +03:00
Use different pagination images for different styles
This commit is contained in:
parent
e53314f403
commit
a2451c0575
@ -47,6 +47,9 @@ class PageStyle extends Style implements StyleInterface {
|
||||
// view.
|
||||
global $page, $version, $errors;
|
||||
|
||||
// Add template root value to page variables
|
||||
$page['stylepath'] = MIBEW_WEB_ROOT . '/' . $this->filesPath();
|
||||
|
||||
// Prepare to output html
|
||||
start_html_output();
|
||||
|
||||
|
@ -141,7 +141,10 @@ class ChatTemplateEngine {
|
||||
} elseif ($var == 'styleid') {
|
||||
return $this->styleName;
|
||||
} elseif ($var == 'pagination') {
|
||||
return generate_pagination($this->templateData['pagination']);
|
||||
return generate_pagination(
|
||||
MIBEW_WEB_ROOT . '/' . $this->stylePath,
|
||||
$this->templateData['pagination']
|
||||
);
|
||||
} elseif ($var == 'errors' || $var == 'harderrors') {
|
||||
if (
|
||||
!empty($this->templateData['errors'])
|
||||
|
@ -29,9 +29,16 @@ function generate_pagination_link($page, $title)
|
||||
return "<a href=\"" . htmlspecialchars($href) . "\" class=\"pagelink\">$title</a>";
|
||||
}
|
||||
|
||||
function generate_pagination_image($id, $alt)
|
||||
{
|
||||
return "<img src=\"" . MIBEW_WEB_ROOT . "/images/$id.gif\" border=\"0\" alt=\"" . htmlspecialchars($alt) . "\"/>";
|
||||
/**
|
||||
* Builds HTML markup for pagination image
|
||||
*
|
||||
* @param string $style_path Root path of the style
|
||||
* @param string $id Name of the image with neither path nor extension.
|
||||
* @param string $alt Value of an 'alt' atribute of the image tag.
|
||||
* @return string HTML markup
|
||||
*/
|
||||
function generate_pagination_image($style_path, $id, $alt) {
|
||||
return "<img src=\"" . $style_path . "/images/$id.gif\" border=\"0\" alt=\"" . htmlspecialchars($alt) . "\"/>";
|
||||
}
|
||||
|
||||
function prepare_pagination($items_count, $default_items_per_page = 15)
|
||||
@ -127,7 +134,7 @@ function setup_empty_pagination()
|
||||
$page['pagination'] = false;
|
||||
}
|
||||
|
||||
function generate_pagination($pagination, $bottom = true)
|
||||
function generate_pagination($style_path, $pagination, $bottom = true)
|
||||
{
|
||||
global $pagination_spacing, $links_on_page;
|
||||
$result = getlocal2("tag.pagination.info",
|
||||
@ -146,7 +153,7 @@ function generate_pagination($pagination, $bottom = true)
|
||||
$maxPage = min($curr_page + $links_on_page, $pagination['total']);
|
||||
|
||||
if ($curr_page > 1) {
|
||||
$result .= generate_pagination_link($curr_page - 1, generate_pagination_image("prevpage", getlocal("tag.pagination.previous"))) . $pagination_spacing;
|
||||
$result .= generate_pagination_link($curr_page - 1, generate_pagination_image($style_path, "prevpage", getlocal("tag.pagination.previous"))) . $pagination_spacing;
|
||||
}
|
||||
|
||||
for ($i = $minPage; $i <= $maxPage; $i++) {
|
||||
@ -160,7 +167,7 @@ function generate_pagination($pagination, $bottom = true)
|
||||
}
|
||||
|
||||
if ($curr_page < $pagination['total']) {
|
||||
$result .= $pagination_spacing . generate_pagination_link($curr_page + 1, generate_pagination_image("nextpage", getlocal("tag.pagination.next")));
|
||||
$result .= $pagination_spacing . generate_pagination_link($curr_page + 1, generate_pagination_image($style_path, "nextpage", getlocal("tag.pagination.next")));
|
||||
}
|
||||
$result .= "</div>";
|
||||
}
|
||||
|
BIN
src/mibew/styles/dialogs/default/images/nextpage.gif
Normal file
BIN
src/mibew/styles/dialogs/default/images/nextpage.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 915 B |
BIN
src/mibew/styles/dialogs/default/images/prevpage.gif
Normal file
BIN
src/mibew/styles/dialogs/default/images/prevpage.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 914 B |
@ -102,7 +102,7 @@ if( $page['pagination.items'] ) {
|
||||
<?php
|
||||
if( $page['pagination.items'] ) {
|
||||
echo "<br/>";
|
||||
echo generate_pagination($page['pagination']);
|
||||
echo generate_pagination($page['stylepath'], $page['pagination']);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -109,7 +109,7 @@ if( $page['pagination.items'] ) {
|
||||
<?php
|
||||
if( $page['pagination.items'] ) {
|
||||
echo "<br/>";
|
||||
echo generate_pagination($page['pagination']);
|
||||
echo generate_pagination($page['stylepath'], $page['pagination']);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -119,7 +119,7 @@ if( $page['pagination.items'] ) {
|
||||
<?php
|
||||
if( $page['pagination.items'] ) {
|
||||
echo "<br/>";
|
||||
echo generate_pagination($page['pagination']);
|
||||
echo generate_pagination($page['stylepath'], $page['pagination']);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -67,7 +67,7 @@ function tpl_content() { global $page;
|
||||
<?php
|
||||
if( $page['pagination'] ) {
|
||||
if( $page['pagination.items'] ) {
|
||||
echo generate_pagination($page['pagination'], false);
|
||||
echo generate_pagination($page['stylepath'], $page['pagination'], false);
|
||||
}
|
||||
?>
|
||||
|
||||
@ -113,7 +113,7 @@ if( $page['pagination.items'] ) {
|
||||
<?php
|
||||
if( $page['pagination.items'] ) {
|
||||
echo "<br/>";
|
||||
echo generate_pagination($page['pagination']);
|
||||
echo generate_pagination($page['stylepath'], $page['pagination']);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -72,7 +72,7 @@ if( $page['pagination.items'] ) {
|
||||
<?php
|
||||
if( $page['pagination.items'] ) {
|
||||
echo "<br/>";
|
||||
echo generate_pagination($page['pagination']);
|
||||
echo generate_pagination($page['stylepath'], $page['pagination']);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user