This repository has been archived by the owner on Oct 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gest_collezione.php
66 lines (57 loc) · 2.13 KB
/
gest_collezione.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
require_once("php/tools.php");
require_once("php/database.php");
if (! isset($_SESSION["id"]) || $_SESSION["is_admin"] == 0) {
header ("location: login.php");
exit();
}
$id = isset($_GET["id"]) ? $_GET["id"] : "";
try {
$connessione = new Database();
if ($id != "")
$collezione = $connessione->getCollezioneById($id);
unset($connessione);
} catch (Exception) {
unset($connessione);
Tools::errCode(500);
exit();
}
if ($id != "" && empty($collezione)) {
Tools::errCode(404);
exit();
}
$page = Tools::buildPage($_SERVER["SCRIPT_NAME"]);
if ($id != "") {
$collezione = $collezione[0];
$title = $collezione["nome"] . " • Modifica collezione"; Tools::toHtml($title, 1);
Tools::replaceAnchor($page, "title", $title);
Tools::replaceAnchor($page, "bc_id", $id);
$bc_nome = $collezione["nome"]; Tools::toHtml($bc_nome);
Tools::replaceAnchor($page, "bc_nome", $bc_nome);
Tools::replaceAnchor($page, "intestazione", "Modifica collezione");
Tools::replaceAnchor($page, "gest_id", $id);
Tools::toHtml($collezione, 0);
Tools::replaceAnchor($page, "nome", $collezione["nome"]);
Tools::replaceAnchor($page, "descrizione", (isset($collezione["descrizione"]) ? $collezione["descrizione"] : ""));
if (isset($collezione["locandina"])) {
Tools::replaceAnchor($page, "immagine_webp", "pics/w200_" . $collezione["locandina"] . ".webp");
Tools::replaceAnchor($page, "immagine", "pics/w200_" . $collezione["locandina"] . ".jpg");
} else {
Tools::replaceSection($page, "locandina", "");
}
Tools::replaceAnchor($page, "submit_value", "modifica");
Tools::replaceAnchor($page, "submit", "Modifica");
} else {
Tools::replaceAnchor($page, "title", "Aggiungi collezione");
Tools::replaceSection($page, "breadcrumb", "Aggiungi");
Tools::replaceAnchor($page, "intestazione", "Aggiungi collezione");
Tools::replaceAnchor($page, "gest_id", "");
Tools::replaceAnchor($page, "nome", "");
Tools::replaceAnchor($page, "descrizione", "");
Tools::replaceSection($page, "locandina", "");
Tools::replaceAnchor($page, "submit_value", "aggiungi");
Tools::replaceAnchor($page, "submit", "Aggiungi");
Tools::replaceSection($page, "delete", "");
}
Tools::showPage($page);
?>