<?

function resultsBar($stmt,$offset)
{
global $number_of_pages;
global $current_page;

//Calcul sur le nombre de pages et le nombre de résultat
print '<div align="right"><small>';

//Calcul divers
$cpt=$offset+20; //Pour que le nombre de page commence a 1 pour un offset de 20.
$num_rows=pg_num_rows($stmt); //Nombre de lignes dans le résultat
$number_of_pages=ceil($num_rows/20); //Le nombre de pages pour un offset de 20
$current_page=$cpt/20; //La page courante pour un offset de 20

//Affichage du nombre de resultats
if (pg_num_rows($stmt)<=1) print "Result 1 to $num_rows of $num_rows record ";
else {
$offset_plus_un=$offset+1;
	if ($cpt>$num_rows) print "Results $offset_plus_un to $num_rows of $num_rows records ";
	else print "Results $offset_plus_un to $cpt of $num_rows records ";
}

//Affichage du temps d'execution de la page
$execute = microtime();
print "(".number_format($execute,2);
echo "s)";
print "</small>";

print "</center></div>";

}


function currentPageBar()
{
global $current_page;
global $number_of_pages;
print "<center>Page: $current_page / $number_of_pages</center><br>";	
}


function navigationBar()
{
global $current_page;
global $number_of_pages;
global $offset;

global $nbMAX;
global $_GET;
global $option;
global $species;
global $_SERVER;

if ($number_of_pages<=10)
	{
		for ($i=1;$i<=$number_of_pages;$i++)
		{
		if ($i!=$current_page)
		{
		$link_to_page="<a href=\"".$_SERVER["PHP_SELF"].
			 "?private=".$_GET["private"]."&option=$option".
			 "&offset=".((($i-1)*$nbMAX)).
			 "&species=$species&selectediddev=".$_GET["selectediddev"]."&mutant=".$_GET["mutant"]."&target=".$_GET["target"]."&amputation=".$_GET["amputation"]."&idanat=".$_GET["idanat"]."&Order=".$_GET["Order"]."&BOOLmut=".$_GET["BOOLmut"]."&BOOLtarg=".$_GET["BOOLtarg"]."&BOOLanat=".$_GET["BOOLanat"]."&xref=".$_GET["xref"]."&MOLtype=".$_GET["MOLtype"]."&author=".$_GET["author"]."&only=".$_GET["only"]."&news=".$_GET["news"]."&BOOLmanip=".$_GET["BOOLmanip"]."&fate=".$_GET["fate"]."&fatemode=".$_GET["fatemode"].//"&fateonly=".$_GET["fateonly"].
			 "&nbMAX=$nbMAX\">";
		
		print "$link_to_page $i </a>&nbsp;&nbsp;";
		}
	
		else print "$i &nbsp;&nbsp;";
		}


	}
	else
	{

//Les 5 premiers
	for ($i=$current_page-5;$i<$current_page;$i++)
		{
			if ($i>=1) 
			{
			if ($i!=$current_page)
			{
			$link_to_page="<a href=\"".$_SERVER["PHP_SELF"].
			 "?private=".$_GET["private"]."&option=$option".
			 "&offset=".(($i-1)*$nbMAX).
			 "&species=$species&selectediddev=".$_GET["selectediddev"]."&mutant=".$_GET["mutant"]."&target=".$_GET["target"]."&amputation=".$_GET["amputation"]."&idanat=".$_GET["idanat"]."&Order=".$_GET["Order"]."&BOOLmut=".$_GET["BOOLmut"]."&BOOLtarg=".$_GET["BOOLtarg"]."&BOOLanat=".$_GET["BOOLanat"]."&xref=".$_GET["xref"]."&MOLtype=".$_GET["MOLtype"]."&author=".$_GET["author"]."&only=".$_GET["only"]."&news=".$_GET["news"]."&BOOLmanip=".$_GET["BOOLmanip"]."&fate=".$_GET["fate"]."&fatemode=".$_GET["fatemode"].//"&fateonly=".$_GET["fateonly"].
			 "&nbMAX=$nbMAX\">";
			
			print "$link_to_page ".$i." </a>&nbsp;&nbsp;";			
			}
			}	
		}


	//La page courante
	print "&nbsp;$current_page&nbsp;&nbsp;";

	//Les 5 derniers
	for ($i=$current_page;($i<=$current_page+5);$i++)
			{
			if ($i<=$number_of_pages)
			{
			if ($i!=$current_page)
			{
			$link_to_page="<a href=\"".$_SERVER["PHP_SELF"].
			 "?private=".$_GET["private"]."&option=$option".
			 "&offset=".(($i-1)*$nbMAX).
			 "&species=$species&selectediddev=".$_GET["selectediddev"]."&mutant=".$_GET["mutant"]."&target=".$_GET["target"]."&amputation=".$_GET["amputation"]."&idanat=".$_GET["idanat"]."&Order=".$_GET["Order"]."&BOOLmut=".$_GET["BOOLmut"]."&BOOLtarg=".$_GET["BOOLtarg"]."&BOOLanat=".$_GET["BOOLanat"]."&xref=".$_GET["xref"]."&MOLtype=".$_GET["MOLtype"]."&author=".$_GET["author"]."&only=".$_GET["only"]."&news=".$_GET["news"]."&BOOLmanip=".$_GET["BOOLmanip"]."&fate=".$_GET["fate"]."&fatemode=".$_GET["fatemode"].//"&fateonly=".$_GET["fateonly"].
			 "&nbMAX=$nbMAX\">";
			
			print "$link_to_page ".$i." </a>&nbsp;&nbsp;";			
			}
			}

			}
	}

}








?>