Last change
on this file since 210 was
210,
checked in by jkraaijeveld, 13 years ago
|
Moved all classes into classes_old
|
File size:
1.0 KB
|
Rev | Line | |
---|
[149] | 1 | <?php |
---|
| 2 | |
---|
| 3 | /** |
---|
| 4 | * Description of Answer |
---|
| 5 | * |
---|
| 6 | * @author jkraaijeveld |
---|
| 7 | */ |
---|
| 8 | class Answer extends ResearchToolObject { |
---|
| 9 | public $question; |
---|
[186] | 10 | public $values; |
---|
[149] | 11 | |
---|
| 12 | /** |
---|
| 13 | * Constructor for an Answer object |
---|
[157] | 14 | * @param type $uid : The uid of the Answer object. |
---|
| 15 | * @param type $question : The Question object this Answer answers. |
---|
| 16 | * @param type $values : An array of strings, containing the answers. |
---|
[149] | 17 | */ |
---|
| 18 | public function __construct($uid = null, $question = null, $values = null) { |
---|
| 19 | if(!isset($uid)) |
---|
| 20 | { |
---|
| 21 | $uid = md5(uniqid(rand(), true)); |
---|
| 22 | } |
---|
| 23 | $this->uid = $uid; |
---|
| 24 | $this->question = $question; |
---|
| 25 | $this->values = $values; |
---|
[186] | 26 | } |
---|
| 27 | |
---|
| 28 | /** |
---|
| 29 | * function evaluate() |
---|
| 30 | * Evaluates the references and fills in the objects for them instead. |
---|
| 31 | */ |
---|
| 32 | public function evaluate() |
---|
| 33 | { |
---|
| 34 | if(is_string($this->question)) |
---|
| 35 | { |
---|
| 36 | $dbi = new DatabaseInterface(); |
---|
| 37 | $result = $dbi->get("question", array("code" => $this->question)); |
---|
| 38 | if(!isset($result[0])) |
---|
| 39 | return false; |
---|
| 40 | $this->question = $result[0]; |
---|
| 41 | } |
---|
| 42 | return true; |
---|
| 43 | |
---|
| 44 | } |
---|
[149] | 45 | } |
---|
| 46 | |
---|
| 47 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.