Mercurial > hg > fapweb
annotate showajax.php @ 387:3cc078b17260
Show backend work.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 05 Dec 2013 09:06:06 +0200 |
parents | 0693747fa7d3 |
children | 0c1798c9d486 |
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 |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
67 // |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
68 // Initialize |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
69 // |
126
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
70 stSetupCacheControl(); |
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
71 |
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
72 if (!stConnectSQLDB()) |
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
73 die("Could not connect to SQL database."); |
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
74 |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
75 stReloadDisplayVars(); |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
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 // |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
79 // 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
|
80 // |
145
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
81 $updated = FALSE; |
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
82 |
152 | 83 |
84 // Temporary slides are handled globally | |
145
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
85 if (stGetDisplayVar("tempDuration") > 0 && |
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
86 stGetDisplayVar("tempSlide") > 0 && |
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
87 stGetDisplayVar("tempSlideSet")) |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
88 { |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
89 $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
|
90 stGetDisplayVar("tempSlide")); |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
91 |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
92 if (($res = stFetchSQL($sql)) !== false) |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
93 { |
145
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
94 stSetDisplayVar("tempSlideSet", FALSE); |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
95 stSetDisplayVar("activeSlideMode", SMODE_ROTATE); |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
96 stSetDisplayVar("activeSlide", stGetDisplayVar("tempSlide")); |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
97 stSetDisplayVar("activeSlideExpire", time() + stGetDisplayVar("tempDuration")); |
145
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
98 $updated = TRUE; |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
99 } |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
100 } |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
101 else |
152 | 102 // 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
|
103 switch (stGetDisplayVar("showMode")) |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
104 { |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
105 case SMODE_ROTATE: |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
106 default: |
152 | 107 // |
108 // Rotation / normal slide show mode | |
109 // | |
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 |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
112 if (stGetDisplayVar("rotateList") == 0) |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
113 { |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
114 stSetDisplayVar("rotateList", 1); |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
115 stSetDisplayVar("activeSlideExpire", 0); |
145
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
116 $updated = TRUE; |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
117 } |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
118 |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
119 if (time() >= stGetDisplayVar("activeSlideExpire") && |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
120 stGetDisplayVar("rotateList") > 0) |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
121 { |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
122 // 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
|
123 $list = stGetDisplayVar("rotateList"); |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
124 $sql = stPrepareSQL( |
356
965d43fffdd2
Order slides in rotation list by slide order_num.
Matti Hamalainen <ccr@tnsp.org>
parents:
233
diff
changeset
|
125 "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
|
126 $list); |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
127 |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
128 if (($slideList = stExecSQL($sql)) !== false) |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
129 { |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
130 // Get slide at current index |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
131 $slides = array(); |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
132 foreach ($slideList as $slide) |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
133 $slides[] = $slide; |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
134 |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
135 $index = stGetDisplayVar("rotateListIndex"); |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
136 if (count($slides) > $index) |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
137 { |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
138 $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
|
139 if ($slide_id != stGetDisplayVar("activeSlide")) |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
140 { |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
141 stSetDisplayVar("activeSlide", $slide_id); |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
142 stSetDisplayVar("activeSlideExpire", time() + stGetDisplayVar("rotateDuration")); |
145
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
143 $updated = TRUE; |
143
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 } |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
146 |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
147 // Rotate to next slide |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
148 if (++$index >= count($slides)) |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
149 $index = 0; |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
150 |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
151 stSetDisplayVar("rotateListIndex", $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 } |
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
154 break; |
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 case SMODE_COMPO: |
152 | 157 // |
158 // Competition mode, is controlled from admin UI, so we donẗ | |
159 // actually do anything here. | |
160 // | |
387 | 161 if (time() >= stGetDisplayVar("activeSlideExpire")) |
162 stSetDisplayVar("activeSlideMode", SMODE_COMPO); | |
163 | |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
164 break; |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
165 } |
126
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
166 |
152 | 167 // 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
|
168 if ($updated) |
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
169 stSetDisplayVar("lastUpdate", time()); |
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
170 |
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
171 |
152 | 172 // |
173 // Serve the request | |
174 // | |
144
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
175 $type = stGetRequestItem("type"); |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
176 switch (stGetRequestItem("action")) |
126
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
177 { |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
178 case "check": |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
179 // Check if there has been any change |
145
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
180 $changed = stGetRequestItem("lastUpdate") != stGetDisplayVar("lastUpdate"); |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
181 echo $changed ? "changed" : "nochange"; |
126
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
182 break; |
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
183 |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
184 case "get": |
144
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
185 switch ($type) |
126
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
186 { |
145
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
187 case "update": |
66b485431cac
Change how slides are updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
144
diff
changeset
|
188 echo stGetDisplayVar("lastUpdate"); |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
189 break; |
144
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
190 |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
191 case "slide": |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
192 // Based on the currently active mode ... |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
193 switch (stGetDisplayVar("activeSlideMode")) |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
194 { |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
195 case SMODE_ROTATE: |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
196 // Slide rotation mode, display currently active slide |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
197 if (stGetDisplayVar("activeSlide") > 0) |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
198 { |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
199 $sql = stPrepareSQL("SELECT * FROM displaySlides WHERE id=%d", |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
200 stGetDisplayVar("activeSlide")); |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
201 |
144
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
202 if (($slide = stFetchSQL($sql)) !== false) |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
203 stPrintRotationSlide($slide); |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
204 } |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
205 else |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
206 { |
233 | 207 echo "<div class=\"guru\">Software Failure. Press left mouse button to continue.<br />Guru Meditation #00000004.0000AAC0</div>\n"; |
144
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
208 } |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
209 break; |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
210 |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
211 case SMODE_COMPO: |
152 | 212 // Competition mode, show entry data |
387 | 213 $compo_id = stGetDisplayVar("compoID"); |
144
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
214 $compo = stFetchSQL(stPrepareSQL( |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
215 "SELECT * FROM compos WHERE id=%d", |
387 | 216 $compo_id)); |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
217 |
144
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
218 $prev = stFetchSQL(stPrepareSQL( |
387 | 219 "SELECT * FROM entries WHERE compo_id=%d AND show_id=%d", |
220 $compo_id, stGetDisplayVar("compoPrevEntry"))); | |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
221 |
144
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
222 $entry = stFetchSQL(stPrepareSQL( |
387 | 223 "SELECT * FROM entries WHERE compo_id=%d AND show_id=%d", |
224 $compo_id, stGetDisplayVar("compoCurrEntry"))); | |
144
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
225 |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
226 if ($compo !== false) |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
227 stPrintCompoSlide($compo, $entry, $prev); |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
228 break; |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
229 } |
c030c3cf0d80
More work on display system.
Matti Hamalainen <ccr@tnsp.org>
parents:
143
diff
changeset
|
230 break; |
126
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
231 } |
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
232 break; |
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
233 |
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
234 default: |
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
235 stSetStatus(404, "Not Found"); |
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
236 break; |
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
237 } |
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
238 |
139
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
239 |
75cf14ee99a7
More work on party information system.
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
240 // Save changed variables |
143
20893a5442b7
Move some functions to site module, and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
142
diff
changeset
|
241 stSaveDisplayVars(); |
211
5bae42020034
Factorize some code into msitegen.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
242 |
5bae42020034
Factorize some code into msitegen.
Matti Hamalainen <ccr@tnsp.org>
parents:
175
diff
changeset
|
243 stDumpAJAXStatusErrors(); |
126
71c35d5302c2
More work on cleanups, and AJAX modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
244 ?> |