Annotation of db/prgsrc/drupal/modules/chgk_db/classes/DbPackage/DbPackageTour.class.php, revision 1.2
1.1 roma7 1: <?php
2: require_once(dirname(__FILE__)."/../DbQuestion.class.php");
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());
30: while ($row = $this->db->fetch_row($res)) {
31: $this->questions[$row->Number] = new DbQuestion($row);
32: }
33: }
1.2 ! roma7 34:
! 35: public function setParent($parent = FALSE) {
! 36: if ($parent) {
! 37: $this->parent = $parent;
! 38: } else {
! 39: $this->parent = new DbPackageChamp($this->tour->ParentId);
! 40: }
! 41: }
! 42:
! 43:
! 44: public function getParent() {
! 45: if ($this->parent) {
! 46: return $this->parent;
! 47: }
! 48: return FALSE;
! 49: }
! 50:
! 51: public function getLongTitle() {
! 52: return $this-> getParent()->getTitle(). ' '. $this->getTitle();
! 53: }
1.1 roma7 54: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>