Annotation of db/prgsrc/drupal/modules/chgk_db/classes/DbPackage/DbPackageTour.class.php, revision 1.5

1.1       roma7       1: <?php
1.3       roma7       2: require_once(dirname(__FILE__)."/../DbQuestionFactory.class.php");
1.1       roma7       3: 
                      4: class DbPackageTour extends DbPackage {
                      5:   public $questions;
1.2       roma7       6: 
                      7: 
1.1       roma7       8:   public function getAll() {
                      9:     $this->loadQuestions();
                     10:     return $this;
                     11:   }
1.2       roma7      12: 
1.5     ! roma7      13: /*  public function getPrintVersion() {
        !            14:      $this->loadQuestions();
1.2       roma7      15:      $content = theme('chgk_db_tour', $this);
                     16:      return theme('chgk_db_print', $this->getLongTitle(), $content);
                     17:   }
1.5     ! roma7      18:   */
        !            19:   
        !            20:   public function getHtmlContent() {
        !            21:     $this->loadQuestions();
        !            22:     return theme('chgk_db_tour', $this);
        !            23:   }
1.1       roma7      24:   
1.2       roma7      25:   public function loadQuestions() {
                     26:     if (isset($this->questions)) return;
                     27:       
                     28:     $this->questions = array();
                     29: 
1.1       roma7      30:     $res = $this->db->getQuestionsRes($this->getDbId());
1.3       roma7      31:     $factory = new DbQuestionFactory();
1.1       roma7      32:     while ($row = $this->db->fetch_row($res)) {
1.3       roma7      33:       $this->questions[$row->Number] = $factory->getQuestion($row);
1.1       roma7      34:     }
                     35:   }
1.5     ! roma7      36:  
1.2       roma7      37:   
                     38:   public function getLongTitle() {
                     39:     return $this-> getParent()->getTitle(). '  '. $this->getTitle();
                     40:   }
1.5     ! roma7      41:   
1.3       roma7      42:   public function getParentInfo() {
                     43:     return $this->parent->getInfo();
                     44:   }
                     45:   public function getParentEditor() {
                     46:     return $this->parent->getEditor();
                     47:   }
1.4       roma7      48:   
                     49:   public function getImages() {
                     50:       $this->images = array();
                     51:       foreach ($this->questions as $q) {
                     52:           $this->images = array_merge($this->images, $q->getImages());
                     53:       }
                     54:       return $this->images;
                     55:   }
1.5     ! roma7      56:   public function isSingleTour() {
        !            57:       return true;
        !            58:   }
        !            59:   public function getFb2MainPart() {
        !            60:       return theme('chgk_db_tour_fb2', $this);
        !            61:   }
        !            62: 
        !            63:   public function hasOwnInfo() {
        !            64:       return
        !            65:          preg_replace('/\s/sm', '', $this->getParentInfo())
        !            66:                  !=
        !            67:          preg_replace('/\s/sm', '', $this->getInfo());
        !            68:   }
        !            69: 
        !            70:    public function getFullTitle() {
        !            71:      $result=  $this->getParent()->getTitle();
        !            72:      if (!preg_match('/\.\s*$/', $result)) {
        !            73:              $result .= ". ";
        !            74:      }
        !            75:      $result.=" ".$this->getTitle() ;
        !            76:      return $result;
        !            77:   }
        !            78:   public function loadChildren() {
        !            79:      $this->children = array();
        !            80:   }
        !            81:   
        !            82:   public function hasPrintVersion() {
        !            83:     return TRUE;
        !            84:   }
        !            85: 
        !            86:   public function hasFb2() {
        !            87:     return TRUE;
        !            88:   }
        !            89:   
1.1       roma7      90: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>