Annotation of db/prgsrc/drupal/modules/chgk_db/classes/DbPackage/DbPackageTour.class.php, revision 1.3
1.1 roma7 1: <?php
1.3 ! roma7 2: require_once(dirname(__FILE__)."/../DbQuestionFactory.class.php");
1.1 roma7 3:
4: class DbPackageTour extends DbPackage {
5: public $questions;
1.2 roma7 6: private $parent;
7:
8: public function __construct($row, $parent = FALSE) {
9: parent::__construct($row);
10: $this->setParent($parent);
11: }
12:
1.1 roma7 13: public function getAll() {
14: $this->loadQuestions();
15: return $this;
16: }
1.2 roma7 17:
18: public function getPrintVersion() {
19: $this->loadQuestions();
20: $content = theme('chgk_db_tour', $this);
21: return theme('chgk_db_print', $this->getLongTitle(), $content);
22: }
1.1 roma7 23:
1.2 roma7 24: public function loadQuestions() {
25: if (isset($this->questions)) return;
26:
27: $this->questions = array();
28:
1.1 roma7 29: $res = $this->db->getQuestionsRes($this->getDbId());
1.3 ! roma7 30: $factory = new DbQuestionFactory();
1.1 roma7 31: while ($row = $this->db->fetch_row($res)) {
1.3 ! roma7 32: $this->questions[$row->Number] = $factory->getQuestion($row);
1.1 roma7 33: }
34: }
1.2 roma7 35:
36: public function setParent($parent = FALSE) {
37: if ($parent) {
38: $this->parent = $parent;
39: } else {
40: $this->parent = new DbPackageChamp($this->tour->ParentId);
41: }
42: }
43:
44:
45: public function getParent() {
46: if ($this->parent) {
47: return $this->parent;
48: }
49: return FALSE;
50: }
51:
52: public function getLongTitle() {
53: return $this-> getParent()->getTitle(). ' '. $this->getTitle();
54: }
1.3 ! roma7 55: public function getParentInfo() {
! 56: return $this->parent->getInfo();
! 57: }
! 58: public function getParentEditor() {
! 59: return $this->parent->getEditor();
! 60: }
! 61:
1.1 roma7 62: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>