-
Notifications
You must be signed in to change notification settings - Fork 9
/
favorites_mobile.tpl
54 lines (41 loc) · 1.84 KB
/
favorites_mobile.tpl
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
{{php}}
header('Content-type: application/json');
{{/php}}
{{ $sections = array() }}
{{ $articles = array() }}
{{ list_articles length="50" constraints="issue greater 2" }}
{{ if $gimme->section->url_name == "alltag" or $gimme->section->url_name == "politik" or $gimme->section->url_name == "kultur" }}
{{ if !$articles[$gimme->section->url_name] }}
{{ $articles[$gimme->section->url_name] = array() }}
{{ /if }}
{{ $article = array() }}
{{ $article["url"] = {{ uri options="article" }} }}
{{ $article["time"] = $gimme->article->publish_date|strtotime }}
{{ $articles[$gimme->section->url_name][] = $article }}
{{ if !$sections[$gimme->section->url_name] }}
{{ $sections[$gimme->section->url_name] = array() }}
{{ $sections[$gimme->section->url_name]["url"] = "/mobile/"|cat:$gimme->section->url_name }}
{{ $sections[$gimme->section->url_name]["time"] = $gimme->article->publish_date|strtotime }}
{{ else }}
{{ if $article["time"] > $sections[$gimme->section->url_name]["time"] }} {{ $sections[$gimme->section->url_name]["time"] = $article["time"] }} {{ /if }}
{{ /if }}
{{ /if }}
{{ /list_articles }}
{{ $sections["favorites"] = array() }}
{{ $sections["favorites"]["url"] = "/favorites" }}
{{ $sections["favorites"]["time"] = $favorites_time }}
{{ $articles["favorites"] = array() }}
{{foreach from=$faves item=article}}
{{ $articles["favorites"][] = $article }}
{{/foreach}}
{{ $sections["front"] = array() }}
{{ $sections["front"]["url"] = "/" }}
{{ $sections["front"]["time"] = 0 }}
{{foreach from=$sections item=section}}
{{ if $section["time"] > $sections["front"]["time"] }} {{ $sections["front"]["time"] = $section["time"] }} {{ /if }}
{{/foreach}}
{{ $articles["sections"] = array() }}
{{foreach from=$sections item=section}}
{{ $articles["sections"][] = $section }}
{{/foreach}}
{{ $view->json($articles) }}