XLAgenda
Un agenda en PHP pour votre site Web
Accueil | Présentation | Configuration nécessaire | Installation | Historique | FAQ | Forum | Utilisateurs | Démonstration
Vous n'êtes pas identifié(e).
Bonjour,
Ci-joint une petite copie d'écran de mon calendrier :
http://hidalgoj.free.fr/calendrier.jpg
On y voit un évènement (en rose), qui est une soirée commençant le 25/08 à 19:30 et se terminant le 26/02 à 02:00.
Cet évènement est donc logiquement étalé sur 2 jours (25/08 et 26/08).
J'aimerais que cet évènement apparaisse étalé sur 1 seul jour (25/08), sauf si son heure de fin était supérieure à 5h du matin par exemple.
J'ai regardé de près le fichier request.php, qui semble être le fichier à modifier (je ne vois pas d'autre solution a priori). Ci-joint pour mémoire son contenu :
$query="SELECT * FROM $table_agenda WHERE ((date_debut <= '$year-$month-$next' AND date_fin >= '$year-$month-$next') OR (date_debut='$year-$month-$next')) AND actif='1'";
$result=mysql_query($query);
$total=mysql_num_rows($result);
if (!$total)
{
if ($month == $this_month AND $year == $this_year AND $next == $this_day)
{
echo "<td class=\"today_without_event\">$next</td>\n";
}
else
{
echo "<td class=\"day_without_event\">$next</td>\n";
}
}
if ($total)
{
if ($month == $this_month AND $year == $this_year AND $next == $this_day)
{
echo "<td class=\"today_with_event\"><a href=\"$root_agenda$url_page?day=$next&month=$month&year=$year\">$next</a></td>\n";
}
else
{
echo "<td class=\"day_with_event\"><a href=\"$root_agenda$url_page?day=$next&month=$month&year=$year\">$next</a></td>\n";
}
}
?>
Pourriez-vous SVP m'aider à modifier ce fichier en conséquence ? Je suppose que la modification doit être assez simple, mais mes connaissances en php et MySQL sont vraiment trop basiques, et après pas mal d'ssais infructueux j'ai jeté l'éponge...
MERCI d'avance.
Je me réponds à moi-même. La solution est la suivante, elle fonctionne très bien à ma connaissance (testée dans tous les cas de figure) :
$query="SELECT *
FROM $table_agenda
WHERE (
(date_debut='$year-$month-$next')
OR (date_debut < '$year-$month-$next' AND date_fin = '$year-$month-$next' AND heure_fin > '05:00:00')
OR (date_debut < '$year-$month-$next' AND date_fin > '$year-$month-$next')
)
AND actif='1'";
$result=mysql_query($query);
$total=mysql_num_rows($result);
if (!$total)
{
if ($month == $this_month AND $year == $this_year AND $next == $this_day)
{
echo "<td class=\"today_without_event\">$next</td>\n";
}
else
{
echo "<td class=\"day_without_event\">$next</td>\n";
}
}
if ($total)
{
if ($month == $this_month AND $year == $this_year AND $next == $this_day)
{
echo "<td class=\"today_with_event\"><a href=\"$root_agenda$url_page?day=$next&month=$month&year=$year\">$next</a></td>\n";
}
else
{
echo "<td class=\"day_with_event\"><a href=\"$root_agenda$url_page?day=$next&month=$month&year=$year\">$next</a></td>\n";
}
}
?>
Merci à Julie.
Merci pour l'astuce, ça faisait un moment que je cherchais la solution pour modifier le calendrier de mes événements.
Merci José Hidalgo
Hors ligne
Bonjour,
Soluce plus valide pour la dernière version à ce jour ? Pas de fichier "request" et le code semble avoir changé.
Merci !
Hors ligne