title_table_month(): month names changed to numbers, reqd by publisher
[www.energie.vellum.cz.git] / index.php
index af6897b..43507a5 100644 (file)
--- a/index.php
+++ b/index.php
@@ -4,18 +4,59 @@
 .tab-bold  { font-weight: bold; }
 .post-type { font-family: monospace; }
 .nowrap    { white-space: nowrap; }
+.centered  { text-align: center; }
 ";
        $head='
 <script type="text/javascript" src="objednavka.js"></script>
 ';
-       $want_js=true;
+       $detect_js=true;
 
        include("common.php");
 ?>
-<h1>Objednávka</h1>
-<form action="predplatne.php" method="post">
+<h1 class="centered"><img src="img/eap-title.png" alt="Teplo &amp; Peníze" /></h1>
+<p>&nbsp;</p>
+<?php
+
+function title_table_month($year,$month)
+{
+       $size_width_s= 98; $size_height_s=138;
+       $size_width  =486; $size_height  =688;
+
+       $base=sprintf("img/eap-%04d-%02d",$year,$month+1);
+       $name=sprintf(        "%04d/%02d",$year,$month+1);
+       print("<a href=\"${base}.jpg\">"
+                       ."<img src=\"${base}s.jpg\" width=\"$size_width_s\" height=\"$size_height_s\""
+                       ." style=\"border:0;width:${size_width_s}px;height:${size_height_s}px\" alt=\"titulní stránka $name\" /><br />\n"
+                       ."$name"
+                       ."</a>");
+}
+
+function title_table_year($year,$month_max=11)
+{
+       $split=6;
+
+       print("<table border=\"0\" width=\"100%\"><tr><td align=\"center\"><table border=\"1\" cellpadding=\"5\">\n");
+       for ($month=0;$month<=$month_max;$month++) {
+               if (($month%$split)==0)
+                       print("<tr>");
+               print("<td align=\"center\">");
+               title_table_month($year,$month);
+               print("</td>");
+               if (($month%$split)==$split-1 || $month==$month_max)
+                       print("</tr>\n");
+               }
+       print("</table></td></tr></table>");
+}
+
+title_table_year(2001,5);
+?>
+
+<p>&nbsp;</p>
+
+<h2>Objednávka</h2>
+<form action="objednavka.php<?php print($have_js); ?>" method="post">
 <table border="0" width="100%">
-       <tr><td align="center"><table border="1" width="90%">
+<tr><td align="center"><table border="1" width="90%">
        <tr><td align="center"><table border="0">
 <?php
        function tab_left($name)
        <tr><?php                  tab_left("want_phys_2000"); ?><td>roèník 2000 za cenu 150 Kè</td></tr>
 <?php
 
-       if (($f=fopen("objednavka.js","r"))) {
-               while (($s=fgets($f,0x1000))) {
-                       if (!($s=trim($s)))
-                               break;
-                       if (!(ereg("^want_price\\[ *'cd_([^']*)'\\]=([0-9]*);\$",$s,$o_matched)))
-                               continue;
-                       $o_year =$o_matched[1];
-                       $o_price=$o_matched[2];
-                       print("<tr>");
-                       tab_left("want_cd_$o_year");
-                       print("<td>roèník $o_year na CD za cenu $o_price Kè</td></tr>\n");
-                       }
-               fclose($f);
+       if (!($f=fopen("objednavka.js","r")))
+               fatal("Nepodaøilo se naèíst seznam dostupného zbo¾í");
+       while (($s=fgets($f,0x1000))) {
+               if (!($s=trim($s)))
+                       break;
+               if (!(ereg("^want_price\\[ *'cd_([^']*)'\\]=([0-9]*);\$",$s,$o_matched)))
+                       continue;
+               $o_year =$o_matched[1];
+               $o_price=$o_matched[2];
+               print("<tr>");
+               tab_left("want_cd_$o_year");
+               print("<td>roèník $o_year na CD za cenu $o_price Kè</td></tr>\n");
                }
+       fclose($f);
        if ($have_js) {
                ?>
        <tr><td colspan="3"><hr /></td></tr>
@@ -59,7 +100,7 @@ function print_addr($title,$pfx,$ico)
                <tr><td valign="top">Adresa:</td><td colspan="2"><table border="0">
                        <colgroup width="0*" span="3" />
                        <tr><td>Ulice:</td><td colspan="2"><input type="text" name="<?php print("${pfx}ulice"); ?>" size="60" /></td></tr>
-                       <tr><td>Mìsto:</td><td            ><input type="text" name="<?php print("${pfx}ulice"); ?>" size="30" /></td>
+                       <tr><td>Mìsto:</td><td            ><input type="text" name="<?php print("${pfx}mesto"); ?>" size="30" /></td>
                                <td>PSÈ:                         <input type="text" name="<?php print("${pfx}psc"); ?>" size="5" maxlength="5" /></td></tr>
                        </table></td></tr>
        <?php
@@ -78,8 +119,8 @@ function print_addr($title,$pfx,$ico)
        <?php
 }
 
-print_addr("Adresa pro vystavení a zaslání faktury"          ,"name1_",true);
-print_addr("Adresa pro zasílaní èasopisu (jen pokud se li¹í)","name2_",false);
+print_addr("Adresa pro vystavení a zaslání faktury"          ,"addr1_",true);
+print_addr("Adresa pro zasílaní èasopisu (jen pokud se li¹í)","addr2_",false);
 
 ?>
 <tr><td><table border="0">