Mercurial > hg > fapweb
view compos.inc.php @ 472:1eabbd70cd25
Add skipping button.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 06 Dec 2013 22:28:23 +0200 |
parents | c30f5bcb71fd |
children | 532cebd9c9f2 |
line wrap: on
line source
<? // // FAPWeb Simple Demoparty System // Competitions page // (C) Copyright 2012-2013 Tecnic Software productions (TNSP) // echo stGetSetting("compoDescription"); function stConvSwitchMode(&$str, &$mode, $newMode) { if ($newMode != $mode) { if ($mode != "") $str .= "\n</".$mode.">\n"; $mode = $newMode; if ($mode != "") $str .= "<".$mode.">\n"; } } function stConvertCompoDesc($desc) { global $stDescConversion; $str = ""; $mode = ""; foreach (explode("\n", $desc) as $line) { if (preg_match("/^\s*\s*\*(.+)$/", $line, $m)) { stConvSwitchMode($str, $mode, "ol"); $str .= "<li>".$m[1]."</li>\n"; } else if (preg_match("/^\s*-\s*(.+)$/", $line, $m)) { stConvSwitchMode($str, $mode, "ul"); $str .= "<li>".$m[1]."</li>\n"; } else { stConvSwitchMode($str, $mode, "p"); $str .= $line; } } stConvSwitchMode($str, $mode, ""); return $str; } $sql = "SELECT id,name FROM compos WHERE visible<>0 ORDER BY id ASC"; if (($res = stExecSQL($sql)) !== FALSE) { $list = array(); foreach ($res as $item) { $list[] = "<a href=\"#compo".$item["id"]."\">".chentities($item["name"])."</a>"; } echo "<p class=\"compolist\">".join($list, " | ")."</p>"; } $sql = "SELECT * FROM compos WHERE visible<>0 ORDER BY id ASC"; if (($res = stExecSQL($sql)) !== FALSE) { foreach ($res as $item) { echo "<div id=\"compo".$item["id"]."\">\n". "<h2>".chentities($item["name"])."</h2>\n". stConvertCompoDesc($item["description"]). "</div>\n"; } } ?>