--- db/prgsrc/drupal/modules/chgk_db/classes/DbPackage/DbPackageChamp.class.php 2010/02/28 20:17:35 1.1 +++ db/prgsrc/drupal/modules/chgk_db/classes/DbPackage/DbPackageChamp.class.php 2010/03/21 18:06:04 1.3 @@ -1,7 +1,55 @@ id = str_replace('.txt', '', $this->tour->FileName); } + + public function getAll() { + $this->loadTours(); + } + + private function loadTours() { + $res = $this->db->getToursRes($this->getDbId()); + while ($row = $this->db->fetch_row($res)) { + $this->tours[$row->Number] = new DbPackageTour($row, $this); + $this->tours[$row->Number] -> loadQuestions(); + } + } + public function getPrintVersion() { + $this->loadTours(); + $content = theme('chgk_db_champ_full', $this); + return theme('chgk_db_print', $this->getTitle(), $content); + } + + public function getTours() { + return $this->tours; + } + public function isSingleTour() { + return sizeof($this->tours)==1; + } + + public function getImages() { + $this->images = array(); + foreach ($this->tours as $t) { + $this->images = array_merge($this->images, $t->getImages()); + } + return $this->images; + } + public function getImagesBinaries() { + $images=$this->getImages(); + $result = ''; + foreach ($images as $i) { + $name = file_directory_path()."/$i"; + $result.=""; + $file = fopen($name,'rb'); + $str_file=fread($file,filesize($name)); + $result.=base64_encode($str_file); + $result.=""; + fclose($file); + } + return $result; + } }