Esempio n. 1
0
 /**
  * show the details of an object
  * @return void
  */
 function _showObject()
 {
     global $objDatabase, $_ARRAYLANG;
     if (!empty($_GET['id'])) {
         $immoID = intval($_GET['id']);
         if (empty($immoID)) {
             \Cx\Core\Csrf\Controller\Csrf::header('Location: ?section=immo&cmd=immolist');
             die;
         }
     }
     $this->_getFieldNames($immoID, $this->frontLang);
     if (($objRS = $objDatabase->SelectLimit('SELECT reference FROM ' . DBPREFIX . 'module_immo WHERE id=' . $immoID, 1)) !== false) {
         $reference = $objRS->fields['reference'];
     }
     $this->_objTpl->setGlobalVariable(array('TXT_IMMO_PRICE_PREFIX' => $this->arrSettings['currency_lang_' . $this->frontLang], 'TXT_IMMO_PRICE_SUFFIX' => $this->_currencySuffix, 'TXT_IMMO_SHOWMAP' => $_ARRAYLANG['TXT_IMMO_SHOWMAP'], 'TXT_IMMO_PRINT_PAGE' => $_ARRAYLANG['TXT_IMMO_PRINT_PAGE'], 'TXT_IMMO_BACK' => $_ARRAYLANG['TXT_IMMO_BACK'], 'TXT_IMMO_CONTACT_FORM' => $_ARRAYLANG['TXT_IMMO_CONTACT_FORM'], 'TXT_IMMO_HOMEPAGE_LINK' => $_ARRAYLANG['TXT_IMMO_HOMEPAGE_LINK'], 'TXT_IMMO_SERVICE_LINKS' => $_ARRAYLANG['TXT_IMMO_SERVICE_LINKS'], 'TXT_IMMO_GOTO_TOP' => $_ARRAYLANG['TXT_IMMO_GOTO_TOP'], 'TXT_IMMO_TO_PICTURES' => $_ARRAYLANG['TXT_IMMO_TO_PICTURES'], 'TXT_IMMO_TO_OBJECTDATA' => $_ARRAYLANG['TXT_IMMO_TO_OBJECTDATA'], 'TXT_IMMO_TO_LINKS' => $_ARRAYLANG['TXT_IMMO_TO_LINKS'], 'TXT_IMMO_PICTURES' => $_ARRAYLANG['TXT_IMMO_PICTURES'], 'TXT_IMMO_OBJECTDATA' => $_ARRAYLANG['TXT_IMMO_OBJECTDATA'], 'TXT_IMMO_LINKS' => $_ARRAYLANG['TXT_IMMO_LINKS'], 'TXT_IMMO_TO_PLANS' => $_ARRAYLANG['TXT_IMMO_TO_PLANS'], 'TXT_IMMO_TO_MAP' => $_ARRAYLANG['TXT_IMMO_TO_MAP'], 'TXT_IMMO_INTERESTED_IN_OBJECT' => $_ARRAYLANG['TXT_IMMO_INTERESTED_IN_OBJECT'], 'IMMO_ID' => $immoID, 'IMMO_DETAILS_JAVASCRIPT' => $this->_getDetailsJS()));
     $img = $this->_getFieldFromText('Übersichtsbild', 'img');
     $imgOverviewKey = $this->_currFieldID;
     $imgdim = $this->_getImageDim($img, 540);
     $homepageLink = trim($this->_getFieldFromText('Link auf Homepage'));
     $homepageLink_active = $this->_getFieldFromText('Link auf Homepage', 'active');
     $this->_getListing();
     $this->_objTpl->setVariable(array('IMMO_HEADER' => $this->_getFieldFromText('Kopfzeile'), 'IMMO_ADDRESS' => $this->_getFieldFromText('Adresse'), 'IMMO_REF_NR' => $reference, 'IMMO_LOCATION' => $this->_getFieldFromText('Ort'), 'IMMO_PRICE' => $this->_getFieldFromText('Preis'), 'IMMO_DESCRIPTION' => $this->_getFieldFromText('Beschreibung'), 'IMMO_HEADLINE' => $this->_getFieldFromText('Headline'), 'IMMO_HOMEPAGE_LINK' => $homepageLink, 'IMMO_IMG_DIM' => $imgdim[0], 'IMMO_IMG_WIDTH' => $imgdim[1], 'IMMO_IMG_HEIGHT' => $imgdim[2], 'IMMO_IMG_SRC' => $img, 'IMMO_ID' => $immoID, 'IMMO_IMAGES_INDEX' => $imgOverviewKey));
     if ($homepageLink != '' && $homepageLink_active) {
         $this->_objTpl->parse("homepageLink");
     } else {
         $this->_objTpl->hideblock("homepageLink");
     }
     $this->_objTpl->parse("basicData");
     $imgRow = 1;
     $lnkRow = 1;
     $textcount = 0;
     $imagecount = 0;
     $linkcount = 0;
     foreach ($this->fieldNames as $fieldKey => $field) {
         if ($field['content']['active'] == 1 && !in_array($field['names'][1], $this->_usedFields)) {
             switch ($field['type']) {
                 case 'text':
                 case 'textarea':
                 case 'digits_only':
                 case 'price':
                     $textcount++;
                     $this->_objTpl->setVariable(array('IMMO_FIELD_NAME' => htmlentities($field['names'][$this->frontLang], ENT_QUOTES, CONTREXX_CHARSET), 'IMMO_FIELD_CONTENT' => htmlentities($field['type'] == 'price' ? number_format($field['content'][$this->frontLang], $this->_arrPriceFormat[$this->frontLang]['dec'], $this->_arrPriceFormat[$this->frontLang]['dec_sep'], $this->_arrPriceFormat[$this->frontLang]['thousand_sep']) : $field['content'][$this->frontLang], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_IMMO_CURRENCY_PREFIX' => $field['type'] == 'price' ? htmlentities($this->arrSettings['currency_lang_' . $this->frontLang], ENT_QUOTES, CONTREXX_CHARSET) : '', 'TXT_IMMO_CURRENCY_SUFFIX' => $field['type'] == 'price' ? $this->_currencySuffix : ''));
                     if (trim($field['content'][$this->frontLang]) != '') {
                         if ($textcount < $this->_fieldCount['text']) {
                             $this->_objTpl->touchBlock('textListHR');
                         }
                         $this->_objTpl->parse('textList');
                     }
                     break;
                 case 'img':
                     $imagecount++;
                     $img = trim($field['img']);
                     if (!empty($img)) {
                         $imgdim = $this->_getImageDim($img, 160);
                         $this->_objTpl->setVariable(array('IMMO_FIELD_NAME' => htmlentities($field['names'][$this->frontLang], ENT_QUOTES, CONTREXX_CHARSET), 'IMMO_FIELD_CONTENT' => htmlentities($field['content'][$this->frontLang], ENT_QUOTES, CONTREXX_CHARSET), 'IMMO_IMG_SRC' => $img, 'IMMO_IMG_WIDTH' => $imgdim[1], 'IMMO_IMG_HEIGHT' => $imgdim[2], 'IMMO_IMG_DIM' => $imgdim[0], 'IMMO_IMAGES_INDEX' => $fieldKey));
                         if ($fieldKey == 125) {
                             $this->_objTpl->touchBlock("anchor_plan_images");
                         }
                         if ($imgRow++ % 3 == 0) {
                             if ($imagecount < $this->_fieldCount['img']) {
                                 $this->_objTpl->touchBlock('imageListHR');
                             }
                             $this->_objTpl->parse('imageList');
                             $this->_objTpl->parse('imageListRow');
                         } else {
                             $this->_objTpl->parse('imageList');
                         }
                     }
                     break;
                 case 'panorama':
                     $img = trim($field['img']);
                     if (!empty($img)) {
                         $imgdim = $this->_getImageDim($img, 530);
                         $this->_objTpl->setVariable(array('IMMO_FIELD_NAME' => htmlentities($field['names'][$this->frontLang], ENT_QUOTES, CONTREXX_CHARSET), 'IMMO_FIELD_CONTENT' => htmlentities($field['content'][$this->frontLang], ENT_QUOTES, CONTREXX_CHARSET), 'IMMO_IMG_SRC' => $img, 'IMMO_IMG_WIDTH' => $imgdim[1], 'IMMO_IMG_HEIGHT' => $imgdim[2], 'IMMO_IMG_DIM' => $imgdim[0], 'IMMO_IMAGES_INDEX' => $fieldKey));
                         $this->_objTpl->parse('panorama');
                     }
                     break;
                 case 'link':
                 case 'protected_link':
                     $linkcount++;
                     $splitName = explode(" - ", $field['names'][$this->frontLang]);
                     $iconType = strtolower(trim($splitName[count($splitName) - 1]));
                     $this->_objTpl->setVariable(array('IMMO_LINK_ICON_SRC' => $this->_getIcon($iconType), 'IMMO_FIELD_NAME' => htmlentities($field['names'][$this->frontLang], ENT_QUOTES, CONTREXX_CHARSET), 'IMMO_FIELD_CONTENT' => htmlspecialchars($field['type'] == 'protected_link' ? '?section=immo&amp;cmd=getPDF&amp;id=' . $immoID . '_' . $fieldKey : $field['content'][$this->frontLang])));
                     if (trim($field['content'][$this->frontLang]) != '') {
                         if ($lnkRow++ % 2 == 0) {
                             $this->_objTpl->parse('linkList');
                             $this->_objTpl->parse('linkListRow');
                         } else {
                             $this->_objTpl->parse('linkList');
                         }
                     }
                     break;
             }
         }
     }
 }