Exemplo n.º 1
0
 public static function generatePage(ServiceManager $serviceManager, $P)
 {
     $requesturi = $serviceManager->get('request')->getRequestTarget();
     $aP = ['language' => HelperConfig::$lang, 'pageconfig' => $P->cb_pageconfig, 'pagetype' => $P->cb_pagetype, 'subnavkey' => $P->cb_subnav, 'requesturi' => $requesturi, 'requesturiarray' => parse_url($requesturi), 'locale_format_date' => HelperConfig::$core['locale_format_date'], 'locale_format_date_time' => HelperConfig::$core['locale_format_date_time'], 'maintenancemode' => HelperConfig::$core['maintenancemode'], 'numberformat_decimals' => HelperConfig::$core['numberformat_decimals'], 'numberformat_decimal_point' => HelperConfig::$core['numberformat_decimal_point'], 'numberformat_thousands_seperator' => HelperConfig::$core['numberformat_thousands_seperator']];
     if (HelperConfig::$core["enable_module_customer"]) {
         $aP["isloggedin"] = \HaaseIT\HCSF\Customer\Helper::getUserData();
         $aP["enable_module_customer"] = true;
     }
     if (HelperConfig::$core["enable_module_shop"]) {
         $aP["currency"] = HelperConfig::$shop["waehrungssymbol"];
         $aP["orderamounts"] = HelperConfig::$shop["orderamounts"];
         if (isset(HelperConfig::$shop["vat"]["full"])) {
             $aP["vatfull"] = HelperConfig::$shop["vat"]["full"];
         }
         if (isset(HelperConfig::$shop["vat"]["reduced"])) {
             $aP["vatreduced"] = HelperConfig::$shop["vat"]["reduced"];
         }
         if (isset(HelperConfig::$shop["custom_order_fields"])) {
             $aP["custom_order_fields"] = HelperConfig::$shop["custom_order_fields"];
         }
         $aP["enable_module_shop"] = true;
     }
     if (isset($P->cb_key)) {
         $aP["path"] = pathinfo($P->cb_key);
     } else {
         $aP["path"] = pathinfo($aP["requesturi"]);
     }
     if ($P->cb_customcontenttemplate != NULL) {
         $aP["customcontenttemplate"] = $P->cb_customcontenttemplate;
     }
     if ($P->cb_customdata != NULL) {
         $aP["customdata"] = $P->cb_customdata;
     }
     if (isset($_SERVER["HTTP_REFERER"])) {
         $aP["referer"] = $_SERVER["HTTP_REFERER"];
     }
     // if there is no subnav defined but there is a default subnav defined, use it
     // subnavkey can be used in the templates to find out, where we are
     if ((!isset($aP["subnavkey"]) || $aP["subnavkey"] == '') && HelperConfig::$core["subnav_default"] != '') {
         $aP["subnavkey"] = HelperConfig::$core["subnav_default"];
         $P->cb_subnav = HelperConfig::$core["subnav_default"];
     }
     if ($P->cb_subnav != NULL && isset(HelperConfig::$navigation[$P->cb_subnav])) {
         $aP["subnav"] = HelperConfig::$navigation[$P->cb_subnav];
     }
     // Get page title, meta-keywords, meta-description
     $aP["pagetitle"] = $P->oPayload->getTitle();
     $aP["keywords"] = $P->oPayload->cl_keywords;
     $aP["description"] = $P->oPayload->cl_description;
     // TODO: Add head scripts to DB
     //if (isset($P["head_scripts"]) && $P["head_scripts"] != '') $aP["head_scripts"] = $P["head_scripts"];
     // Shopping cart infos
     if (HelperConfig::$core["enable_module_shop"]) {
         $aP["cartinfo"] = SHelper::getShoppingcartData();
     }
     $aP["countrylist"][] = ' | ';
     foreach (HelperConfig::$countries["countries_" . HelperConfig::$lang] as $sKey => $sValue) {
         $aP["countrylist"][] = $sKey . '|' . $sValue;
     }
     if (HelperConfig::$core["enable_module_shop"] && ($aP["pagetype"] == 'itemoverview' || $aP["pagetype"] == 'itemoverviewgrpd' || $aP["pagetype"] == 'itemdetail')) {
         $aP = SHelper::handleItemPage($serviceManager, $P, $aP);
     }
     $aP["content"] = $P->oPayload->cl_html;
     $aP["content"] = str_replace("@", "@", $aP["content"]);
     // Change @ to HTML Entity -> maybe less spam mails
     $aP['lang_available'] = HelperConfig::$core['lang_available'];
     $aP['lang_detection_method'] = HelperConfig::$core['lang_detection_method'];
     $aP['lang_by_domain'] = HelperConfig::$core['lang_by_domain'];
     if (HelperConfig::$core['debug']) {
         self::getDebug($aP, $P);
         $aP["debugdata"] = Tools::$sDebug;
     }
     return $aP;
 }