Last change
on this file since 246 was
246,
checked in by hendrikvanantwerpen, 13 years ago
|
Created first page mainmenu in new system.
Moved old pages out of project root.
Fixed RDFAPI.php case for people with proper OS'es.
|
File size:
1.2 KB
|
Rev | Line | |
---|
[208] | 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 | |
---|
[238] | 20 | $survey_results = Survey::get(array("uid" => $args->uid)); |
---|
[208] | 21 | if (!empty($survey_results)) { |
---|
| 22 | $survey = $survey_results[0]; |
---|
| 23 | } else { |
---|
| 24 | die("No survey found!"); |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | $question->questions = array(); |
---|
| 28 | foreach ($args->questions->uids as $questionUid) { |
---|
[238] | 29 | $question_results = Question::get(array("uid"=>$questionUid)); |
---|
[208] | 30 | $question = $question_results[0]; |
---|
| 31 | $survey->questions[] = $question; |
---|
| 32 | } |
---|
| 33 | |
---|
| 34 | // The next part is a rather experimental way of automatically writing all passed arguments to the session object. |
---|
| 35 | // If this does not work properly, we should write the "write title to session->title" call by hand. |
---|
| 36 | /* |
---|
| 37 | foreach ($args as $key=>$value) { |
---|
| 38 | $session->$key = $value; |
---|
| 39 | } |
---|
| 40 | */ |
---|
[238] | 41 | //var_dump($survey); |
---|
[208] | 42 | // Do I need to check if this is done before proceeding? |
---|
[238] | 43 | $survey->save(); |
---|
[208] | 44 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.