Mercurial > hg > lukkari
changeset 98:6a7172b3a841
Update to match the main page API.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 22 Dec 2012 14:57:31 +0200 |
parents | acb600abc0c7 |
children | c77a48f6ad75 |
files | index.php |
diffstat | 1 files changed, 12 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/index.php Sat Dec 22 14:57:14 2012 +0200 +++ b/index.php Sat Dec 22 14:57:31 2012 +0200 @@ -22,7 +22,7 @@ "en" => array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"), ); -$lukTranslations = array( +$pageTranslations = array( "Original" => array("fi" => "Alkuperäinen"), "Next period" => array("fi" => "Seuraava periodi"), "Current period" => array("fi" => "Nykyinen periodi"), @@ -67,24 +67,6 @@ require "merrors.inc.php"; -// Translation function -function lukMsg($msg) -{ - global $lukTranslations, $pageLang; - - if (isset($lukTranslations[$msg]) && isset($lukTranslations[$msg][$pageLang])) - $str = $lukTranslations[$msg][$pageLang]; - else - $str = $msg; - - foreach (func_get_args() as $argn => $argv) - { - $str = preg_replace("/\%".$argn."/", $argv, $str); - } - return $str; -} - - function lukGetDayName($day) { global $lukDayNames, $pageLang; @@ -303,7 +285,7 @@ } else { - errorMsg(lukMsg("classNotSet", $classDefault)); + errorMsg(cmQM("classNotSet", $classDefault)); $luokka = $classDefault; } @@ -369,7 +351,7 @@ $dataFile = $cachePath.$luokka.".data"; if (!file_exists($dataFile)) { - errorMsg(lukMsg("classDataNotFound", lukChEntities($luokka))); + errorMsg(cmQM("classDataNotFound", lukChEntities($luokka))); $haveData = FALSE; } else @@ -406,7 +388,7 @@ { $out = "<p>".join("; ", $classInfo["general"])."</p>\n". - "<div>".lukMsg("viikossa", $classInfo["totalHours"])."</div>\n". + "<div>".cmQM("viikossa", $classInfo["totalHours"])."</div>\n". "<table class=\"timetable\">". " <tr>\n <th></th>\n"; @@ -469,7 +451,7 @@ // // $pageTitle = $haveData ? $luokka." / ".join("; ", $classInfo["info"]) : $luokka; -printPageHeader($pageTitle); +cmPrintPageHeader($pageTitle); echo "<form id=\"controls\" action=\"".$baseURI."\" method=\"get\"> <table> @@ -484,15 +466,15 @@ echo " </select> </th> - <th><input class=\"submit\" type=\"submit\" value=\"".lukMsg("Switch")."\" /></th> + <th><input class=\"submit\" type=\"submit\" value=\"".cmQM("Switch")."\" /></th> "; if (!$mobileMode) { echo " <th><a id=\"next\" class=\"textctrl\" href=\"".$baseURI.($nextPeriod ? "" : "?next")."\">". - ($nextPeriod ? lukMsg("Current period") : lukMsg("Next period"))."</a></th>\n". - " <th><a id=\"orig\" class=\"textctrl\" href=\"".$origBaseURI.$luokka.$origBaseExt."\">".lukMsg("Original")."</a></th>\n". + ($nextPeriod ? cmQM("Current period") : cmQM("Next period"))."</a></th>\n". + " <th><a id=\"orig\" class=\"textctrl\" href=\"".$origBaseURI.$luokka.$origBaseExt."\">".cmQM("Original")."</a></th>\n". " <th><a id=\"xml\" class=\"textctrl\" href=\"".$baseURI.$cachePath."/".$luokka.".xml\">XML</a></th>\n". " <th><a class=\"textctrl mobile\" href=\"http://tnsp.org/mluk/\">Mobile</a></th>\n"; } @@ -519,15 +501,15 @@ echo "<div id=\"footer\">". -lukMsg("contact", "ccr @ IRCNet", "ccr (at) tnsp (dot) org"). -//" <div style=\"color: red;\">".lukMsg("beta")."</div>\n". +cmQM("contact", "ccr @ IRCNet", "ccr (at) tnsp (dot) org"). +//" <div style=\"color: red;\">".cmQM("beta")."</div>\n". "</div>\n"; if (!$mobileMode) { echo "<div id=\"csssel\">\n". " <div id=\"ctitle\">Lukkari v2.0</div>\n". -" <div>".lukMsg("Style").": "; +" <div>".cmQM("Style").": "; foreach ($pageCSSAlts as $name => $id) echo "<a href=\"".$baseURI."?css=".$id."\">".$name."</a>"; @@ -540,7 +522,7 @@ } echo "</div>\n"; -printPageFooter(); +cmPrintPageFooter(); // Dump the course data cache, but only if it has changed