maj syntaxe accolades, maj jQuery, correction layout contact
[mtweb] / web / out / dist / functions.php
1 <?php
2
3   if(!function_exists("mw_navig")) :
4   function mw_navig($current, $total, $max, $base_url, $start_param, $legende = null)
5   { $navig = "";
6     if($max && $total > $max)
7     { if(isset($legende))
8       { $navig .=
9          $legende." ".($current + 1)." &agrave; "
10         .(($current + $max) > $total ? $total : $current + $max)
11         ." sur ".$total." - aller &agrave; la ";
12       }
13       $get_params = array();
14       if(($q = strpos($base_url, "?")) !== false)
15       { $v_query = explode("&", substr($base_url, $q + 1));
16         $base_url = substr($base_url, 0, $q);
17         foreach($v_query as $query)
18         { if($query)
19           { $v = explode("=", $query);
20             $get_params[$v[0]] = $v[1];
21           }
22         }
23       }
24       if(isset($get_params[$start_param])) unset($get_params[$start_param]);
25       $base_url .= "?";
26       foreach($get_params as $key => $value) $base_url .= $key."=".$value."&";
27       $nb_pages = ceil($total / $max);
28       $navig .=
29        "page : "
30       ."<select onchange=\"document.location=this.options[this.selectedIndex].value;\">\n";
31       $np = 1;
32       $ni = 0;
33       while($ni < $total)
34       { $navig .=
35          "  <option value=\"".$base_url.$start_param."=".$ni."\"".($current >= $ni && $current <= $ni ? " SELECTED" : "").">"
36         .$np
37         ."</option>\n";
38         $np++;
39         $ni += $max;
40       }
41       $navig .=
42        "</select>\n";
43       if($current >= $max)
44       { $navig .=
45           "<a href=\"".$base_url.$start_param."=".($current - $max)."\">&laquo;</a>\n";
46       }
47       if($current < $total - $max)
48       { $navig .=
49           "<a href=\"".$base_url.$start_param."=".($current + $max)."\">&raquo;</a>\n";
50       }
51     }
52     return $navig;
53   }
54   endif;
55
56 ?>