changeset 31:dbe7ff545293

Add support for fetching and showing data for next/upcoming period.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 16 Oct 2011 03:00:46 +0300
parents 6148ce4a83ed
children b305d409becd
files index.php update.sh
diffstat 2 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/index.php	Tue Sep 27 10:56:50 2011 +0300
+++ b/index.php	Sun Oct 16 03:00:46 2011 +0300
@@ -159,12 +159,16 @@
   errorMsg("Luokkien listaa ei löytynyt. Kokeile ladata sivu uudelleen hetken kuluttua.");
 }
 
+if (isset($_GET["next"]))
+  $dataFile = "cache-next/".$luokka.".data";
+else
+  $dataFile = "cache/".$luokka.".data";
 
-if (!file_exists($dataDir.$luokka.".data")) {
+if (!file_exists($dataFile)) {
   errorMsg("Luokan ".htmlentities($luokka)." tietoja ei löytynyt! Jos luokkakoodi on uusi, ilmestyy se järjestelmään seuraavan päivityksen aikana. Luokkatiedot päivitetään 2 kertaa vuorokaudessa.");
   $haveData = FALSE;
 } else {
-  require($dataDir.$luokka.".data");
+  require($dataFile);
   $haveData = isset($classDefs);
 }
 
@@ -412,6 +416,7 @@
 
 echo "</a>]</td>
    <td>[<a href=\"http://www.oamk.fi/tyojarjestykset/otek/luokat/OR_".$luokka.".htm\">Alkuperäinen</a>]</td>
+   <td>[<a href=\"".$baseURI."?next\">Seuraava periodi</a>]</td>
   </tr>
  </table>
 </form>
--- a/update.sh	Tue Sep 27 10:56:50 2011 +0300
+++ b/update.sh	Sun Oct 16 03:00:46 2011 +0300
@@ -58,3 +58,5 @@
 #parse "http://www.oamk.fi/tyojarjestykset/otek/luokat/" "luokat.txt" ""
 parse "http://www.oamk.fi/~heikkim/Luhti1/Ryhm%84t/" "luokat.txt" "Ryh._"
 
+CACHEDIR="cache-next/"
+parse "http://www.oamk.fi/~heikkim/Luhti2/Ryhm%84t/" "luokat.txt" "Ryh._"