Annotation of db/prgsrc/drupal/modules/chgk_db/classes/DbQuestion.class.php, revision 1.2
1.1 roma7 1: <?php
2: require_once(dirname(__FILE__)."/DbFieldFactory.class.php");
3:
4: class DbQuestion {
5: private $question;
6: private $fieldFactory;
7: public $fields;
8:
9: public function __construct($row) {
10: $this->question = $row;
11: $this->fieldFactory = new DbFieldFactory();
12: $this->setFields();
13: }
14:
15: private function setFields() {
16: $this->setQuestionField();
17:
1.2 ! roma7 18: $fields = array('Answer', 'PassCriteria', 'Comments', 'Sources', 'Authors');
1.1 roma7 19: foreach ($fields as $field) {
20: $this->setField($field);
21: }
22: }
23:
24: private function setQuestionField() {
25: $this->fields['Question'] = $this->fieldFactory->getField(
26: 'Question',
27: $this->question->Question,
28: $this->question->Number);
29: }
30:
31: private function setField($field) {
32: $f = $this->fieldFactory->getField(
33: $field,
34: $this->question->{$field}
35: );
36: if ($f->isEmpty()) {
37: return;
38: }
39: $this->fields[$field] = $f;
40: }
41:
42: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>