source: Dev/trunk/getInfo.php @ 161

Last change on this file since 161 was 152, checked in by fpvanagthoven, 13 years ago
  • getInfo.php returnet informatie over het aangevraagde object. Dit kan via ajax routines op verscheidene infopanels weergegeven worden. (Bijvoorbeeld in de huidige versie van selectSession.php). Deze script wordt later nog uitgebreid om verschillende soorten objecten en sets informatie weer te geven. (Momenteel alleen sessions!)
  • selectSession werkt grotendeels, op deleteSession en een non-fatal error bij createSession na.
  • logout.php gebruikt nu ook destroy_session();
  • sequencerScripts.js uitgebreid om een simpel aan te roepen AJAX routine mogelijk te maken. Dit biedt de mogelijkheid om pagina's aan te passen zonder een refresh.
File size: 1.2 KB
Line 
1<?php
2
3require 'classes/master.php'; //should be at top of every page
4
5/*
6 * Add extra POST variable in functions using this php return, describing object type.
7 * This makes it easier to decide what properties to echo and also to query the database.
8 * (Prevents repetitive session->query->question->application->user->respondent->etc queries!)
9 */
10
11if (isset($_POST['uid'])) {
12    if (!empty($_POST['uid'])) {
13        $uid = $_POST['uid'];
14    } else {
15        //$errors[] = "No uid passed!";
16    }
17} else {
18    //$errors[] = "Wrong call, no uid property in POST data!";
19}
20
21$dbi = new DatabaseInterface();
22
23// For the moment only supports sessions as object to get information for!
24$results = $dbi->get("Session", array("uid" => $uid));
25
26if (count($results) > 0) {
27    if ($results[0] != null) {
28        $returnString = "";
29
30        $result = $results[0];
31        $returnString = $returnString . "Title: $result->title. <br />";
32        $length = count($result->pipeline);
33        $returnString = $returnString .  "Number of steps: $length <br />";
34        $returnString = $returnString . "UID: $uid";
35    } else {
36        $returnString = "Null error!";
37    }
38} else {
39    $returnString = "Non-existing uid!";
40}
41
42echo $returnString;
43?>
Note: See TracBrowser for help on using the repository browser.