<?php
function getlinks($option = "all", $show_blank = "off") {
// global variables needed by the function
global $total_records, $row, $numtoshow;
// build the "GET" type URL for the links
$extra_vars = $this->build_geturl();
// determine what is exactly the actual script's name
$file = $this->file;
// total number of screens
$number_of_pages = ceil($total_records / $numtoshow);
// subscript variable for the returned array of links
$subscript = 0;
for ($current = 0; $current < $number_of_pages; $current++) {
// check if the option asks for this element in the array
if ((($option == "all") || ($option == "sides")) && ($current == 0)) {
if ($row != 0)
$array[0] = '<A HREF="' . $file . '?row=' . ($row - 1)
. $extra_vars . '">' . $this->str_previous . '</A>';
elseif (($row == 0) && ($show_blank == "on"))
$array[0] = $this->str_previous;
}
if (($option == "all") || ($option == "pages")) {
if ($row == $current)
$array[++$subscript] = ($current > 0 ? ($current + 1) : 1);
else
$array[++$subscript] = '<A HREF="' . $file . '?row=' . $current
. $extra_vars . '">' . ($current + 1) . '</A>';
}
if ((($option == "all") || ($option == "sides")) && ($current == ($number_of_pages - 1))) {
if ($row != ($number_of_pages - 1))
$array[++$subscript] = '<A HREF="' . $file . '?row=' . ($row + 1) . $extra_vars
. '">' . $this->str_next . '</A>';
elseif (($row == ($number_of_pages - 1)) && ($show_blank == "on"))
$array[++$subscript] = $this->str_next;
}
}
return $array;
}
?>