Last change
on this file since 186 was
186,
checked in by jkraaijeveld, 13 years ago
|
Implemented lazy evaluation.
- Initially, references to other database objects are now given as an ID rather than an object.
- Every model class now has an evaluate() function, which gets all the objects that object has references to. Returns true if it got all the values correctly, false if there are invalid references.
- Every connector now first evaluates an object before storing, to make sure only objects with valid references get stored.
|
File size:
1.2 KB
|
Line | |
---|
1 | <?php |
---|
2 | |
---|
3 | /* |
---|
4 | * To change this template, choose Tools | Templates |
---|
5 | * and open the template in the editor. |
---|
6 | */ |
---|
7 | |
---|
8 | /** |
---|
9 | * Description of Question |
---|
10 | * |
---|
11 | * @author fpvanagthoven |
---|
12 | */ |
---|
13 | class Question extends ResearchToolObject{ |
---|
14 | public $title; |
---|
15 | public $type; |
---|
16 | public $description; |
---|
17 | public $category; |
---|
18 | public $answers; // format answers['#'] |
---|
19 | |
---|
20 | /** |
---|
21 | * Constructor for a Question. $uid equals the corresponding code. |
---|
22 | * @param type $uid |
---|
23 | * @param type $title |
---|
24 | * @param type $type |
---|
25 | * @param type $description |
---|
26 | * @param type $category |
---|
27 | * @param type $answers |
---|
28 | */ |
---|
29 | public function __construct($uid, $title = null, $type = null, $description = null, $category = null, $answers = null) |
---|
30 | { |
---|
31 | if(!isset($uid)) |
---|
32 | { |
---|
33 | $uid = md5(uniqid(rand(), true)); |
---|
34 | } |
---|
35 | $this->uid = $uid; |
---|
36 | $this->title = $title; |
---|
37 | $this->type = $type; |
---|
38 | $this->description = $description; |
---|
39 | $this->category = $category; |
---|
40 | $this->answers = $answers; |
---|
41 | } |
---|
42 | |
---|
43 | /** |
---|
44 | * function evaluate() |
---|
45 | * evaluates all the references of this object. |
---|
46 | */ |
---|
47 | public function evaluate() |
---|
48 | { |
---|
49 | //Do nothing since Question does not contain any references |
---|
50 | } |
---|
51 | } |
---|
52 | |
---|
53 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.