source: Dev/trunk/createsurvey.php @ 186

Last change on this file since 186 was 163, checked in by fpvanagthoven, 13 years ago
  • Basically alles gefixt om te werken met een local copy van de session, opgeslagen in $_SESSIONlocalSessionCopy?.
  • Flag $_SESSIONupdateNeeded? toegevoegd om aan te geven wanneer er een update uit de database nodig is in plaats van gewoon verder werken met de local copy.
  • '123'/'456' placeholder routine weggehaald uit returnStep.php
  • CreateObject? doet nog niets, maar dat komt volgende week! (AJAX-aangestuurd object creation, met als doel: pipeline editing zonder constante page refreshes).
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.