[212] | 1 | <?php |
---|
| 2 | /** |
---|
| 3 | * Description of ResearchToolObject |
---|
| 4 | * |
---|
| 5 | * @author jkraaijeveld |
---|
| 6 | */ |
---|
| 7 | abstract class ResearchToolObject { |
---|
| 8 | |
---|
| 9 | public $uid; |
---|
| 10 | |
---|
| 11 | public function evaluate() |
---|
| 12 | { |
---|
| 13 | return true; |
---|
| 14 | } |
---|
| 15 | |
---|
| 16 | public static function load($filename) |
---|
| 17 | { |
---|
| 18 | $model = ModelFactory::getDefaultModel(); |
---|
| 19 | if(file_exists($filename)) |
---|
| 20 | $model->load($filename); |
---|
| 21 | return $model; |
---|
| 22 | } |
---|
| 23 | |
---|
| 24 | /** |
---|
| 25 | * function createArguments() |
---|
| 26 | * @param type $arguments |
---|
| 27 | * Creates the arguments to be used in the query based on the |
---|
| 28 | * arguments specified in the incoming array. |
---|
| 29 | */ |
---|
| 30 | public static function createArguments($arguments) |
---|
| 31 | { |
---|
| 32 | $argumentString = ""; |
---|
| 33 | foreach(array_keys($arguments) as $key) |
---|
| 34 | { |
---|
| 35 | $addition = ""; |
---|
| 36 | switch($key) |
---|
| 37 | { |
---|
| 38 | case "uid" : $addition = "predicates:uid '" . $arguments[$key] . "'\n"; break; |
---|
| 39 | case "question" : $addition = "predicates:question_code '" . $arguments[$key] . "'\n"; break; |
---|
| 40 | case "values": foreach($arguments[$key] as $value) { $addition = $addition . "predicates:answered '" . $value . "'\n"; } break; |
---|
| 41 | case "survey" : $addition = "predicates:for_survey '" . $arguments[$key] . "'\n"; break; |
---|
| 42 | case "respondent" : $addition = "predicates:by_respondent '" . $arguments[$key] . "'\n"; break; |
---|
| 43 | case "answers" : foreach($arguments[$key] as $answer) { $addition = $addition . "predicates:given_answer '" . $answer . "'\n"; } break; |
---|
| 44 | case "title" : $addition = "predicates:title '" . $arguments[$key] . "'\n"; break; |
---|
| 45 | case "description" : $addition = "predicates:description '" . $arguments[$key] . "'\n"; break; |
---|
| 46 | case "style" : $addition = "predicates:style '" . $arguments[$key] . "'\n"; break; |
---|
| 47 | case "code" : $addition = "predicates:question_code '" . $arguments[$key] . "'\n";break; |
---|
| 48 | case "type" : $addition = "predicates:question_type '" . $arguments[$key] . "'\n"; break; |
---|
| 49 | case "category" : $addition = "predicates:question_category '" . $arguments[$key] . "'\n"; |
---|
| 50 | case "definedanswers" : foreach($arguments[$key] as $answer) { $addition = $addition . "predicates:has_answer '" . $answer . "'\n"; } break; |
---|
| 51 | case "name" : $addition = "predicates:name '" . $arguments[$key] . "'\n"; break; |
---|
| 52 | case "password" : $addition = "predicates:password '" . $arguments[$key] . "'\n"; break; |
---|
| 53 | case "creator" : $addition = "predicates:creator '" . $arguments[$key] . "'\n"; break; |
---|
| 54 | case "creationdate" : $addition = "predicates:creationdate '" . $arguments[$key] . "'\n"; break; |
---|
| 55 | case "applications" : foreach($arguments[$key] as $application) { $addition = $addition . "predicates:has_application '" . $application . "'\n"; } break; |
---|
| 56 | case "surveys" : foreach($arguments[$key] as $survey) { $addition = $addition . "predicates:has_survey '" . $survey . "'\n"; } break; |
---|
| 57 | case "answersets" : foreach($arguments[$key] as $answerset) { $addition = $addition . "predicates:has_answerset '" . $answerset . "'\n"; } break; |
---|
| 58 | case "questions" : foreach($arguments[$key] as $question) { $addition = $addition . "predicates:has_question '" . $question . "'\n"; } break; |
---|
| 59 | case "location" : $addition = "predicates:location '" . $arguments[$key] . "\n"; break; |
---|
| 60 | case "facilitator" : $addition = "predicates:facilitator '" . $arguments[$key] . "\n"; break; |
---|
| 61 | case "starttime" : $addition = "predicates:starttime '" . $arguments[$key] . "\n"; break; |
---|
| 62 | case "endtime" : $addition = "predicates:endtime '" . $arguments[$key] . "\n"; break; |
---|
| 63 | case "session" : $addition = "predicates:of_session '" . $arguments[$key] . "\n"; break; |
---|
| 64 | case "resultset" : $addition = "predciates:has_resultset '" . $arguments[$key] . "\n"; break; |
---|
| 65 | } |
---|
| 66 | $argumentString = $argumentString . $addition; |
---|
| 67 | } |
---|
| 68 | return $argumentString; |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | ?> |
---|