source: Dev/trunk/classes/SessionDatabaseInterface.php @ 79

Last change on this file since 79 was 78, checked in by basvannuland, 14 years ago

save and load application
start with save and load session

File size: 2.1 KB
Line 
1<?php
2
3// Survey database interface class as intermediate for storing data from the site to the RDF database
4require_once 'rdfConstants.php';
5
6// Include RAP Library to write RDF files
7include(RDFAPI_INCLUDE_DIR . "RDFAPI.php");
8
9
10
11class SessionDatabaseInterface
12{               
13    protected $sessionRDFWriter;
14    protected $sessionRDFReader;
15
16
17    public function __construct($sessionID)
18    {
19        if($sessionID == null)
20            $sessionUID = md5( uniqid(rand(), true) );
21        else
22            $sessionUID = $sessionID;
23
24        $this->sessionRDFWriter = new SessionRDFWriter($surveyUID);
25        $this->sessionRDFReader = new SessionRDFReader($surveyUID);
26    }
27   
28    public function setSessionInfo($session)
29    {
30        $sTitle = $session['sessionTitle'];
31        $sDescription = $session['sessionDescription'];
32
33        $this->sessionRDFWriter->createSession($sTitle,$sDescription);
34       
35        $pipelineCount = $session['pipelineCount'];
36       
37        for($i = 1; $i <= $pipelineCount; $i++)
38        {
39            if(isset($session[$i.'s']))
40            {
41                $this->sessionRDFWriter->addSurveyToPipeline($session[$i.'s'], $i);
42            }
43            else if(isset($session[$i.'a']))
44            {
45                $this->sessionRDFWriter->addApplicationToPipeline($session[$i.'a'], $i);
46            }
47            else if(isset($session[$i.'d']))
48            {
49                $this->sessionRDFWriter->addDashboardToPipeline($session[$i.'d'], $i);
50            }
51        }
52    }
53   
54    public function getSessionInfo()
55    {
56        $sessionInfo = array();
57
58        $resultSession = $this->sessionRDFReader->getSurveyInfo();
59       
60        $sessionInfo['sessionTitle'] = substr($resultSession[0][0]['?title'],9,strlen($resultSession[0][0]['?title'])-11);
61        $sessionInfo['sessionDescription'] = substr($resultSession[0][0]['?description'],9,strlen($resultSession[0][0]['?description'])-11);
62       
63        foreach ($resultSession[1][1] as $surveyInfo)
64         {
65           
66        }
67    }
68   
69    public function getExistingSessions()
70    {
71       
72    }
73}
74?>
Note: See TracBrowser for help on using the repository browser.