Subversion-Projekte lars-tiefland.content-management

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

<form action="<?= $_SERVER['PHP_SELF']."?action=new" ?>" method="post">
<table width="662" border="1" cellspacing="0" cellpadding="3">  
        <tr>
                <td bgcolor="#<? echo $webs[bgcolor_links] ?>"><font color="#<? echo $webs[font_color_links] ?>"><strong>Wochenkarte: Erstellen</strong></font></td>
        </tr>  
        <tr>
        <td> 
<?php
        if (isset($_POST['new'])) {
                $zeit1 = mktime(0, 0, 0, $_POST['monat1'], $_POST['tag1'], $_POST['jahr1']);
                $zeit1 -= (60*60*59);
                $zeit2 = mktime(0, 0, 0, $_POST['monat1'], $_POST['tag1'], $_POST['jahr1']);
                $zeit2 += (60*60*109);
                
                $sql = "INSERT INTO woche (
                                                                        gueltig_von,
                                                                        gueltig_bis,
                                                                        letzte_aenderung_von,
                                                                        letzte_aenderung_am,
                                                                        erstellt_von,
                                                                        erstellt_am
                                                                  ) VALUES (
                                                                        '".$zeit1."',
                                                                        '".$zeit2."',
                                                                        '".$PHP_AUTH_USER."',
                                                                        NOW(),
                                                                        '".$PHP_AUTH_USER."',
                                                                        NOW()
                                                                  )
                                                                        ";
                mysql_query($sql,$remoteServer_dbh) OR die(mysql_error().$sql);
                $woche_id = mysql_insert_id();
                
                // Leere Woche erstellen
                for ($i = 0; $i < 9; $i++) {
                        $sql = "INSERT INTO mittagsgericht      (
                                                                                                        beschreibung,
                                                                                                        drei_gang_menu,
                                                                                                        seniorenmenu,
                                                                                                        grosse_portion,
                                                                                                        seniorengedeck,
                                                                                                        preis,
                                                                                                        wochentag,
                                                                                                        woche
                                                                                                ) VALUES (
                                                                                                        '0',
                                                                                                        '0',
                                                                                                        '0',
                                                                                                        '0',
                                                                                                        '0',
                                                                                                        '0',
                                                                                                        '$i',
                                                                                                        '$woche_id'
                                                                                                )";
                        mysql_query($sql,$remoteServer_dbh) OR die(mysql_error()."<hr />".$sql);
                }
        }       
        
?>
                        
                        Montag(Start-Tag):
                                <select name="tag1" size="1">
<?php
                                        for ($i = 1; $i <= 31; $i++)
                                                echo "<option>$i</option>"
?>                      
                                </select>
                         
                                <select name="monat1" size="1">
<?php
                                        for ($i = 1; $i <= 12; $i++)
                                                echo "<option>$i</option>"
?>                      
                                </select>
                         
                                <select name="jahr1" size="1">
<?php
                                        for ($i = 2008; $i <= 2020; $i++)
                                                echo "<option>$i</option>"
?>                      
                                </select>
                                
                        
                </td>
        </tr>

        <tr>
                <td bgcolor="#<? echo $webs[bgcolor_links] ?>"><font color="#<? echo $webs[font_color_links] ?>"><input type="submit" value="Woche anlegen" name="new" style="border: 1px solid gray; background-color: #dddddd;"></font></td>
        </tr>
</table>
</form>