-
Notifications
You must be signed in to change notification settings - Fork 0
/
.htUtenti.php
78 lines (72 loc) · 2.86 KB
/
.htUtenti.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
<?php
//20110206.014
$FIELDS = Objects::getUtentiFields();
$TABLE = "users";
$PAGE_CONTENT = "<h1>Gestione utenti</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" => "(" . ((!is_array($old)) ? "!ADMIN.checkIfUsernameExists('username')" : "1") . " && ADMIN.validateObject('Utenti', '" . $_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"];
logMessage((($saveRecord["action"] == "add") ? "Inserito" : "Modificato") . " utente " . $saveRecord["recordId"]);
break;
case "del":
$config = array(
"idValue" => $_GET["id"],
"idField" => BasicTable::getIdField($FIELDS),
"fields" => $FIELDS,
"table" => $TABLE,
);
$deleteRecord = BasicTable::deleteRecord($config);
$PAGE_CONTENT .= $deleteRecord["htmlCode"];
logMessage("Cancellato utente " . $_GET["id"]);
break;
default:
$config = array(
"title" => "Elenco utenti",
"idField" => BasicTable::getIdField($FIELDS),
"columns" => array(
"username" => array("name"=>"Username", "type"=>"field"),
"maglia" => array("name"=>"Maglia", "type"=>"arrayIndex", "values"=>getElencoMaglie()),
"provincia" => array("name"=>"Provincia", "type"=>"arrayIndex", "values"=>getProvince()),
"realName" => array("name"=>"Nome", "type"=>"field"),
"type" => array("name"=>"Tipo", "type"=>"arrayIndex", "values"=>$LOGIN->getUserTypes()),
"referenceUser" => array("name"=>"Comitato di riferimento", "type"=>"field"),
"status" => array("name"=>"Status", "type"=>"arrayIndex", "values"=>BasicTable::$basicStatus),
),
"table" => $TABLE,
"filters" => array(
"username" => array("name"=>"Username", "type"=>"keyword", "query"=>"username LIKE '%%%value%%%'"),
"userLevel" => (($LOGIN->getUserData("type") == 1) ? array("name"=>"Type", "type"=>"select", "values"=>$LOGIN->getUserTypes(), "query"=>"type='%%value%%'", "width"=>150) : null),
),
);
$PAGE_CONTENT .= BasicTable::getTable($config);
break;
}
$PAGE_CONTENT .= "<div><a href='" . $_SERVER["SCRIPT_NAME"] . "?cmd=" . $_REQUEST["cmd"] . "'>Visualizza l'elenco degli utenti</a></div>\n";
?>