Example #1
0
 protected function _load($path, $bodyid)
 {
     $model = new Yntour_Model_DbTable_Tours();
     $select = $model->select()->where('bodyid=?', $bodyid)->orWhere('path=?', $path);
     $setting = Engine_Api::_()->getApi('settings', 'core')->getSetting('yntourmode', 'disable');
     if ($setting == 'disabled') {
         $select->where('enabled=?', 1);
     }
     $tour = $model->fetchRow($select);
     // tour exists
     if (!is_object($tour)) {
         return;
     }
     if ($tour->path != $path && $tour->option == 1) {
         return;
     }
     if (!is_object($tour)) {
         return array('id' => 0, 'total' => 0, 'rows' => array(), 'title' => '', 'autoplay' => 0, 'autoclose' => 0, 'autoclose_time_delay' => 0, 'hash' => '', 'view_rule' => 'all');
     }
     $model = new Yntour_Model_DbTable_Touritems();
     $select = $model->select()->where('tour_id=?', $tour->getIdentity())->order('priority');
     $rows = $model->fetchAll($select)->toArray();
     $temp_rows = array();
     $language_select = $this->view->translate()->getLocale();
     $model_language = new Yntour_Model_DbTable_Itemlanguages();
     foreach ($rows as $row) {
         $body = $model_language->getLanguage($row['touritem_id'], $language_select)->body;
         if ($body) {
             $row['body'] = $body;
         }
         $row['width'] = intval($row['width']);
         $temp_rows[] = $row;
     }
     $result = array('hash' => $tour->hash, 'total' => count($temp_rows), 'id' => $tour->getIdentity(), 'title' => $tour->title, 'rows' => $temp_rows, 'autoplay' => $tour->autoplay, 'autoclose' => $tour->autoclose, 'autoclose_time_delay' => $tour->autoclose_time_delay, 'hash' => $tour->hash, 'view_rule' => $tour->view_rule);
     return $result;
 }
Example #2
0
 public function loadTour($path, $mode)
 {
     $model = new Yntour_Model_DbTable_Tours();
     $select = $model->select()->where('path=?', urldecode($path));
     $setting = Engine_Api::_()->getApi('settings', 'core')->getSetting('yntourmode', 'disable');
     if ($setting == 'disabled') {
         $select->where('enabled=?', 1);
     }
     $tour = $model->fetchRow($select);
     if (!is_object($tour)) {
         return array('id' => 0, 'total' => 0, 'rows' => array(), 'autoplay' => 0, 'autoclose' => 0, 'autoclose_time_delay' => 0, 'hash' => '', 'view_rule' => 'all');
     }
     $model = new Yntour_Model_DbTable_Touritems();
     $select = $model->select()->where('tour_id=?', $tour->getIdentity())->order('priority');
     $rows = $model->fetchAll($select)->toArray();
     $result = array('hash' => $tour->hash, 'total' => count($rows), 'id' => $tour->getIdentity(), 'rows' => $rows, 'autoplay' => $tour->autoplay, 'autoclose' => $tour->autoclose, 'autoclose_time_delay' => $tour->autoclose_time_delay, 'hash' => $tour->hash, 'view_rule' => $tour->view_rule);
     return $result;
 }