$nbrpages)$end=$nbrpages; // crée les tests de formulaire $script = $script_test_form; $script = str_replace("!!tests!!", test_field_value_comp('form', 'page', GREATER, $nbrpages, $msg["page_too_high"]) ."\n". test_field_value_comp('form', 'page', LESSER, 1, $msg["page_too_low"]), $script); $print = $script; // affichage de la barre de navigation $print .= "
\n"; // on fait suivre les variables d'environnement du portail if($cms_active && strpos($url, 'javascript:') === false) { $query = "select distinct var_name from cms_vars"; $result = pmb_mysql_query($query); if(pmb_mysql_num_rows($result)){ while($row = pmb_mysql_fetch_object($result)){ $var_name = $row->var_name; global ${$var_name}; if(!empty(${$var_name})) { $url .= "&".$var_name."=".${$var_name}; } } } } $printurl = $url; $printurl = str_replace("&page=!!page!!", "", $printurl); $printurl = str_replace("page=!!page!!&", "", $printurl); $printurl = str_replace("page=!!page!!", "", $printurl); if($action) $printurl=$action; $print .= "
\n"; // first if ($page != 1) { $printurl = str_replace("!!page!!", "1", $url); $print .= "".$msg["first_page"]."\n"; }else { $print .= "".$msg["first_page"]."\n"; } // prev if ($precedente >= 1) { $printurl = str_replace("!!page!!", "$precedente", $url); $print .= "".$msg["prec_page"]."\n"; }else { $print .= "".$msg["prec_page"]."\n"; } for ($i = $start; ($i <= $nbrpages) && ($i<=$page+$distance) ; $i++) { if($i==$page) { $print .= "".$i.""; } else { $printurl = str_replace("!!page!!", "$i", $url); $print .= "".$i.""; } if($i<$nbrpages) $print .= " "; } // next if ($suivante <= $nbrpages) { $printurl = str_replace("!!page!!", "$suivante", $url); $print .= "".$msg["next_page"]."\n"; } else { $print .= "".$msg["next_page"]."\n"; } // last if ($page != $nbrpages) { $printurl = str_replace("!!page!!", "$nbrpages", $url); $print .= "".$msg["last_page"]."\n"; }else { $print .= "".$msg["last_page"]."\n"; } $start_in_page = ((($page-1)*$nb_per_page)+1); if(($start_in_page + $nb_per_page) > $nbr_lignes) { $end_in_page = $nbr_lignes; } else { $end_in_page = ((($page-1)*$nb_per_page)+$nb_per_page); } $print .= " (".$start_in_page." - ".$end_in_page." / ".$nbr_lignes.")"; if($opac_items_pagination_custom) { $pagination_custom = explode(',', $opac_items_pagination_custom); if(count($pagination_custom)) { $pagination_nav_bar = ""; $max_nb_elements = 0; $printurl = str_replace("!!page!!", "1", $url); if(!$nb_per_page_custom_url) { $nb_per_page_custom_url = "&nb_per_page_custom=!!nb_per_page_custom!!"; } foreach ($pagination_custom as $nb_elements) { $nb_elements = trim($nb_elements)+0; if($nb_elements < $nbr_lignes) { if($nb_elements == $nb_per_page) $pagination_nav_bar .= ""; if(strpos($printurl, 'javascript:') !== false) { $pagination_nav_bar .= " ".$nb_elements." "; } else { $pagination_nav_bar .= " ".$nb_elements." "; } if($nb_elements == $nb_per_page) $pagination_nav_bar .= ""; } if($nb_elements > $max_nb_elements) { $max_nb_elements = $nb_elements; } } if(($max_nb_elements > $nbr_lignes) && ($nb_per_page < $nbr_lignes)) { if(strpos($printurl, 'javascript:') !== false) { $pagination_nav_bar .= " ".$msg['display_all']." "; } else { $pagination_nav_bar .= " ".$msg['display_all']." "; } } if($pagination_nav_bar) { $pagination_nav_bar = " ".$msg['per_page']." ".$pagination_nav_bar.""; } $print .= $pagination_nav_bar; } } $print .= "
\n"; $print .= "
\n"; return $print; } function printnavbar_onclick($page, $nbrpages, $url,$action='') { global $script_test_form; global $msg; $page+= 0; $precedente = $page-1; $suivante = $page+1; // affichage de la barre de navigation $print = "
\n"; $print .= "
\n"; // first if ($page != 1) { $print .= "".$msg["first_page"]."\n"; }else { $print .= "".$msg["first_page"]."\n"; } // prev if ($precedente >= 1) { $printurl = str_replace("!!page!!", "$precedente", $url); $print .= "".$msg["prec_page"]."\n"; }else { $print .= "".$msg["prec_page"]."\n"; } // page courante if ($nbrpages > 1) { $print .= $msg['page']." /$nbrpages\n"; }else { $print .= $msg['page']." $page/$nbrpages\n"; } // next if ($suivante <= $nbrpages) { $print .= "".$msg["next_page"]."\n"; } else { $print .= "".$msg["next_page"]."\n"; } // last if ($page != $nbrpages) { $print .= "".$msg["last_page"]."\n"; }else { $print .= "".$msg["last_page"]."\n"; } $print .= "
\n"; $print .= "
\n"; return $print; }