diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index d9359322f..61f307783 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -1186,6 +1186,33 @@ class e_form } + /** + * Render Pagination using 'nextprev' shortcode. + * @param string $url eg. e_REQUEST_SELF.'?from=[FROM]' + * @param int $total total records + * @param int $from value to replace [FROM] with in the URL + * @param int $perPage number of items per page + * @param array $options template, type, glyphs + * @return string + */ + public function pagination($url='', $total=0, $from=0, $perPage=10, $options=array()) + { + require_once(e_CORE."shortcodes/single/nextprev.php"); + + $nextprev = array( + 'tmpl_prefix' => varset($options['template'],'default'), + 'total' => intval($total), + 'amount' => intval($perPage), + 'current' => intval($from), + 'url' => urldecode($url), + 'type' => varset($options['type'],'record'), // page|record + 'glyphs' => vartrue($options['glyphs'],false) // 1|0 + ); + + return nextprev_shortcode($nextprev); + } + + /** * Render a bootStrap ProgressBar. diff --git a/e107_handlers/np_class.php b/e107_handlers/np_class.php deleted file mode 100644 index 00c788c53..000000000 --- a/e107_handlers/np_class.php +++ /dev/null @@ -1,89 +0,0 @@ - $view) { - $pages = ceil($total / $view); - } else { - $pages = FALSE; - } - - if ($pages) { - $nppage = LAN_GOPAGE." "; - if ($pages > 10) { - $current = ($from/$view)+1; - - for($c = 0; $c <= 2; $c++) { - $nppage .= ($view * $c == $from ? "[".($c + 1)."] " : "".($c + 1)." "); - } - - if ($current >= 3 && $current <= 5) { - for($c = 3; $c <= $current; $c++) { - $nppage .= ($view * $c == $from ? "[".($c+1)."] " : "".($c + 1)." "); - } - } - else if($current >= 6 && $current <= ($pages-5)) { - $nppage .= " ... "; - for($c = ($current-2); $c <= $current; $c++) { - $nppage .= ($view * $c == $from ? "[".($c+1)."] " : "".($c + 1)." "); - } - } - $nppage .= " ... "; - - - if (($current + 5) > $pages && $current != $pages) { - $tmp = ($current-2); - } else { - $tmp = $pages-3; - } - - for($c = $tmp; $c <= ($pages-1); $c++) { - $nppage .= ($view * $c == $from ? "[".($c + 1)."] " : "".($c + 1)." "); - } - - } else { - for($c = 0; $c < $pages; $c++) { - if ($view * $c == $from ? $nppage .= "[".($c + 1)."] " : $nppage .= "".($c + 1)." "); - } - } - $text = "