Objet : devel-adl
Archives de la liste
- From: svn AT agendadulibre.org
- To: devel AT agendadulibre.org
- Subject: [Devel] r193 - trunk
- Date: Sun, 29 Oct 2006 19:49:06 +0100 (CET)
- List-archive: <http://lolut.utbm.info/pipermail/devel>
- List-id: Developpement de l'Agenda du Libre <devel.agendadulibre.org>
Author: thomas
Date: Sun Oct 29 19:49:06 2006
New Revision: 193
Modified:
trunk/calendar.css
trunk/funcs.inc.php
trunk/index.php
Log:
Ajout d'un sélecteur de région en dessous de la barre de
navigation. Ce sélecteur permet de limiter l'affichage du calendrier
aux évènements d'une région donnée.
Une fois qu'une région est sélectionnée, on peut se déplacer dans les
mois précédents, suivants et dans le calendrier annuel en conservant
ce filtre sur la région.
Modified: trunk/calendar.css
==============================================================================
--- trunk/calendar.css (original)
+++ trunk/calendar.css Sun Oct 29 19:49:06 2006
@@ -59,6 +59,17 @@
font-size: 12px;
}
+form
+{
+ margin: 0;
+ padding: 0;
+}
+
+select
+{
+ border: 0px #eee solid;
+}
+
h1 {
text-align: center;
font: 26pt georgia;
@@ -299,4 +310,4 @@
margin-top: 0;
text-align: center;
font-size: 80%;
-}
\ No newline at end of file
+}
Modified: trunk/funcs.inc.php
==============================================================================
--- trunk/funcs.inc.php (original)
+++ trunk/funcs.inc.php Sun Oct 29 19:49:06 2006
@@ -201,7 +201,7 @@
'month' => $next_month);
}
-function show_day_events ($db, $day, $month, $year)
+function show_day_events ($db, $day, $month, $year, $region)
{
/*
* Compute timestamp of current day and next day. The next day is
@@ -210,10 +210,17 @@
$cur = mktime (0, 0, 0, $month, $day, $year);
$next = $cur + (24 * 60 * 60);
- $sql = "select * from events where
+ if ($region == "all")
+ $sql = "select * from events where
((end_time >= " .
$db->quote_smart(date_timestamp2mysql($cur)) . ") AND
(start_time <= " .
$db->quote_smart(date_timestamp2mysql($next)) . ") AND
(moderated = 1))";
+ else
+ $sql = "select * from events where
+ ((end_time >= " .
$db->quote_smart(date_timestamp2mysql($cur)) . ") AND
+ (start_time <= " .
$db->quote_smart(date_timestamp2mysql($next)) . ") AND
+ (moderated = 1) AND
+ (region = " . $db->quote_smart($region) . "))";
$result = $db->query ($sql);
@@ -236,7 +243,7 @@
}
}
-function calendar($db, $month, $year)
+function calendar($db, $month, $year, $region)
{
$prev = get_prev_month($month, $year);
$prev_year = $prev['year'];
@@ -278,7 +285,7 @@
echo " <h1>";
echo $max_day_in_prev_month + $day;
echo "</h1>\n";
- show_day_events ($db, $max_day_in_prev_month + $day,
$prev_month, $prev_year);
+ show_day_events ($db, $max_day_in_prev_month + $day,
$prev_month, $prev_year, $region);
echo " </td>\n";
}
/* Show days of the current month */
@@ -294,7 +301,7 @@
echo " <td class=\"current_month\"><h1>";
echo $day;
echo "</h1>\n";
- show_day_events ($db, $day, $month, $year);
+ show_day_events ($db, $day, $month, $year, $region);
echo "</td>\n";
}
/* Show days after the current month (next month) */
@@ -303,7 +310,7 @@
echo " <td class=\"other_month\"><h1>";
echo $day - $max_day_in_month;
echo "</h1>\n";
- show_day_events ($db, $day - $max_day_in_month, $next_month,
$next_year);
+ show_day_events ($db, $day - $max_day_in_month, $next_month,
$next_year, $region);
echo "</td>\n";
}
$day++;
@@ -313,7 +320,7 @@
echo "</table>\n";
}
-function one_month_calendar($db, $month, $year)
+function one_month_calendar($db, $month, $year, $region)
{
/*
* Compute previous and next months
@@ -327,32 +334,108 @@
$prev_month = $prev['month'];
/*
- * Display links for previous and next months
+ * Display the month calendar header, which contains:
+ * 1. Link to the previous month
+ * 2. Name of the current month
+ * 3. Current year, with link to the corresponding year calendar
+ * 4. Link to the next month
+ * 5. The region selector
*/
echo "<h2 class=\"calendar\">\n";
- echo " <a href=\"?year=".$prev_year."&month=".$prev_month."\">
<< </a>\n";
+ echo " <a
href=\"?year=".$prev_year."&month=".$prev_month."&region=".$region."\">
<< </a>\n";
echo " <span id=\"month_name\">".date_month2string($month)." ";
- echo " <a href=\"?year=".$year."\">".$year."</a>"."</span>\n";
- echo " <a href=\"?year=".$next_year."&month=".$next_month."\">
>> </a>\n";
+ echo " <a
href=\"?year=".$year."&region=".$region."\">".$year."</a>"."</span>\n";
+ echo " <a
href=\"?year=".$next_year."&month=".$next_month."&region=".$region."\">
>> </a>\n";
+
+ echo "<form>\n";
+ echo "<select>\n";
+
+ $ret = $db->query ("select * from regions");
+ if ($ret == FALSE)
+ {
+ error ("Erreur lors de la recherche des r�gions");
+ put_footer();
+ exit;
+ }
+
+ echo "<option onclick=\"window.location='?year=" . $year .
+ "&month=" . $month . "'\"" .
+ "value=\"all\">Toutes les r�gions</option>\n";
+
+ while ($row = mysql_fetch_object($ret))
+ {
+ if ($row->id == $region)
+ echo
+ "<option onclick=\"window.location='?year=" . $year .
+ "&month=" . $month .
+ "&region=" . $row->id .
"'\"" .
+ "value=\"" . $row->id . "\" selected=\"1\">" . $row->name
. "</option>\n";
+ else
+ echo
+ "<option onclick=\"window.location='?year=" . $year .
+ "&month=" . $month .
+ "&region=" . $row->id .
"'\"" .
+ "value=\"" . $row->id . "\">" . $row->name . "</option>\n";
+ }
+
+ echo "</select>";
+ echo "</form>";
+
echo "</h2>\n\n";
/*
* Display the calendar
*/
- calendar($db, $month, $year);
+ calendar($db, $month, $year, $region);
}
-function year_calendar($db, $year)
+function year_calendar($db, $year, $region)
{
/*
- * Display links for previous and next years
+ * Display the year calendar header, which contains:
+ * 1. Link to the previous year
+ * 3. Current year
+ * 4. Link to the next year
+ * 5. The region selector
*/
$next_year = $year + 1;
$prev_year = $year - 1;
echo "<h2 class=\"calendar\">\n";
- echo " <a href=\"?year=".$prev_year."\"> << </a>\n";
+ echo " <a href=\"?year=".$prev_year."&region=".$region."\"> <<
</a>\n";
echo " <span id=\"month_name\">".$year."</span>\n";
- echo " <a href=\"?year=".$next_year."\"> >> </a>\n";
+ echo " <a href=\"?year=".$next_year."&region=".$region."\"> >>
</a>\n";
+
+ echo "<form>";
+ echo "<select>\n";
+
+ $ret = $db->query ("select * from regions");
+ if ($ret == FALSE)
+ {
+ error ("Erreur lors de la recherche des r�gions");
+ put_footer();
+ exit;
+ }
+
+ echo "<option onclick=\"window.location='?year=" . $year .
+ "value=\"all\">Toutes les r�gions</option>\n";
+
+ while ($row = mysql_fetch_object($ret))
+ {
+ if ($row->id == $region)
+ echo
+ "<option onclick=\"window.location='?year=" . $year .
+ "&region=" . $row->id .
"'\"" .
+ "value=\"" . $row->id . "\" selected=\"1\">" . $row->name
. "</option>\n";
+ else
+ echo
+ "<option onclick=\"window.location='?year=" . $year .
+ "&region=" . $row->id .
"'\"" .
+ "value=\"" . $row->id . "\">" . $row->name . "</option>\n";
+ }
+
+ echo "</select>";
+ echo "</form>";
+
echo "</h2>\n\n";
/*
@@ -363,12 +446,12 @@
while ($num < 12) {
// month header, with a link to the single month on a page
echo "<h3 class=\"calendar\">\n";
- echo " <a href=\"?year=".$year."&month=".$month."\">\n";
+ echo " <a
href=\"?year=".$year."&month=".$month."&region=".$region."\">\n";
echo " <span id=\"month_name\">".date_month2string($month)."
".$year."</span>\n";
echo " </a>\n";
echo "</h3>\n\n";
- calendar($db, $month, $year);
+ calendar($db, $month, $year, $region);
$next = get_next_month($month, $year);
$year = $next['year'];
Modified: trunk/index.php
==============================================================================
--- trunk/index.php (original)
+++ trunk/index.php Sun Oct 29 19:49:06 2006
@@ -32,6 +32,17 @@
$db = new db();
+if ($_GET['region'] &&
+ ($_GET['region'] == "all" ||
+ ereg("^[0-9][0-9]?", $_GET['region'])))
+{
+ $region = $_GET['region'];
+}
+else
+{
+ $region = "all";
+}
+
/*
* Compute the month to be displayed in the agenda
*/
@@ -41,7 +52,8 @@
$year = $_GET['year'];
else
$year = date("Y");
- year_calendar ($db, $year);
+
+ year_calendar ($db, $year, $region);
}
else if($_GET['month'] && $_GET['year'])
{
@@ -54,13 +66,13 @@
$year = date("Y");
$month = date("n");
}
- one_month_calendar ($db, $month, $year);
+ one_month_calendar ($db, $month, $year, $region);
}
else
{
$year = date("Y");
$month = date("n");
- one_month_calendar ($db, $month, $year);
+ one_month_calendar ($db, $month, $year, $region);
}
put_footer();
- [Devel] r193 - trunk, svn, 29/10/2006
- Re: [Devel] r193 - trunk, David MENTRE, 29/10/2006
Archives gérées par MHonArc 2.6.16.