Commit e30f6da4 authored by Francesco Iannuzzelli's avatar Francesco Iannuzzelli

#21 Fix landing event

parent 37cd9836
......@@ -232,7 +232,7 @@ class Events
* @param integer $year Specific year (optional)
* @return array Events
*/
public function Keyword($id_keyword,$limit,$year=0)
public function Keyword($id_keyword,$limit,$year=0,$only_future=true)
{
$join = $this->geo->GeoJoin("e.id_geo");
$rows = array();
......@@ -245,12 +245,15 @@ class Events
INNER JOIN events e ON ku.id=e.id_event AND ku.id_type=8
INNER JOIN event_types et ON e.id_event_type=et.id_event_type ";
$sqlstr .= $join['join'];
$sqlstr .= " WHERE ku.id_keyword=$id_keyword AND e.approved=1 AND e.start_date>=CURDATE()";
$sqlstr .= " WHERE ku.id_keyword=$id_keyword AND e.approved=1 ";
if($only_future) {
$sqlstr .= " AND e.start_date>=CURDATE()";
}
if($this->id_topic>0)
$sqlstr .= " AND (e.id_topic='$this->id_topic' OR e.id_group='$this->id_group') ";
else
$sqlstr .= " AND e.portal=1 ";
$sqlstr .= " ORDER BY e.start_date ASC ";
$sqlstr .= " ORDER BY e.start_date " . ($only_future? " ASC":" DESC");
if($limit>0)
$sqlstr .= " LIMIT $limit";
$db =& Db::globaldb();
......
......@@ -4502,7 +4502,7 @@ class Layout
$k_array['links'] = $k_links;
include_once(SERVER_ROOT."/../classes/events.php");
$ee = new Events();
$events = $ee->Keyword($keyword['id_keyword'], $this->records_per_page);
$events = $ee->Keyword($keyword['id_keyword'], $this->records_per_page, 0, false);
$k_events = array();
foreach($events as $event) {
$k_events['e_'.$event['id_event']] = $this->EventItem($event);
......
Markdown is supported
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