Last change
on this file since 192 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
|
Rev | Line | |
---|
[163] | 1 | <?php |
---|
| 2 | |
---|
[165] | 3 | require 'classes/master.php'; //should be at top of every page |
---|
[163] | 4 | |
---|
[165] | 5 | if (isset($_POST['objectToCreate'])) { |
---|
| 6 | if (!empty($_POST['objectToCreate'])) { |
---|
| 7 | $otc = $_POST['objectToCreate']; |
---|
[185] | 8 | } else { |
---|
[166] | 9 | //die ("Invalid arguments passed!"); |
---|
[165] | 10 | } |
---|
[185] | 11 | } else { |
---|
[166] | 12 | //die ("No arguments passed!"); |
---|
[165] | 13 | } |
---|
[163] | 14 | |
---|
[165] | 15 | $dbi = new DatabaseInterface(); |
---|
[191] | 16 | $creator_results = $dbi->get("User", array("uid" => $_SESSION['userUid'])); |
---|
| 17 | $creator = $creator_results[0]; |
---|
[188] | 18 | |
---|
[191] | 19 | //var_dump($creator); |
---|
| 20 | |
---|
| 21 | if (!$creator) { |
---|
| 22 | die("Stuff is broke, yo!"); |
---|
[165] | 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; |
---|
[185] | 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; |
---|
[165] | 45 | default: |
---|
[166] | 46 | //die ("Variable \$otc: $otc does not match a compatible object type!"); |
---|
[165] | 47 | break; |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | echo $uid; |
---|
[163] | 51 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.