1: <?php
2: require_once(dirname(__FILE__)."/../DbQuestionFactory.class.php");
3:
4: class DbPackageTour extends DbPackage {
5: public $questions;
6:
7:
8: public function getAll() {
9: $this->loadQuestions();
10: return $this;
11: }
12:
13: /* public function getPrintVersion() {
14: $this->loadQuestions();
15: $content = theme('chgk_db_tour', $this);
16: return theme('chgk_db_print', $this->getLongTitle(), $content);
17: }
18: */
19:
20: public function getHtmlContent() {
21: $this->loadQuestions();
22: return theme('chgk_db_tour', $this);
23: }
24:
25: public function loadQuestions() {
26: if (isset($this->questions)) return;
27:
28: $this->questions = array();
29:
30: $res = $this->db->getQuestionsRes($this->getDbId());
31: $factory = new DbQuestionFactory();
32: while ($row = $this->db->fetch_row($res)) {
33: $this->questions[$row->Number] = $factory->getQuestion($row);
34: }
35: }
36:
37:
38: public function getLongTitle() {
39: return $this-> getParent()->getTitle(). ' '. $this->getTitle();
40: }
41:
42: public function getParentInfo() {
43: return $this->parent->getInfo();
44: }
45: public function getParentEditor() {
46: return $this->parent->getEditor();
47: }
48:
49: public function getImages() {
50: $this->images = array();
51: foreach ($this->questions as $q) {
52: $this->images = array_merge($this->images, $q->getImages());
53: }
54: return $this->images;
55: }
56: public function isSingleTour() {
57: return true;
58: }
59: public function getFb2MainPart() {
60: return theme('chgk_db_tour_fb2', $this);
61: }
62:
63: public function hasOwnInfo() {
64: return
65: preg_replace('/\s/sm', '', $this->getParentInfo())
66: !=
67: preg_replace('/\s/sm', '', $this->getInfo());
68: }
69:
70: public function getFullTitle() {
71: $result= $this->getParent()->getTitle();
72: if (!preg_match('/\.\s*$/', $result)) {
73: $result .= ". ";
74: }
75: $result.=" ".$this->getTitle() ;
76: return $result;
77: }
78: public function loadChildren() {
79: $this->children = array();
80: }
81:
82: public function hasPrintVersion() {
83: return TRUE;
84: }
85:
86: public function hasFb2() {
87: return TRUE;
88: }
89:
90: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>