| Server IP : 193.86.120.172 / Your IP : 216.73.216.215 Web Server : Apache/2.4.63 (Unix) System : Linux JServices 3.10.108 #86003 SMP Wed Oct 22 13:20:46 CST 2025 x86_64 User : kubec ( 1026) PHP Version : 8.2.28 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /volume1/web/hotellesnizatisi_cz/new/ |
Upload File : |
<?php
require_once __DIR__ . '/includes/auth.php';
$user = require_section('cenik');
require_once __DIR__ . '/includes/layout.php';
$id = isset($_GET['id']) ? (int)$_GET['id'] : null;
$s = [
'text_cs' => '', 'text_en' => '', 'text_de' => '',
'poradi' => 0, 'aktivni' => 1,
];
if ($id) {
$stmt = db()->prepare('SELECT * FROM web_storno_podminky WHERE id = ?');
$stmt->execute([$id]);
$row = $stmt->fetch();
if (!$row) {
set_flash('error', 'Podmínka nebyla nalezena.');
header('Location: cenik.php');
exit;
}
$s = $row;
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$values = [
trim($_POST['text_cs'] ?? ''),
trim($_POST['text_en'] ?? ''),
trim($_POST['text_de'] ?? ''),
(int)($_POST['poradi'] ?? 0),
isset($_POST['aktivni']) ? 1 : 0,
];
if ($id) {
db()->prepare('
UPDATE web_storno_podminky SET text_cs=?, text_en=?, text_de=?, poradi=?, aktivni=?
WHERE id=?
')->execute([...$values, $id]);
set_flash('success', 'Storno podmínka byla uložena.');
} else {
db()->prepare('
INSERT INTO web_storno_podminky (text_cs, text_en, text_de, poradi, aktivni)
VALUES (?,?,?,?,?)
')->execute($values);
set_flash('success', 'Nová storno podmínka byla přidána.');
}
header('Location: cenik.php');
exit;
}
admin_layout_start('cenik', $id ? 'Upravit storno podmínku' : 'Přidat storno podmínku', '', $user);
?>
<form method="post" class="card" style="padding:26px 28px;max-width:600px;">
<h3 style="font-size:.9rem;margin-bottom:14px;">Čeština</h3>
<div class="field"><label for="text_cs">Text</label><textarea id="text_cs" name="text_cs"><?= htmlspecialchars($s['text_cs']) ?></textarea></div>
<h3 style="font-size:.9rem;margin:22px 0 14px;border-top:1px solid var(--border);padding-top:18px;">English</h3>
<div class="field"><label for="text_en">Text</label><textarea id="text_en" name="text_en"><?= htmlspecialchars($s['text_en']) ?></textarea></div>
<h3 style="font-size:.9rem;margin:22px 0 14px;border-top:1px solid var(--border);padding-top:18px;">Deutsch</h3>
<div class="field"><label for="text_de">Text</label><textarea id="text_de" name="text_de"><?= htmlspecialchars($s['text_de']) ?></textarea></div>
<div class="field" style="margin-top:22px;border-top:1px solid var(--border);padding-top:18px;max-width:140px;">
<label for="poradi">Pořadí</label>
<input type="number" id="poradi" name="poradi" value="<?= (int)$s['poradi'] ?>">
</div>
<div class="toggle-row">
<label for="aktivni">Zobrazit na webu</label>
<input type="checkbox" id="aktivni" name="aktivni" <?= $s['aktivni'] ? 'checked' : '' ?>>
<label class="switch" for="aktivni"></label>
</div>
<div style="display:flex;gap:10px;margin-top:24px;">
<button type="submit" class="btn btn-primary">Uložit</button>
<a href="cenik.php" class="btn btn-secondary">Zrušit</a>
</div>
</form>
<?php admin_layout_end(); ?>