Mercurial > hg > fapweb
annotate pages/compos.inc.php @ 662:2e0b11277f2f
Use more descriptive anchor IDs.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 05 Nov 2014 19:04:03 +0200 |
parents | f1016ed4b05b |
children | 7091b0c6c7c1 |
rev | line source |
---|---|
14
e36c4d2b09c4
Fix settings to work, clean up the code, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
8
diff
changeset
|
1 <? |
160 | 2 // |
571
ce11ea112a65
Change the header blurb a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
565
diff
changeset
|
3 // FAPWeb - Simple Web-based Demoparty Management System |
160 | 4 // Competitions page |
565 | 5 // (C) Copyright 2012-2014 Tecnic Software productions (TNSP) |
160 | 6 // |
662
2e0b11277f2f
Use more descriptive anchor IDs.
Matti Hamalainen <ccr@tnsp.org>
parents:
661
diff
changeset
|
7 function stConvertNameToID($name) |
2e0b11277f2f
Use more descriptive anchor IDs.
Matti Hamalainen <ccr@tnsp.org>
parents:
661
diff
changeset
|
8 { |
2e0b11277f2f
Use more descriptive anchor IDs.
Matti Hamalainen <ccr@tnsp.org>
parents:
661
diff
changeset
|
9 return preg_replace("/[^a-z0-9_]/", "", strtolower($name)); |
2e0b11277f2f
Use more descriptive anchor IDs.
Matti Hamalainen <ccr@tnsp.org>
parents:
661
diff
changeset
|
10 } |
2e0b11277f2f
Use more descriptive anchor IDs.
Matti Hamalainen <ccr@tnsp.org>
parents:
661
diff
changeset
|
11 |
2e0b11277f2f
Use more descriptive anchor IDs.
Matti Hamalainen <ccr@tnsp.org>
parents:
661
diff
changeset
|
12 |
587
135efe0c3b49
Add new options for hiding/showing compo and schedule pages.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
13 if (stChkSetting("showCompos")) |
193 | 14 { |
661
f1016ed4b05b
Add back to page top link for each compo description.
Matti Hamalainen <ccr@tnsp.org>
parents:
587
diff
changeset
|
15 echo |
f1016ed4b05b
Add back to page top link for each compo description.
Matti Hamalainen <ccr@tnsp.org>
parents:
587
diff
changeset
|
16 "<div id=\"pageTop\"></div>\n". |
f1016ed4b05b
Add back to page top link for each compo description.
Matti Hamalainen <ccr@tnsp.org>
parents:
587
diff
changeset
|
17 stGetSetting("compoDescription"); |
587
135efe0c3b49
Add new options for hiding/showing compo and schedule pages.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
18 |
135efe0c3b49
Add new options for hiding/showing compo and schedule pages.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
19 $sql = "SELECT id,name FROM compos WHERE visible<>0 ORDER BY id ASC"; |
135efe0c3b49
Add new options for hiding/showing compo and schedule pages.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
20 |
135efe0c3b49
Add new options for hiding/showing compo and schedule pages.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
21 if (($res = stExecSQL($sql)) !== FALSE) |
193 | 22 { |
587
135efe0c3b49
Add new options for hiding/showing compo and schedule pages.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
23 $list = array(); |
135efe0c3b49
Add new options for hiding/showing compo and schedule pages.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
24 foreach ($res as $item) |
135efe0c3b49
Add new options for hiding/showing compo and schedule pages.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
25 { |
662
2e0b11277f2f
Use more descriptive anchor IDs.
Matti Hamalainen <ccr@tnsp.org>
parents:
661
diff
changeset
|
26 $list[] = "<a class=\"compo\" href=\"#". |
2e0b11277f2f
Use more descriptive anchor IDs.
Matti Hamalainen <ccr@tnsp.org>
parents:
661
diff
changeset
|
27 stConvertNameToID($item["name"])."\">". |
2e0b11277f2f
Use more descriptive anchor IDs.
Matti Hamalainen <ccr@tnsp.org>
parents:
661
diff
changeset
|
28 chentities($item["name"])."</a>"; |
587
135efe0c3b49
Add new options for hiding/showing compo and schedule pages.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
29 } |
135efe0c3b49
Add new options for hiding/showing compo and schedule pages.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
30 echo "<div class=\"compolist\">".join($list, "<span class=\"composep\"> | </span>")."</div>"; |
193 | 31 } |
32 | |
33 | |
587
135efe0c3b49
Add new options for hiding/showing compo and schedule pages.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
34 $sql = "SELECT * FROM compos WHERE visible<>0 ORDER BY id ASC"; |
8
4c5f651aa107
Migrate certain settings to SQL database, cleanups, etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
35 |
587
135efe0c3b49
Add new options for hiding/showing compo and schedule pages.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
36 if (($res = stExecSQL($sql)) !== FALSE) |
0 | 37 { |
587
135efe0c3b49
Add new options for hiding/showing compo and schedule pages.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
38 foreach ($res as $item) |
135efe0c3b49
Add new options for hiding/showing compo and schedule pages.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
39 { |
135efe0c3b49
Add new options for hiding/showing compo and schedule pages.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
40 echo |
662
2e0b11277f2f
Use more descriptive anchor IDs.
Matti Hamalainen <ccr@tnsp.org>
parents:
661
diff
changeset
|
41 "<div id=\"".stConvertNameToID($item["name"])."\">\n". |
587
135efe0c3b49
Add new options for hiding/showing compo and schedule pages.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
42 "<h2>".chentities($item["name"])."</h2>\n". |
135efe0c3b49
Add new options for hiding/showing compo and schedule pages.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
43 stConvertCommonDesc($item["description"], FALSE). |
661
f1016ed4b05b
Add back to page top link for each compo description.
Matti Hamalainen <ccr@tnsp.org>
parents:
587
diff
changeset
|
44 "<div class=\"backToTop\"><a href=\"#pageTop\">Back</a></div>\n". |
587
135efe0c3b49
Add new options for hiding/showing compo and schedule pages.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
45 "</div>\n"; |
135efe0c3b49
Add new options for hiding/showing compo and schedule pages.
Matti Hamalainen <ccr@tnsp.org>
parents:
571
diff
changeset
|
46 } |
0 | 47 } |
48 } | |
49 ?> |