1: <?php
2:
3: class DbPackageChamp extends DbPackage {
4: private $tours;
5:
6: protected function setId() {
7: $this->id = str_replace('.txt', '', $this->tour->FileName);
8: }
9:
10: public function getAll() {
11: $this->loadTours();
12: }
13:
14: private function loadTours() {
15: $res = $this->db->getToursRes($this->getDbId());
16: while ($row = $this->db->fetch_row($res)) {
17: $this->tours[$row->Number] = new DbPackageTour($row, $this);
18: $this->tours[$row->Number] -> loadQuestions();
19: }
20: }
21: public function getPrintVersion() {
22: $this->loadTours();
23: $content = theme('chgk_db_champ_full', $this);
24: return theme('chgk_db_print', $this->getTitle(), $content);
25: }
26:
27: public function getTours() {
28: return $this->tours;
29: }
30: public function isSingleTour() {
31: return sizeof($this->tours)==1;
32: }
33:
34: public function getImages() {
35: $this->images = array();
36: foreach ($this->tours as $t) {
37: $this->images = array_merge($this->images, $t->getImages());
38: }
39: return $this->images;
40: }
41: public function getImagesBinaries() {
42: $images=$this->getImages();
43: $result = '';
44: foreach ($images as $i) {
45: $name = file_directory_path()."/$i";
46: $result.="<binary content-type='image/jpeg' id='$i'>";
47: $file = fopen($name,'rb');
48: $str_file=fread($file,filesize($name));
49: $result.=base64_encode($str_file);
50: $result.="</binary>";
51: fclose($file);
52: }
53: return $result;
54: }
55: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>