Last change
on this file since 236 was
235,
checked in by fpvanagthoven, 13 years ago
|
getObject.php is de nieuwe pagina die gewoon PHP objecten in JSON zet en echoet. Nu werkt alleen de questionEditor er op, uiteindelijk zou dit ook de infopanel en de sequencer moeten gaan serven.
|
File size:
696 bytes
|
Line | |
---|
1 | <?php |
---|
2 | |
---|
3 | require "classes/master.php"; |
---|
4 | |
---|
5 | //Get post variables |
---|
6 | if (!isset($_POST['args']) || empty($_POST['args'])) { |
---|
7 | $requestArray = JSON_deode($_POST['args']); |
---|
8 | } else { |
---|
9 | die("No input passed!"); |
---|
10 | } |
---|
11 | |
---|
12 | $resultArray = array(); |
---|
13 | |
---|
14 | foreach ($requestArray as $request) { |
---|
15 | $type = $request->type; |
---|
16 | $results = $type::get(array("uid" => $request->uid)); |
---|
17 | |
---|
18 | if (isset($results) && !empty($results) && count($results) > 0) { |
---|
19 | // Add type property for easier identification in JS. |
---|
20 | $results[0]->objectType = type; |
---|
21 | $resultArray[] = $results[0]; |
---|
22 | } |
---|
23 | else { |
---|
24 | $resultArray[] = array("uid"=>"Not found!"); |
---|
25 | } |
---|
26 | } |
---|
27 | |
---|
28 | $output = JSON.encode($resultArray); |
---|
29 | echo $output; |
---|
30 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.