Rev | Line | |
---|
[156] | 1 | <?php |
---|
| 2 | |
---|
| 3 | require 'classes/master.php'; //should be at top of every page |
---|
| 4 | |
---|
| 5 | if (!isset($_SESSION['username'])) { |
---|
| 6 | redirect("index.php"); |
---|
| 7 | } |
---|
| 8 | |
---|
| 9 | $dbi = new DatabaseInterface(); |
---|
| 10 | $creator_results = $dbi->get("user", array("name" => $_SESSION['username'])); |
---|
| 11 | if (count($creator_results) > 0) { |
---|
| 12 | $creator = $creator_results[0]; |
---|
| 13 | $newSurvey = new Survey(null, "New survey", "Default description", $creator, null); |
---|
| 14 | $dbi->set($newSurvey); |
---|
| 15 | } else { |
---|
| 16 | die("No user with that uid found!"); |
---|
| 17 | } |
---|
| 18 | |
---|
| 19 | // Optional part, for when the session needs to be set in pipelineEditor |
---|
| 20 | $session_results = $dbi->get("session", array("uid" => $_SESSION['currentSession'])); |
---|
| 21 | if (count($session_results) > 0) { |
---|
| 22 | $session = $session_results[0]; |
---|
| 23 | $session->pipeline[] = $newSurvey; |
---|
| 24 | $dbi->set($session); |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | |
---|
| 28 | redirect("pipelineEditor.php"); |
---|
| 29 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.