2 |
ddelon |
1 |
<?
|
|
|
2 |
|
|
|
3 |
// +--------------------------------------------------------------------------------------------------+
|
|
|
4 |
// |appli_arbre.php |
|
|
|
5 |
// +--------------------------------------------------------------------------------------------------+
|
|
|
6 |
// | Copyright (c) 2002 |
|
|
|
7 |
// +--------------------------------------------------------------------------------------------------+
|
|
|
8 |
// | Ce programme utilise l'objet arbre défini dans arbre.php pour |
|
|
|
9 |
// | générer un arbre des forums, les tables requises sont |
|
|
|
10 |
// | agora, agora_join, agora_categ, agora_stat |
|
|
|
11 |
// +--------------------------------------------------------------------------------------------------+
|
|
|
12 |
// | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |
|
|
|
13 |
// +--------------------------------------------------------------------------------------------------+
|
|
|
14 |
//
|
|
|
15 |
// $Id: appli_arbre.php,v 1.1 2005-09-22 14:02:48 ddelon Exp $
|
|
|
16 |
|
|
|
17 |
include ("php/lib/lib.putstyle.php");
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
function afficherContenuCorps () {
|
|
|
22 |
global $thema; //permet un passage de parametre
|
|
|
23 |
global $GS_GLOBAL ;
|
|
|
24 |
|
|
|
25 |
$page_arg = $GS_GLOBAL['current_page_row']->P_ARGUMENT;
|
|
|
26 |
if($page_arg != ""):$thema=$page_arg;endif;
|
|
|
27 |
|
|
|
28 |
// version alexandre
|
|
|
29 |
|
|
|
30 |
//javascript pour la gestion des popup
|
|
|
31 |
//------------------------------------------------------------------------------
|
|
|
32 |
global $G_javascript;
|
|
|
33 |
$G_javascript = $G_javascript." function MagicPopup (mURL) {"."\n";
|
|
|
34 |
$G_javascript = $G_javascript." var sArgs = 'toolbar=0'+"."\n";
|
|
|
35 |
$G_javascript = $G_javascript." ',hotkeys=0'+"."\n";
|
|
|
36 |
$G_javascript = $G_javascript." ',location=0'+"."\n";
|
|
|
37 |
$G_javascript = $G_javascript." ',directories=0'+"."\n";
|
|
|
38 |
$G_javascript = $G_javascript." ',menubar=0'+"."\n";
|
|
|
39 |
$G_javascript = $G_javascript." ',personalbar=0'+"."\n";
|
|
|
40 |
$G_javascript = $G_javascript." ',status=0'+"."\n";
|
|
|
41 |
$G_javascript = $G_javascript." ',scrollbars=1'+"."\n";
|
|
|
42 |
$G_javascript = $G_javascript." ',resizable=1'+"."\n";
|
|
|
43 |
$G_javascript = $G_javascript." ',width=640 '+"."\n";
|
|
|
44 |
$G_javascript = $G_javascript." ',height=450';"."\n";
|
|
|
45 |
$G_javascript = $G_javascript."\n";
|
|
|
46 |
$G_javascript = $G_javascript." var wWindow = open (mURL, 'more', sArgs);"."\n";
|
|
|
47 |
$G_javascript = $G_javascript." wWindow.window.focus ();"."\n";
|
|
|
48 |
$G_javascript = $G_javascript." }"."\n";
|
|
|
49 |
$G_javascript = $G_javascript."\n";
|
|
|
50 |
|
|
|
51 |
GEN_ ("MagicPopup" , $G_javascript) ;
|
|
|
52 |
|
|
|
53 |
$G_javascript = " function MagicPopup2 (mURL) {"."\n";
|
|
|
54 |
$G_javascript = $G_javascript." var sArgs = 'toolbar=1'+"."\n";
|
|
|
55 |
$G_javascript = $G_javascript." ',hotkeys=0'+"."\n";
|
|
|
56 |
$G_javascript = $G_javascript." ',location=1'+"."\n";
|
|
|
57 |
$G_javascript = $G_javascript." ',directories=0'+"."\n";
|
|
|
58 |
$G_javascript = $G_javascript." ',menubar=1'+"."\n";
|
|
|
59 |
$G_javascript = $G_javascript." ',personalbar=1'+"."\n";
|
|
|
60 |
$G_javascript = $G_javascript." ',status=1'+"."\n";
|
|
|
61 |
$G_javascript = $G_javascript." ',scrollbars=1'+"."\n";
|
|
|
62 |
$G_javascript = $G_javascript." ',resizable=1'+"."\n";
|
|
|
63 |
$G_javascript = $G_javascript." ',width=800 '+"."\n";
|
|
|
64 |
$G_javascript = $G_javascript." ',height=600';"."\n";
|
|
|
65 |
$G_javascript = $G_javascript." ',left=0';"."\n";
|
|
|
66 |
$G_javascript = $G_javascript." ',top=0';"."\n";
|
|
|
67 |
$G_javascript = $G_javascript."\n";
|
|
|
68 |
$G_javascript = $G_javascript." var wWindow = open (mURL, 'more', sArgs);"."\n";
|
|
|
69 |
$G_javascript = $G_javascript." wWindow.window.focus ();"."\n";
|
|
|
70 |
$G_javascript = $G_javascript." }"."\n";
|
|
|
71 |
$G_javascript = $G_javascript."\n";
|
|
|
72 |
|
|
|
73 |
js_register ("MagicPopup2" , $G_javascript) ;
|
|
|
74 |
//------------------------------------------------------------------------------
|
|
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
|
78 |
include "php/frame/arbre/arbre.php" ;
|
|
|
79 |
|
|
|
80 |
global $num_sem; // le numero de la semaine
|
|
|
81 |
|
|
|
82 |
// requete sur le sommet de l'arbre
|
|
|
83 |
$query = "SELECT NB_ABONNES,NUM_SEM FROM agora_stats WHERE FORUM=\"tela-botanicae\" ORDER BY NUM_SEM DESC" ;
|
|
|
84 |
$result = mysql_query($query) or die ("Echec de la requête sur les forums1");
|
|
|
85 |
$tela = mysql_fetch_object($result) ;
|
|
|
86 |
|
|
|
87 |
// le numero de la semaine
|
|
|
88 |
if (empty($num_sem)) $num_sem = $tela->NUM_SEM ;
|
|
|
89 |
|
|
|
90 |
// requete sur le sommet de l'arbre avec le bon numero de semaine
|
|
|
91 |
$res = mysql_query("SELECT NB_ABONNES,NB_MESSAGES FROM agora_stats WHERE FORUM=\"tela-botanicae\" AND NUM_SEM=\"$num_sem\"");
|
|
|
92 |
$tel = mysql_fetch_object($res);
|
|
|
93 |
|
|
|
94 |
$nb_total_mess = $tel->NB_MESSAGES;
|
|
|
95 |
$nb_total_abon = $tel->NB_ABONNES;
|
|
|
96 |
|
|
|
97 |
$query = "SELECT AGO_A_LIEN_PUCE,AGO_A_LIEN_FEUILLE,AGO_A_LIEN_BRANCHE FROM agora WHERE AGO_A_NOMGRP=\"tela-botanicae\"" ;
|
|
|
98 |
$result = mysql_query($query) or die ("Echec de la requête sur les forums2");
|
|
|
99 |
$tela2 = mysql_fetch_object($result) ;
|
|
|
100 |
|
|
|
101 |
// creation de l'arbre
|
|
|
102 |
$arbreforum = new arbre("Tela Botanica",$tela2->AGO_A_LIEN_BRANCHE,$tel->NB_ABONNES,$tela2->AGO_A_LIEN_FEUILLE,"http://fr.groups.yahoo.com/group/tela-botanicae/messages") ;
|
|
|
103 |
|
|
|
104 |
$res = "<tr class=\"titlePage\"><td>L'arbre des forums de Tela Botanica</td></tr>\n" ;
|
|
|
105 |
$res.= "<tr><td> </td></tr>\n" ;
|
|
|
106 |
|
|
|
107 |
$res .= $arbreforum->cime("Tela Botanica",$tela2->AGO_A_LIEN_BRANCHE,$tel->NB_ABONNES,"javascript:MagicPopup2('$tela2->AGO_A_LIEN_FEUILLE')","http://fr.groups.yahoo.com/group/tela-botanicae/messages") ;
|
|
|
108 |
// requete sur les branches
|
|
|
109 |
// d'abord les nom des groupes
|
|
|
110 |
$query1 = "SELECT agora.AGO_A_NOMGRP FROM agora" ;
|
|
|
111 |
if (!empty($thema)) $query1 .= ",agora_join" ;
|
|
|
112 |
$query1 .= " WHERE agora.AGO_A_NOMGRP<>\"tela-botanicae\" AND
|
|
|
113 |
agora.AGO_A_VISIBLE=1" ;
|
|
|
114 |
if (!empty($thema)) { $query1 .= " AND agora.AGO_A_ID=agora_join.AGO_J_IDFORUM and
|
|
|
115 |
AGO_J_IDCATEG=\"$thema\"" ;
|
|
|
116 |
}
|
|
|
117 |
$query1 .= " ORDER BY AGO_A_DATE_CREATION DESC" ;
|
|
|
118 |
|
|
|
119 |
$result_message = mysql_query($query1) or die ("Echec de la requête sur les forums");
|
|
|
120 |
//tableau stockant la différence du nbre de messages entre la semaine en cours dans la page et la semaine précédente
|
|
|
121 |
$diff_message = array();
|
|
|
122 |
while ($row_message = mysql_fetch_object($result_message)) {
|
|
|
123 |
//implémentation du tableau $diff_message
|
|
|
124 |
$query_nb_message_1 = "SELECT NB_MESSAGES FROM agora_stats WHERE FORUM=\"$row_message->AGO_A_NOMGRP\" AND NUM_SEM=\"$num_sem\"";
|
|
|
125 |
$result_nb_message_1 = mysql_query($query_nb_message_1) or die ("Echec sur la requête _nb_message_1") ;
|
|
|
126 |
$row_nb_message_1 = mysql_fetch_object($result_nb_message_1) ;
|
|
|
127 |
$query_nb_message_2 = "SELECT NB_MESSAGES FROM agora_stats WHERE FORUM=\"$row_message->AGO_A_NOMGRP\" AND NUM_SEM= ".($num_sem -1)."";
|
|
|
128 |
$result_nb_message_2 = mysql_query($query_nb_message_2) or die ("Echec sur la requête _nb_message_2") ;
|
|
|
129 |
$row_nb_message_2 = mysql_fetch_object($result_nb_message_2) ;
|
|
|
130 |
$diff_message[$row_message->AGO_A_NOMGRP] = $row_nb_message_1->NB_MESSAGES - $row_nb_message_2->NB_MESSAGES;
|
|
|
131 |
}
|
|
|
132 |
$result1 = mysql_query($query1) or die ("Echec de la requête sur les forums");
|
|
|
133 |
while ($row1 = mysql_fetch_object($result1)) {
|
|
|
134 |
// pour chaque groupe, le nbre de messages et le nbre d'abonnes
|
|
|
135 |
$query2 = "SELECT NB_MESSAGES,NB_ABONNES FROM agora_stats WHERE FORUM=\"$row1->AGO_A_NOMGRP\" AND NUM_SEM=\"$num_sem\"" ;
|
|
|
136 |
$result2 = mysql_query($query2) or die ("Echec de la requête sur agora_stats");
|
|
|
137 |
$row2 = mysql_fetch_object($result2) ;
|
|
|
138 |
// et le reste des informations pour chaque groupe
|
|
|
139 |
$query3 = "SELECT AGO_A_ALIAS,AGO_A_LIEN_BRANCHE,AGO_A_LIEN_FEUILLE,AGO_A_LIEN_PUCE,AGO_A_COULEUR,AGO_A_TAILLE_B FROM agora WHERE AGO_A_NOMGRP=\"$row1->AGO_A_NOMGRP\"";
|
|
|
140 |
$result3 = mysql_query($query3) or die ("Echec sur la requête 3") ;
|
|
|
141 |
$row3 = mysql_fetch_object($result3) ;
|
|
|
142 |
$lien_feuille = "http://fr.groups.yahoo.com/group/$row1->AGO_A_NOMGRP/messages" ;
|
|
|
143 |
$lien_nombre = "http://fr.groups.yahoo.com/group/$row1->AGO_A_NOMGRP/members" ;
|
|
|
144 |
// On cherche à obtenir une valeur entre 0 et 100 pour déterminer la couleur de la feuille de l'arbre
|
|
|
145 |
$maxi_message = max($diff_message);
|
|
|
146 |
if ($maxi_message == 0){$maxi_message = 0.01;}
|
|
|
147 |
$calcul_couleur = ($diff_message[$row1->AGO_A_NOMGRP])/$maxi_message*100;
|
|
|
148 |
//Fin. La valeur de la couleur pour le groupe en cours est stocké dans $calcul_couleur
|
|
|
149 |
if ($row2->NB_ABONNES != 0) {//pour ne pas afficher les branches n'existant pas encore à la semaine donnée
|
|
|
150 |
$arbreforum->addBranche($row3->AGO_A_ALIAS,$row3->AGO_A_LIEN_BRANCHE,$row2->NB_ABONNES,"javascript:MagicPopup2('$lien_nombre')",$lien_feuille,$calcul_couleur,$row3->AGO_A_TAILLE_B);
|
|
|
151 |
// info pour le cartouche
|
|
|
152 |
$nb_total_mess += $row2->NB_MESSAGES;
|
|
|
153 |
$nb_total_abon += $row2->NB_ABONNES;
|
|
|
154 |
}
|
|
|
155 |
}
|
|
|
156 |
$res .= $arbreforum->affBranche() ;
|
|
|
157 |
$res .= $arbreforum->affRacine() ;
|
|
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
|
161 |
include ('php/frame/arbre/cartouche.php');
|
|
|
162 |
|
|
|
163 |
|
|
|
164 |
|
|
|
165 |
//fermeture de la connexion
|
|
|
166 |
//mysql_close();
|
|
|
167 |
|
|
|
168 |
|
|
|
169 |
return $res ;
|
|
|
170 |
}
|
|
|
171 |
|
|
|
172 |
//==============================================================================
|
|
|
173 |
// FUNCTION putFooter ()
|
|
|
174 |
//
|
|
|
175 |
// Generation of footer.
|
|
|
176 |
//==============================================================================
|
|
|
177 |
|
|
|
178 |
function putFooter () {
|
|
|
179 |
return ' ';
|
|
|
180 |
}
|
|
|
181 |
|
|
|
182 |
//-- End of source ------------------------------------------------------------
|
|
|
183 |
?>
|