1 |
3b343aea
|
Tomáš Pašek
|
<?php
|
2 |
|
|
require "../model/DB.php";
|
3 |
b9ed6a80
|
Tomáš Pašek
|
require "../model/Tag.php";
|
4 |
|
|
require "../model/Word.php";
|
5 |
3b343aea
|
Tomáš Pašek
|
$DB = new DB();
|
6 |
|
|
|
7 |
|
|
// (B) SEARCH FOR USERS
|
8 |
|
|
$results = $DB->select(
|
9 |
b9ed6a80
|
Tomáš Pašek
|
"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"
|
11 |
3b343aea
|
Tomáš Pašek
|
);
|
12 |
|
|
|
13 |
b9ed6a80
|
Tomáš Pašek
|
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);
|
25 |
3b343aea
|
Tomáš Pašek
|
echo $result;
|