Line | |
---|
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'])); // Determine if user exists, so we can add him/her as creator of the new survey |
---|
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 | // For now, store in local copy, only upload local copy to db when needed (page change, etc...) |
---|
21 | if (isset($_SESSION['localSessionCopy']) && !empty($_SESSION['localSessionCopy'])) { |
---|
22 | $session = $_SESSION['localSessionCopy']; |
---|
23 | $session->pipeline[] = $newSurvey; |
---|
24 | $_SESSION['localSessionCopy'] = $session; |
---|
25 | } |
---|
26 | |
---|
27 | |
---|
28 | redirect("pipelineEditor.php"); |
---|
29 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.