Projekt: Hesla Jednoty bratrské/2009/index php
PHP soubor pro editaci databáze s Hesly, původně nazvaný index.php
<?php
require_once 'functions.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
<!--
verze 10.01 ze dne : 2009-03-13
licence: GFDL + CC-BY-SA
autor: sl
spoluautor: http://cs.wikiversity.org/wiki/User:Kychot
-->
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
<link rel="styleSheet" type="text/css" href="./styl.css" />
<title>Hesla Jednoty bratrské</title>
</head>
<?php
if (isset($_REQUEST['set_date'])) {
$date = mktime(0, 0, 0, $_REQUEST['month'], $_REQUEST['day'], $_REQUEST['year']);
} else {
$date = isset($_REQUEST['date']) ? strtotime($_REQUEST['date']) : strtotime(DEFAULT_DATE);
}
if (isset($_REQUEST['save'])) {
switch($_REQUEST['save']) {
case "< předchozí":
save_all($date);
$date -= (60 * 60 * 24);
break;
case "následující >":
save_all($date);
$date += (60 * 60 * 24);
break;
default:
save_all($date);
break;
}
}
if (isset($_REQUEST['sel'])) {
sel();
}
?>
<body>
<div id="stranka-obal">
<div id="hlavni">
<form action='<?php echo $_SERVER['PHP_SELF'] ?>' method='post'>
<div class='navigace'>
<table>
<tr>
<td>
<input type="hidden" name="date" value="<?php echo date("Y-m-d", $date); ?>" />
<input type="submit" name="save" value="< předchozí" />
<input type="submit" name="save" value="uložit" />
<input type="submit" name="save" value="následující >" />
</td>
<td class='vyber-data'>
<span><?php echo $dny[date("N", $date)] ?> </span>
<input type="text" name="day" value="<?php echo date("j", $date) ?>"
maxlength="2" size="2" />.
<select name="month">
<?php foreach($mesice as $key => $value): ?>
<option value="<?php echo $key ?>"
<?php echo $key == date("n", $date) ? "selected='selected'" : ""; ?>><?php echo $value ?></option>
<?php endforeach ?>
</select>
<input type="text" name="year"
value="<?php echo date("Y", $date) ?>" maxlength="4" size="4" />
<input type="submit" name="set_date" value="nastav" />
</td>
</tr>
</table>
</div>
<?php if (date("d", $date) == 1): // zobrazovat jen 1. den v měsíci ?>
<div class='heslo'>
<strong>Heslo měsíce: </strong>
<?php get_losung("", $date, "MONTH", "los", false); ?><br />
<?php get_losung("ekumenický", $date, "MONTH", "cep"); ?>
<?php get_losung("kralický", $date, "MONTH", "kra"); ?>
<?php get_losung("jiný", $date, "MONTH", "oth"); ?>
</div>
<?php endif;?>
<div class='heslo'>
<?php get_day("Týden", $date, "week"); ?>
<?php get_day("Významný den", $date, "important"); ?>
<?php get_day("Svátek", $date, "holiday"); ?>
<?php get_day("Neděle", $date, "sunday"); ?>
</div>
<div class='heslo'>
<strong>SZ: </strong>
<?php get_losung("", $date, "OT", "los", false); ?><br />
<?php get_losung("ekumenický", $date, "OT", "cep"); ?>
<?php get_losung("kralický", $date, "OT", "kra"); ?>
<?php get_losung("jiný", $date, "OT", "oth"); ?>
</div>
<div class='heslo'>
<strong>NZ: </strong>
<?php get_losung("", $date, "NT", "los", false); ?><br />
<?php get_losung("ekumenický", $date, "NT", "cep"); ?>
<?php get_losung("kralický", $date, "NT", "kra"); ?>
<?php get_losung("jiný", $date, "NT", "oth"); ?>
</div>
<p><strong>Píseň</strong> <?php get_song($date, "Ld", "cs"); ?></p>
<p>
<strong>Čtení</strong><br />
<?php get_reading("1. čtení", $date, "SR"); ?>
<?php get_reading("2. čtení", $date, "CR"); ?>
<?php get_reading("evangelium", $date, "Ev"); ?>
<?php get_reading("epištola", $date, "Ep"); ?>
<?php get_reading("žalm", $date, "Ps"); ?>
</p>
<p>
<strong>Výročí</strong>
<?php get_comment($date); ?>
</p>
<p>
<input type="hidden" name="date"
value="<?php echo date("Y-m-d", $date); ?>" />
<input type="submit" name="save" value="< předchozí" />
<input type="submit" name="save" value="uložit" />
<input type="submit" name="save" value="následující >" />
</p>
</form>
</div><!-- hlavni -->
</div><!-- stranka-obal -->
</body>
</html>