Accéder au contenu.
Menu Sympa

devel - [Devel] r306 - branches/dui

Objet : devel-adl

Archives de la liste

[Devel] r306 - branches/dui


Chronologique Discussions 
  • From: svn AT agendadulibre.org
  • To: devel AT agendadulibre.org
  • Subject: [Devel] r306 - branches/dui
  • Date: Sun, 21 Oct 2007 17:33:45 +0200 (CEST)
  • List-archive: <http://agendadulibre.org/pipermail/devel>
  • List-id: Developpement de l'Agenda du Libre <devel.agendadulibre.org>

Author: ldayot
Date: Sun Oct 21 17:32:50 2007
New Revision: 306

Log:
Lorsqu'il y a plus de <x> evenements le meme jour, alors le calendrier
mensuel s'etend beaucoup. Solution retenue ici : fixer un nombre maximum
d'evenements à afficher dans une journee du calendrier et proposer un
lien vers tous les évenements de cette journee la. Pour qu'il n'y ait
pas de jaloux, les evenements affichez sont tires au hasard.




Modified:
branches/dui/bd-private.inc.php.template
branches/dui/funcs.inc.php

Modified: branches/dui/bd-private.inc.php.template
==============================================================================
--- branches/dui/bd-private.inc.php.template (original)
+++ branches/dui/bd-private.inc.php.template Sun Oct 21 17:32:50 2007
@@ -24,4 +24,7 @@
/** Mailing-list of moderators */
$moderatorlist = "moderators AT your.domain.org";

+/** Max events displayed in calendar **/
+$maxEventsInCalendar = 2;
+
?>

Modified: branches/dui/funcs.inc.php
==============================================================================
--- branches/dui/funcs.inc.php (original)
+++ branches/dui/funcs.inc.php Sun Oct 21 17:32:50 2007
@@ -256,7 +256,7 @@
'month' => $next_month);
}

-function show_day_events ($db, $day, $month, $year, $region)
+function show_day_events ($db, $day, $month, $year, $region,
$maxEventsInCalendar=100)
{
/*
* Compute timestamp of current day and next day. The next day is
@@ -270,37 +270,45 @@
((end_time >= " .
$db->quote_smart(date_timestamp2mysql($cur)) . ") AND
(start_time <= " .
$db->quote_smart(date_timestamp2mysql($next)) . ") AND
(moderated = 1))
- order by city";
+ order by rand()";
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) . ") OR
(locality>=1)) )
- order by city";
+ order by rand()";

$result = $db->query ($sql);

if (! $result)
{
- echo "Rien";
+ echo "Erreur ". $sql;
return;
}

- if ($db->numRows ($result) > 0)
+ if (($count = $db->numRows ($result)) > 0)
{
echo " <ul>\n";
-
- while ($ret = $db->fetchObject ($result))
+ $n=0;
+ while (($ret = $db->fetchObject ($result)) &&
($n<$maxEventsInCalendar))
{
echo " <li><a href=\"showevent.php?id=" . $ret->id . "\">\n";
echo " <b>" . str_replace("-", " ", stripslashes($ret->city)) .
"</b>: ";
echo htmlentities(stripslashes($ret->title));
echo " </a></li>\n";
+ $n++;
}
+ if ($ret)
+ {
+ echo "<div style=\"text-align:right;text-decoration:bold;\"><a
href=\"showoneday.php?date={$ret->start_time}\" title=\"".
+ sprintf( _("Tous les %s �v�nements du %s"), $count,
onlyday_timestamp2humanreadable(date_mysql2timestamp($ret->start_time)) ).
+ "\"><b>+ ". ($count-$n). " autre". ($count-$n>1 ? "s" : "").
"</b></a></div>\n";
+ }

echo " </ul>\n";
}
+
}

// LD : seems ad hoc function. TODO : generalize or remove it.
@@ -316,6 +324,8 @@

function calendar($db, $month, $year, $region)
{
+global $maxEventsInCalendar;
+
$prev = get_prev_month($month, $year);
$prev_year = $prev['year'];
$prev_month = $prev['month'];
@@ -357,7 +367,7 @@
calendar_custom_icon($year, $month, $day);
echo $max_day_in_prev_month + $day;
echo "</h1>\n";
- show_day_events ($db, $max_day_in_prev_month + $day,
$prev_month, $prev_year, $region);
+ show_day_events ($db, $max_day_in_prev_month + $day,
$prev_month, $prev_year, $region, $maxEventsInCalendar);
echo " </td>\n";
}
/* Show days of the current month */
@@ -374,7 +384,7 @@
calendar_custom_icon($year, $month, $day);
echo $day;
echo "</h1>\n";
- show_day_events ($db, $day, $month, $year, $region);
+ show_day_events ($db, $day, $month, $year, $region,
$maxEventsInCalendar);
echo "</td>\n";
}
/* Show days after the current month (next month) */
@@ -384,7 +394,7 @@
calendar_custom_icon($year, $month, $day);
echo $day - $max_day_in_month;
echo "</h1>\n";
- show_day_events ($db, $day - $max_day_in_month, $next_month,
$next_year, $region);
+ show_day_events ($db, $day - $max_day_in_month, $next_month,
$next_year, $region, $maxEventsInCalendar);
echo "</td>\n";
}
$day++;
@@ -682,7 +692,7 @@
if ($cat != "-1")
if ($cat_id==0)
{
- $last_line = "<p>". _("Tags"). " : ";
+ $last_line = "<p>". _("Mots-cl�s"). " : ";
foreach ($result_tags as $tag)
$last_line .= "<a href=\"listevents.php?tag=$tag\">$tag</a> ";
$last_line .= "</p>";
@@ -704,7 +714,7 @@
if ($cat != "-1")
if ($cat_id==0)
{
- $last_line = "<p>". _("Tags"). " : ";
+ $last_line = "<p>". _("Mots-cl�s"). " : ";
foreach ($result_tags as $tag)
$last_line .= "<a href=\"listevents.php?tag=$tag\">$tag</a> ";
$last_line .= "</p>";
@@ -753,7 +763,7 @@
"URL : " . $url . "\n".
"Contact : " . $contact . "\n" .
"Soumetteur : " . $submitter . "\n" .
- "Tags : " . $tags . "\n" .
+ "Mots-cl�s : " . $tags . "\n" .
"Description : \n " . preg_replace ("/\n/", "\n ", $description);

return $str;





Archives gérées par MHonArc 2.6.16.

Haut de le page