Objet : devel-adl
Archives de la liste
- From: svn AT agendadulibre.org
- To: devel AT agendadulibre.org
- Subject: [Devel] r227 - trunk
- Date: Mon, 15 Jan 2007 22:46:12 +0100 (CET)
- List-archive: <http://lolut.utbm.info/pipermail/devel>
- List-id: Developpement de l'Agenda du Libre <devel.agendadulibre.org>
Author: thomas
Date: Mon Jan 15 22:46:11 2007
New Revision: 227
Modified:
trunk/listevents.php
trunk/stats.php
Log:
Prendre en compte seulement les évènements modérés dans l'Agenda du
Libre.
Merci à Gaël Utard pour l'aide en SQL.
Modified: trunk/listevents.php
==============================================================================
--- trunk/listevents.php (original)
+++ trunk/listevents.php Mon Jan 15 22:46:11 2007
@@ -60,7 +60,7 @@
$hasevent = FALSE;
$sql = "select id, title, city, start_time, end_time from events " .
- "where tags like '%" . $_GET['tag'] . "%' and start_time > NOW()
order by start_time";
+ "where (tags like '%" . $_GET['tag'] . "%') and (start_time > NOW())
and (moderated=1) order by start_time ";
$events = $db->query($sql);
if (! $events)
{
@@ -83,7 +83,7 @@
}
$sql = "select id, title, city, start_time, end_time from events ".
- "where tags like '%" . $_GET['tag'] . "%' and start_time < NOW()
order by start_time desc";
+ "where (tags like '%" . $_GET['tag'] . "%') and (start_time < NOW())
and (moderated=1) order by start_time desc";
$events = $db->query($sql);
if (! $events)
{
Modified: trunk/stats.php
==============================================================================
--- trunk/stats.php (original)
+++ trunk/stats.php Mon Jan 15 22:46:11 2007
@@ -53,7 +53,7 @@
<?php
-$result = $db->query ("select regions.name,if(events.id is null,0,count(*))
as 'event_count' from regions left join events on regions.id=events.region
group by regions.name");
+$result = $db->query ("select regions.name,count(events.id) as 'event_count'
from regions left join events on regions.id=events.region where
events.moderated=1 or events.id is null group by regions.name");
echo "<table class=\"stats\">";
@@ -78,19 +78,13 @@
echo "<p>Seules les villes o� plus de trois �v�nements ont �t� organis�s
sont mentionn�es.</p>";
-$result = $db->query ("select city,count(*) as 'event_count' from events
group by city order by event_count desc");
+$result = $db->query ("select city,count(*) as 'event_count' from events
where (moderated=1) group by city having (event_count > 3) order by
event_count desc");
echo "<table class=\"stats\">";
$i = 0;
while ($row = mysql_fetch_object($result))
{
- /* The preselection could have been done directly in MySQL, but
- unfortunately, MySQL 4.0 doesn't support subrequests in the from
- clause */
- if ($row->event_count <= 3)
- break;
-
if ($i % 2 == 0)
echo "<tr class=\"odd\">";
else
@@ -107,7 +101,7 @@
echo "<h3>Statistiques par date</h3>";
-$result = $db->query ("SELECT CONCAT(YEAR(start_time), '-',
MONTH(start_time)) AS 'month',COUNT(*) AS 'event_count' FROM events GROUP BY
EXTRACT(YEAR_MONTH FROM start_time)");
+$result = $db->query ("SELECT CONCAT(YEAR(start_time), '-',
MONTH(start_time)) AS 'month',COUNT(*) AS 'event_count' FROM events WHERE
(moderated=1) GROUP BY EXTRACT(YEAR_MONTH FROM start_time)");
echo "<table class=\"stats\">";
- [Devel] r227 - trunk, svn, 15/01/2007
Archives gérées par MHonArc 2.6.16.