Přeskočit na obsah

Projekt: Hesla Jednoty bratrské/2016/index05 php

Z Wikiverzity

index.php

[editovat]

Webový formulář pro editaci Hesel JB. Verze w05 z 2015-01-13, která ještě neumožňuje editovat citáty (tabulku quote):

<?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 2016w05 ze dne 2015-01-13	
licence: GFDL + CC-BY-SA
autor původního PHP kódu pro Hesla na rok 2009: Slávek Heřman
struktura databáze + úpravy PHP kódu pro další roky: Petr Heřman aka http://cs.wikiversity.org/wiki/User:Kychot
-->

<?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);
}

switch (DB_NAME) {
       case "hes14":     $project = 'local: 2014'; break;
       case "hes15":     $project = 'local: 2015'; break;
       case "hes16":     $project = 'local: 2016'; break;
       case "dulos191":  $project = 'neevidována'; break;
       case "dulos1152": $project = 'neevidována'; break;
       case "dulos933":  $project = 'neevidována'; break;
       case "dulos1909": $project = '2011';        break;
       case "dulos1454": $project = '2011jarda';   break;
       case "dulos6127": $project = '2012mirek';   break;
       case "dulos9360": $project = '2012rfc';     break;
       case "dulos7146": $project = '2013mirek, 2013petr'; break; /* user */
       case "dulos7660": $project = '2013test, 2013rfc';   break;
       case "dulos1801": $project = '2014/mirek';  break;
       case "dulos3152": $project = '2014/nkd';    break;
       case "dulos995":  $project = '2014/petr';   break;
       case "dulos1811": $project = '2014/vlada';  break;
       case "dulos897":  $project = '2014/rfc';    break;
       case "dulos8594": $project = '2015/mirek';  break;
       case "dulos9766": $project = '2015/petr';   break;
       case "dulos3926": $project = '2015/rfc';    break;
       case "dulos8551": $project = '2016/mirek';  break;
       case "dulos9715": $project = '2016/petr';   break;
       case "dulos1398": $project = '2016/rfc';    break;
       default:          $project = '???';
}

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();
}

?>

<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
<link rel="styleSheet" type="text/css" href="./styl.css" />
<title>Hesla JB <?php echo "$project = "; echo DB_NAME ?></title>
</head>

<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="&lt; předchozí" />
			<input type="submit" name="save" value="uložit" />
			<input type="submit" name="save" value="následující &gt;" />
		</td>
		<!-- <td>[<?php echo "$project = "; echo DB_NAME ?>]</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) {
					echo "\t\t\t\t<option value=\"$key\"";
					if ($key == date("n", $date)) {
						echo " selected='selected'";
					}
					echo ">$value</option>\n";
				}
?>
			</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'>
<?php	echo "\t<strong>Heslo měsíce: </strong>";
	get_losung("",          $date, "MONTH", "de", false, false);
	get_losung("ekumenický",$date, "MONTH", "cs", "cep");
	get_losung("kralický",  $date, "MONTH", "cs", "kra");
	get_losung("jiný",      $date, "MONTH", "cs", "oth");
?>

</div>
<?php endif;?>

<div class='heslo'>
<?php	get_day("Týden",       $date, "week",     'cs');
	get_day("Neděle",      $date, "sunday",   'cs');
	get_day("Svátek",      $date, "holiday",  'cs');
	get_day("2. svátek",   $date, "holiday2", 'cs');
	get_day("Významný den",$date, "important",'cs');
?>

</div>

<div class='heslo'>
<?php 	echo "\t<strong>SZ: </strong>";
	get_losung("",          $date, "OT", "de", false, false);
	get_losung("ekumenický",$date, "OT", "cs", "cep");
	get_losung("kralický",  $date, "OT", "cs", "kra");
	get_losung("jiný",      $date, "OT", "cs", "oth");
?>

</div>

<div class='heslo'>
<?php	echo "\t<strong>NZ: </strong>";
	get_losung("",          $date, "NT", "de", false, false);
	get_losung("ekumenický",$date, "NT", "cs", "cep");
	get_losung("kralický",  $date, "NT", "cs", "kra");
	get_losung("jiný",      $date, "NT", "cs", "oth");
?>

</div>

<p><strong>Píseň</strong> <?php get_song($date, "Ld", "cs"); ?>	</p>

<p>
<?php	echo "\t<strong>Čtení</strong><br />\n";
	get_reading("1. čtení (SR)",  $date, "SR");
	get_reading("<b>Ev</b>angelium",$date, "Ev");
	get_reading("<b>Ep</b>ištola",  $date, "Ep");
	get_reading("žalm (WP)",      $date, "WP");
	get_reading("žalm (Ps)",      $date, "Ps");
	get_reading("žalm (PF)",      $date, "PF");
	get_reading("2. čtení (CR)",  $date, "CR");
	get_reading("3. čtení (DL)",  $date, "DL");
	get_reading("+1. čtení (x1)", $date, "x1");
	get_reading("+2. čtení (x2)", $date, "x2");
	get_reading("+3. čtení (x3)", $date, "x3");
	get_reading("perikopa (Pr)",  $date, "Pr");
	get_reading("2.perikopa (Pr2)",$date, "Pr2");
?>
</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="&lt; předchozí" />
	<input type="submit" name="save" value="uložit" />
	<input type="submit" name="save" value="následující &gt;" />
</p>

</form>

</div><!-- hlavni -->
</div><!-- stranka-obal -->
</body>
</html>