Ignore:
Timestamp:
08/30/11 17:49:19 (14 years ago)
Author:
basvannuland
Message:

start with dashboard database

File:
1 edited

Legend:

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

    r85 r91  
    9494        }
    9595       
    96         if(!$this->checkQuestionIDExists($qID))
    97         {
     96        if($this->checkQuestionCodeExists($qCode))
     97        {
     98            return 'Question code (' . $qCode . ') already in use. Please try a new code.';
     99        }
     100        else if($this->checkQuestionIDExists($qID))
     101        {
     102            return 'Question already exists';
     103        }
     104        else {
    98105            $this->questionRDFWriter->createQuestion($qTitle,$qDescription,$qType,$qID,"null","null",$qAnswers);
     106            return 'Question saved';
    99107        }
    100108    }
     
    201209        return $result;
    202210    }
     211   
     212    public function checkQuestionCodeExists($qCode)
     213    {
     214        $result = false;
     215
     216        $questionCodes = $this->questionRDFReader->readQuestionCodes();
     217       
     218        if ($questionCodes != null)
     219        {
     220            foreach($questionCodes as $questionCode)
     221            {
     222                $code = $questionCode['?questionCode']->label;
     223                if(!strcmp($code ,$qCode))
     224                {
     225                    $result = true;
     226                    break;
     227                }
     228            }
     229        }
     230
     231        return $result;
     232    }
    203233}
    204234?>
Note: See TracChangeset for help on using the changeset viewer.