Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
448 ddelon 1
<?
2
 
3
/* Fonctions locales de AGORA */
4
 
5
/*
6
array get_image(&$tableau)
7
 
8
réupère les infos d'une image d'identifant $id ou
9
choisi au hasard l'une des entrées dans un tableau
10
(liste de nom de fichiers) si $id vaut NULL
11
 
12
retourne un tableau :
13
 
14
$tableau['id'] id de l'image
15
$tableau['image'] nom de l'image
16
$tableau['alt'] infos de l'image
17
 
18
*/
19
 
20
function get_image(&$left_image)
21
  {
22
  global $tbl;
23
 
24
  if ($left_image['id'] == "") $add_query = "AGO_I_ALLOW = 1";
25
  else $add_query = "AGO_I_ID = ".$left_image['id'];
26
 
27
  $query = "select * from agora_image where $add_query";
28
  $result = mysql_query($query) or die("<B>Erreur de requête de récupération des images AGORA...</B> $query");
29
  $nbquery = mysql_num_rows($result);
30
 
31
  if ($nbquery > 1)
32
    {
33
    $i = 0;
34
 
35
    while ($row = mysql_fetch_object($result))
36
      {
37
      $tmp_id = $row->AGO_I_ID;
38
      $tmp_img = $row->AGO_I_IMAGE;
39
 
40
      if (($tmp_id != "")&&($tmp_img != ""))
41
        {
42
        $tableau[$i]['id'] = $tmp_id;
43
        $tableau[$i]['image'] = $tmp_img;
44
        $tableau[$i]['alt'] = $row->AGO_I_ALT;
45
        }
46
 
47
      $i++;
48
      }
49
 
50
    $tmp_nb = count($tableau);
51
 
52
    mt_srand((float) microtime()*1000000);
53
    $aleatoire = mt_rand(1,$tmp_nb);
54
 
55
    $left_image['id'] = $tableau[$aleatoire-1]['id'];
56
    $left_image['image'] = $tableau[$aleatoire-1]['image'];
57
    $left_image['alt'] = $tableau[$aleatoire-1]['alt'];
58
    }
59
 
60
  else if ($nbquery == 1)
61
    {
62
    $row = mysql_fetch_object($result);
63
 
64
    $left_image['id'] = $row->AGO_I_ID;
65
    $left_image['image'] = $row->AGO_I_IMAGE;
66
    $left_image['alt'] = $row->AGO_I_ALT;
67
    }
68
 
69
  else
70
    {
71
    die ("Arrêt du programme causé par la fonction get_image() de AGORA... NbQuery a une valeur incohérente.");
72
    }
73
 
74
  if ($left_image['alt'] == "") $left_image['alt'] = $left_image['image'];
75
 
76
  mysql_free_result($result);
77
  }
78
 
79
 
80
 
81
function afficheBouton ($alignTable, $leLibele1, $laCmd1)
82
  {
83
  $StyleFond = "";
84
  $StyleActif = "tabActive";
85
 
86
  $StyleTxtInnactif = "tabInactiveAnchor";
87
  $StyleInnactif = "tabInactive";
88
 
89
  $ret = "";
90
 
91
  $ret .= "\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"$alignTable\"><tr>\n";
92
  $ret .= '<td align="left" valign="bottom" class="tabInactive" colspan="5"><img src="'.PROJET_CHEMIN_IMAGE.'vide.gif" width="1" height="1" border="0" alt="" /></td>'."\n";
93
  $ret .= "</tr><tr>\n";
94
  $ret .= "<td align=\"left\" valign=\"bottom\" class=\"tabInactive\"><img src=\"".PROJET_CHEMIN_IMAGE."vide.gif\" width=\"1\" height=\"1\" border=\"0\" alt=\"\" /></td>\n";
95
 
96
  if ($laCmd1 != "NULL")
97
    {
98
    $ret .= "<td align=\"left\" valign=\"bottom\" class=\"$StyleActif\"><img src=\"".PROJET_CHEMIN_IMAGE."vide.gif\" width=\"5\" height=\"1\" border=\"0\" alt=\"\" /></td>\n";
99
    $ret .= "<td align=\"left\" valign=\"bottom\" class=\"$StyleActif\"><a href=\"$laCmd1\" class=\"anchor\">$leLibele1</a></td>\n";
100
    $ret .= "<td align=\"left\" valign=\"bottom\" class=\"$StyleActif\"><img src=\"".PROJET_CHEMIN_IMAGE."vide.gif\" width=\"5\" height=\"1\" border=\"0\" alt=\"\" /></td>\n";
101
    }
102
 
103
  else
104
    {
105
    $ret .= "<td align=\"left\" valign=\"bottom\" class=\"$StyleInnactif\"><img src=\"".PROJET_CHEMIN_IMAGE."vide.gif\" width=\"5\" height=\"1\" border=\"0\" alt=\"\" /></td>\n";
106
    $ret .= "<td align=\"left\" valign=\"bottom\" class=\"$StyleInnactif\"><span class=\"$StyleTxtInnactif\">$leLibele1</span></td>\n";
107
    $ret .= "<td align=\"left\" valign=\"bottom\" class=\"$StyleInnactif\"><img src=\"".PROJET_CHEMIN_IMAGE."vide.gif\" width=\"5\" height=\"1\" border=\"0\" alt=\"\" /></td>\n";
108
    }
109
 
110
  $ret .= "<td align=\"left\" valign=\"bottom\" class=\"tabInactive\"><img src=\"".PROJET_CHEMIN_IMAGE."vide.gif\" width=\"1\" height=\"1\" border=\"0\" alt=\"\" /></td>\n";
111
 
112
  $ret .= "</tr><tr>\n";
113
 
114
  $ret .= "<td align=\"left\" valign=\"bottom\" class=\"tabInactive\" colspan=\"5\"><img src=\"".PROJET_CHEMIN_IMAGE."vide.gif\" width=\"1\" height=\"1\" border=\"0\" alt=\"\" /></td>\n";
115
 
116
  $ret .= "</tr></table>\n\n";
117
 
118
  return $ret;
119
  }
120
 
121
?>