git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-366
* Search :
- #249, #251, #253 : Some tweaks to be more accurate. -MC
-
+
+ * Stats :
+ - #261: Stats of registrations over the time. -Car
+
* Validations :
- #137: Now possible to add comments without any action. -MC
- #191, #256: Marketing now uses the validation process. -MC
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2004 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************/
+
+require_once("xorg.inc.php");
+new_skinned_page("stats/evolution_inscrits.tpl", AUTH_COOKIE);
+
+$page->run();
+
+?>
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2004 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************/
+
+require_once("xorg.inc.php");
+
+new_skinned_page('index.tpl', AUTH_COOKIE);
+
+//nombre de jours sur le graph
+$JOURS=Env::getInt('jours', 364);
+define('DUREEJOUR',24*3600);
+
+//recupere le nombre d'inscriptions par jour sur la plage concernée
+$res = $globals->xdb->iterRow(
+ "SELECT IF( date_ins>DATE_SUB(NOW(),INTERVAL $JOURS DAY),
+ TO_DAYS(date_ins)-TO_DAYS(NOW()),
+ ".(-($JOURS+1)).") AS jour,
+ COUNT(user_id) AS nb
+ FROM auth_user_md5
+ WHERE perms IN ('admin','user')
+ GROUP BY jour");
+
+//genere des donnees compatibles avec GNUPLOT
+$inscrits='';
+
+// la première ligne contient le total des inscrits avant la date de départ (J - $JOURS)
+list(,$init_nb) = $res->next();
+$total = $init_nb;
+
+list($numjour, $nb) = $res->next();
+
+for ($i=-$JOURS;$i<=0;$i++) {
+ if ($numjour<$i) {
+ if(!list($numjour, $nb) = $res->next()) {
+ $numjour = 0;
+ $nb = 0;
+ }
+ }
+ if ($numjour==$i) $total+=$nb;
+ $inscrits .= date('d/m/y',$i*DUREEJOUR+time())." ".$total."\n";
+}
+
+//Genere le graphique à la volée avec GNUPLOT
+header( "Content-type: image/png");
+
+$ymin = round($init_nb*0.95,0);
+$ymax = round($total *1.05,0);
+
+$gnuplot = <<<EOF2
+gnuplot <<EOF
+
+set term png small color
+set size 640/480
+set xdata time
+set timefmt "%d/%m/%y"
+
+set format x "%m/%y"
+set yr [$ymin:$ymax]
+
+set title "Nombre d'inscrits"
+
+plot "-" using 1:2 title 'inscrits' with lines;
+{$inscrits}
+EOF
+EOF2;
+
+passthru($gnuplot);
+?>
--- /dev/null
+{***************************************************************************
+ * Copyright (C) 2003-2004 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************}
+
+
+<h1>
+ Evolution du nombre d'inscrits au site polytechnique.org
+</h1>
+
+<div class="center">
+{if $smarty.request.jours eq 1826}
+[<strong>depuis 5 ans</strong>]
+{else}
+[<a href="?jours=1826">depuis 5 ans</a>]
+{/if}
+{if $smarty.request.jours eq 731}
+[<strong>depuis 2 ans</strong>]
+{else}
+[<a href="?jours=731">depuis 2 ans</a>]
+{/if}
+{if (!$smarty.request.jours) or ($smarty.request.jours eq 364)}
+[<strong>depuis un an</strong>]
+{else}
+[<a href="?jours=364">depuis un an</a>]
+{/if}
+{if $smarty.request.jours eq 30}
+[<strong>depuis un mois</strong>]
+{else}
+[<a href="?jours=30">depuis 1 mois</a>]
+{/if}
+</div>
+<div class="center">
+ <img src="{"stats/graph_evolution.php?jours="|url}{$smarty.request.jours}" alt=" [ INSCRITS ] " />
+</div>
+
+{* vim:set et sw=2 sts=2 sws=2: *}
</p>
<ul>
+<li><a href="evolution_inscrits.php">Nombre d'inscrits au cours du temps</a></li>
<li><a href="stats_promo.php">Nombre d'inscrits dans ta promotion</a></li>
<li><a href="nb_by_promo.php">Nombre d'inscrits par promotion</a></li>
<li><a href="parselog.php">Statistiques mail</a></li>