Revize 7227a179
Přidáno uživatelem Jan Šedivý před téměř 6 roky(ů)
old/html/multidic/app/webroot/administration/add_field.php | ||
---|---|---|
1 | 1 |
<?php |
2 |
|
|
3 |
$action = $_REQUEST['action']; |
|
4 |
|
|
2 | 5 |
if (!Empty($action) && $action == "insert_new_field") { |
3 | 6 |
require_once("./administration/field.php"); |
4 | 7 |
|
5 | 8 |
$zobrazit_znovu = true; |
6 |
|
|
9 |
$name = $_REQUEST['name']; |
|
10 |
$en_field = $_REQUEST['en_field']; |
|
11 |
|
|
7 | 12 |
if (Empty($name)) { |
8 | 13 |
print_hlasku("Český název musíte vyplnit"); |
9 | 14 |
} |
old/html/multidic/app/webroot/administration/edit_field.php | ||
---|---|---|
2 | 2 |
require_once("./administration/field.php"); |
3 | 3 |
|
4 | 4 |
$vypis_edit = true; |
5 |
$action = $_REQUEST['action']; |
|
6 |
$field_id = $_REQUEST['field_id']; |
|
5 | 7 |
|
6 | 8 |
if (!Empty($action) && $action == "edit_field") { |
7 | 9 |
|
10 |
$name = $_REQUEST['name']; |
|
11 |
$en_field = $_REQUEST['en_field']; |
|
12 |
|
|
8 | 13 |
if (Empty($name)) { |
9 | 14 |
print_hlasku("Název musíte vyplnit"); |
10 | 15 |
} |
... | ... | |
18 | 23 |
|
19 | 24 |
$Record = get_field($field_id); |
20 | 25 |
$name = $Record[1]; |
26 |
$en_field = $Record[2]; |
|
21 | 27 |
|
22 | 28 |
?> |
23 | 29 |
<script language="JavaScript"> |
old/html/multidic/app/webroot/administration/field.php | ||
---|---|---|
89 | 89 |
require_once("./classes/db.php"); |
90 | 90 |
$spojeni = new DB_Sql(); |
91 | 91 |
$dotaz = "INSERT INTO field (field, en_field) |
92 |
VALUES ('$field', '$en_field')";
|
|
93 |
$spojeni->query($dotaz); |
|
94 |
if ($spojeni->connection->errno != 0) {
|
|
92 |
VALUES ('" . $spojeni->escape_string($field) . "', '" . $spojeni->escape_string($en_field) . "')";
|
|
93 |
$result = $spojeni->query($dotaz);
|
|
94 |
if (!$result) {
|
|
95 | 95 |
print_hlasku("Bohužel, obor '$field' - '$en_field' se nepodařilo přidat."); |
96 | 96 |
return false; |
97 | 97 |
} |
... | ... | |
107 | 107 |
function print_table_of_field($order = "IDfield", $od = 0, $limit = 30) { |
108 | 108 |
require_once("./classes/db.php"); |
109 | 109 |
$spojeni = new DB_Sql(); |
110 |
$dotaz = "SELECT * FROM field ORDER BY \"$order\" OFFSET $od LIMIT $limit";
|
|
110 |
$dotaz = "SELECT * FROM field ORDER BY $order LIMIT $od, $limit";
|
|
111 | 111 |
$radky = $spojeni->query($dotaz); |
112 | 112 |
$navrat = "<h3 class=\"nadpis2\">Výpis oborů</h3>"; |
113 | 113 |
$navrat .= get_razeni($order, $od, $limit); |
114 | 114 |
$navrat .= "<table><form action=\"\" method=\"post\">"; |
115 | 115 |
$navrat .= get_header_of_table(); |
116 |
while ($spojeni->next_record()) { |
|
117 |
$navrat .= get_row_of_table($spojeni->Record, 1, 3);
|
|
116 |
while ($record = $spojeni->next_record()) {
|
|
117 |
$navrat .= get_row_of_table($record, 1, 3);
|
|
118 | 118 |
} |
119 | 119 |
$navrat .= get_foot_of_table(); |
120 | 120 |
$navrat .= '<input type="hidden" name="action" value="delete_field">'; |
... | ... | |
125 | 125 |
function possible_to_delete_field($field_id) { |
126 | 126 |
require_once("./classes/db.php"); |
127 | 127 |
$spojeni = new DB_Sql(); |
128 |
$dotaz = "SELECT * FROM dict WHERE field LIKE '$field_id'";
|
|
129 |
$spojeni->query($dotaz); |
|
130 |
if ($spojeni->connection->errno != 0) {
|
|
131 |
print_hlasku($spojeni->$Error);
|
|
128 |
$dotaz = "SELECT * FROM dict WHERE field LIKE '" . $spojeni->escape_string($field_id) ."'";
|
|
129 |
$result = $spojeni->query($dotaz);
|
|
130 |
if (!$result) {
|
|
131 |
print_hlasku('Nelze odstranit obor');
|
|
132 | 132 |
return false; |
133 | 133 |
} |
134 | 134 |
//echo $spojeni->num_rows(); |
... | ... | |
145 | 145 |
} |
146 | 146 |
require_once("./classes/db.php"); |
147 | 147 |
$spojeni = new DB_Sql(); |
148 |
$dotaz = "DELETE FROM field WHERE \"IDfield\" = $ID";
|
|
149 |
$spojeni->query($dotaz); |
|
150 |
if ($spojeni->connection->errno != 0) {
|
|
148 |
$dotaz = "DELETE FROM field WHERE IDfield = " . $spojeni->escape_string($ID);
|
|
149 |
$result = $spojeni->query($dotaz);
|
|
150 |
if (!$result) {
|
|
151 | 151 |
//print_hlasku("Bohužel, obor '$field' se nepodařilo smazat."); |
152 | 152 |
return false; |
153 | 153 |
} |
... | ... | |
159 | 159 |
function update_field($name, $en_field, $field_id) { |
160 | 160 |
require_once("./classes/db.php"); |
161 | 161 |
$spojeni = new DB_Sql(); |
162 |
$dotaz = "UPDATE field SET field = '$name',
|
|
163 |
en_field = '$en_field'
|
|
164 |
WHERE \"IDfield\" = $field_id";
|
|
165 |
$spojeni->query($dotaz); |
|
166 |
if ($spojeni->connection->errno != 0) {
|
|
162 |
$dotaz = "UPDATE field SET field = '" . $spojeni->escape_string($name) ."',
|
|
163 |
en_field = '" . $spojeni->escape_string($en_field) ."'
|
|
164 |
WHERE IDfield = " . $spojeni->escape_string($field_id);
|
|
165 |
$result = $spojeni->query($dotaz);
|
|
166 |
if (!$result) {
|
|
167 | 167 |
print_hlasku("Obor se nepodařilo upravit."); |
168 | 168 |
echo_zpet_do_oboru(); |
169 | 169 |
return false; |
... | ... | |
177 | 177 |
function get_field($field_id) { |
178 | 178 |
require_once("./classes/db.php"); |
179 | 179 |
$spojeni = new DB_Sql(); |
180 |
$dotaz = "SELECT * FROM field WHERE \"IDfield\" LIKE '$field_id'";
|
|
180 |
$dotaz = "SELECT * FROM field WHERE IDfield LIKE '" . $spojeni->escape_string($field_id) . "'";
|
|
181 | 181 |
$radky = $spojeni->query($dotaz); |
182 | 182 |
|
183 |
$spojeni->next_record(); |
|
183 |
$record = $spojeni->next_record();
|
|
184 | 184 |
|
185 |
return $spojeni->Record;
|
|
185 |
return $record;
|
|
186 | 186 |
} |
187 | 187 |
?> |
old/html/multidic/app/webroot/administration/list_field.php | ||
---|---|---|
1 | 1 |
<?php |
2 | 2 |
require_once("./administration/field.php"); |
3 | 3 |
|
4 |
$action = $_REQUEST['action']; |
|
5 |
|
|
4 | 6 |
if (!Empty($action) && $action == "delete_field") { |
5 | 7 |
$coun_true = 0; |
6 | 8 |
$coun_false = 0; |
9 |
$smaz = $_REQUEST['smaz']; |
|
7 | 10 |
if (Is_Array($smaz)) { |
8 | 11 |
for (Reset($smaz); Current($smaz); Next($smaz)) { |
9 | 12 |
//echo "Index: ".Key($smaz)."/n<br>"; |
... | ... | |
18 | 21 |
print_hlasku("Bohužel,$coun_false oborů se nepodařilo smazat ($coun_true se podařilo smazat)"); |
19 | 22 |
} |
20 | 23 |
|
21 |
if (!Empty($serad)) {
|
|
22 |
print_table_of_field($order, $od, $limit);
|
|
24 |
if (!Empty($_REQUEST['serad'])) {
|
|
25 |
print_table_of_field($_REQUEST['order'], $_REQUEST['od'], $_REQUEST['limit']);
|
|
23 | 26 |
} |
24 | 27 |
else { |
25 | 28 |
print_table_of_field(); |
Také k dispozici: Unified diff
Re #7580 administrace - obory