Esempio n. 1
0
 /**
  * Show the shadowbox
  */
 function shadowbox()
 {
     global $objDatabase, $_ARRAYLANG, $objInit;
     $id = intval($_GET['id']);
     $lang = intval($_GET['lang']);
     $entries = $this->createEntryArray();
     $entry = $entries[$id];
     $settings = $this->createSettingsArray();
     $title = $entry['translation'][$lang]['subject'];
     $content = $entry['translation'][$lang]['content'];
     $picture = !empty($entry['translation'][$lang]['image']) ? $entry['translation'][$lang]['image'] : "none";
     $this->_objTpl = new \Cx\Core\Html\Sigma(ASCMS_THEMES_PATH);
     \Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTpl);
     $this->_objTpl->setCurrentBlock("shadowbox");
     $objResult = $objDatabase->SelectLimit("\n            SELECT foldername\n              FROM " . DBPREFIX . "skins\n             WHERE id='{$objInit->currentThemesId}'", 1);
     if ($objResult !== false) {
         $themesPath = $objResult->fields['foldername'];
     }
     $template = preg_replace('/\\[\\[([A-Z_]+)\\]\\]/', '{$1}', $settings['data_template_shadowbox']);
     $this->_objTpl->setTemplate($template);
     if ($entry['translation'][$lang]['attachment']) {
         $this->_objTpl->setVariable(array("HREF" => $entry['translation'][$lang]['attachment'], "TXT_DOWNLOAD" => empty($entry['translation'][$lang]['attachment_desc']) ? $_ARRAYLANG['TXT_DATA_DOWNLOAD_ATTACHMENT'] : $entry['translation'][$lang]['attachment_desc']));
         $this->_objTpl->parse("attachment");
     }
     $this->_objTpl->setVariable(array("TITLE" => $title, "CONTENT" => $content, "PICTURE" => $picture, "THEMES_PATH" => $themesPath));
     if ($picture != "none") {
         $this->_objTpl->parse("image");
     } else {
         $this->_objTpl->hideBlock("image");
     }
     $this->_objTpl->parse("shadowbox");
     $this->_objTpl->show();
     die;
 }
Esempio n. 2
0
 /**
  * Shows the map
  * @param int $highlight Id of the Object to be highlighted
  * @return void
  */
 function _showMap()
 {
     global $objDatabase, $_ARRAYLANG, $_CONFIG;
     $this->_objTpl->loadTemplateFile("modules/immo/template/frontend_map_template.html");
     // Check if something has to be highlighted
     $highlight = isset($_GET['highlight']) ? intval($_GET['highlight']) : 0;
     // Extract all Placeholders out of the message
     $subQueryPart = "";
     $first = true;
     $matches = array();
     preg_match_all("/%([^%]+)%/", $this->arrSettings['message'], $matches);
     setlocale(LC_ALL, "de_CH");
     foreach ($matches[1] as $match) {
         if ($first) {
             $first = false;
         } else {
             $subQueryPart .= " OR ";
         }
         $subQueryPart .= "lower(name) = '" . strtolower($match) . "'";
     }
     // Get All the immo objects
     $query = " SELECT immo.id as `id`,\n                        immo.reference AS `ref` ,\n                        immo.visibility,\n                        immo.object_type AS otype,\n                        immo.new_building AS `new` ,\n                        immo.property_type AS ptype,\n                        immo.longitude as `long`,\n                        immo.latitude as `lat`,\n                        immo.zoom as `zoom`,\n                        immo.logo as `logo`\n                    FROM " . DBPREFIX . "module_immo AS immo\n                    WHERE immo.visibility = 'listing'";
     $objResult = $objDatabase->Execute($query);
     if ($objResult) {
         $keyCounter = 0;
         while (!$objResult->EOF) {
             unset($data);
             // This is the one we want to highlight. So we scroll to it
             if ($objResult->fields['id'] == $highlight) {
                 $startX = $objResult->fields['long'];
                 $startY = $objResult->fields['lat'];
                 $startZoom = $objResult->fields['zoom'];
             }
             $data = array('reference' => $objResult->fields['ref'], 'object_type' => $_ARRAYLANG['TXT_IMMO_OBJECTTYPE' . strtoupper($objResult->fields['object_type'])], 'new_building' => $objResult->fields['new_building'] ? $_ARRAYLANG['TXT_IMMO_YES'] : $_ARRAYLANG['TXT_IMMO_NO'], 'property_type' => $_ARRAYLANG['TXT_IMMO_PROPERTYTYPE' . strtoupper($objResult->fields['property_type'])], 'longitude' => $objResult->fields['longitude'], 'latitude' => $objResult->fields['latitude']);
             $query = "  SELECT content.field_id AS `field_id` ,\n                                fieldnames.name AS `field_name` ,\n                                fieldvalue AS `value` ,\n                                image.uri AS `uri` ,\n                                field.type AS `type`\n                            FROM " . DBPREFIX . "module_immo_content AS `content`\n                            INNER JOIN " . DBPREFIX . "module_immo_fieldname AS `fieldnames` ON fieldnames.field_id = content.field_id\n                            AND fieldnames.lang_id = '" . $this->frontLang . "'\n                            AND content.lang_id = '" . $this->frontLang . "'\n                            AND fieldnames.field_id\n                            IN (\n                                SELECT field_id\n                                FROM `" . DBPREFIX . "module_immo_fieldname` AS fieldn\n                                WHERE\n                                " . $subQueryPart . "\n                            )\n                            AND content.immo_id ='" . $objResult->fields['id'] . "'\n                            LEFT OUTER JOIN " . DBPREFIX . "module_immo_image AS `image` ON image.field_id = content.field_id\n                            AND image.immo_id = '" . $objResult->fields['id'] . "'\n                            LEFT OUTER JOIN " . DBPREFIX . "module_immo_field AS `field` ON content.field_id = field.id";
             $objResult2 = $objDatabase->Execute($query);
             while (!$objResult2->EOF) {
                 $data[strtolower($objResult2->fields['field_name'])] = $objResult2->fields['type'] == "img" || $objResult2->fields['type'] == "panorama" ? !empty($objResult2->fields['uri']) ? $objResult2->fields['uri'] : "../core/Core/View/Media/icons/pixel.gif" : $objResult2->fields['value'];
                 $objResult2->MoveNext();
             }
             // Line breaks are evil
             $message = str_replace("\r", "", $this->arrSettings['message']);
             $message = str_replace("\n", "", $message);
             // get all fieldnames + -contents from the highlighted immo ID
             if (!empty($highlight)) {
                 $this->_getFieldNames($highlight);
             }
             // replace the placeholder in the message with the date (if provided)
             foreach ($matches[1] as $match) {
                 $toReplace = isset($data[strtolower($match)]) ? $data[strtolower($match)] : "";
                 //custom values for "price" field
                 if ($match == strtoupper($this->arrFields['price'])) {
                     $toReplace = number_format($toReplace, $this->_arrPriceFormat[$this->frontLang]['dec'], $this->_arrPriceFormat[$this->frontLang]['dec_sep'], $this->_arrPriceFormat[$this->frontLang]['thousand_sep']);
                     $status = $this->_getFieldFromText('status');
                     if ($this->_getFieldFromText($this->arrFields['price']) == 0) {
                         $status = "null";
                     }
                     $toReplace = $this->arrSettings['currency_lang_' . $this->frontLang] . " " . $toReplace . " " . $this->_currencySuffix;
                     switch ($status) {
                         case 'verkauft':
                             $toReplace = '<strike>' . $toReplace . '</strike>  &nbsp;<span style=\\"color: red;\\">(verkauft)</span>';
                             break;
                         case 'versteckt':
                             $toReplace = '<span style=\\"color: red;\\">verkauft</span>';
                             break;
                             //                            case 'null':
                             //                                $toReplace = '<span style=\"color: red;\">verkauft</span>';
                             //                                break;
                         //                            case 'null':
                         //                                $toReplace = '<span style=\"color: red;\">verkauft</span>';
                         //                                break;
                         case 'reserviert':
                             $toReplace .= '  &nbsp;<span style=\\"color: red;\\">(reserviert)</span>';
                             break;
                     }
                 }
                 $message = str_replace("%" . $match . "%", $toReplace, $message);
             }
             $this->_objTpl->setVariable(array('IMMO_KEY_NUMBER' => $keyCounter, 'IMMO_MARKER_LAT' => $objResult->fields['lat'], 'IMMO_MARKER_LONG' => $objResult->fields['long'], 'IMMO_MARKER_MSG' => $message, 'IMMO_MARKER_ID' => $objResult->fields['id'], 'IMMO_MARKER_HIGHLIGHT' => $objResult->fields['id'] == $highlight ? 1 : 0, 'IMMO_MARKER_LOGO' => $objResult->fields['logo']));
             $this->_objTpl->parse("setmarker");
             $keyCounter++;
             $objResult->MoveNext();
         }
     }
     // Nothing is highlighted. Start at the default start point
     if (!$highlight || !isset($startX)) {
         $startX = $this->arrSettings['lat_frontend'];
         $startY = $this->arrSettings['lon_frontend'];
         $startZoom = $this->arrSettings['zoom_frontend'];
     }
     $googleKey = empty($this->arrSettings['GOOGLE_API_KEY_' . $_SERVER['SERVER_NAME']]) ? $_CONFIG['googleMapsAPIKey'] : $this->arrSettings['GOOGLE_API_KEY_' . $_SERVER['SERVER_NAME']];
     $this->_objTpl->setVariable(array('IMMO_GOOGLE_API_KEY' => $googleKey, 'IMMO_START_X' => $startX, 'IMMO_START_Y' => $startY, 'IMMO_START_ZOOM' => $startZoom, 'IMMO_LANG' => $this->frontLang, 'IMMO_TXT_LOOK' => $_ARRAYLANG['TXT_IMMO_LOOK']));
     if (!empty($_GET['bigone']) && $_GET['bigone'] == 1) {
         $this->_objTpl->touchBlock("big");
         $this->_objTpl->parse("big");
     } else {
         $this->_objTpl->touchBlock("small");
         $this->_objTpl->parse("small");
     }
     $this->_objTpl->getBlockList();
     $this->_objTpl->parse("map");
     $this->_objTpl->show("map");
     die;
 }
 /**
  * Creates the main overview for this component.
  *
  * @param $template
  *
  * @throws \Cx\Core\Routing\UrlException
  */
 public function showOverview(Sigma $template)
 {
     global $_ARRAYLANG, $_CONFIG;
     \JS::registerJS('core_modules/TemplateEditor/View/Script/spectrum.js');
     \JS::activate('intro.js');
     $template->loadTemplateFile($this->cx->getCodeBaseCoreModulePath() . '/TemplateEditor/View/Template/Backend/Default.html');
     /**
      * @var $themes Theme[]
      */
     $themes = $this->themeRepository->findAll();
     foreach ($themes as $theme) {
         $template->setVariable(array('TEMPLATEEDITOR_LAYOUT_NAME' => $theme->getThemesname(), 'TEMPLATEEDITOR_LAYOUT_ID' => $theme->getId()));
         if ($this->theme->getId() == $theme->getId()) {
             $template->setVariable(array('TEMPLATEEDITOR_LAYOUT_ACTIVE' => 'selected'));
         }
         $template->parse('layouts');
     }
     if ($this->themeOptions) {
         $presets = $this->themeOptions->getPresetRepository()->findAll();
         foreach ($presets as $preset) {
             $template->setVariable(array('TEMPLATEEDITOR_PRESET_NAME' => $this->themeOptions->getActivePreset()->getName() == $preset ? $preset . ' (' . $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_PRESET_ACTIVE'] . ')' : $preset, 'TEMPLATEEDITOR_PRESET_ID' => $preset));
             if ($_SESSION['TemplateEditor'][$this->theme->getId()]['activePreset'] == $preset) {
                 $template->setVariable(array('TEMPLATEEDITOR_PRESET_ACTIVE' => 'selected'));
             }
             $template->parse('presets');
         }
         if ($_SESSION['TemplateEditor'][$this->theme->getId()]['activePreset'] == $this->themeOptions->getActivePreset()->getName()) {
             $template->setVariable(array('TEMPLATEDITOR_PRESET_IS_ALREADY_ACTIVE' => 'disabled'));
             $template->setVariable(array('TXT_CORE_MODULE_TEMPLATEEDITOR_REMOVE_PRESET_TEXT_IS_ACTIVE' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_REMOVE_PRESET_TEXT_IS_ACTIVE']));
             $template->show('presetTextActive');
         }
         if ($_SESSION['TemplateEditor'][$this->theme->getId()]['activePreset'] == 'Default') {
             $template->setVariable(array('TEMPLATEDITOR_PRESET_IS_DEFAULT' => 'disabled'));
         }
         foreach ($presets as $preset) {
             $template->setVariable(array('TEMPLATEEDITOR_PRESET_FOR_PRESETS_NAME' => $preset, 'TEMPLATEEDITOR_PRESET_FOR_PRESETS_ID' => $preset));
             $template->parse('presetsForPresets');
         }
         $this->themeOptions->renderOptions($template);
         if ($this->themeOptions->getOptionCount() != 0) {
             $template->parse('presetBlock');
             $template->setVariable('TXT_CORE_MODULE_TEMPLATEEDITOR_SAVE', $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_SAVE']);
             $template->parse('save_button');
         }
     } else {
         $template->setVariable(array('TEMPLATEOPTION_NO_OPTIONS_TEXT' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_NO_OPTIONS_HELP'], 'TEMPLATEOPTION_NO_OPTIONS_LINKNAME' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_NO_OPTIONS_LINKNAME']));
         $template->parse('no_options');
     }
     $template->setVariable(array('TEMPLATEEDITOR_IFRAME_URL' => Url::fromModuleAndCmd('home', '', null, array('preview' => $this->theme->getId(), 'templateEditor' => 1)), 'TEMPLATEEDITOR_BACKURL' => './index.php?cmd=ViewManager'));
     $template->setGlobalVariable($_ARRAYLANG);
     \ContrexxJavascript::getInstance()->setVariable(array('newPresetTemplate' => '', 'TXT_CORE_MODULE_TEMPLATEEDITOR_SAVE' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_SAVE'], 'TXT_CORE_MODULE_TEMPLATEEDITOR_CANCEL' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_CANCEL'], 'TXT_CORE_MODULE_TEMPLATEEDITOR_SAVE_CONTENT' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_SAVE_CONTENT'], 'TXT_CORE_MODULE_TEMPLATEEDITOR_SAVE_TITLE' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_SAVE_TITLE'], 'TXT_CORE_MODULE_TEMPLATEEDITOR_YES' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_YES'], 'TXT_CORE_MODULE_TEMPLATEEDITOR_NO' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_NO'], 'TXT_CORE_MODULE_TEMPLATEEDITOR_ADD_PRESET' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_ADD_PRESET'], 'TXT_CORE_MODULE_TEMPLATEEDITOR_REMOVE_PRESET_TEXT' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_REMOVE_PRESET_TEXT'], 'TXT_CORE_MODULE_TEMPLATEEDITOR_ACTIVATE_PRESET_TITLE' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_ACTIVATE_PRESET_TITLE'], 'TXT_CORE_MODULE_TEMPLATEEDITOR_ADD_PRESET_TITLE' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_ADD_PRESET_TITLE'], 'TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_LAYOUT_OPTION' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_LAYOUT_OPTION'], 'TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_PRESET_OPTION' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_PRESET_OPTION'], 'TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_PRESET_ACTIVATE' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_PRESET_ACTIVATE'], 'TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_PRESET_ADD' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_PRESET_ADD'], 'TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_PRESET_RESET' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_PRESET_RESET'], 'TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_VIEW_OPTION' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_VIEW_OPTION'], 'TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_VIEW_OPTION_LIST' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_VIEW_OPTION_LIST'], 'TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_PREVIEW' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_PREVIEW'], 'TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_SAVE' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_SAVE'], 'TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_NEXT' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_NEXT'], 'TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_BACK' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_BACK'], 'TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_STOP' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_INTRO_STOP'], 'themeid' => $this->theme->getId(), 'iframeUrl' => Url::fromModuleAndCmd('home', '', null, array('preview' => $this->theme->getId(), 'templateEditor' => 1))->toString(), 'domainUrl' => $_CONFIG['domainUrl']), 'TemplateEditor');
 }