Revize b9ed6a80
Přidáno uživatelem Tomáš Pašek před více než 3 roky(ů)
application/controller/TableController.php | ||
---|---|---|
1 | 1 |
<?php |
2 | 2 |
require "../model/DB.php"; |
3 |
require "../model/Tag.php"; |
|
4 |
require "../model/Word.php"; |
|
3 | 5 |
$DB = new DB(); |
4 | 6 |
|
5 | 7 |
// (B) SEARCH FOR USERS |
6 | 8 |
$results = $DB->select( |
7 |
"SELECT * FROM dd_wordform limit 10" |
|
9 |
"SELECT w.id, w.context, w.date, w.description, w.description2, w.description3, w.ending, w.finished, |
|
10 |
w.namedentity, w.position1, w.position2, w.positiondetail, w.word, w.tag_id, w.lemma_id, t.tag, l.lemma, l.pos FROM dd_wordform as w left join dd_tag as t on w.tag_id = t.id left join dd_lemma as l on w.lemma_id = l.id order by w.id LIMIT 100" |
|
8 | 11 |
); |
9 | 12 |
|
10 |
// (C) OUTPUT RESULTS |
|
11 |
$result = json_encode(count($results)==0 ? null : $results); |
|
13 |
var_dump($results); |
|
14 |
|
|
15 |
$output = Array(); |
|
16 |
foreach ($results as $res) { |
|
17 |
$tag = new Tag($res["tag_id"], $res["tag"]); |
|
18 |
$lemma = new Lemma($res["lemma_id"], $res["lemma"], $res["pos"]); |
|
19 |
$word = new Word($res["id"], $res["context"], $res["date"], $res["description"], $res["description2"], $res["description3"], $res["ending"], |
|
20 |
$res["finished"], $res["namedentity"], $res["position1"], $res["position2"], $res["positiondetail"], $res["word"], $lemma, $tag); |
|
21 |
array_push($output, $word); |
|
22 |
} |
|
23 |
|
|
24 |
$result = json_encode(count($output)==0 ? null : $output); |
|
12 | 25 |
echo $result; |
Také k dispozici: Unified diff
Feature #8345 Implementce filterů dat - Server
vytvořené objekty databáze, posílání json objektu klientu