[40] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | // Survey database interface class as intermediate for storing data from the site to the RDF database
|
---|
[45] | 4 | require_once 'rdfConstants.php';
|
---|
[40] | 5 |
|
---|
| 6 | // Include RAP Library to write RDF files
|
---|
| 7 | include(RDFAPI_INCLUDE_DIR . "RDFAPI.php");
|
---|
| 8 |
|
---|
| 9 |
|
---|
| 10 |
|
---|
| 11 | class ApplicationDatabaseInterface
|
---|
| 12 | {
|
---|
| 13 | protected $applicationRDFWriter;
|
---|
| 14 | protected $applicationRDFReader;
|
---|
| 15 |
|
---|
| 16 |
|
---|
| 17 | public function __construct($surveyID)
|
---|
| 18 | {
|
---|
| 19 | if($surveyID == null)
|
---|
| 20 | $surveyUID = md5( uniqid(rand(), true) );
|
---|
| 21 | else
|
---|
| 22 | $surveyUID = $surveyID;
|
---|
| 23 |
|
---|
| 24 | $this->applicationRDFWriter = new ApplicationRDFWriter();
|
---|
| 25 | $this->applicationRDFReader = new ApplicationRDFReader();
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | public function setApplicationInfo($application)
|
---|
| 29 | {
|
---|
| 30 | $aTitle = $application['applicationTitle'];
|
---|
| 31 | $aDescription = $application['applicationDescription'];
|
---|
| 32 | $aStyle = $application['applicationStyle'];
|
---|
| 33 |
|
---|
| 34 | $this->applicationRDFWriter->setApplicationInfo($aTitle, $aDescription, $aStyle)
|
---|
| 35 |
|
---|
| 36 | $this->applicationRDFWriter->saveApplications();
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | public function getApplicationInfo()
|
---|
| 40 | {
|
---|
| 41 | $applicationInfo = array();
|
---|
| 42 |
|
---|
| 43 | $resultApplication = $this->applicationRDFReader->readAllApplications();
|
---|
| 44 |
|
---|
| 45 | for($aNumber = 0;$aNumber<=sizeof($resultApplication[0]);$aNumber++)
|
---|
| 46 | {
|
---|
| 47 | $applicationInfo['applicationID'] = substr($resultSurvey[0][$aNumber]['?uid'],9,strlen($resultSurvey[0][$aNumber]['?uid'])-11);
|
---|
| 48 | $applicationInfo['applicationTitle'] = substr($resultSurvey[1][$aNumber]['?title'],9,strlen($resultSurvey[0][$aNumber]['?title'])-11);
|
---|
| 49 | $applicationInfo['applicationDescription'] = substr($resultSurvey[2][$aNumber]['?description'],9,strlen($resultSurvey[0][$aNumber]['?description'])-11);
|
---|
| 50 | $applicationInfo['applicationStyle'] = substr($resultSurvey[3][$aNumber]['?style'],9,strlen($resultSurvey[0][$aNumber]['?style'])-11);
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | return $applicationInfo;
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 | }
|
---|
| 57 | ?> |
---|