Last change
on this file since 386 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.2 KB
|
Line | |
---|
1 | <?php |
---|
2 | |
---|
3 | require 'classes/master.php'; |
---|
4 | |
---|
5 | // Quit if no arguments have been passed. |
---|
6 | if (!isset($_POST['args'])) { |
---|
7 | if (empty($_POST['args'])) { |
---|
8 | die("Error! No arguments passed!"); |
---|
9 | } |
---|
10 | } |
---|
11 | |
---|
12 | $args = json_decode($_POST['args']); |
---|
13 | if ($args == false) { |
---|
14 | die("Error decoding JSON arguments!"); |
---|
15 | } |
---|
16 | |
---|
17 | // At this point we know we have arguments in the POST data. |
---|
18 | // Query the survey object from the database. |
---|
19 | |
---|
20 | $dbi = new DatabaseInterface(); |
---|
21 | $survey_results = $dbi->get("Survey", array("uid" => $args->uid)); |
---|
22 | if (!empty($survey_results)) { |
---|
23 | $survey = $survey_results[0]; |
---|
24 | } else { |
---|
25 | die("No survey found!"); |
---|
26 | } |
---|
27 | |
---|
28 | $question->questions = array(); |
---|
29 | foreach ($args->questions->uids as $questionUid) { |
---|
30 | $question_results = $dbi->get("Question", array("code"=>$questionUid)); |
---|
31 | $question = $question_results[0]; |
---|
32 | $survey->questions[] = $question; |
---|
33 | } |
---|
34 | |
---|
35 | // The next part is a rather experimental way of automatically writing all passed arguments to the session object. |
---|
36 | // If this does not work properly, we should write the "write title to session->title" call by hand. |
---|
37 | /* |
---|
38 | foreach ($args as $key=>$value) { |
---|
39 | $session->$key = $value; |
---|
40 | } |
---|
41 | */ |
---|
42 | var_dump($survey); |
---|
43 | // Do I need to check if this is done before proceeding? |
---|
44 | $dbi->set($survey); |
---|
45 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.