Changeset 233 for Dev/branches/jos-branch/classes
- Timestamp:
- 01/13/12 13:57:41 (13 years ago)
- Location:
- Dev/branches/jos-branch/classes
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/jos-branch/classes/models/Question.php
r217 r233 12 12 private static $filename = 'data/questions/questions.rdf'; 13 13 14 public $code; 14 15 public $title; 15 16 public $type; … … 27 28 * @param type $answers 28 29 */ 29 public function __construct($uid, $ title = null, $type = null, $description = null, $category = null, $answers = null)30 public function __construct($uid, $code = null, $title = null, $type = null, $description = null, $category = null, $answers = null) 30 31 { 31 32 if(!isset($uid)) … … 33 34 $uid = md5(uniqid(rand(), true)); 34 35 } 36 $this->code = $code; 35 37 $this->uid = $uid; 36 38 $this->title = $title; … … 61 63 $predicateRType = new Resource(RTYPE); 62 64 $model->add(new Statement($resourceQuestion,$predicateRType,$resourceQuestionType)); 65 66 $questionUid = new Literal($this->uid); 67 $predicateUid = new Resource(UID); 68 $model->add(new Statement($resourceQuestion,$predicateUid,$questionUid)); 63 69 64 70 $questionQCode = new Literal($this->uid); … … 98 104 * Get the questions corresponding to the arguments. 99 105 * @param type $arguments : An array having one ore more of the following elements: 100 * ' code', 'title', 'type', 'description', 'category', 'definedanswers'.106 * 'uid', 'code', 'title', 'type', 'description', 'category', 'definedanswers'. 101 107 */ 102 108 public static function get($arguments) … … 107 113 PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '> 108 114 PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '> 109 SELECT DISTINCT ?uid, ? title, ?type, ?description, ?category115 SELECT DISTINCT ?uid, ?code, ?title, ?type, ?description, ?category 110 116 WHERE 111 117 { 112 118 _question predicates:resource_type resources:question ; 113 predicates:question_code ?uid ; 119 predicates:uid ?uid ; 120 predicates:question_code ?code ; 114 121 predicates:title ?title ; 115 122 predicates:question_type ?type ; … … 130 137 { 131 138 $answers = Question::getAnswers($model, $result['?uid']->label); 132 $questions[] = new Question($result['?uid']->label, $result['? title']->label, $result['?type']->label, $result['?description']->label, $result['?category']->label, $answers);139 $questions[] = new Question($result['?uid']->label, $result['?code']->label, $result['?title']->label, $result['?type']->label, $result['?description']->label, $result['?category']->label, $answers); 133 140 } 134 141 } -
Dev/branches/jos-branch/classes/models/ResearchToolObject.php
r212 r233 5 5 * @author jkraaijeveld 6 6 */ 7 // Survey database interface class as intermediate for storing data from the site to the RDF database 8 require_once 'rdfConstants.php'; 9 // Include RAP Library to write RDF files 10 include(RDFAPI_INCLUDE_DIR . "RDFAPI.php"); 11 12 7 13 abstract class ResearchToolObject { 8 14 -
Dev/branches/jos-branch/classes/widgets/SurveyEditorWidget.php
r230 r233 13 13 14 14 private $loadedSurvey; 15 private $dbi;16 15 17 16 public function __construct() { 18 // Set basic variables 19 // Should probably include a default empty survey for the sake of safety 20 $dbi = new DatabaseInterface(); 17 21 18 } 22 19 23 20 public function handlePost() { 24 21 // Get POSTed data and store variables to class instance properties 25 $dbi = new DatabaseInterface();22 26 23 if (isset($_POST['objectUid']) && !empty($_POST['objectUid'])) { 27 $surveyResults = $dbi->get("Survey",array("uid" => $_POST['objectUid']));24 $surveyResults = Survey::get(array("uid" => $_POST['objectUid'])); 28 25 if (!empty($surveyResults)) { 29 26 $this->loadedSurvey = $surveyResults[0]; … … 39 36 $questionString = ""; 40 37 foreach ($this->loadedSurvey->questions as $question) { 41 $questionString .= $question-> code. ",";38 $questionString .= $question->uid . ","; 42 39 } 43 40 // echo the HTML markup to display the editor on the screen -
Dev/branches/jos-branch/classes/widgets/Toolbox.php
r230 r233 25 25 <div class="bigButton toolbox" onclick="ddMenu.Open('toolbox_m1')"><img src="images/icons/survey.png" class="buttonIcon" /><p>Survey</p> 26 26 <div id="toolbox_m1" onmouseover="ddMenu.CancelCloseTimer()" onmouseout="ddMenu.SetCloseTimer()"> 27 <a href="#" >+ Add new</a>27 <a href="#" onclick="submitToolbox('Survey')">+ Add new</a> 28 28 <a href="#">> Add existing</a> 29 29 </div> … … 34 34 <div class="bigButton toolbox" onClick="ddMenu.Open('toolbox_m2')"><img src="images/icons/application.png" class="buttonIcon" /><p>Application</p> 35 35 <div id="toolbox_m2" onmouseover="ddMenu.CancelCloseTimer()" onmouseout="ddMenu.SetCloseTimer()"> 36 <a href="#" >+ Add new</a>36 <a href="#" onclick="submitToolbox('Application')">+ Add new</a> 37 37 <a href="#">> Add existing</a> 38 38 </div>
Note: See TracChangeset
for help on using the changeset viewer.