/**
  * Generate the module
  */
 protected function compile()
 {
     global $objPage;
     $session = $this->Session->get('bmfilter') ?: array();
     // Get the total number of items
     $objStore = \BmStoresModel::findByIdOrAlias(\Input::get('store'));
     if ($objStore === null) {
         // Do not index or cache the page
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         // Send a 404 header
         header('HTTP/1.1 404 Not Found');
         $this->Template->articles = '<p class="error">' . sprintf($GLOBALS['TL_LANG']['MSC']['invalidPage'], \Input::get('items')) . '</p>';
         return;
     }
     $storeData = $objStore->row();
     // Kategorie
     if ((int) $storeData['category'] > 0) {
         $catObj = $this->Database->prepare('SELECT * FROM `tl_bm_stores_categories` WHERE `id`=? ')->limit(1)->execute($storeData['category']);
         if ($catObj->numRows > 0) {
             $storeData['category'] = $catObj->name;
         }
     }
     // Website
     $storeData['website_href'] = substr($storeData['website'], 0, 4) != 'http' ? 'http://' . $storeData['website'] : $storeData['website'];
     // facebook
     $storeData['facebook_href'] = substr($storeData['facebook'], 0, 4) != 'http' ? 'http://' . $storeData['facebook'] : $storeData['facebook'];
     // twitter
     $storeData['twitter_href'] = substr($storeData['twitter'], 0, 4) != 'http' ? 'http://' . $storeData['twitter'] : $storeData['twitter'];
     // gplus
     $storeData['gplus_href'] = substr($storeData['gplus'], 0, 4) != 'http' ? 'http://' . $storeData['gplus'] : $storeData['gplus'];
     // blog
     $storeData['blog_href'] = substr($storeData['blog'], 0, 4) != 'http' ? 'http://' . $storeData['blog'] : $storeData['blog'];
     // Email
     $this->import('String');
     $storeData['email'] = $this->String->encodeEmail($storeData['email']);
     //for smartphone phonenumber clean for href
     $replaces = array(' ', ',', '/', '(', ')', '[', ']', '{', '}', '+');
     $storeData['phone_href'] = str_replace($replaces, '', $storeData['telefon']);
     // Open-Status
     $storeData['open_status'] = $this->getCurrentOpenStatus($objLibrary);
     $GLOBALS['TL_JAVASCRIPT'][] = '.' . BN_PATH . '/assets/js/bn_fe.js';
     // Google-Maps url-search-string
     $storeData['gmapsplace'] = ampersand($storeData['strasse'] . ' ' . $storeData['hausnummer'] . ', ' . $storeData['plz'] . ' ' . $storeData['ort']);
     //Bilder vorbereiten
     $scaletype = 'proportional';
     $img_height = 250;
     $img_width = 250;
     $storeData['images'] = array();
     for ($ic = 0; $ic <= 5; $ic++) {
         if (strlen($storeData['image_' . $ic]) > 0) {
             $storeData['images'][] = array('thumb' => \Image::get($storeData['image_' . $ic], $img_width, $img_height, $scaletype), 'src' => $storeData['image_' . $ic]);
         }
     }
     $this->Template->data = $storeData;
     $this->Template->articles = '';
     $this->Template->referer = 'javascript:history.go(-1)';
     $this->Template->back = $GLOBALS['TL_LANG']['MSC']['goBack'];
 }
示例#2
0
 /**
  * replace bn-specific inserttag if get-paramter isset
  * bn::colname::alternative from objPage
  * @param string
  * @return string
  */
 public function replaceBmInsertTags($strTag)
 {
     if (substr($strTag, 0, 4) == 'bn::') {
         global $objPage;
         $storeIdAlias = \Input::get('store');
         $split = explode('::', $strTag);
         switch ($split[1]) {
             case 'fullname':
                 if (!$storeIdAlias) {
                     return $objPage->{$split}[2];
                 }
                 $objStore = \BmStoresModel::findByIdOrAlias($storeIdAlias);
                 $fullname = $objStore->filialname;
                 return $fullname;
                 break;
             case 'printbutton':
                 return !$libId ? '' : '<a href="javascript:window.print()" class="printbutton"><i class="fa fa-print"></i></a>';
                 break;
             default:
                 return $objStore->{$split}[1];
         }
     }
     return false;
 }