1: <?php
2: require_once(dirname(__FILE__)."/../DbQuestionFactory.class.php");
3:
4: class DbPackageTour extends DbPackage {
5: public $questions;
6: private $parent;
7:
8: public function __construct($row, $parent = FALSE) {
9: parent::__construct($row);
10: $this->setParent($parent);
11: }
12:
13: public function getAll() {
14: $this->loadQuestions();
15: return $this;
16: }
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: }
23:
24: public function loadQuestions() {
25: if (isset($this->questions)) return;
26:
27: $this->questions = array();
28:
29: $res = $this->db->getQuestionsRes($this->getDbId());
30: $factory = new DbQuestionFactory();
31: while ($row = $this->db->fetch_row($res)) {
32: $this->questions[$row->Number] = $factory->getQuestion($row);
33: }
34: }
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: }
55: public function getParentInfo() {
56: return $this->parent->getInfo();
57: }
58: public function getParentEditor() {
59: return $this->parent->getEditor();
60: }
61:
62: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>