--- db/prgsrc/drupal/modules/chgk_db/classes/DbPackage/DbPackageTour.class.php 2010/03/21 18:06:04 1.4 +++ db/prgsrc/drupal/modules/chgk_db/classes/DbPackage/DbPackageTour.class.php 2010/04/24 21:45:51 1.5 @@ -3,23 +3,24 @@ require_once(dirname(__FILE__)."/../DbQu class DbPackageTour extends DbPackage { public $questions; - private $parent; - public function __construct($row, $parent = FALSE) { - parent::__construct($row); - $this->setParent($parent); - } public function getAll() { $this->loadQuestions(); return $this; } - public function getPrintVersion() { - $this->loadQuestions(); +/* public function getPrintVersion() { + $this->loadQuestions(); $content = theme('chgk_db_tour', $this); return theme('chgk_db_print', $this->getLongTitle(), $content); } + */ + + public function getHtmlContent() { + $this->loadQuestions(); + return theme('chgk_db_tour', $this); + } public function loadQuestions() { if (isset($this->questions)) return; @@ -32,26 +33,12 @@ class DbPackageTour extends DbPackage { $this->questions[$row->Number] = $factory->getQuestion($row); } } - - public function setParent($parent = FALSE) { - if ($parent) { - $this->parent = $parent; - } else { - $this->parent = new DbPackageChamp($this->tour->ParentId); - } - } - - - public function getParent() { - if ($this->parent) { - return $this->parent; - } - return FALSE; - } + public function getLongTitle() { return $this-> getParent()->getTitle(). ' '. $this->getTitle(); } + public function getParentInfo() { return $this->parent->getInfo(); } @@ -66,4 +53,38 @@ class DbPackageTour extends DbPackage { } return $this->images; } + public function isSingleTour() { + return true; + } + public function getFb2MainPart() { + return theme('chgk_db_tour_fb2', $this); + } + + public function hasOwnInfo() { + return + preg_replace('/\s/sm', '', $this->getParentInfo()) + != + preg_replace('/\s/sm', '', $this->getInfo()); + } + + public function getFullTitle() { + $result= $this->getParent()->getTitle(); + if (!preg_match('/\.\s*$/', $result)) { + $result .= ". "; + } + $result.=" ".$this->getTitle() ; + return $result; + } + public function loadChildren() { + $this->children = array(); + } + + public function hasPrintVersion() { + return TRUE; + } + + public function hasFb2() { + return TRUE; + } + }