get_input('field'),
'results' => array()
);
if (get_input('action') == 'translate') {
$object_ids = get_input('object_ids');
// Using the method from the api.php
$schools = getSchoolsFromIDs($object_ids);
foreach ($schools as $sc) {
$res['results'][] = array($sc->school_id, $sc->school_name);
}
} else if (get_input('action') == 'suggest') {
$search = get_input('value');
$limit = (int) get_input('limit');
$schools = get_data("SELECT * FROM {$CONFIG->dbprefix}koolielu_schools WHERE school_name like '%{$search}%' limit $limit");
foreach ($schools as $sc) {
$res['results'][] = array($sc->school_id, $sc->school_name);
}
} else {
// et:paha lugu, en:...
}
echo json_encode($res);
?>