<?php
require_once(dirname(__FILE__)."/../DbQuestionFactory.class.php");
class DbPackageTour extends DbPackage {
public $questions;
public function getAll() {
$this->loadQuestions();
return $this;
}
/* 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;
$this->questions = array();
$res = $this->db->getQuestionsRes($this->getDbId());
$factory = new DbQuestionFactory();
while ($row = $this->db->fetch_row($res)) {
$this->questions[$row->Number] = $factory->getQuestion($row);
}
}
public function getLongTitle() {
return $this-> getParent()->getTitle(). ' '. $this->getTitle();
}
public function getParentInfo() {
return $this->parent->getInfo();
}
public function getParentEditor() {
return $this->parent->getEditor();
}
public function getImages() {
$this->images = array();
foreach ($this->questions as $q) {
$this->images = array_merge($this->images, $q->getImages());
}
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;
}
}
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>