1
|
<?php
|
2
|
|
3
|
require_once('./inc/all.inc.php');
|
4
|
require_once('./admin/core/admin.class.php');
|
5
|
|
6
|
$tpl = & new Template(INDEX_TMPL);
|
7
|
|
8
|
$body = & new Template('./admin/tmpl/admin.tmpl.php');
|
9
|
$left = & new Template('./admin/left.php');
|
10
|
//$main = & new Template('./admin/');
|
11
|
$admi = & new Administration ();
|
12
|
|
13
|
$left->set('table_chooser', $admi->get_table_chooser( $_REQUEST['table'] ));
|
14
|
$left->set('table', $_REQUEST['table']);
|
15
|
|
16
|
switch($_REQUEST['nav_id']) {
|
17
|
case("list"):
|
18
|
|
19
|
if (!Empty($_REQUEST['actione']) && $_REQUEST['actione'] == "delete") {
|
20
|
$main = $admi->delete_more_rows( $_REQUEST['smaz'], $_REQUEST['table'], $_REQUEST['unique'] );
|
21
|
}
|
22
|
|
23
|
if (!Empty($_REQUEST['actione']) && $_REQUEST['actione'] == "sort") {
|
24
|
$main = $admi->get_table( $_REQUEST['table'], $_REQUEST['unique'], $_REQUEST['order'], $_REQUEST['od'], $_REQUEST['limit'] );
|
25
|
}
|
26
|
else {
|
27
|
if ( empty($_REQUEST['unique']))
|
28
|
$_REQUEST['unique'] = 'id_'.$_REQUEST['table'];
|
29
|
$main .= $admi->get_table( $_REQUEST['table'], $_REQUEST['unique'], $_REQUEST['unique'] );
|
30
|
}
|
31
|
|
32
|
break;
|
33
|
case("insert"):
|
34
|
$main = & new Template('./admin/insert.php');
|
35
|
if (isset($_REQUEST['actione']) && ($_REQUEST['actione'] == "insert")) {
|
36
|
$content = $admi->insert($_REQUEST['table'], $_REQUEST['fields']);
|
37
|
$content = "<tr><td>".$content."</td></tr>";
|
38
|
}
|
39
|
$content .= $admi->table_of_new_edit($_REQUEST['table'], $_REQUEST['form_name']);
|
40
|
$main->set('table_of_new_edit', $content);
|
41
|
$main->set('table', $_REQUEST['table']);
|
42
|
|
43
|
break;
|
44
|
case("edit"):
|
45
|
|
46
|
if (isset($_REQUEST['unique']) && isset($_REQUEST['unique_id']) && ($_REQUEST['actione'] == "edit")) {
|
47
|
$main = $admi->update ($_REQUEST['table'], $_REQUEST['unique'], $_REQUEST['unique_id'], $_REQUEST['fields']);
|
48
|
$main = "<tr><td>".$main."</td></tr>";
|
49
|
} // end row update
|
50
|
else {
|
51
|
$form_name = "edit_form";
|
52
|
$main = & new Template('./admin/edit.php');
|
53
|
$main->set('unique_id', $_REQUEST['unique_id']);
|
54
|
$main->set('unique', $_REQUEST['unique']);
|
55
|
$main->set('table', $_REQUEST['table']);
|
56
|
$main->set('form_name', $form_name);
|
57
|
if (!isset($_REQUEST['unique']) || !isset($_REQUEST['unique_id'])) {
|
58
|
print_hlasku("Internal Error:");
|
59
|
return;
|
60
|
}
|
61
|
$Record = $admi->get_row($_REQUEST['table'], $_REQUEST['unique'], $_REQUEST['unique_id']);
|
62
|
$main->set('table_of_edit', $admi->table_of_new_edit($_REQUEST['table'], $form_name, $Record) );
|
63
|
}
|
64
|
|
65
|
break;
|
66
|
default:
|
67
|
|
68
|
break;
|
69
|
}
|
70
|
|
71
|
$body->set('main', $main);
|
72
|
$body->set('left', $left);
|
73
|
|
74
|
$tpl->set('obsah', $body);
|
75
|
|
76
|
echo $tpl->fetch();
|
77
|
|
78
|
//p_g($_REQUEST);
|
79
|
|