Changeset 233 for Dev/branches/jos-branch/returnObjectDisplay.php
- Timestamp:
- 01/13/12 13:57:41 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/jos-branch/returnObjectDisplay.php
r208 r233 3 3 require 'classes/master.php'; 4 4 5 /* 5 /* 6 6 * Note: do not try to implement info panel displays in this file as well, it passes and queries a lot of data that you really do not need. 7 7 * Since this function will be used so often, adding extra unneeded code to it will slow down the regular operation of the editor (refreshes, etc..) while not offering a significant advantage over the existing getInfo.php … … 9 9 10 10 11 if (isset($_POST['args']) && !empty($_POST['args'])) {11 if (isset($_POST['args']) && !empty($_POST['args'])) { 12 12 // Get arguments and convert to object 13 13 $input = $_POST['args']; … … 17 17 } 18 18 19 $dbi = new DatabaseInterface();20 19 $outputArray = array(); 21 20 foreach ($requestArray as $request) { 21 22 $type = $request->type; 23 $results = $type::get(array("uid" => $request->uid)); 22 24 23 //!!! DEZE SHIT MOET WEER TERUGGEDRAAID WORDEN ZODRA QUESTIONS WEER GEWOON UIDS HEBBEN IPV CODES!24 if ($request->type == "Question"){25 $results = $dbi->get($request->type, array("code" => $request->uid));26 // Bottom line, werkt prima. Questions werken nu op ns1:question_code, accessible als question->code27 }28 else {29 $results = $dbi->get($request->type, array("uid"=>$request->uid));30 }31 25 if (isset($results) && !empty($results)) { 32 26 is_array($results) ? $object = $results[0] : $object = $results; 27 if ($object->evaluate()) { 28 $object->ObjectType = $type; 29 $outputArray[] = $object; 30 } 33 31 } 34 32 // We now have the targeted object loaded in memory 35 33 // First add all shared properties 36 $objectProperties = array(37 "uid" => $object->uid,38 "title" => $object->title,39 "type" => get_class($object),40 "description" => $object->description41 );42 // Then add object-specific properties? (E.G. pipeline for sessions, answertype for questions, age for respondents)43 // Nothing so far, though, because data structure changes all the time...44 // Then add the resulting array to the outputArray45 $outputArray[] = $objectProperties;46 34 } 47 35 48 49 36 // Encode the output array in JSON format, then send back to the client 50 $output = json_encode($outputArray); 51 52 die($output); 37 if (!empty($outputArray)) { 38 echo JSON_encode($outputArray); 39 } 53 40 ?>
Note: See TracChangeset
for help on using the changeset viewer.