Commit 01b75af4 authored by Loïc DAYOT's avatar Loïc DAYOT Committed by Ploc
Browse files

feat(): add css class style in calendar depending on tags of the event

Add a css class depending on tags of event in calendar.

For example : tag `libre-en-fete-2017` for the event can add the following css class in calendar.css:

```css
.cal_tag_libre-en-fete-2017::before {
  content: url(../../adl/image/lef-2007-small.png);
}
```

close #44
parent d52a18a1
/*
* Copyright 2007-2015
* Copyright 2007-2017
* - Erwan Leherisse <contact CHEZ imaginair POINT net>
* - Melanie Bats <melanie POINT bats CHEZ utbm POINT fr>
* - Thomas Petazzoni <thomas POINT petazzoni CHEZ enix POINT org>
* - Jean-Marie Favreau <jeanmarie POINT favreau CHEZ free POINT fr>
* - Loïc Dayot <ldayot CHEZ epnadmin POINT net>
*
* This file is part of agenda-libre-php.
*
......@@ -321,6 +322,39 @@ td.other_month a:hover, td.other_month a:active {
color: #000;
}
/*
* These attributes apply to the event title in calendar
* in relation with tags of event
*/
.cal_city {
font-weight: bold;
}
.cal_event {
display:inline;
}
.cal_tag_libre-en-fete-2016::before,
.cal_tag_libre-en-fete-2017::before,
.cal_tag_libre-en-fete-2018::before {
content: url(../../adl/image/lef-2007-small.png);
}
.cal_tag_belgique::before {
content: url(../../image/belgique.png);
}
.cal_tag_france::before {
content: url(../../adl/image/france.png);
}
.cal_tag_quebec::before {
content: url(../../adl/image/quebec.png);
}
.cal_tag_suisse::before {
content: url(../../adl/image/suisse.png);
}
/* Carte evenements/localgroups */
#region-map {
......
......@@ -127,7 +127,7 @@ class event {
$result = $this->db->query ($query);
while ($record = $this->db->fetchObject($result))
{
$localgroup = new event($this->db);
$localgroup = new localgroup($this->db);
$localgroup->id = $record->localgroup_id;
$localgroup->role = $record->role;
$this->localgroups[] = $localgroup;
......
......@@ -50,7 +50,7 @@ class localgroup {
// -------------------------------------------------------------------
function __construct($db, $id)
function __construct($db, $id=0)
{
$this->db = $db;
$this->error = 0;
......
......@@ -212,6 +212,7 @@ class tagsHtml {
// Get tags name for one event
// Filter for one category, all if null
// return a string
function eventTagsList($event_id, $category_id=null)
{
$query = "SELECT name FROM {$GLOBALS['db_tablename_prefix']}tags_events ".
......
......@@ -344,7 +344,7 @@ function show_day_events ($db, $day, $month, $year, $region, $maxEventsInCalenda
if ($region == "all")
{
$sql = "select * from {$GLOBALS['db_tablename_prefix']}events where
$sql = "select id from {$GLOBALS['db_tablename_prefix']}events where
((end_time >= " . $db->quote_smart(date_timestamp2mysql($cur)) . ") AND
(start_time <= " . $db->quote_smart(date_timestamp2mysql($next)) . ") AND
(moderated = 1))";
......@@ -352,7 +352,7 @@ function show_day_events ($db, $day, $month, $year, $region, $maxEventsInCalenda
else
{
$oRegion = new region($db, $region);
$sql = "SELECT * FROM {$GLOBALS['db_tablename_prefix']}events WHERE
$sql = "SELECT id FROM {$GLOBALS['db_tablename_prefix']}events WHERE
((end_time >= " . $db->quote_smart(date_timestamp2mysql($cur)) . ") AND
(start_time <= " . $db->quote_smart(date_timestamp2mysql($next)) . ") AND
(moderated = 1) AND
......@@ -372,10 +372,15 @@ function show_day_events ($db, $day, $month, $year, $region, $maxEventsInCalenda
$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 stripslashes($ret->title);
$event = new event($db, $ret->id);
echo " <li><a href=\"showevent.php?id=" . $event->id . "\">\n";
echo " <span class='cal_event";
echo str_replace(' ', ' cal_tag_', ' '.$event->tags);
echo "'><span class='cal_city'>" .
str_replace("-", " ", stripslashes($event->city)) . "</span>: ".
stripslashes($event->title). "</span>";
echo " </a></li>\n";
unset($event);
$n++;
}
if ($ret)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment