aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--classes/helpers/CinisisDisplayHelper.php10
-rw-r--r--tests/repetition.php10
2 files changed, 12 insertions, 8 deletions
diff --git a/classes/helpers/CinisisDisplayHelper.php b/classes/helpers/CinisisDisplayHelper.php
index cf095ac..8a795e8 100644
--- a/classes/helpers/CinisisDisplayHelper.php
+++ b/classes/helpers/CinisisDisplayHelper.php
@@ -89,19 +89,19 @@ class CinisisDisplayHelper {
* @param $action
* Page action.
*/
- function navbar($entry, $entries, $action = 'index.php') {
+ function navbar($entry, $entries, $action = 'index.php', $extra = NULL) {
// First / prev links.
if ($entry != 1) {
$prev = $entry - 1;
- echo '<a href="'. $action .'?entry=1">first</a> ';
- echo '<a href="'. $action .'?entry='. $prev .'">&lt; prev</a> ';
+ echo '<a href="'. $action .'?entry=1"'. $extra .'>first</a> ';
+ echo '<a href="'. $action .'?entry='. $prev . $extra .'">&lt; prev</a> ';
}
// Next / last links.
if ($entry < $entries) {
$next = $entry + 1;
- echo '<a href="'. $action .'?entry='. $next .'">next &gt;</a> ';
- echo '<a href="'. $action .'?entry='. $entries .'">last</a>';
+ echo '<a href="'. $action .'?entry='. $next . $extra .'">next &gt;</a> ';
+ echo '<a href="'. $action .'?entry='. $entries . $extra .'">last</a>';
}
}
}
diff --git a/tests/repetition.php b/tests/repetition.php
index 7555016..1677c18 100644
--- a/tests/repetition.php
+++ b/tests/repetition.php
@@ -8,7 +8,8 @@ require_once '../index.php';
// Draw the document.
$display = new CinisisDisplayHelper('Repetition finder');
-$display->form($display->form_input_text('code'), 'repetition.php');
+$form = $display->form_input_text('code') . $display->form_input_text('display');
+$display->form($form, 'repetition.php');
// Get field code.
$code = CinisisHttpHelper::get_numeric_arg('code');
@@ -21,16 +22,19 @@ if ($isis->db) {
// Get the number of entries.
$field = $isis->db->format['fields'][$code]['name'];
$entries = $isis->db->entries();
- $entry = 1;
+ $entry = CinisisHttpHelper::get_numeric_arg('entry') - 1;
// Query database.
do {
- $result = $isis->db->read($entry++);
+ $result = $isis->db->read(++$entry);
if ($entry == $entries) {
break;
}
} while (!isset($result[$field]) || count($result[$field]) < 2);
+ // Navigation bar.
+ $display->navbar($entry, $entries, $repetition, '&code='. $code);
+
// Format output.
echo "<pre>\n";
echo "Showing entry $entry from $entries total entries.\n";