get($type, array("uid" => $uid)); if (count($results) > 0) { // check if DB object exists and assign it to variable if ($results[0] != null) { $returnString = ""; $result = $results[0]; } else return; } else return; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // Note: the next part needs to be converted to JSON operation, so that the javascript can easily handle any style changes to the information retrieved. This implementation is just silly. // Basic idea: return a JSON array of property: value pairs, then let javascript loop through these properties and format them suitably. This is both more flexible and easier to adjust, as well as resulting in smaller packets. // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! switch ($type) { case "Session": $returnString .= "Title: $result->title"; $result->evaluate(); $returnString .= "Created: " . $result->creationdate->format("H:i:s, d-m-Y") . " by " . $result->creator->name . ""; $cS = 0; $cD = 0; $cA = 0; foreach ($result->pipeline as $step) { switch (get_class($step)){ case "Survey": $cS++; break; case "Application": $cA++; break; case "Dashboard": $cD++; break; default: //derp? break; } } $returnString .= "Number of steps: "; break; case "Survey": $returnString .= "Title: $result->title"; $returnString .= "Creator: LOLOL ME!!!"; $qCount = 0; $qCount = count($result->questions); $returnString .= "Questions: $qCount"; $returnString .= "Description: $result->description"; break; case "Application": $returnString .= "Title: $result->title"; $returnString .= "Path: C:/folder_of_awesomeness/epicgame.exe"; $returnString .= "Description: $result->description"; break; case "Dashboard": break; case "Respondent": break; case "Question": break; case "Answer": break; default: break; } echo $returnString; ?>