hello
Server : Apache/2.4.52 (Ubuntu) System : Linux HAN2 5.15.0-185-generic #195-Ubuntu SMP Fri Jun 19 17:11:50 UTC 2026 x86_64 User : servadmin ( 1000) PHP Version : 8.1.2-1ubuntu2.25 Disable Function : NONE Directory : /www/docs/video.obu.edu/Archives/scripts/ |
<?php
//get the search results from the session
$results = $_SESSION['result'];
//if the user has not changed the value of the number to be displayed per page
if(!isset($_SESSION['num']))
{
$num=10;
}
else
{ //if the user has changed the value of the number to be displayed get it from the session
$num=$_SESSION['num'];
}
if(!isset($_GET['display']))
{
$displayPage = 0;
}
else
{
$displayPage = $_GET['display'];
}
//get which page the user is on
$multiplier = $displayPage;
//do some math ... get then end point of the display
$numToDisplay = ($multiplier*$num)+$num;
//if they are on the last page then set the number to display to be the end of the list (prevent index out of range error)
if($numToDisplay > sizeof($results))
{
$numToDisplay = sizeof($results);
}
while(($multiplier*$num)>$numToDisplay)
{
$multiplier-=1;
}
//get the number of results
$len = sizeof($results);
//if there are more results than should be displayed on one page
if($len > $num)
{ //print out the pages div which allows the user to navigate forwards and backwards among pages
echo "<div id= \"pages\">";
echo "<ul class=\"numPages\">
<li><a href=\"index.php?display=" . (($displayPage-1)>0?($displayPage-1):0) . "\"><<</a></li>";
//add another page to the list as necessary
for($i=0;$i<=floor($len/$num);$i++)
{ if($i!=$displayPage)
{
echo "<li><a href=\"index.php?display=" . $i ."\">" . ($i+1) ."</a></li>";
}
else
{
echo "<li><a style=\"color: red;\" class =\"selected\" href=\"index.php?display=" . $i ."\">" . ($i+1) ."</a></li>";
}
}
echo "<li><a href=\"index.php?display=". (($displayPage+1)>floor($len/$num)?$displayPage:($displayPage+1)) . "\">>></a></li>
</ul>
</div>";
//+$num;
}
else
{ //if there are fewer than the chosen number to display in the search results then set it up
$multiplier = 0 ;
$numToDisplay = sizeof($results);
}
echo "<h2>Displaying results " . ($multiplier*$num +1) . " to ".$numToDisplay . " of " . sizeof($results) . "</h2>";
//for each result that should be displayed on this page print out the div with all required information
for($i=$multiplier*$num; $i<$numToDisplay; $i++)
{
echo " <div name=\"" . $results[$i]['resourceId'] . "\" id=\"result" . $i . "\" class=\"result\">
<input id=\"item". $i . "\" class=\"collapse\" type=\"button\" onclick=\"display(" . $i . ")\" value=\" \"/>
<div class=\"widthLimiter\"><a href=\"result.php?id=" . $results[$i]['resourceId'] ."\" class=\"title\">" . $results[$i]['title'] ."</a></div>
<input type=\"button\" id=\"add" . $results[$i]['resourceId'] . "\" onclick=\"addToFolder(". $results[$i]['resourceId'] . "," . $i .")\" class=\"add\"></input>
<ul>
<li>Date:" . $results[$i]['dateExpression'] . "</li>
<li>Extent:" . $results[$i]['extentNumber'] . " " . $results[$i]['extentType']."</li>
</ul>
</div>
<div class=\"info\" id=\"block". $i . "\">
<br />
<h2>Scope and Content:</h2>
<p>";
//print out the scope and contents or a generic note if they are not there
if(isset($results[$i]['noteContent']))
{
echo $results[$i]['noteContent'];
}
else
{
echo "Please see the archivist.";
}
echo "</p>
</div>";
}
echo "<br />";
//print out the same pages section as at the top
if($len > $num)
{echo "<div id= \"pages\">";
echo "<ul class=\"numPages\">
<li><a href=\"index.php?display=" . (($displayPage-1)>0?($displayPage-1):0) . "\"><<</a></li>";
//add another page to the list as necessary
for($i=0;$i<=floor($len/$num);$i++)
{
if($i!=$displayPage)
{
echo "<li><a href=\"index.php?display=" . $i ."\">" . ($i+1) ."</a></li>";
}
else
{
echo "<li><a style=\"color: red;\" class =\"selected\" href=\"index.php?display=" . $i ."\">" . ($i+1) ."</a></li>";
}
}
echo "<li><a href=\"index.php?display=". (($displayPage+1)>floor($len/$num)?$displayPage:($displayPage+1)) . "\">>></a></li>
</ul>
</div>";
}
?>