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.htm
executable file
·203 lines (172 loc) · 6.8 KB
/
informaciniai-pranesimai.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
title = "Informaciniai pranešimai"
url = "/informaciniai-pranesimai"
layout = "default"
is_hidden = 0
contentType = "html"
==
<?php
function onStart()
{
$filter=array();
$filterVals=array();
$filterParams=array();
$filter[]='active=1';
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;
}
}
$this['counties'] = Db::select('SELECT c.id, c.title, COUNT(n.id) AS cnt FROM county c LEFT JOIN notification n ON n.county=c.id GROUP BY c.id, c.title ORDER BY title');
$v=Db::select('SELECT COUNT(n.id) AS cnt FROM notification n WHERE n.county=0 AND n.active=1');
$this['v_cnt'] = $v[0]->cnt;
$v=Db::select('SELECT COUNT(n.id) AS cnt FROM notification n WHERE n.active=1');
$this['t_cnt'] = $v[0]->cnt;
if(isset($_GET['county'])){
$this['rss']='<link rel="alternate" type="application/rss+xml" title="Informaciniai pranešimai" href="http://atviras.vilnius.lt/informaciniai-pranesimai-rss?county='.intval($_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', $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', $filterVals);
}
$rssFilter=array();
foreach($filterVals as $k=>$f){
if($k=='county')
$rssFilter['county']=$f;
else
$rssFilter['filter['.$k.']']=$f;
}
$this['rssFilter']=http_build_query($rssFilter);
$this['rss']='<link rel="alternate" type="application/rss+xml" title="Informaciniai pranešimai" href="http://atviras.vilnius.lt/informaciniai-pranesimai-rss" />';
}
?>
==
<style type="text/css">
.counties{
margin:0;
padding:0;
}
.counties .filter a{
display:block;
padding:10px;
margin: 0px 5px 5px 0px;
width:30%;
float:left;
border:3px solid #16a085;
}
.counties .filter a:hover{
color:#fff;
background:#16a085;
}
.type {
display:block;
height: 68px;
width: 80px;
}
.treePermit{
background-image:url('{{ 'assets/images/medziai.png'|theme }}');
background-repeat:no-repeat;
background-size: contain;
}
.planning{
background-image:url('{{ 'assets/images/planai.png'|theme }}');
background-repeat:no-repeat;
background-size: contain;
}
</style>
<div class="container">
<div class="row">
<div class="col-md-12">
<h3>Seniūnijos</h3>
<div class="counties">
<div class="filter"><a href="/informaciniai-pranesimai">Visos ({{ t_cnt }})</a></div>
<div class="filter"><a href="?county=0">Nenurodyta ({{ v_cnt }})</a></div>
{% for c in counties %}
<div class="filter"><a href="?county={{ c.id }}">{{ c.title }} ({{ c.cnt }})</a></div>
{% endfor %}
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{% if all %}
<h5>Rodomi paskutiniai 50 pranešimų iš visų seniūnijų</h5>
{% else %}
<h5>{{ county.title }}</h5>
{% if county.subscription!='' %}
{% endif %}
{% endif %}
</div>
</div>
</div>
<form method="get">
{% if all %}
{% else %}
<input type="hidden" name="county" value="{{ county.id }}" />
{% endif %}
<table class="table table-condensed">
<tr>
<th width="130">Data</th>
<!-- <th width="250">Gavėjas</th> -->
<th>Tipas</th>
<th width="300">Informacija</th>
{% if all %}
<th>Seniūnija</th>
{% endif %}
<th width="300">Adresas</th>
</tr>
<tr>
<th></th>
<!--<th><input type="text" name="filter[receiver]" value="{{ receiver }}" /></th>-->
<th></th>
<th><input type="text" name="filter[planned_work]" value="{{ planned_work }}" /></th>
{% if all %}
<th></th>
{% endif %}
<th width="300"><input type="text" name="filter[address]" value="{{ address }}" /></th>
</tr>
{% for n in notifications %}
<tr>
<td>{{ n.date|slice(0,16) }}</td>
<!--<td>{{ n.receiver|e }}</td>-->
<td><div class="type {% if n.type=="Kirtimų leidimas" %}treePermit{% else %}planning{% endif %}" title="{{ n.content }}"></div></td>
<td>Dokumento numeris: {{ n.number }}:<br />{{ n.planned_work|raw }}</td>
{% if all %}
<td>{{ n.county }}</td>
{% endif %}
<td>{{ n.address }}, {{ n.address2 }}</td>
</tr>
{% endfor %}
</table>
<input type="submit" class="hide" />
</form>
<div class="container">
<div class="row">
<div class="col-md-12">
<p><a href="/informaciniai-pranesimai-rss?{{ rssFilter }}">RSS prenumerata</a></p>
</div>
</div>
</div>