5 |
5 |
* Pomocna funkce, vraci do tabulky zformatovane slovo
|
6 |
6 |
*
|
7 |
7 |
* @param $Record polozka slovniku nactena z db
|
8 |
|
* @return do tabulky zformatovany zaznam
|
|
8 |
* @return string tabulky zformatovany zaznam
|
9 |
9 |
*/
|
10 |
|
|
11 |
|
function get_row_of_table($Record, $od = 1, $do = 3) {
|
12 |
|
$navrat .= "<tr class=\"akt\">\n ";
|
13 |
|
$navrat .= '<td>'.$Record[0].'</td>'.
|
14 |
|
'<td><a href="?nav_id=edit_report&ratio='.$Record[0].'">edit</a></td>';
|
15 |
|
for($j=$od;$j<$do;$j++) {
|
16 |
|
$navrat .= "<td class=\"akt\">";
|
17 |
|
$navrat .= "$Record[$j]";
|
18 |
|
$navrat .= " </td>\n";
|
19 |
|
}
|
20 |
|
$navrat .= "</tr> \n ";
|
21 |
|
return $navrat;
|
22 |
|
}
|
23 |
10 |
|
|
11 |
function get_row_of_table($record)
|
|
12 |
{
|
|
13 |
$navrat = '<tr class="akt">';
|
|
14 |
$navrat .= "<td>$record[0]</td>";
|
|
15 |
$navrat .= "<td><a href='?nav_id=edit_report&ratio=$record[0]'>edit</a></td>";
|
|
16 |
|
|
17 |
for ($i = 1; $i < 3; $i++)
|
|
18 |
{
|
|
19 |
$navrat .= "<td>$record[$i]</td>";
|
|
20 |
}
|
|
21 |
|
|
22 |
$navrat .= "</tr>";
|
|
23 |
|
|
24 |
return $navrat;
|
|
25 |
}
|
24 |
26 |
|
25 |
27 |
function get_pocet_reportu() {
|
26 |
28 |
require_once("./classes/db.php");
|
... | ... | |
48 |
50 |
function print_table_of_reports($order = "ratio", $od = 0, $limit = 30) {
|
49 |
51 |
require_once("./classes/db.php");
|
50 |
52 |
$spojeni = new DB_Sql();
|
51 |
|
$dotaz = "SELECT * FROM report ORDER BY \"$order\" OFFSET $od LIMIT $limit";
|
52 |
|
$radky = $spojeni->query($dotaz);
|
|
53 |
$dotaz = "SELECT * FROM report ORDER BY $order LIMIT $limit OFFSET $od ";
|
|
54 |
$query = $spojeni->query($dotaz);
|
53 |
55 |
$navrat = "<h3 class=\"nadpis2\">Výpis zpráv</h3>";
|
54 |
56 |
$navrat .= "<table><form action=\"\" method=\"post\">";
|
55 |
57 |
$navrat .= get_header_of_table();
|
56 |
|
while ($spojeni->next_record()) {
|
57 |
|
$navrat .= get_row_of_table($spojeni->Record, 1, 3);
|
|
58 |
|
|
59 |
$radky = $query->fetch_all();
|
|
60 |
foreach ($radky as $radka) {
|
|
61 |
$navrat .= get_row_of_table($radka);
|
58 |
62 |
}
|
59 |
63 |
$navrat .= get_foot_of_table();
|
60 |
64 |
$navrat .= '';
|
... | ... | |
65 |
69 |
function update_report($czech, $english, $ratio) {
|
66 |
70 |
require_once("./classes/db.php");
|
67 |
71 |
$spojeni = new DB_Sql();
|
68 |
|
$dotaz = "UPDATE report SET czech = '".pg_escape_string($czech)."',
|
69 |
|
english = '".pg_escape_string($english)."'
|
70 |
|
WHERE \"ratio\" = $ratio";
|
|
72 |
$dotaz = "UPDATE report SET czech = '" . $spojeni->escape_string($czech) . "',
|
|
73 |
english = '" . $spojeni->escape_string($english) . "'
|
|
74 |
WHERE ratio = $ratio";
|
71 |
75 |
$spojeni->query($dotaz);
|
72 |
76 |
if ($spojeni->connection->errno != 0) {
|
73 |
77 |
print_hlasku("Zprávu se nepodařilo upravit.");
|
... | ... | |
82 |
86 |
function get_report($ratio) {
|
83 |
87 |
require_once("./classes/db.php");
|
84 |
88 |
$spojeni = new DB_Sql();
|
85 |
|
$dotaz = "SELECT * FROM report WHERE \"ratio\" LIKE '$ratio'";
|
|
89 |
$dotaz = "SELECT * FROM report WHERE ratio LIKE '$ratio'";
|
86 |
90 |
$radky = $spojeni->query($dotaz);
|
87 |
|
|
88 |
|
$spojeni->next_record();
|
89 |
91 |
|
90 |
|
return $spojeni->Record;
|
|
92 |
return mysqli_fetch_assoc($radky);
|
91 |
93 |
}
|
Re #7580 úpravy motivačních hlášek