".$idx : ""),
"animation",
"animation"
);
}
//
$db = $f->db;
// On initialise la variable $DEBUG avec la valeur 0
// pour ne pas afficher les messages trop verbeux du traitement.
// Pour afficher les messages il faut initialiser la variable à 1.
$DEBUG = 0;
// Paramètres et Variables
if (isset($_GET['obj']))
$obj = $_GET['obj'];
else
$obj = "liste";
if (isset($_GET['step']))
$step = $_GET['step'];
else
$step = 0;
//
$view = "";
if (isset($_GET['view']) && $_GET['view'] == 'all') {
$view = "all";
}
// Ouverture du conteneur spécifique de la page
echo "\n\t
\n\n";
//
if ($obj == "liste") {
//
if ($view != "all") {
//
echo "
";
echo "\n\t";
echo "";
echo "Afficher toutes les animations";
echo "";
echo "\n\n";
}
//
if ($view == "all") {
//
echo "
";
echo "\n\t";
echo "";
echo "Afficher seulement les dernières animations";
echo "";
echo "\n\n";
}
// Récupération de toutes les élections en base de données
$sql = "select * from election order by election_libelle";
$res = $f->db->query($sql);
$f->databaseError ($res);
$elections_data = array();
while ($row =& $res->fetchRow(DB_FETCHMODE_ASSOC)) {
$elections_data[$row["election"]] = $row;
}
$res->free();
// Récupération de tous les répertoires résultat présents dans le
// répertoire aff/
$elections_aff = array();
$dir = AFF_RESULTS_PATH;
//
if (file_exists($dir)) {
//
$dossier = opendir($dir);
//
while ($entree = readdir($dossier)) {
//
if (preg_match("@[.]@", $entree) || $entree == 'CVS'
|| $entree == 'img' || $entree == 'dyn'
) {
//
continue;
} else {
//
$elections_aff[] = $entree;
}
}
//
closedir($dossier);
}
//
$elections = array();
// On boucle sur les élections présentes dans le répertoire aff/
foreach ($elections_aff as $election_aff) {
//
$simulation = false;
$centaine = false;
$premiere_centaine = false;
$seconde_centaine = false;
// Si l'élection est une seconde simulation
if (preg_match("@([A-Za-z]{3})([0-9]{2})-([0-9]{1})D@", $election_aff)) {
//
$simulation = true;
$seconde_centaine = true;
$centaine = "2nde centaine";
}
// Si l'élection est une seconde simulation
if (preg_match("@([A-Za-z]{3})([0-9]{2})-([0-9]{1})C@", $election_aff)) {
//
$simulation = true;
$premiere_centaine = true;
$centaine = "1ere centaine";
}
//
$elections[$election_aff] = array(
"date" => (isset($elections_data[$election_aff]["election_date"]) ? $elections_data[$election_aff]["election_date"] : "1970-01-01"),
"simulation" => $simulation,
"tour" => (isset($elections_data[$election_aff]["election_tour"]) ? $elections_data[$election_aff]["election_tour"] : "0"),
"scrutin" => (substr($election_aff, 0, 7)),
"centaine" => ($centaine === false ? "" : $centaine),
);
}
// S'il y a au moins une élection
if (count($elections) > 0) {
// Trie des élections
foreach ($elections as $key => $election) {
// Récupère la date
$dates[$key] = $election['date'];
// Récupère le nom de l'élection
$keys[$key] = $key;
}
array_multisort($dates, SORT_DESC, $keys, SORT_ASC, $elections);
}
//
echo "
\n";
//
echo "";
echo "";
echo " ";
echo " | ";
echo "";
echo "";
echo " PARAMETRAGE - Type Affichage Sélectionné - Actualisation Page (seconde)";
echo " | ";
echo "LANCER L'ANIMATION | ";
echo "
\n";
//
$election_displayed_counter = 0;
$scrutin = "";
//
foreach ($elections as $value => $infos) {
//
if (file_exists (AFF_RESULTS_PATH.$value."/election.inc")) {
//
include (AFF_RESULTS_PATH.$value."/election.inc");
//
$param0 = AFF_RESULTS_PATH.$value."/param.inc";
$param1 = AFF_RESULTS_PATH.$value."/param1.inc";
$param2 = AFF_RESULTS_PATH.$value."/param-global.inc";
//
$animation_counter = 0;
//
if (file_exists($param0)) {
$animation_counter += 1;
}
if (file_exists ($param1)) {
$animation_counter += 1;
}
if (file_exists ($param2)) {
$animation_counter += 1;
}
/**
*
*/
//
if (file_exists($param0)) {
//
include ($param0);
//
if ($scrutin != $infos["scrutin"]) {
$election_displayed_counter += 1;
}
//
if ($election_displayed_counter > 4 && $view != "all") {
break;
}
//
if ($scrutin != $infos["scrutin"]) {
$scrutin = $infos["scrutin"];
echo "";
echo "".$infos["scrutin"]." | ";
echo "
\n";
}
//
echo "";
//
echo "";
echo "".$election.($infos["centaine"] == false ? " (Résultats Définitifs)" : "")."";
echo " ";
echo "TOUR ".$infos["tour"];
echo " | ";
//
echo "";
echo "";
echo "";
echo "".$affichage." - ".$refresh." s ";
echo " | ";
//
echo "";
if (file_exists ($param1)) {
echo "";
echo "\" />";
echo "Animation No 1";
echo "";
} else {
echo "";
echo "\" />";
echo "Animation";
echo "";
}
echo " | ";
//
echo "
\n";
//
if (file_exists ($param1)) {
include ($param1);
//
echo "";
//
echo "";
echo "";
echo "";
echo "".$affichage." - ".$refresh." s ";
echo " | ";
//
echo "";
echo "";
echo "\" />";
echo "Animation No 2";
echo "";
echo " | ";
//
echo "
\n";
}
if (file_exists ($param2)) {
include ($param2);
//
echo "";
//
echo "";
echo "";
echo "";
echo "".$affichage." - ".$refresh." s ";
echo " | ";
//
echo "";
echo "";
echo "\" />";
echo "Animation No 3";
echo "";
echo " | ";
//
echo "
\n";
}
//
//*****
//echo "
|
\n";
}
}
}
//
echo "
\n";
} else {
//
echo "
\n";
}
// Fermeture du conteneur spécifique de la page
echo "\n\t
\n";
?>