Last change
on this file since 228 was
191,
checked in by fpvanagthoven, 13 years ago
|
- Clean up van bestanden die niet meer gebruikt worden/niet nodig zijn/zijn gemerged met bestaande files.
- Daarnaast question/survey editor nu grotendeels werkend (min save functie...)
- Inloggen werkt nu op userUid ipv naam, werkt beter met het aanmaken van creators.
- Bug in returnObjectDisplay gefixt, er stond nog een var_dump tussen de echoes. JSON houdt niet van HTML tags.
|
File size:
1.3 KB
|
Line | |
---|
1 | <?php |
---|
2 | |
---|
3 | require 'classes/master.php'; //should be at top of every page |
---|
4 | |
---|
5 | if (isset($_POST['objectToCreate'])) { |
---|
6 | if (!empty($_POST['objectToCreate'])) { |
---|
7 | $otc = $_POST['objectToCreate']; |
---|
8 | } else { |
---|
9 | //die ("Invalid arguments passed!"); |
---|
10 | } |
---|
11 | } else { |
---|
12 | //die ("No arguments passed!"); |
---|
13 | } |
---|
14 | |
---|
15 | $dbi = new DatabaseInterface(); |
---|
16 | $creator_results = $dbi->get("User", array("uid" => $_SESSION['userUid'])); |
---|
17 | $creator = $creator_results[0]; |
---|
18 | |
---|
19 | //var_dump($creator); |
---|
20 | |
---|
21 | if (!$creator) { |
---|
22 | die("Stuff is broke, yo!"); |
---|
23 | } |
---|
24 | |
---|
25 | $uid = null; |
---|
26 | switch (strtolower($otc)) { |
---|
27 | case "application": |
---|
28 | $newApp = new Application(null, "New application", "Default description", "Default style"); |
---|
29 | $dbi->set($newApp); |
---|
30 | $uid = $newApp->uid; |
---|
31 | break; |
---|
32 | case "survey": |
---|
33 | $newSurvey = new Survey(null, "New Survey", "Default description", $creator, null); |
---|
34 | $dbi->set($newSurvey); |
---|
35 | $uid = $newSurvey->uid; |
---|
36 | break; |
---|
37 | case "dashboard": |
---|
38 | //TODO |
---|
39 | break; |
---|
40 | case "question": |
---|
41 | $newQuestion = new Question(null, "new Question", "int", "Default description", "Standard category", array()); |
---|
42 | $dbi->set($newQuestion); |
---|
43 | $uid = $newQuestion->uid; |
---|
44 | break; |
---|
45 | default: |
---|
46 | //die ("Variable \$otc: $otc does not match a compatible object type!"); |
---|
47 | break; |
---|
48 | } |
---|
49 | |
---|
50 | echo $uid; |
---|
51 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.