-
Notifications
You must be signed in to change notification settings - Fork 0
/
.htMaglie.php
81 lines (74 loc) · 2.5 KB
/
.htMaglie.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
//20101015.007
$PAGE_TITLE = "Maglie";
$FIELDS = Objects::getMaglieFields();
$TABLE = "maglie";
$PAGE_CONTENT = "<h1>Gestione maglie</h1>\n";
switch($_REQUEST["cmd2"]) {
case "show":
case "edit":
$config = array(
"idField" => BasicTable::getIdField($FIELDS),
"idValue" => $_GET["id"],
"table" => $TABLE,
);
$old = BasicTable::getOldData($config);
if(!is_array($old)) {
$_REQUEST["cmd2"] = "add";
}
//continue...
case "add":
$config = array(
"jsCheckForm" => "ADMIN.validateObject('Maglie', '" . $_REQUEST["cmd2"] . "')",
"action" => $_REQUEST["cmd2"],
"idField" => BasicTable::getIdField($FIELDS),
"fields" => $FIELDS,
"data" => $old,
);
$PAGE_CONTENT .= BasicTable::getForm($config);
break;
case "save":
$config = array(
"idField" => BasicTable::getIdField($FIELDS),
"fields" => $FIELDS,
"data" => $_POST,
"table" => $TABLE,
);
$saveRecord = BasicTable::saveRecord($config);
$PAGE_CONTENT .= $saveRecord["htmlCode"];
$REGISTRY->setValue("lastMaglieChange", time());
break;
case "del":
if(!Methods::getNumeroUnitaCRIPerMaglia($_GET["id"])) {
$config = array(
"idValue" => $_GET["id"],
"idField" => BasicTable::getIdField($FIELDS),
"fields" => $FIELDS,
"table" => $TABLE,
);
$deleteRecord = BasicTable::deleteRecord($config);
$PAGE_CONTENT .= $deleteRecord["htmlCode"];
$REGISTRY->setValue("lastMaglieChange", time());
}
break;
default:
$config = array(
"title" => "Maglie",
"idField" => BasicTable::getIdField($FIELDS),
"columns" => array(
"id" => array("name"=>"ID", "type"=>"field", "hideColumn"=>true),
"codice" => array("name"=>"Codice", "type"=>"field"),
"provincia" => array("name"=>"Provincia", "type"=>"field"),
"canale" => array("name"=>"Canale", "type"=>"field"),
"selettive" => array("name"=>"Selettive", "type"=>"field"),
"lunghezzaCollegamento" => array("name"=>"Lunghezza Collegamento", "type"=>"arrayIndex", "values"=>$MAGLIA_LUNGHEZZA_COLLEGAMENTO),
),
"table" => $TABLE,
"disableDelete" => "Methods::getNumeroUnitaCRIPerMaglia(%object%->id)",
"defaultOrder" => array("col"=>"codice", "dir"=>"ASC"),
);
$PAGE_CONTENT .= BasicTable::getTable($config);
break;
}
$PAGE_CONTENT .= "<div><a href='" . $_SERVER["SCRIPT_NAME"] . "?cmd=" . $_REQUEST["cmd"] . "'>Torna all'elenco delle maglie</a></div>\n";
?>