Mercurial > hg > fapweb
annotate showajax.php @ 407:eaea1ae2bc3d
Moar work.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 05 Dec 2013 16:57:38 +0200 |
parents | 14cdbeb331b6 |
children | b320959477ef |
rev | line source |
---|---|
126
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
1 <? |
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
2 // |
136
aeebfedb5709
Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
3 // FAPWeb Simple Demoparty System |
aeebfedb5709
Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
4 // Party information display system AJAX backend module |
aeebfedb5709
Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
5 // (C) Copyright 2012-2013 Tecnic Software productions (TNSP) |
126
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
6 // |
175
8df523e6326a
User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents:
163
diff
changeset
|
7 require_once "mconfig.inc.php"; |
8df523e6326a
User require_once instead of require.
Matti Hamalainen <ccr@tnsp.org>
parents:
163
diff
changeset
|
8 require_once "msite.inc.php"; |
126
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
9 |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
10 |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
11 function stPrintCompoEntry($entry, $class, $compo, $title = false) |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
12 { |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
13 echo |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
14 " <div class=\"".$class."\">\n"; |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
15 |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
16 if ($title !== false) |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
17 echo |
387 | 18 " <div class=\"entryTitle\">".$title."</div>\n"; |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
19 |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
20 echo |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
21 " <div class=\"entryIndex\">#".$entry["show_id"]."</div>\n". |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
22 " <div class=\"entryName\">".chentities($entry["name"])."</div>\n"; |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
23 |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
24 if ($compo["showAuthors"]) |
387 | 25 { |
26 if ($title === false) | |
27 echo " <div class=\"entryBy\">by</div>\n"; | |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
28 echo " <div class=\"entryAuthor\">".chentities($entry["author"])."</div>\n"; |
387 | 29 } |
30 | |
31 if ($title === false) | |
32 echo " <div class=\"entryInfo\">".chentities($entry["info"])."</div>\n"; | |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
33 |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
34 echo |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
35 " </div>\n"; |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
36 } |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
37 |
163 | 38 |
140
20ca8edfb01a
Rename some settings and variables.
Matti Hamalainen <ccr@tnsp.org>
parents:
139
diff
changeset
|
39 function stPrintCompoSlide($compo, $entry, $prev) |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
40 { |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
41 echo |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
42 " <div class=\"compoHeader\">\n". |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
43 " <img src=\"img/fapsm.png\" /><br />\n". |
387 | 44 " <div class=\"compoTitle\">".chentities($compo["name"])." competition</div>\n". |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
45 " </div>\n"; |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
46 |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
47 if ($entry !== false) |
386 | 48 stPrintCompoEntry($entry, "compoNext", $compo, false); |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
49 |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
50 if ($prev !== false) |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
51 stPrintCompoEntry($prev, "compoPrev", $compo, "Previous entry"); |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
52 } |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
53 |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
54 |
140
20ca8edfb01a
Rename some settings and variables.
Matti Hamalainen <ccr@tnsp.org>
parents:
139
diff
changeset
|
55 function stPrintRotationSlide($slide) |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
56 { |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
57 echo |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
58 " <div class=\"showHeader\">\n". |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
59 " <img src=\"img/fapsm.png\" /><br />\n". |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
60 " </div>\n". |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
61 " <div class=\"showText\">\n". |
140
20ca8edfb01a
Rename some settings and variables.
Matti Hamalainen <ccr@tnsp.org>
parents:
139
diff
changeset
|
62 $slide["text"]. |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
63 " </div>\n"; |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
64 } |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
65 |
163 | 66 |
391 | 67 function stGuruMeditation() |
68 { | |
69 echo | |
70 "<div class=\"guru\">". | |
71 "Software Failure. Press left mouse button to continue.<br />". | |
72 "Guru Meditation #00000004.0000AAC0". | |
73 "</div>\n"; | |
74 } | |
75 | |
76 | |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
77 // |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
78 // Initialize |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
79 // |
126
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
80 stSetupCacheControl(); |
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
81 |
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
82 if (!stConnectSQLDB()) |
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
83 die("Could not connect to SQL database."); |
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
84 |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
85 stReloadDisplayVars(); |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
86 |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
87 |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
88 // |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
89 // Check if the slide needs updating? |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
90 // |
145
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
91 $updated = FALSE; |
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
92 |
391 | 93 if (stGetDisplayVar("showMode") == SMODE_DISABLED) |
94 { | |
95 stGuruMeditation(); | |
96 exit; | |
97 } | |
152 | 98 |
99 // Temporary slides are handled globally | |
145
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
100 if (stGetDisplayVar("tempDuration") > 0 && |
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
101 stGetDisplayVar("tempSlide") > 0 && |
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
102 stGetDisplayVar("tempSlideSet")) |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
103 { |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
104 $sql = stPrepareSQL("SELECT * FROM displaySlides WHERE id=%d", |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
105 stGetDisplayVar("tempSlide")); |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
106 |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
107 if (($res = stFetchSQL($sql)) !== false) |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
108 { |
145
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
109 stSetDisplayVar("tempSlideSet", FALSE); |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
110 stSetDisplayVar("activeSlideMode", SMODE_ROTATE); |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
111 stSetDisplayVar("activeSlide", stGetDisplayVar("tempSlide")); |
393 | 112 stSetDisplayVar("activeSlideExpire", time() + stGetDisplayVar("tempDuration") * 60); |
145
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
113 $updated = TRUE; |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
114 } |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
115 } |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
116 else |
152 | 117 // Otherwise we act according to global show mode |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
118 switch (stGetDisplayVar("showMode")) |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
119 { |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
120 case SMODE_ROTATE: |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
121 default: |
152 | 122 // |
123 // Rotation / normal slide show mode | |
124 // | |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
125 stSetDisplayVar("activeSlideMode", SMODE_ROTATE); |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
126 |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
127 if (stGetDisplayVar("rotateList") == 0) |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
128 { |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
129 stSetDisplayVar("rotateList", 1); |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
130 stSetDisplayVar("activeSlideExpire", 0); |
145
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
131 $updated = TRUE; |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
132 } |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
133 |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
134 if (time() >= stGetDisplayVar("activeSlideExpire") && |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
135 stGetDisplayVar("rotateList") > 0) |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
136 { |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
137 // Get list of slides from active rotation list |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
138 $list = stGetDisplayVar("rotateList"); |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
139 $sql = stPrepareSQL( |
356
965d43fffdd2
Order slides in rotation list by slide order_num.
Matti Hamalainen <ccr@tnsp.org>
parents:
233
diff
changeset
|
140 "SELECT * FROM displayListSlides WHERE list_id=%d ORDER BY order_num", |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
141 $list); |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
142 |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
143 if (($slideList = stExecSQL($sql)) !== false) |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
144 { |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
145 // Get slide at current index |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
146 $slides = array(); |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
147 foreach ($slideList as $slide) |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
148 $slides[] = $slide; |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
149 |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
150 $index = stGetDisplayVar("rotateListIndex"); |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
151 if (count($slides) > $index) |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
152 { |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
153 $slide_id = $slides[$index]["slide_id"]; |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
154 if ($slide_id != stGetDisplayVar("activeSlide")) |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
155 { |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
156 stSetDisplayVar("activeSlide", $slide_id); |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
157 stSetDisplayVar("activeSlideExpire", time() + stGetDisplayVar("rotateDuration")); |
145
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
158 $updated = TRUE; |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
159 } |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
160 } |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
161 |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
162 // Rotate to next slide |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
163 if (++$index >= count($slides)) |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
164 $index = 0; |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
165 |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
166 stSetDisplayVar("rotateListIndex", $index); |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
167 } |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
168 } |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
169 break; |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
170 |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
171 case SMODE_COMPO: |
152 | 172 // |
173 // Competition mode, is controlled from admin UI, so we donẗ | |
174 // actually do anything here. | |
175 // | |
387 | 176 if (time() >= stGetDisplayVar("activeSlideExpire")) |
177 stSetDisplayVar("activeSlideMode", SMODE_COMPO); | |
178 | |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
179 break; |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
180 } |
126
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
181 |
152 | 182 // Check if we need to update the "last updated" timestamp |
145
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
183 if ($updated) |
407 | 184 stDisplayUpdated(); |
145
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
185 |
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
186 |
152 | 187 // |
188 // Serve the request | |
189 // | |
144
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
190 $type = stGetRequestItem("type"); |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
191 switch (stGetRequestItem("action")) |
126
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
192 { |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
193 case "check": |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
194 // Check if there has been any change |
145
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
195 $changed = stGetRequestItem("lastUpdate") != stGetDisplayVar("lastUpdate"); |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
196 echo $changed ? "changed" : "nochange"; |
126
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
197 break; |
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
198 |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
199 case "get": |
144
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
200 switch ($type) |
126
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
201 { |
145
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
202 case "update": |
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
203 echo stGetDisplayVar("lastUpdate"); |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
204 break; |
144
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
205 |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
206 case "slide": |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
207 // Based on the currently active mode ... |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
208 switch (stGetDisplayVar("activeSlideMode")) |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
209 { |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
210 case SMODE_ROTATE: |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
211 // Slide rotation mode, display currently active slide |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
212 if (stGetDisplayVar("activeSlide") > 0) |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
213 { |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
214 $sql = stPrepareSQL("SELECT * FROM displaySlides WHERE id=%d", |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
215 stGetDisplayVar("activeSlide")); |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
216 |
144
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
217 if (($slide = stFetchSQL($sql)) !== false) |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
218 stPrintRotationSlide($slide); |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
219 } |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
220 else |
391 | 221 stGuruMeditation(); |
144
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
222 break; |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
223 |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
224 case SMODE_COMPO: |
152 | 225 // Competition mode, show entry data |
387 | 226 $compo_id = stGetDisplayVar("compoID"); |
144
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
227 $compo = stFetchSQL(stPrepareSQL( |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
228 "SELECT * FROM compos WHERE id=%d", |
387 | 229 $compo_id)); |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
230 |
144
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
231 $prev = stFetchSQL(stPrepareSQL( |
387 | 232 "SELECT * FROM entries WHERE compo_id=%d AND show_id=%d", |
233 $compo_id, stGetDisplayVar("compoPrevEntry"))); | |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
234 |
144
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
235 $entry = stFetchSQL(stPrepareSQL( |
387 | 236 "SELECT * FROM entries WHERE compo_id=%d AND show_id=%d", |
237 $compo_id, stGetDisplayVar("compoCurrEntry"))); | |
144
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
238 |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
239 if ($compo !== false) |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
240 stPrintCompoSlide($compo, $entry, $prev); |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
241 break; |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
242 } |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
243 break; |
126
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
244 } |
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
245 break; |
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
246 |
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
247 default: |
391 | 248 stGuruMeditation(); |
126
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
249 break; |
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
250 } |
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
251 |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
252 |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
253 // Save changed variables |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
254 stSaveDisplayVars(); |
211
5bae42020034
Factorize some code into msitegen.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
255 |
5bae42020034
Factorize some code into msitegen.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
256 stDumpAJAXStatusErrors(); |
126
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
257 ?> |