source: Dev/trunk/getInfo.php @ 173

Last change on this file since 173 was 168, checked in by fpvanagthoven, 13 years ago
  • moveStep() [js] werkt weer, editor is nu op delete/clear na helemaal functioneel
  • Zit nog steeds een creator bug in savesession.php en selectSession.php
  • getInfo.php is nu aangepast om voor meerdere objecttypes te werken en relevante informatie terug te geven, geformatteerd als table. De styling hiervan moet wel nog beter geregeld worden.
File size: 2.7 KB
Line 
1<?php
2
3require 'classes/master.php'; //should be at top of every page
4
5if (isset($_POST['uid']) && isset($_POST['type'])) {
6    if (!empty($_POST['uid']) && !empty($_POST['type'])) {
7        $uid = $_POST['uid'];
8        $type = $_POST['type'];
9    } else {
10//$errors[] = "No uid passed!";
11        return;
12    }
13} else {
14//$errors[] = "Wrong call, no uid property in POST data!";
15    return;
16}
17
18$dbi = new DatabaseInterface();
19
20$results = $dbi->get($type, array("uid" => $uid));
21
22if (count($results) > 0) {      // check if DB object exists and assign it to variable
23    if ($results[0] != null) {
24        $returnString = "<table border='0'>";
25        $result = $results[0];
26    } else
27        return;
28} else
29    return;
30
31switch ($type) {
32    case "Session":
33        $returnString .= "<tr> <td>Name</td> <td>$result->title</td> </tr>";
34        $returnString .= "<tr><td>Created</td><td>" . $result->datetime->format("H:i:s, d-m-Y") . " by " . $result->creator[0]->name . "</td></tr>";
35        $cS = 0; $cD = 0; $cA = 0;
36        foreach ($result->pipeline as $step) {
37            switch (get_class($step)){
38                case "Survey":
39                    $cS++;
40                    break;
41                case "Application":
42                    $cA++;
43                    break;
44                case "Dashboard":
45                    $cD++;
46                    break;
47                default:
48                    //derp?
49                    break;
50            }
51        }
52        $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>";
53        break;
54    case "Survey":
55        $returnString .= "<tr> <td>Name</td><td>$result->title</td> </tr>";
56        $returnString .= "<tr> <td>Creator</td> <td>LOLOL ME!!!</td> </tr>";
57        $qCount = 0;
58        foreach ($result->questions as $q) {
59            $qCount++;
60        }
61        $returnString .= "<tr> <td>Questions</td> <td>$qCount</td> </tr>";
62        $returnString .= "<tr> <td>Description</td> <td>$result->description</td> </tr>";
63       
64        break;
65    case "Application":
66        $returnString .= "<tr> <td>Name</td> <td>$result->title</td> </tr>";
67        $returnString .= "<tr> <td>Location</td> <td>C:/folder_of_awesomeness/epicgame.exe</td> </tr>";
68        $returnString .= "<tr> <td>Description</td> <td>$result->description</td> </tr>";
69        break;
70    case "Dashboard":
71        break;
72    case "Respondent":
73        break;
74    case "Question":
75        break;
76    case "Answer":
77        break;
78    default:
79        break;
80}
81
82$returnString .= "</table>";
83echo $returnString;
84?>
Note: See TracBrowser for help on using the repository browser.