Commit 19449a46 authored by Francesco Iannuzzelli's avatar Francesco Iannuzzelli

Events sitemap

parent 364a670e
......@@ -107,7 +107,7 @@ class Events
public function EventsAll()
{
$sqlstr = "SELECT id_event,UNIX_TIMESTAMP(start_date) AS start_date_ts
FROM events WHERE approved=1";
FROM events WHERE approved=1 ORDER BY start_date DESC";
$rows = array();
$db =& Db::globaldb();
$db->QueryExe($rows, $sqlstr);
......
......@@ -170,6 +170,22 @@ class Sitemap
$index .= "<lastmod>" . $this->DateISO8601($now) . "</lastmod>\n";
$index .= "</sitemap>\n";
}
// events
include_once(SERVER_ROOT."/../classes/events.php");
$ee = new Events();
$urls_events = array();
$events = $ee->EventsAll();
foreach($events as $event)
{
$url = $this->Url("events",array('id'=>$event['id_event'],'subtype'=>'event'),true);
$event_ts = $event['start_date_ts'] > $now ? $now : $event['start_date_ts'];
$urls_events[] = array('type'=>'article','url'=>$url,'lastmod_ts'=>$event_ts);
}
$events_map = $this->WriteMap($urls_events,$this->priorities['article'],"always","events");
$index .= "<sitemap>\n";
$index .= "<loc>{$events_map}</loc>\n";
$index .= "<lastmod>" . $this->DateISO8601($now) . "</lastmod>\n";
$index .= "</sitemap>\n";
// topics
$topics = $tt->NoDomains();
$fm = new FileManager();
......@@ -294,9 +310,9 @@ class Sitemap
}
}
private function Url($type,$params=array())
private function Url($type,$params=array(),$global=false)
{
return $this->irl->PublicUrlTopic($type,$params,$this->topic);
return $global? $this->irl->PublicUrlGlobal($type, $params) : $this->irl->PublicUrlTopic($type,$params,$this->topic);
}
private function WriteMap($urls,$priority,$changefreq,$type)
......
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