Example #1
0
 public function setStaticTemplateVariables()
 {
     if ($this->registry->router->getAdministrativeMode() == 0) {
         $link = $this->_adminPane = '';
     } else {
         $link = $this->_adminPane = __ADMINPANE__ . '/';
     }
     $languageModel = App::getModel('language');
     $languages = $languageModel->getLanguages();
     $this->layer = $this->registry->loader->getCurrentLayer();
     if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') {
         $this->assign('SSLNAME', 'https://');
     } else {
         $this->assign('SSLNAME', 'http://');
     }
     $theme = App::getRegistry()->loader->getParam('theme');
     $this->assign('URL', App::getURLAdress() . $link);
     $this->assign('CURRENT_URL', App::getCurrentURLAdress());
     $this->assign('DESIGNPATH', DESIGNPATH);
     $this->assign('ASSETSPATH', App::getURLForAssetDirectory() . $theme . '/assets/');
     $this->assign('THEMESPATH', App::getURLForAssetDirectory());
     $this->assign('CURRENT_CONTROLLER', $this->registry->router->getCurrentController());
     $this->assign('CURRENT_ACTION', $this->registry->router->getAction());
     $this->assign('CURRENT_PARAM', $this->registry->core->getParam());
     $this->assign('SHOP_NAME', Session::getActiveShopName());
     $templateData = array();
     if ($this->registry->router->getAdministrativeMode() == 0) {
         $cartModel = App::getModel('cart');
         $client = App::getModel('client')->getClient();
         $productCart = $cartModel->getShortCartList();
         $productCart = $cartModel->getProductCartPhotos($productCart);
         $this->assign('SHOP_LOGO', $this->layer['photoid']);
         $this->assign('FAVICON', $this->layer['favicon']);
         $this->assign('enableregistration', $this->layer['enableregistration']);
         $this->assign('client', $client);
         $this->assign('clientdata', $client);
         $this->assign('showtax', $this->layer['showtax']);
         $this->assign('currencySymbol', Session::getActiveCurrencySymbol());
         $this->assign('count', $cartModel->getProductAllCount());
         $this->assign('globalPrice', $cartModel->getGlobalPrice());
         $this->assign('productCart', $productCart);
         $this->assign('language', Session::getActiveLanguageId());
         $this->assign('languageCode', Session::getActiveLanguage());
         $this->assign('languageFlag', $languageModel->getLanguages());
         $this->assign('currencies', $languageModel->getAllCurrenciesForView());
         $this->assign('breadcrumb', App::getModel('breadcrumb')->getPageLinks());
         $this->assign('contentcategory', App::getModel('staticcontent')->getContentCategoriesTree());
         $this->assign('defaultcontact', App::getModel('contact')->getContactById($this->layer['contactid']));
         $this->assign('newsletterButton', App::getModel('newsletter')->isNewsletterButton());
         $this->assign('cartpreview', $cartModel->getCartPreviewTemplate());
         if ($this->layer['cartredirect'] != '') {
             $this->assign('cartredirect', App::getURLAdress() . Seo::getSeo($this->layer['cartredirect']));
         } else {
             $this->assign('cartredirect', '');
         }
         $this->assign('modulesettings', $this->registry->core->getModuleSettingsForView());
         $message = Session::getVolatileMessage();
         if (isset($message) && !empty($message)) {
             $this->assign('message', $message[0]);
         }
         $this->assign('categories', App::getModel('CategoriesBox')->getCategoriesTree(2));
         $methods = $this->getXajaxMethodsForFrontend();
         foreach ($methods as $xajaxMethodName => $xajaxMethodParams) {
             $this->registry->xajax->registerFunction(array($xajaxMethodName, App::getModel($xajaxMethodParams['model']), $xajaxMethodParams['method']));
         }
         $message = Session::getVolatileMessage();
         if (isset($message) && !empty($message)) {
             $this->assign('message', $message[0]);
         }
         $this->assign('view', Helper::getViewId());
         $this->assign('viewid', Helper::getViewId());
     } else {
         $this->registry->core->setAdminStoreConfig();
         $templateData = array('user_name' => App::getModel('users')->getUserFullName(), 'user_id' => App::getModel('users')->getActiveUserid(), 'language' => Session::getActiveLanguageId(), 'languages' => json_encode($languages), 'globalsettings' => Session::getActiveGlobalSettings(), 'views' => App::getModel('view')->getViews(), 'vatvalues' => json_encode(App::getModel('vat/vat')->getVATValuesAll()), 'FRONTEND_URL' => Session::getActiveShopUrl() != '' ? 'http://' . Session::getActiveShopUrl() : App::getURLAdress(), 'appversion' => Session::getActiveAppVersion(), 'view' => Helper::getViewId(), 'viewid' => Helper::getViewId());
         $message = Session::getVolatileMessage();
         if (isset($message) && !empty($message)) {
             $templateData['message'] = $message[0];
         }
         $methods = $this->getXajaxMethodsForAdmin();
         foreach ($methods as $xajaxMethodName => $xajaxMethodParams) {
             $this->registry->xajax->registerFunction(array($xajaxMethodName, App::getModel($xajaxMethodParams['model']), $xajaxMethodParams['method']));
         }
         $Data = Event::dispatch($this, 'template.setStaticTemplateVariables', array('data' => $templateData));
         foreach ($Data as $param => $value) {
             $this->assign($param, $value);
         }
         $this->assign('view', Helper::getViewId());
         $this->assign('viewid', Helper::getViewId());
     }
 }