Mercurial > hg > lukkari
changeset 129:b9ebc24f27fd
Move some code around a bit, to make mobile mode integration easier.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 27 Aug 2014 16:36:39 +0300 |
parents | 0f451151b9f1 |
children | 7cfe0770168f |
files | index.php |
diffstat | 1 files changed, 45 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/index.php Wed Aug 27 16:32:37 2014 +0300 +++ b/index.php Wed Aug 27 16:36:39 2014 +0300 @@ -359,9 +359,14 @@ -// Check given parameters +// +// Main code begins +// +// Check given parameters: // Language must be the first setting to be validated, // so that the translation support works properly. +// + if (isset($_GET["lang"])) { $tmp = strtolower($_GET["lang"]); @@ -457,14 +462,11 @@ } -// -// Main code starts -// - // Read classfile if (($classes = lukReadClassFile($classIDFile, &$timestamp)) === false) stError(stQM("classListNotFound")); + // Read class data $dataFile = $cachePath.$luokka.".data"; if (!file_exists($dataFile)) @@ -482,6 +484,8 @@ // Set some variables $pageTitle = $haveData ? $luokka." / ".join("; ", $classInfo["info"]) : $luokka; + +// Create references to mobile device (Apple touch) icons $extra = ""; foreach (array(57 => FALSE, 76 => TRUE, 114 => TRUE, 120 => TRUE, 152 => TRUE) as $iconSize => $addSize) { @@ -490,8 +494,44 @@ "href=\"img/icon-".$iconSize."-precomposed.png\" />\n"; } + +// Start printing the page cmPrintPageHeader($pageTitle, $extra); + +// Info box +if (!$mobileMode) +{ + echo + "<div id=\"infobox\">\n". + " <div id=\"ctitle\">OAMK Lukkari v".$pageVersion."</div>\n". + " <div id=\"csssel\">".cmQM("Style").": "; + + foreach ($pageCSSAlts as $name => $id) + { + echo + "<a ".(($pageCSSIndex == $id) ? " class=\"selected\"" : ""). + "href=\"".$baseURI."?css=".$id."\">".$name."</a>"; + } + + echo + "</div>\n". + " <div id=\"clang\">"; + + foreach ($pageLanguages as $id) + { + echo + "<a ".(($pageLang == $id) ? " class=\"selected\"" : ""). + "href=\"".$baseURI."?lang=".$id."\">".$id."</a>"; + } + + echo "</div>\n"; +} + +echo "</div>\n"; + + +// Additional controls echo "<form id=\"controls\" action=\"".$baseURI."\" method=\"get\">\n". " <table>\n". @@ -556,35 +596,6 @@ //" <div style=\"color: red;\">".cmQM("beta", $pageVersion)."</div>\n". "</div>\n"; -if (!$mobileMode) -{ - echo - "<div id=\"infobox\">\n". - " <div id=\"ctitle\">OAMK Lukkari v".$pageVersion."</div>\n". - " <div id=\"csssel\">".cmQM("Style").": "; - - foreach ($pageCSSAlts as $name => $id) - { - echo - "<a ".(($pageCSSIndex == $id) ? " class=\"selected\"" : ""). - "href=\"".$baseURI."?css=".$id."\">".$name."</a>"; - } - - echo - "</div>\n". - " <div id=\"clang\">"; - - foreach ($pageLanguages as $id) - { - echo - "<a ".(($pageLang == $id) ? " class=\"selected\"" : ""). - "href=\"".$baseURI."?lang=".$id."\">".$id."</a>"; - } - - echo "</div>\n"; -} - -echo "</div>\n"; cmPrintPageFooter();