Index: Dev/trunk/getInfo.php
===================================================================
--- Dev/trunk/getInfo.php	(revision 152)
+++ Dev/trunk/getInfo.php	(revision 168)
@@ -3,41 +3,82 @@
 require 'classes/master.php'; //should be at top of every page
 
-/*
- * Add extra POST variable in functions using this php return, describing object type.
- * This makes it easier to decide what properties to echo and also to query the database.
- * (Prevents repetitive session->query->question->application->user->respondent->etc queries!)
- */
-
-if (isset($_POST['uid'])) {
-    if (!empty($_POST['uid'])) {
+if (isset($_POST['uid']) && isset($_POST['type'])) {
+    if (!empty($_POST['uid']) && !empty($_POST['type'])) {
         $uid = $_POST['uid'];
+        $type = $_POST['type'];
     } else {
-        //$errors[] = "No uid passed!";
+//$errors[] = "No uid passed!";
+        return;
     }
 } else {
-    //$errors[] = "Wrong call, no uid property in POST data!";
+//$errors[] = "Wrong call, no uid property in POST data!";
+    return;
 }
 
 $dbi = new DatabaseInterface();
 
-// For the moment only supports sessions as object to get information for!
-$results = $dbi->get("Session", array("uid" => $uid));
+$results = $dbi->get($type, array("uid" => $uid));
 
-if (count($results) > 0) {
+if (count($results) > 0) {      // check if DB object exists and assign it to variable
     if ($results[0] != null) {
-        $returnString = "";
+        $returnString = "<table border='0'>";
+        $result = $results[0];
+    } else
+        return;
+} else
+    return;
 
-        $result = $results[0];
-        $returnString = $returnString . "Title: $result->title. <br />";
-        $length = count($result->pipeline);
-        $returnString = $returnString .  "Number of steps: $length <br />";
-        $returnString = $returnString . "UID: $uid";
-    } else {
-        $returnString = "Null error!";
-    }
-} else {
-    $returnString = "Non-existing uid!";
+switch ($type) {
+    case "Session":
+        $returnString .= "<tr> <td>Name</td> <td>$result->title</td> </tr>";
+        $returnString .= "<tr><td>Created</td><td>" . $result->datetime->format("H:i:s, d-m-Y") . " by " . $result->creator[0]->name . "</td></tr>";
+        $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 .= "<tr><td>Number of steps</td><td><ul style='list-style-type: none;'><li style='margin-left: -40px;'>$cS Surveys<li style='margin-left: -40px;'>$cA Applications<li style='margin-left: -40px;'>$cD Dashboards</ul></td></tr>";
+        break;
+    case "Survey":
+        $returnString .= "<tr> <td>Name</td><td>$result->title</td> </tr>";
+        $returnString .= "<tr> <td>Creator</td> <td>LOLOL ME!!!</td> </tr>";
+        $qCount = 0;
+        foreach ($result->questions as $q) {
+            $qCount++;
+        }
+        $returnString .= "<tr> <td>Questions</td> <td>$qCount</td> </tr>";
+        $returnString .= "<tr> <td>Description</td> <td>$result->description</td> </tr>";
+        
+        break;
+    case "Application":
+        $returnString .= "<tr> <td>Name</td> <td>$result->title</td> </tr>";
+        $returnString .= "<tr> <td>Location</td> <td>C:/folder_of_awesomeness/epicgame.exe</td> </tr>";
+        $returnString .= "<tr> <td>Description</td> <td>$result->description</td> </tr>";
+        break;
+    case "Dashboard":
+        break;
+    case "Respondent":
+        break;
+    case "Question":
+        break;
+    case "Answer":
+        break;
+    default:
+        break;
 }
 
+$returnString .= "</table>";
 echo $returnString;
 ?>
