# HG changeset patch # User Matti Hamalainen # Date 1356181051 -7200 # Node ID 6a7172b3a841a3a62266ad3687b45f6a157c3528 # Parent acb600abc0c76185494285c3da0e2edd5a09b0ff Update to match the main page API. diff -r acb600abc0c7 -r 6a7172b3a841 index.php --- 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 = "

".join("; ", $classInfo["general"])."

\n". - "
".lukMsg("viikossa", $classInfo["totalHours"])."
\n". + "
".cmQM("viikossa", $classInfo["totalHours"])."
\n". "". " \n \n"; @@ -469,7 +451,7 @@ // // $pageTitle = $haveData ? $luokka." / ".join("; ", $classInfo["info"]) : $luokka; -printPageHeader($pageTitle); +cmPrintPageHeader($pageTitle); echo "
@@ -484,15 +466,15 @@ echo " - + "; if (!$mobileMode) { echo " \n". - " \n". + ($nextPeriod ? cmQM("Current period") : cmQM("Next period"))."\n". + " \n". " \n". " \n"; } @@ -519,15 +501,15 @@ echo "
". -lukMsg("contact", "ccr @ IRCNet", "ccr (at) tnsp (dot) org"). -//"
".lukMsg("beta")."
\n". +cmQM("contact", "ccr @ IRCNet", "ccr (at) tnsp (dot) org"). +//"
".cmQM("beta")."
\n". "
\n"; if (!$mobileMode) { echo "
\n". "
Lukkari v2.0
\n". -"
".lukMsg("Style").": "; +"
".cmQM("Style").": "; foreach ($pageCSSAlts as $name => $id) echo "".$name.""; @@ -540,7 +522,7 @@ } echo "
\n"; -printPageFooter(); +cmPrintPageFooter(); // Dump the course data cache, but only if it has changed
". - ($nextPeriod ? lukMsg("Current period") : lukMsg("Next period"))."".lukMsg("Original")."".cmQM("Original")."XMLMobile