1 |
6daefa8c
|
Petr Lukašík
|
<?php
|
2 |
|
|
require_once("./functions/dictionary.php");
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
function get_row_of_table($Record, $translation_lang_id) {
|
6 |
|
|
$navrat .= "<tr class=\"akt\">\n ";
|
7 |
|
|
//$navrat .= '<td> </td>';
|
8 |
|
|
$navrat .= '<td><a href="?nav_id=edit_translation&translation_lang_id='.$translation_lang_id.'&translation_id='.
|
9 |
|
|
$Record["IDtranslation"].'">uprav</a></td>';
|
10 |
|
|
$navrat .= "<td>";
|
11 |
|
|
$navrat .= $Record["idf"];
|
12 |
|
|
$navrat .= " </td>\n";
|
13 |
|
|
$navrat .= "<td>";
|
14 |
|
|
$navrat .= $Record["translation"];
|
15 |
|
|
$navrat .= " </td>\n";
|
16 |
|
|
$navrat .= "</tr> \n ";
|
17 |
|
|
return $navrat;
|
18 |
|
|
}
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
function get_pocet_translation($translation_lang_id) {
|
22 |
|
|
require_once("./classes/db.php");
|
23 |
|
|
$spojeni = new DB_Sql();
|
24 |
|
|
$dotaz = "SELECT 1 FROM translation WHERE language = '$translation_lang_id'";
|
25 |
|
|
$spojeni->query($dotaz);
|
26 |
|
|
return $spojeni->num_rows();
|
27 |
|
|
}
|
28 |
|
|
|
29 |
|
|
function get_razeni($translation_lang_id, $l_order = "IDtranslation", $l_od = 0, $l_limit = 30) {
|
30 |
|
|
global $order;
|
31 |
|
|
global $od;
|
32 |
|
|
global $limit;
|
33 |
|
|
|
34 |
|
|
$order = $l_order;
|
35 |
|
|
$od = $l_od;
|
36 |
|
|
$limit = $l_limit;
|
37 |
|
|
$pocet_translation = get_pocet_translation($translation_lang_id);
|
38 |
|
|
$nav = "list_translation";
|
39 |
|
|
$nav_tr_lang_id = "translation_lang_id=$translation_lang_id";
|
40 |
|
|
|
41 |
|
|
$navrat = "<p class=\"akt\"></p>";
|
42 |
|
|
$navrat .= "<table>
|
43 |
|
|
<tr class=\"nadpis_sekce\"><td><form action\"\" method=\"post\" name=\"razeni\">
|
44 |
|
|
Zobrazeno $limit položek od $od. (Celkem $pocet_translation)<br />
|
45 |
|
|
Řadit podle
|
46 |
|
|
<select name=\"order\">
|
47 |
|
|
<option value=\"IDtranslation\"";
|
48 |
|
|
if( $order == "IDtranslation" ) {
|
49 |
|
|
$navrat .= " selected=\"true\"";
|
50 |
|
|
}
|
51 |
|
|
$navrat .= ">Identifikátor</option>
|
52 |
|
|
|
53 |
|
|
<option value=\"idf\"";
|
54 |
|
|
if( $order == "idf" ) {
|
55 |
|
|
$navrat .= " selected=\"true\"";
|
56 |
|
|
}
|
57 |
|
|
$navrat .= ">česky</option>
|
58 |
|
|
|
59 |
|
|
<option value=\"translation\"";
|
60 |
|
|
if( $order == "translation" ) {
|
61 |
|
|
$navrat .= " selected=\"true\"";
|
62 |
|
|
}
|
63 |
|
|
$navrat .= ">překlad</option>
|
64 |
|
|
</select>
|
65 |
|
|
od: <input type=\"text\" name=\"od\" value=\"$od\" size=\"5\" />
|
66 |
|
|
počet: <input type=\"text\" name=\"limit\" value=\"$limit\" size=\"5\" />
|
67 |
|
|
<input type=\"hidden\" name=\"translation_lang_id\" value=\"$translation_lang_id\" />
|
68 |
|
|
<input type=\"submit\" name=\"serad\" value=\"Zobraz\" /> </form>
|
69 |
|
|
</td></tr>
|
70 |
|
|
<tr class=\"nadpis_sekce\"><td align=\"center\">
|
71 |
|
|
<a href=\"?nav_id=$nav&serad=true&order=$order&od=0&limit=$limit&$nav_tr_lang_id\">
|
72 |
|
|
Na začátek </a> | ";
|
73 |
|
|
if ($od-$limit >= 0)
|
74 |
|
|
$navrat .="<a href=\"?nav_id=$nav&serad=true&order=$order&od=".
|
75 |
|
|
($od-$limit)."&limit=$limit&$nav_tr_lang_id\">
|
76 |
|
|
Předchozích $limit </a> | ";
|
77 |
|
|
if ($od+$limit < $pocet_translation)
|
78 |
|
|
$navrat .="<a href=\"?nav_id=$nav&serad=true&order=$order&od=".
|
79 |
|
|
($od+$limit)."&limit=$limit&$nav_tr_lang_id\">
|
80 |
|
|
Dalších $limit </a> | ";
|
81 |
|
|
$navrat .="<a href=\"?nav_id=$nav&serad=true&order=$order&od=".
|
82 |
|
|
($pocet_translation-$limit)."&limit=$limit&$nav_tr_lang_id\">
|
83 |
|
|
Na konec </a></td>
|
84 |
|
|
";
|
85 |
|
|
$navrat .= "</td></tr></table>";
|
86 |
|
|
return $navrat;
|
87 |
|
|
}
|
88 |
|
|
//NOVE2504
|
89 |
|
|
function get_header_of_table() {
|
90 |
|
|
return "<tr class=\"nadpis_sekce\">
|
91 |
|
|
<td></td>
|
92 |
|
|
<td>česky</td>
|
93 |
|
|
<td>překlad</td>
|
94 |
|
|
</tr>";
|
95 |
|
|
}
|
96 |
|
|
|
97 |
|
|
|
98 |
|
|
//NOVE2504
|
99 |
|
|
function get_foot_of_table() {
|
100 |
|
|
return '<tr class="nadpis_sekce"><td></td>
|
101 |
|
|
<td></td><td></td></tr>';
|
102 |
|
|
}
|
103 |
|
|
|
104 |
|
|
function print_table_of_translation($translation_lang_id, $order = "IDtranslation", $od = 0, $limit = 30) {
|
105 |
|
|
require_once("./classes/db.php");
|
106 |
|
|
$spojeni = new DB_Sql();
|
107 |
|
|
$dotaz = "SELECT * FROM translation
|
108 |
|
|
WHERE language = '$translation_lang_id'
|
109 |
|
|
ORDER BY \"$order\"
|
110 |
|
|
OFFSET $od LIMIT $limit";
|
111 |
|
|
$radky = $spojeni->query($dotaz);
|
112 |
|
|
$navrat = "<h3 class=\"nadpis2\">Výpis překladu prostředí jazyk - $translation_lang_id</h3>";
|
113 |
|
|
$navrat .= get_razeni($translation_lang_id, $order, $od, $limit);
|
114 |
|
|
$navrat .= "<table>";
|
115 |
|
|
$navrat .= get_header_of_table();
|
116 |
|
|
while ($spojeni->next_record()) {
|
117 |
|
|
$navrat .= get_row_of_table($spojeni->Record, $translation_lang_id);
|
118 |
|
|
}
|
119 |
|
|
$navrat .= get_foot_of_table();
|
120 |
|
|
$navrat .= "</table>";
|
121 |
|
|
echo $navrat;
|
122 |
|
|
}
|
123 |
|
|
|
124 |
|
|
|
125 |
|
|
function update_translation($translation, $translation_id) {
|
126 |
|
|
require_once("./classes/db.php");
|
127 |
|
|
$spojeni = new DB_Sql();
|
128 |
|
|
$dotaz = "UPDATE translation SET translation = '$translation'
|
129 |
|
|
WHERE \"IDtranslation\" = $translation_id";
|
130 |
|
|
$spojeni->query($dotaz);
|
131 |
|
|
if ($spojeni->Errno != 0) {
|
132 |
|
|
print_hlasku("Položku se nepodařilo upravit.");
|
133 |
|
|
echo_zpet_do_translation();
|
134 |
|
|
return false;
|
135 |
|
|
}
|
136 |
|
|
print_hlasku("Položka změněna.");
|
137 |
|
|
echo_zpet_do_translation();
|
138 |
|
|
return true;
|
139 |
|
|
}
|
140 |
|
|
|
141 |
|
|
|
142 |
|
|
function get_translation($translation_id) {
|
143 |
|
|
require_once("./classes/db.php");
|
144 |
|
|
$spojeni = new DB_Sql();
|
145 |
|
|
$dotaz = "SELECT * FROM translation WHERE \"IDtranslation\" LIKE '$translation_id'";
|
146 |
|
|
$radky = $spojeni->query($dotaz);
|
147 |
|
|
|
148 |
|
|
$spojeni->next_record();
|
149 |
|
|
|
150 |
|
|
return $spojeni->Record;
|
151 |
|
|
}
|
152 |
|
|
?>
|