| 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('okoli');
require_once __DIR__ . '/includes/layout.php';
$id = isset($_GET['id']) ? (int)$_GET['id'] : null;
$a = [
'hodnota' => '',
'nazev_cs' => '', 'nazev_en' => '', 'nazev_de' => '',
'popis_cs' => '', 'popis_en' => '', 'popis_de' => '',
'poradi' => 0, 'aktivni' => 1,
];
if ($id) {
$stmt = db()->prepare('SELECT * FROM web_okoli_atrakce WHERE id = ?');
$stmt->execute([$id]);
$row = $stmt->fetch();
if (!$row) {
set_flash('error', 'Atrakce nebyla nalezena.');
header('Location: okoli.php');
exit;
}
$a = $row;
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$values = [
trim($_POST['hodnota'] ?? ''),
trim($_POST['nazev_cs'] ?? ''),
trim($_POST['nazev_en'] ?? ''),
trim($_POST['nazev_de'] ?? ''),
trim($_POST['popis_cs'] ?? ''),
trim($_POST['popis_en'] ?? ''),
trim($_POST['popis_de'] ?? ''),
(int)($_POST['poradi'] ?? 0),
isset($_POST['aktivni']) ? 1 : 0,
];
if ($id) {
db()->prepare('
UPDATE web_okoli_atrakce SET
hodnota=?, nazev_cs=?, nazev_en=?, nazev_de=?,
popis_cs=?, popis_en=?, popis_de=?,
poradi=?, aktivni=?
WHERE id=?
')->execute([...$values, $id]);
set_flash('success', 'Atrakce byla uložena.');
} else {
db()->prepare('
INSERT INTO web_okoli_atrakce
(hodnota, nazev_cs, nazev_en, nazev_de, popis_cs, popis_en, popis_de, poradi, aktivni)
VALUES (?,?,?,?,?,?,?,?,?)
')->execute($values);
set_flash('success', 'Nová atrakce byla přidána.');
}
header('Location: okoli.php');
exit;
}
admin_layout_start('okoli', $id ? 'Upravit atrakci' : 'Přidat atrakci', '', $user);
?>
<form method="post" class="card" style="padding:26px 28px;max-width:680px;">
<div class="field">
<label for="hodnota">Hodnota (krátký ukazatel)</label>
<input type="text" id="hodnota" name="hodnota" value="<?= htmlspecialchars($a['hodnota']) ?>" placeholder="např. 100 m, 786 m, ⛵" maxlength="20">
</div>
<h3 style="font-size:.9rem;margin:22px 0 14px;border-top:1px solid var(--border);padding-top:20px;">Čeština</h3>
<div class="field">
<label for="nazev_cs">Název</label>
<input type="text" id="nazev_cs" name="nazev_cs" value="<?= htmlspecialchars($a['nazev_cs']) ?>">
</div>
<div class="field">
<label for="popis_cs">Popis</label>
<textarea id="popis_cs" name="popis_cs"><?= htmlspecialchars($a['popis_cs']) ?></textarea>
</div>
<h3 style="font-size:.9rem;margin:24px 0 14px;border-top:1px solid var(--border);padding-top:20px;">English</h3>
<div class="field">
<label for="nazev_en">Název</label>
<input type="text" id="nazev_en" name="nazev_en" value="<?= htmlspecialchars($a['nazev_en']) ?>">
</div>
<div class="field">
<label for="popis_en">Popis</label>
<textarea id="popis_en" name="popis_en"><?= htmlspecialchars($a['popis_en']) ?></textarea>
</div>
<h3 style="font-size:.9rem;margin:24px 0 14px;border-top:1px solid var(--border);padding-top:20px;">Deutsch</h3>
<div class="field">
<label for="nazev_de">Název</label>
<input type="text" id="nazev_de" name="nazev_de" value="<?= htmlspecialchars($a['nazev_de']) ?>">
</div>
<div class="field">
<label for="popis_de">Popis</label>
<textarea id="popis_de" name="popis_de"><?= htmlspecialchars($a['popis_de']) ?></textarea>
</div>
<div class="field" style="margin-top:24px;border-top:1px solid var(--border);padding-top:20px;max-width:140px;">
<label for="poradi">Pořadí</label>
<input type="number" id="poradi" name="poradi" value="<?= (int)$a['poradi'] ?>">
</div>
<div class="toggle-row">
<label for="aktivni">Zobrazit na webu</label>
<input type="checkbox" id="aktivni" name="aktivni" <?= $a['aktivni'] ? 'checked' : '' ?>>
<label class="switch" for="aktivni"></label>
</div>
<div style="display:flex;gap:10px;margin-top:26px;">
<button type="submit" class="btn btn-primary">Uložit</button>
<a href="okoli.php" class="btn btn-secondary">Zrušit</a>
</div>
</form>
<?php admin_layout_end(); ?>