Annotation of db/prgsrc/drupal/modules/chgk_db/classes/DbQuestion.class.php, revision 1.4
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;
1.3 roma7 8: private $typeMap = array(
9: 'Я' => 'Jeopardy'
10: );
1.1 roma7 11:
12: public function __construct($row) {
13: $this->question = $row;
14: $this->fieldFactory = new DbFieldFactory();
15: $this->setFields();
16: }
17:
1.3 roma7 18: public function getHtml() {
19: return theme('chgk_db_question', $this);
20: }
1.4 ! roma7 21:
! 22: public function getFb2() {
! 23: return theme('chgk_db_question_fb2', $this);
! 24: }
! 25:
! 26: public function getImages() {
! 27: $this->images = array();
! 28: foreach ($this->fields as $f) {
! 29: $this->images = array_merge($this->images, $f->getImages());
! 30: }
! 31: return $this->images;
! 32: }
! 33:
! 34:
1.3 roma7 35: public function getField($name) {
36: return $this->fields[$name];
37: }
38:
39: public function getNumber() {
40: return $this->question->Number;
41: }
42: protected function setFields() {
1.1 roma7 43: $this->setQuestionField();
44:
1.2 roma7 45: $fields = array('Answer', 'PassCriteria', 'Comments', 'Sources', 'Authors');
1.1 roma7 46: foreach ($fields as $field) {
47: $this->setField($field);
48: }
49: }
50:
51: private function setQuestionField() {
52: $this->fields['Question'] = $this->fieldFactory->getField(
53: 'Question',
54: $this->question->Question,
55: $this->question->Number);
56: }
57:
58: private function setField($field) {
59: $f = $this->fieldFactory->getField(
60: $field,
61: $this->question->{$field}
62: );
63: if ($f->isEmpty()) {
64: return;
65: }
66: $this->fields[$field] = $f;
1.4 ! roma7 67: }
1.1 roma7 68: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>