Ignore:
Timestamp:
07/21/11 13:06:09 (14 years ago)
Author:
basvannuland
Message:

added uid to data return

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/classes/SurveyDatabaseInterface.php

    r26 r28  
    1010
    1111class SurveyDatabaseInterface
    12 {       
    13     protected static $instance;
    14        
     12{               
    1513        protected $surveyRDFWriter;
    1614        protected $surveyRDFReader;
    1715 
    1816
    19     protected function __construct()
     17    public function __construct($surveyID=null)
    2018    {
    21         //protected to prevent direct instantiation
    22                 $surveyUID = md5( uniqid(rand(), true) );
    23                
     19                if($surveyID == null)
     20                        $surveyUID = md5( uniqid(rand(), true) );
     21                else
     22                        $surveyUID = $surveyID;
     23                                       
    2424                $this->surveyRDFWriter = new SurveyRDFWriter($surveyUID);
    2525                $this->surveyRDFReader = new SurveyRDFReader($surveyUID);
    2626    }
    27 
    28         public static function getInstance()
    29     {
    30         if (!self::$instance)
    31         {
    32             self::$instance = new SurveyDatabaseInterface();
    33         }
    34 
    35         return self::$instance;
    36     }
     27               
     28        public function __destruct()
     29        {
     30                echo "Destroyed";
     31        }
    3732       
    3833        public function setSurveyInfo($survey)
     
    7671                $resultSurvey = $this->surveyRDFReader->getSurveyInfo();
    7772               
     73                $surveyInfo['surveyID'] = substr($resultSurvey[0][0]['?uid'],9,strlen($resultSurvey[0][0]['?uid'])-11);
    7874                $surveyInfo['surveyTitle'] = substr($resultSurvey[0][0]['?title'],9,strlen($resultSurvey[0][0]['?title'])-11);
    7975                $surveyInfo['surveyDescription'] = substr($resultSurvey[0][0]['?description'],9,strlen($resultSurvey[0][0]['?description'])-11);
Note: See TracChangeset for help on using the changeset viewer.