This repository has been archived by the owner on Feb 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinformaciniai-pranesimai-rss.htm
executable file
·97 lines (88 loc) · 3.49 KB
/
informaciniai-pranesimai-rss.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
title = "Informaciniai pranešimai RSS"
url = "/informaciniai-pranesimai-rss"
is_hidden = 0
contentType = "rss"
==
<?php
function onStart()
{
$filter=array();
$filterVals=array();
if(isset($_GET['filter']) && is_array($_GET['filter']))
foreach($_GET['filter'] as $k=>$f){
if(!empty($f))
switch($k){
case 'address':
/*$filterVals[$k]='%'.$f.'%';
$filter[]=" (address LIKE :".$k." OR address2 LIKE :".$k.") ";
break;*/
case 'receiver':
case 'planned_work':
case 'county':
$this[$k]=$f;
$filterVals[$k]='%'.$f.'%';
$filter[]=$k." LIKE :".$k;
break;
default:
break;
}
}
if(isset($_GET['county'])){
$filterVals['county']=intval($_GET['county']);
$this['notifications'] = Db::select('SELECT n.*, c.title AS county FROM notification n LEFT JOIN county c ON n.county=c.id
WHERE n.county=:county
AND ('.((count($filter)>0)?implode(" AND ", $filter):'1=1').')
ORDER BY date DESC LIMIT 50', $filterVals);
$county=Db::select('SELECT * FROM county c WHERE c.id=:county', ['county' => intval($_GET['county'])]);
$this['county'] = $county[0];
}
else{
$this['all']=true;
$this['notifications'] = Db::select('SELECT n.*, c.title AS county FROM notification n LEFT JOIN county c ON n.county=c.id
WHERE ('.((count($filter)>0)?implode(" AND ", $filter):'1=1').')
ORDER BY date DESC LIMIT 50');
}
echo '<?xml version="1.0" encoding="utf-8"?>';
}
?>
==
{{ xml }}
<rss version="2.0">
<channel>
{% if all %}
<title>Informaciniai pranešimai</title>
{% else %}
<title>{{ county.title }} - Informaciniai pranešimai</title>
{% endif %}
<description>Informacija apie įvairius dalykus vykstančius mieste.</description>
{% if all %}
<link>http://atviras.vilnius.lt/informaciniai-pranesimai-rss</link>
{% else %}
<link>http://atviras.vilnius.lt/informaciniai-pranesimai-rss?county={{ county.id }}</link>
{% endif %}
<category domain="atviras.vilnius.lt">Miestiečių informavimas</category>
<language>lt-lt</language>
<lastBuildDate>{{ lastUpdate | date("D, d M Y h:i:s O") }}</lastBuildDate>
<managingEditor>povilas.poderskis@vilnius.lt</managingEditor>
<pubDate>Sat, 22 Oct 2017 13:38:55 +0300</pubDate>
<webMaster>atviras@vilnius.lt</webMaster>
<generator>Atviras Vilnius</generator>
<image>
<url>http://atviras.vilnius.lt/themes/responsiv-flat/assets/images/logo.png</url>
<title>Atviras Vilnius</title>
<link>http://atviras.vilnius.lt</link>
<description>Atviras Vilnius</description>
</image>
{% for n in notifications %}
<item>
<title>{{ n.county }}, {{ n.address }}, {{ n.address2 }}</title>
<description>{{ n.content }} {{ n.planned_work|raw }}</description>
<link>http://atviras.vilnius.lt/pranesimas/{{ n.id }}</link>
<category domain="atviras.vilnius.lt">{{ n.type }}</category>
<comments>http://www.feedforall.com/forum</comments>
<pubDate>{{ n.date | date("D, d M Y h:i:s O") }}</pubDate>
<author>{{ n.receiver }}</author>
</item>
{% endfor %}
</channel>
</rss>