Changes in / [30:20]


Ignore:
Files:
4 deleted
8 edited

Legend:

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

    r30 r20  
    99class SurveyCreationTool {
    1010
    11     private $survey;
    12     private $timeStamp;
    13 
    14     public function __construct($survey = null, $timeStamp = null) {
    15         $this->survey = $survey;
    16         $this->timeStamp = $timeStamp;
    17 
    18         if( isset($this->survey->id))
    19             SurveyCreationTool::javascript($this->survey->id);
    20         else
    21             SurveyCreationTool::javascript();
    22         ?>
    23 
    24         <div id="surveyCreation"><form id="survey" action="submitsurvey.php" method="post">
     11    public function __construct() {
     12        SurveyCreationTool::javascript();
     13        ?>
     14
     15        <div id="surveyCreation"><form action="submitsurvey.php" method="post">
    2516                <?php
    26                 $this->surveyHead();
    27                 $this->questionCreationForm();
     17                SurveyCreationTool::titleBox();
     18                SurveyCreationTool::descriptionBox();
     19                SurveyCreationTool::questionCreationForm();
    2820                SurveyCreationTool::addQuestionButton();
    2921                SurveyCreationTool::removeLastQuestionButton();
     
    3325    }
    3426
    35     private static function javascript($id = null) {
     27    private static function javascript() {
    3628        ?>
    3729        <script type="text/javascript">
    38             /* autosave every 3 minutes */
    39             setTimeout("save('<?php echo $id; ?>')", 180000);
    40                                                                            
    41             var questionCount = 1;         
    42                                                                                                                                                                                                                    
    43             function getNewQuestion(title, description)
    44             {
    45                 if (title != null)
    46                     var title = title;
    47                 else
    48                     var title = 'Untitled Question';
    49                
    50                 if (description != null)
    51                     var description = description;
    52                 else
    53                     var description = 'Write a question description here.';
    54                                    
     30            var questionCount = 1;           
     31                                                                                                                   
     32            function getNewQuestion()
     33            {
    5534                var questionDiv = document.createElement("div");
    5635                var htmlStr =
     
    5938                    "<th>Question " + questionCount + "</th>" +
    6039                    "<tr><td><label for='questionTitle'>Title</label></td>" +
    61                     "<td><input type='text' class='questionTitle' name='questionTitle" + questionCount + "' onfocus='handleFocus(this)' size='30' value='" + title + "' /></td></tr>" +
     40                    "<td><input type='text' class='questionTitle' name='questionTitle" + questionCount + "' size='30' value='Untitled Question' /></td></tr>" +
    6241                    "<tr><td><label for='questionDescription'>Description</label></td>" +
    63                     "<td><input type='text' class='questionDescription' name='questionDescription" + questionCount + "' onfocus='handleFocus(this)' size='60' value='" + description + "' /></td>" +
     42                    "<td><input type='text' class='questionDescription' name='questionDescription" + questionCount + "' size='60' value='Write a question description here.' /></td>" +
    6443                    "<tr><td><label for='questionType'>Answer type</label></td>" +
    6544                    "<td><select id='" + questionCount + "' name='questionType" + questionCount + "' onchange='handleType(this)'><br />"+
     
    7150                    "</select></td></tr>" +
    7251                    "</table>" +
    73                     "<div id='answersDiv" + questionCount + "' class='answersDiv'></div>" +
     52                    "<div id='answersDiv" + questionCount + "'></div>" +
    7453                    "</div>";
    75                                                                                                                                                                                                                
     54                                                                                                               
    7655                questionDiv.innerHTML = htmlStr;
    77                                                                                                                                                                                                                
     56                                                                                                               
    7857                return questionDiv;
    7958            }
    80                                                                                                                                                                                                                    
     59                                                                                                                   
    8160            function handleFocus(input)
    8261            {
     
    8867                }
    8968            }
    90                                                                                                                                                                                                                                                    
     69                                                                                                                                                   
    9170            function handleBlur(input)
    9271            {       
    9372                var surveyTitle = document.getElementById('surveyTitle');
    9473                var surveyDescription = document.getElementById('surveyDescription');
    95                                                                                                                                                                                                                                    
     74                                                                                                                                   
    9675                if (input.value == "")
    9776                {
    9877                    input.style.color = "gray";
    9978                    input.clicked = null;
    100                                                                                                                                                                                                                                                            
     79                                                                                                                                                           
    10180                    if (input == surveyTitle)
    10281                    {
     
    10988                }                           
    11089            }
    111                                                                                                                                                                                                    
     90                                                                                                   
    11291            function handleType(select)
    11392            {
     
    11695                answersDiv.answerCount = 1;
    11796                answersDiv.clicked = null;
    118                                                                                                                                                        
     97                                                       
    11998                switch (type) {
    12099                    case 'mc':
    121100                        answersDiv.innerHTML = "";
    122101                        addOption(select.id);
    123                                                                                                                                                                                        
     102                                                                                       
    124103                        break;
    125104                    case 'text':
     
    145124
    146125            }
    147                                                                                                                                                                                    
    148                                                                                                                                                                            
     126                                                                                   
     127                                                                           
    149128            function addOption(questionNumber)
    150129            {       
     
    153132                var answerDiv = document.createElement("div");
    154133                answerDiv.className = "answerDiv";
    155                                                                                                                                                                                
     134                                                                               
    156135                var htmlStr = "<input type='text' name='q" +
    157136                    questionNumber + "ans" + answerCount + "' value='Option " + answerCount + "' />";
    158                                                                                                                                                        
     137                                                       
    159138                if (answersDiv.clicked == null)
    160139                {
     
    162141                        + " class='surveyButton' onclick='addOption(" + questionNumber + ")' value='Add Option' />" +
    163142                        "<input type='button' class='surveyButton' onclick='removeOption(" + questionNumber + ")' value='x' />";
    164                                                                                                                            
     143                           
    165144                    answersDiv.clicked = true;
    166145                }
    167                                                                                                                                                                                       
     146                                                                                       
    168147                answerDiv.innerHTML = htmlStr;
    169                                                                                                                        
     148                       
    170149                answerDiv.prev = answersDiv.lastAnswer; //singly linked list
    171150                answersDiv.lastAnswer = answerDiv;
    172                                                                                                                                                                                       
     151                                                                                       
    173152                answersDiv.appendChild(answerDiv);
    174153                answersDiv.answerCount++;
    175154            }
    176                                                                                                                    
     155                   
    177156            function removeOption(questionNumber)
    178157            {
    179158                var answersDiv = document.getElementById("answersDiv" + questionNumber);
    180                                                                                                                       
     159                       
    181160                if (answersDiv.lastAnswer.prev != null)
    182161                {
     
    186165                }
    187166            }
    188                                                                                                                                            
     167                                           
    189168            function minMax(questionNumber)
    190169            {
    191170                var answersDiv = document.getElementById("answersDiv" + questionNumber);
    192                                                                                                                                               
     171                                               
    193172                var answerDiv = document.createElement("div");
    194                                                                                                                
    195173                answerDiv.className = "answerDiv";
    196                 answerDiv.innerHTML = "<label for='min'>Min</label><input type='text' name='q" + questionNumber + "ans1' />" +
    197                     "<label for='max'>Max</label><input type='text' name='q" + questionNumber + "ans2' />";
    198                                                                                                                                           
     174                answerDiv.innerHTML = "<label for='min'>Min</label><input type='text' name='min" + questionNumber + "' />" +
     175                    "<label for='max'>Max</label><input type='text' name='max" + questionNumber + "' />";
     176                                           
    199177                answersDiv.appendChild(answerDiv);
    200178            } 
    201                                                                                                                                            
     179                                           
    202180            function minMaxIncr(questionNumber)
    203181            {
    204                 var answersDiv = document.getElementById("answersDiv" + questionNumber);
    205                                                                                                                                                
     182                minMax(questionNumber);
     183                var answersDiv = document.getElementById("answersDiv" + questionNumber);
     184                                               
    206185                var answerDiv = document.createElement("div");
    207186                answerDiv.className = "answerDiv";
    208                 answerDiv.innerHTML = "<label>Left label</label><input type='text' name='q" + questionNumber + "ans1' />" +
    209                     "<label>Right label</label><input type='text' name='q" + questionNumber + "ans2' />" +
    210                     "<label>Scale count</label><input type='text' name='q" + questionNumber + "ans3' />" +
    211                     "<div id='inputCheckFeedback'" + questionNumber + "";
    212                                                                                                                                            
     187                answerDiv.innerHTML = "<label for='incr'>Increment by</label><input type='text' name='incr" + questionNumber + "' />";
     188                                           
    213189                answersDiv.appendChild(answerDiv);
    214190            }         
    215                                                                                                                                                                                                 
    216                                                                                                                                                                                                         
    217             function addQuestion(title, description)
     191                                                                                                 
     192                                                                                                         
     193            function addQuestion()
    218194            {
    219195                var questionsDiv = document.getElementById('questionsDiv');
    220                 var newQuestion = getNewQuestion(title, description);
    221                                                                                                                                        
     196                var newQuestion = getNewQuestion();
     197                                       
    222198
    223199                newQuestion.prev = document.lastQuestion;
     
    227203                questionCount++;
    228204            }
    229                                                                                                                                    
     205                                   
    230206            function removeLastQuestion()
    231207            {
    232208                var questionsDiv = document.getElementById('questionsDiv');
    233                                                                                                                                        
     209                                       
    234210                if (document.lastQuestion.prev != null)
    235211                {
     
    243219                }               
    244220            }
    245                                                                                                              
    246             function save(surveyID)
    247             {
    248                 var form = document.getElementById('survey');
    249                 var questionsDiv = document.getElementById('questionsDiv');
    250                 form.action = "surveycreation.php";
    251                                                                                
    252                 /* extra time stamp */
    253                 var date = new Date();
    254                 var minutes = date.getUTCMinutes();
    255                 if (minutes < 10)
    256                     minutes = "0" + minutes;
    257                 var timeStamp = date.getHours() + ":" + minutes;
    258                 var timeStampInput = document.createElement("input");
    259                 timeStampInput.name = "timeStamp";
    260                 timeStampInput.value = timeStamp;
    261                 timeStampInput.type = "hidden";
    262                                    
    263                 var surveyIDInput = document.createElement("input");
    264                 surveyIDInput.name = "surveyID";
    265                 surveyIDInput.value = surveyID;
    266                 surveyIDInput.type = "hidden";
    267                                                              
    268                 questionsDiv.appendChild(timeStampInput);
    269                 questionsDiv.appendChild(surveyIDInput);
    270                 form.submit();
    271             }
    272                                                                                                                                            
    273                                                                                                                                                                                                                                                                                                                            
     221                                 
     222                                           
     223                                                                                                                                                                                                                           
    274224        </script>
    275225        <?php
    276226    }
    277227
    278     private function surveyHead() {
    279         ?><div id="surveyHead">
    280         <?php
    281         $this->titleBox();
    282         $this->saveSurvey();
    283         $this->descriptionBox();
    284         ?></div>
    285         <?php
    286     }
    287 
    288     private function titleBox() {
    289         if (isset($this->survey->title))
    290             $value = $this->survey->title;
    291         else
    292             $value = 'Untitled Survey';
    293         ?>
    294         <input type="text" id="surveyTitle" name="surveyTitle" value="<?php echo $value ?>" onblur="handleBlur(this)" onfocus="handleFocus(this)" />
    295         <?php
    296     }
    297 
    298     private function saveSurvey() {
    299         if (isset($this->timeStamp))
    300             echo "<div id='timeStamp'>Last saved " . $this->timeStamp . '</div>';
    301         if (isset($this->survey->id))
    302             $id = $this->survey->id;
    303         else
    304             $id = null;
    305         ?>
    306         <input id="surveySaveButton" type="button" onclick="save('<?php echo $id; ?>')" class='surveyButton' value='Save' />
    307         <?php
    308     }
    309 
    310     private function descriptionBox() {
    311         if (isset($this->survey->description))
    312             $value = $this->survey->description;
    313         else
    314             $value = 'Write a helpful description for this survey here.';
    315         ?>
    316         <textarea id="surveyDescription" name="surveyDescription" onblur="handleBlur(this)" onfocus="handleFocus(this)"><?php echo $value; ?></textarea>
    317         <?php
    318     }
    319 
    320     private function questionCreationForm() {
     228    private static function titleBox() {
     229        ?>
     230        <input type="text" id="surveyTitle" name="surveyTitle" value="Untitled Survey" size="30" onblur="handleBlur(this)" onfocus="handleFocus(this)" />
     231        <?php
     232    }
     233
     234    private static function descriptionBox() {
     235        ?>
     236        <textarea id="surveyDescription" rows="3" cols="80" name="surveyDescription" onblur="handleBlur(this)" onfocus="handleFocus(this)">Write a helpful description for this survey here.</textarea>
     237        <?php
     238    }
     239
     240    private static function questionCreationForm() {
    321241        ?>
    322242        <div id='questionsDiv'>
    323243        </div>
    324         <?php
    325         if (isset($this->survey)) {
    326             foreach ($this->survey->questions as $question) {
    327                 ?>
    328                 <script type="text/javascript"> addQuestion('<?php echo $question->title; ?>', '<?php echo $question->description; ?>');
    329                 </script>
    330                 <?php
    331             }
    332         } else {
    333             ?>
    334             <script type="text/javascript"> addQuestion();</script>
    335             <?php
    336         }
     244        <script type="text/javascript"> addQuestion(); </script>
     245        <?php
    337246    }
    338247
  • /Dev/trunk/classes/SurveyRDFReader.php

    r30 r20  
    33class SurveyRDFReader
    44{
    5         protected $model;
    6        
    7         protected $surveyUID;
    8        
    9     public function __construct($surveyUID)
    10     {
     5        var $model;
     6               
     7        public function SurveyRDFReader()
     8        {
    119        // Create empty MemModel
    1210                $factory = new ModelFactory();
    13                 $this->model = $factory->getDefaultModel();
    14                
    15                 $this->surveyUID = $surveyUID;
     11                $this->model = $factory->getDefaultModel();     
    1612        }
    1713       
    18         public function loadSurvey()
     14        public function loadSurvey($sTitle)
    1915        {
    20                 $this->model->load('surveys/survey_'.$this->surveyUID.'.rdf');
     16                $this->model->load('surveys/'.$sTitle.'.rdf');
    2117        }
    2218       
    23         public function getSurveyInfo()
    24         {               
    25                 SurveyRDFReader::loadSurvey();
    26        
    27                 $result = array();
    28                 $result[] = $this->readSurveyInfo();                           
    29                 $result[] = $this->readSurveyQuestions();
    30                
    31                 return $result;
    32         }
    33        
    34         public function readSurveyInfo()
     19        public function readSurveyTitle()
    3520        {
    3621                $querystring = '
    37                         PREFIX  predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
     22                        PREFIX  predicates: <' .SURVEYTOOL_PREDICATES_NAMESPACE . '>
    3823                        PREFIX  resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
    39                         SELECT  ?uid ?title ?description
    40                         WHERE   
    41                         {
    42                                 _survey         predicates:resource_type        resources:survey ;
    43                                                         predicates:uid                          ?uid    ;
    44                                                         predicates:title                        ?title  ;
    45                                                         predicates:description          ?description
    46                         }';
    47                        
    48                 $result = $this->model->sparqlQuery($querystring);
    49                                
    50                 return $result;
    51         }
    52        
    53         public function readSurveyQuestions()
    54         {
    55                 $result = array();
    56                 $result[] = $this->readSurveyQuestionsTitle();                         
    57                 $result[] = $this->readSurveyQuestionsDescription();
    58                 $result[] = $this->readSurveyQuestionsType();
    59                 $result[] = $this->readSurveyQuestionsID();             
    60                                
    61                 return $result;
    62         }
    63        
    64         public function readSurveyQuestionsTitle()
    65         {
    66                 $querystring = '
    67                         PREFIX  predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
    68                         PREFIX  resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
    69                         SELECT  ?questionTitle
    70                         WHERE
    71                         {       
    72                                 _question       predicates:resource_type        resources:question ;
    73                                                         predicates:title                        ?questionTitle         
    74                         }';
     24                        SELECT  ?title
     25                        WHERE   { resources:survey predicates:title ?title }';
    7526                       
    7627                $result = $this->model->sparqlQuery($querystring);
     
    7930        }
    8031       
    81         public function readSurveyQuestionsDescription()
     32        public function readSurveyDescription()
    8233        {
    8334                $querystring = '
    84                         PREFIX  predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
     35                        PREFIX  predicates: <' .SURVEYTOOL_PREDICATES_NAMESPACE . '>
    8536                        PREFIX  resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
    86                         SELECT  ?questionDescription
    87                         WHERE
    88                         {       
    89                                 _question       predicates:resource_type        resources:question ;
    90                                                         predicates:description  ?questionDescription           
    91                         }';
    92                        
    93                 $result = $this->model->sparqlQuery($querystring);
    94                
    95                 return $result;
    96         }
    97        
    98         public function readSurveyQuestionsType()
    99         {
    100                 $querystring = '
    101                         PREFIX  predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
    102                         PREFIX  resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
    103                         SELECT  ?questionType
    104                         WHERE
    105                         {       
    106                                 _question       predicates:resource_type        resources:question ;
    107                                                         predicates:question_type        ?questionType                           
    108                         }';
    109                        
    110                 $result = $this->model->sparqlQuery($querystring);
    111                
    112                 return $result;
    113         }
    114        
    115         public function readSurveyQuestionsID()
    116         {
    117                 $querystring = '
    118                         PREFIX  predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
    119                         PREFIX  resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
    120                         SELECT  ?questionID
    121                         WHERE
    122                         {       
    123                                 _question       predicates:resource_type        resources:question ;
    124                                                         predicates:uid                          ?questionID                             
    125                         }';
    126                        
    127                 $result = $this->model->sparqlQuery($querystring);
    128                
    129                 return $result;
    130         }
    131        
    132         public function readSurveyAnswers($qID)
    133         {
    134                 $querystring = '
    135                         PREFIX  predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
    136                         PREFIX  resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
    137                         SELECT  ?answerTitle
    138                         WHERE
    139                         {
    140                                 _question               predicates:resource_type        resources:question ;
    141                                                                 predicates:uid                          "' . $qID . '"  ;
    142                                                                 predicates:has_answer           _answer .
    143                                 _answer                 predicates:title                        ?answerTitle                                                           
    144                         }';
     37                        SELECT  ?description
     38                        WHERE   { resources:survey predicates:description ?description }';
    14539                       
    14640                $result = $this->model->sparqlQuery($querystring);
  • /Dev/trunk/classes/SurveyRDFWriter.php

    r30 r20  
    33class SurveyRDFWriter
    44{
    5         protected $model;
     5        var $model;
    66               
    7         protected $resourceSurvey;
    8         protected $surveyUID;
    9        
    10     public function __construct($surveyUID)
     7        var $resourceSurvey;
     8    /**
     9    * Use SurveyRDFWriter::getInstance() instead of this
     10    * constructor.
     11    */
     12    public function __construct()
    1113    {
    1214        // Create empty MemModel
     
    1416                $this->model = $factory->getDefaultModel();
    1517               
    16                 $this->surveyUID = $surveyUID;
     18                $this->initResources();
     19    }
     20
     21        function initResources()
     22        {
    1723               
    18     }   
    19        
    20         public function saveSurvey()
    21         {       
    22                 $this->model->saveAs('surveys/survey_'.$this->surveyUID.'.rdf','rdf');
     24                $this->resourceSurvey = new Resource(SURVEY);
    2325        }
    2426       
    2527        public function createSurvey($sTitle, $sDescription)
    2628        {               
    27                 $this->resourceSurvey = new Resource(SURVEY.'/'.$this->surveyUID);
    28                
    29                 $resourceSurveyType = new Resource(SURVEY);
    30                 $predicateRType = new Resource(RTYPE);
    31                 $this->model->add(new Statement($this->resourceSurvey,$predicateRType,$resourceSurveyType));
    32                
    33                 $literalSurveyID = new Literal($this->surveyUID);
    34                 $predicateUniqueID = new Resource(UID);
    35                 $this->model->add(new Statement($this->resourceSurvey,$predicateUniqueID,$literalSurveyID));
    3629               
    3730                $predicateTitle = new Resource(TITLE);         
     
    4639        public function addQuestion($qTitle,$qDescription,$qType,$qAnswers)
    4740        {
    48                 $questionID = md5( uniqid(rand(), true) );
    49                 $resourceQuestion = new Resource(QUESTION.'/'.$questionID);
    50                                
    51                 $resourceQuestionType = new Resource(QUESTION);
    52                 $predicateRType = new Resource(RTYPE);
    53                 $this->model->add(new Statement($resourceQuestion,$predicateRType,$resourceQuestionType));
    54                                
    55                 $predicateUniqueID = new Resource(UID);
    56                 $questionUID = new Literal($questionID);
    57                 $this->model->add(new Statement($resourceQuestion,$predicateUniqueID,$questionUID));
    58                                
     41                $resourceQuestion = new Resource(QUESTION);
     42                $predicateQuestion = new Resource(HAS_QUESTION);
     43                $this->model->add(new Statement($this->resourceSurvey,$predicateQuestion,$resourceQuestion));
     44               
    5945                $predicateTitle = new Resource(TITLE);         
    6046                $questionTitle = new Literal($qTitle);
     
    6551                $this->model->add(new Statement($resourceQuestion,$predicateDescription,$questionDescription));         
    6652               
    67                 $predicateQType = new Resource(QTYPE);
    68                 $resourceQuestionType = new Literal($qType);
    69                 $this->model->add(new Statement($resourceQuestion,$predicateQType,$resourceQuestionType));
     53                $predicateType = new Resource(TYPE);
     54                $resourceQuestionType = new Resource(QUESTION_TYPE);
     55                $this->model->add(new Statement($resourceQuestion,$predicateType,$resourceQuestionType));
    7056               
    7157                foreach($qAnswers as $answer)
    72                 {               
    73                         $answerID = md5( uniqid(rand(), true) );       
    74                         $resourceAnswer = new Resource(ANSWER.'/'.$answerID);
    75                                
    76                         $resourceAnswerType = new Resource(ANSWER);
    77                         $predicateRType = new Resource(RTYPE);
    78                         $this->model->add(new Statement($resourceAnswer,$predicateRType,$resourceAnswerType)); 
    79 
    80                         $predicateUniqueID = new Resource(UID);
    81                         $answerUID = new Literal($answerID);
    82                         $this->model->add(new Statement($resourceAnswer,$predicateUniqueID,$answerUID));                       
    83                                                
     58                {
     59                        $resourceAnswer = new Resource(ANSWER);
     60                        $predicateAnswer = new Resource(HAS_ANSWER);   
     61                        $this->model->add(new Statement($resourceQuestion,$predicateAnswer,$resourceAnswer));
     62                       
     63                        $predicateTitle = new Resource(TITLE);
    8464                        $answerTitle = new Literal($answer['Title']);
    8565                        $this->model->add(new Statement($resourceAnswer,$predicateTitle,$answerTitle));
    8666                       
     67                        $predicateDescription = new Resource(DESCRIPTION);
    8768                        $answerDescription = new Literal($answer['Description']);
    8869                        $this->model->add(new Statement($resourceAnswer,$predicateDescription,$answerDescription));
    8970                       
    90                         $predicateAnswer = new Resource(HAS_ANSWER);   
    91                         $this->model->add(new Statement($resourceQuestion,$predicateAnswer,$resourceAnswer));
    9271                }
    9372               
    94                 $predicateQuestion = new Resource(HAS_QUESTION);
    95                 $this->model->add(new Statement($this->resourceSurvey,$predicateQuestion,$resourceQuestion));           
     73               
    9674        }
     75       
     76        public function saveSurvey($sTitle)
     77        {
     78                $this->model->saveAs('surveys/'.$sTitle.'.rdf','rdf');
     79               
     80                return true;
     81        }
     82
    9783}
    9884
  • /Dev/trunk/css/style.css

    r30 r20  
    7878}
    7979
    80 #surveyHead {
    81     position: relative;
    82     width: 100%;
    83 }
    84 
    8580#surveyTitle {
    86     width: 17em;
    8781    font-size: large;
    8882    color: gray;
     
    9589#surveyDescription {
    9690    display: block;
    97     width: 35em;
    98     max-width: 35em;
    9991    font-family: sans-serif;
    10092    color: gray;
    101 }
    102 
    103 #timeStamp {
    104     position: absolute;
    105     color: gray;
    106     font-size: small;
    107     right: 6em;
    108     top: 0;
    109     line-height: 2.3em;
    110 }
    111 
    112 #surveySaveButton {
    113     position: absolute;
    114     top: 0;
    115     right: 0;
    116     width: 5em;
    11793}
    11894
     
    125101}
    126102
    127 .answersDiv {
    128     margin-left: 0.5em;
    129 }
    130 
    131103#submitSurvey {
    132104    display: block;
     
    137109
    138110#addQuestionButton {
    139     margin-top: 1em;
    140111    width: 20em;
    141112}
     
    145116}
    146117
    147 
    148118.surveyButton {
    149     color: #888;
    150     font-weight: bold;
     119    margin-top: 1em;
     120    color: gray;
    151121    background-color: #fff;
    152     border: 2px solid #aaa;
    153     -moz-border-radius: 6px;
    154     border-radius: 6px;
     122    border: 1px solid #ddd;
     123    -moz-border-radius: 8px;
     124    border-radius: 8px;
     125    -moz-box-shadow: 1px 1px 1px #555;
     126    -webkit-box-shadow: 1px 1px 1px #555;
     127    box-shadow: 1px 1px 1px #555;
    155128}
    156129
    157130.surveyButton:hover {
    158131    background-color: white;
    159     color: #555;
     132    color: #333;
    160133    border-color: deepskyblue;
    161134}
  • /Dev/trunk/rdfConstants.php

    r30 r20  
    1616
    1717// Predicates used for RDF triples
    18 define('UID',SURVEYTOOL_PREDICATES_NAMESPACE . 'uid');
    1918define('CREATOR',SURVEYTOOL_PREDICATES_NAMESPACE . 'creator');
    2019define('TITLE',SURVEYTOOL_PREDICATES_NAMESPACE . 'title');
    2120define('DESCRIPTION',SURVEYTOOL_PREDICATES_NAMESPACE . 'description');
    22 define('RTYPE',SURVEYTOOL_PREDICATES_NAMESPACE . 'resource_type');
    23 define('QTYPE',SURVEYTOOL_PREDICATES_NAMESPACE . 'question_type');
     21define('TYPE',SURVEYTOOL_PREDICATES_NAMESPACE . 'type');
    2422define('HAS_QUESTION',SURVEYTOOL_PREDICATES_NAMESPACE . 'has_question');
    2523define('HAS_ANSWER',SURVEYTOOL_PREDICATES_NAMESPACE . 'has_answer');
    2624define('NUMBER_OF_ANSWERS',SURVEYTOOL_PREDICATES_NAMESPACE . 'number_of_answers');
    2725define('SCALE',SURVEYTOOL_PREDICATES_NAMESPACE . 'scale');
    28 define('ANSWERED',SURVEYTOOL_PREDICATES_NAMESPACE . 'answered');
    2926
    3027// Arry with types of survey questions
  • /Dev/trunk/submitsurvey.php

    r30 r20  
    1111
    1212$sTitle = $_POST['surveyTitle'];
    13 $sDesription = $_POST['surveyDescription'];
    1413
    15 $surveyRDFWriter->createSurvey($sTitle,$sDesription);
     14$surveyRDFWriter->createSurvey($sTitle,$_POST['surveyDescription']);
    1615
    17 $qNumber = 1;
    18 do
    19 {
    20         $qTitle = $_POST['questionTitle'.$qNumber];
    21         $qDescription = $_POST['questionDescription'.$qNumber];
    22         $qType = $_POST['questionType'.$qNumber];
    23 
    24         if ($qTitle != null)
    25         {
    26                 $qaArray = array();
    27                 $aNumber = 1;
    28                 do
    29                 {
    30                         $aTitle = $_POST['q'.$qNumber.'ans'.$aNumber];
    31                         if ($aTitle != null)
    32                         {
    33                                 $aArray = array();
    34                                 $aArray['Title'] = $aTitle;
    35                                 $aArray['Description'] = 'answerDescription'.$aNumber;
    36                                 $qaArray[] = $aArray;
    37                         }
    38                         $aNumber++;
    39                 } while ($aTitle != null);
    40                                
    41                 $qNumber++;
    42                 $surveyRDFWriter->addQuestion($qTitle,$qDescription,$qType,$qaArray);
    43         }
    44 } while($qTitle != null);
    45 
    46 
    47 $surveyRDFWriter->saveSurvey($sTitle);
     16$done = $surveyRDFWriter->saveSurvey($sTitle);
    4817
    4918echo 'Done<br/><br/>';
     
    5827  $value = $line['?title'];
    5928    if($value != "")
    60       echo $value->toString().'<br/>';
     29      echo $value->toString()."<br/>";
    6130    else
    62       echo 'undbound<br/>';
     31      echo "undbound<br/>";
    6332}
    6433
     
    6837  $value = $line['?description'];
    6938    if($value != "")
    70       echo $value->toString().'<br/>';
     39      echo $value->toString()."<br/>";
    7140    else
    72       echo 'undbound<br/>';
     41      echo "undbound<br/>";
    7342}
    7443
    75 $result3 = $surveyRDFReader->readSurveyQuestions($sTitle);
    76 
    77 if($result3 != null)
    78 {
    79         var_dump($result3);
    80          
    81         foreach($result3 as $line){
    82           $value = $line['?questionTitle'];
    83                 if($value != "")
    84                   echo '<br/>'.'<br/>'.$value->toString().'<br/>';
    85                 else
    86                   echo 'undbound<br/>';
    87         }
    88 } else
    89 {
    90         echo '<"Literal("'.$sTitle.'")"> empty result <br/>';
    91 }
    92 echo '<br/>';
    9344var_dump($_POST);
    9445
  • /Dev/trunk/surveycreation.php

    r30 r20  
    1 <?php
    2 require 'classes/master.php';
    3 
    4 $savedSurvey = null;
    5 
    6 if (isset($_POST['timeStamp']))
    7 {
    8     $timeStamp = $_POST['timeStamp'];
    9        
    10         var_dump($_POST);
    11         echo '<br/><br/>';
    12         $surveyDBI =  new SurveyDatabaseInterface();
    13         $surveyDBI->setSurveyInfo($_POST);
    14         $info = $surveyDBI->getSurveyInfo();
    15         echo '<br/><br/>';
    16         var_dump($info);
    17        
    18         $savedSurvey = Survey::getSurvey($info);
    19 }
    20 else {
    21     $timeStamp = null;
    22 }
    23 
    24 ?>
     1<?php require 'classes/master.php'; ?>
    252
    263<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     
    3512    <body>
    3613        <div id="header">
    37             <div id="logo">CPSFacilitator Tool </div>
    38         </div>
     14                <div id="logo">CPSFacilitator Tool </div>
     15            </div>
    3916        <div id="wrapper">
    40 
     17           
    4118            <div id="content">
    4219                <?php
    43      
    44                 new SurveyCreationTool($savedSurvey, $timeStamp);
     20                    new SurveyCreationTool();
    4521                ?>
    4622            </div>
Note: See TracChangeset for help on using the changeset viewer.