s2diosfunctions.php
/// Art: Include für Online Auftragsverwaltung
/// Inhalt: Funktionen
/// Beschreibung: Pagination, Seitensteuerung, Ordnung
/// Benötigt: Nichts
/// CCML-Parsing: nein
///
//////////////////////////////////////////////////////////////////////////////////////////
///
/// Letzte Änderungen:
/// 07.12.2008 Suchfunktion umgestellt
///
//////////////////////////////////////////////////////////////////////////////////////////
///<07.12.2008/6.0.3.5/>
if (!defined('SHOP_TO_DATE'))
die('Forbidden');
// Pagination
function pagination(&$config, &$template, $max_page) {
if ($config->page > $max_page)
$config->set('page', $max_page);
$template->loop('pagination', array(
'page' => 1,
'invis' => $config->page == 1 ? 'none' : '',
'selected' => '',
'content' => '
',
'title' => $template->vars['firstpage'],
));
$template->loop('pagination', array(
'page' => max(1, $config->page - 1),
'invis' => $config->page == 1 ? 'none' : '',
'selected' => '',
'content' => '
',
'title' => $template->vars['prevpage'],
));
for ($i = max(1, $config->page - 5); $i <= min($config->page + 5, $max_page); $i++)
$template->loop('pagination', array(
'content' => ' '.$i.' ',
'selected' => $config->page == $i ? 'selected' : '',
'page' => $i,
'invis' => '',
'title' => $template->vars['gotopage'].' '.$i,
));
$template->loop('pagination', array(
'page' => min($config->page + 1, $max_page),
'invis' => $config->page == $max_page ? 'none' : '',
'selected' => '',
'content' => '
',
'title' => $template->vars['nextpage'],
));
$template->loop('pagination', array(
'page' => $max_page,
'invis' => $config->page == $max_page ? 'none' : '',
'selected' => '',
'content' => '
',
'title' => $template->vars['lastpage'],
));
}
// Ordnung
function myorder(&$config, $order_values) {
if (is_get(PARAMETER_ORDER)) {
$order = get(PARAMETER_ORDER, CHECK_ALPHA_);
if (in_array($order, $order_values))
$config->set('order', $order);
}
}
// Pro Seite
function myperpage(&$config, &$template) {
if (is_get(PARAMETER_COUNT)) {
$count = get(PARAMETER_COUNT, CHECK_NUM);
if (in_array($count, array(50, 100, 200, 500)))
$config->set('perpage', $count);
}
foreach (array(1, 2, 5, 10, 20, 50, 100, 200, 500, 1000) as $pp)
$template->loop('perpage', array(
'selected' => $config->perpage == $pp ? 'selected="selected"' : '',
'perpage' => $pp,
'perpagetext' => $pp,
));
}
// Richtung
function mydirection(&$config) {
if (is_get(PARAMETER_DIRECTION)) {
$direction = get(PARAMETER_DIRECTION, CHECK_ALPHA);
if (in_array($direction, array('asc', 'desc')))
$config->set('direction', $direction);
}
}
// Seite
function mypage(&$config) {
if (is_get(PARAMETER_PAGE)) {
$page = get(PARAMETER_PAGE, CHECK_NUM);
$config->set('page', $page);
}
}
?>