-
Notifications
You must be signed in to change notification settings - Fork 1
/
fonctions.php
53 lines (45 loc) · 1.79 KB
/
fonctions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
// PAGINATION
function paginateur($nblignes,$debut,$limite,$orderby) {
$pages = intval($nblignes/$limite);
if ($nblignes%$limite) $pages++;
if ($pages > 1) {
if ($debut>=$limite) {
$precdebut = $debut-$limite;
echo " <a style=\"font-size:12px;font-weight:bold;\" href=\"".$_SERVER['PHP_SELF']."?debut=".$precdebut."#\"><img src=\"images/arrow-left.gif\" border=\"0\" alt=\"\" align=\"absmiddle\" border=\"0\"></a> ";
}
for ($i=1;$i<=$pages;$i++) {
$nouvdebut=$limite*($i-1);
if ($nouvdebut == $debut) {
echo "<a style=\"color:#ba0000;font-size:12px;font-weight:bold;\" href=\"".$_SERVER['PHP_SELF']."?debut=".$nouvdebut."\">".$i."</a> ";
} else { // numero avec lien
echo " <a style=\"font-size:12px;font-weight:bold;\" href=\"".$_SERVER['PHP_SELF']."?orderby=".$orderby."&debut=".$nouvdebut."\">".$i."</a> ";
}
}
if ($debut!=$limite*($pages-1)) {
$nouvdebut = $debut+$limite;
echo " <a style=\"font-size:12px;font-weight:bold;\" href=\"".$_SERVER['PHP_SELF']."?orderby=".$orderby."&debut=".$nouvdebut."\"><img src=\"images/arrow-right.gif\" border=\"0\" alt=\"\" align=\"absmiddle\" border=\"0\"></a>";
}
}
}
// EXECUTER UNE REQUETE
function requete( $requete ) {
if($resultat = pg_query( $requete )) return $resultat ;
erreur( "Erreur dans la requete : $requete<br>" . pg_last_error() ) ;
}
// CONVERTIR LES JOURS EN FRANCAIS
function date_fr($date){
list ($jour) = split ('[ ]', $date);
switch($jour) {
case 'Monday': $jour = 'Lundi'; break;
case 'Tuesday': $jour = 'Mardi'; break;
case 'Wednesday': $jour = 'Mercredi'; break;
case 'Thursday': $jour = 'Jeudi'; break;
case 'Friday': $jour = 'Vendredi'; break;
case 'Saturday': $jour = 'Samedi'; break;
case 'Sunday': $jour = 'Dimanche'; break;
default: $jour =''; break;
}
return $jour;
}
?>