source: Dev/branches/jos-branch/createsurvey.php @ 233

Last change on this file since 233 was 208, checked in by jkraaijeveld, 13 years ago

Got latest version from trunk. Ready to reorganise.

File size: 993 bytes
Line 
1<?php
2
3require 'classes/master.php'; //should be at top of every page
4
5if (!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
11if (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...)
21if (isset($_SESSION['localSessionCopy']) && !empty($_SESSION['localSessionCopy'])) {
22    $session = $_SESSION['localSessionCopy'];
23    $session->pipeline[] = $newSurvey;
24    $_SESSION['localSessionCopy'] = $session;
25}
26
27
28redirect("pipelineEditor.php");
29?>
Note: See TracBrowser for help on using the repository browser.