コード例 #1
0
ファイル: Template.php プロジェクト: krisldz/Gekosale2
 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());
     }
 }
コード例 #2
0
ファイル: category.php プロジェクト: krisldz/Gekosale2
    public function getCategoryAll()
    {
        $sql = 'SELECT
					C.idcategory AS id,
					C.categoryid AS parent,
					CT.name as categoryname,
					CT.seo as seo,
					CT.keyword_title,
					CT.keyword,
					CT.keyword_description,
					C.distinction
				FROM category C
				LEFT JOIN categorytranslation CT ON CT.categoryid = C.idcategory AND CT.languageid = :languageid
		';
        $Data = array();
        $stmt = Db::getInstance()->prepare($sql);
        $stmt->bindValue('languageid', Session::getActiveLanguageId());
        $stmt->execute();
        while ($rs = $stmt->fetch()) {
            $Data[] = array('id' => $rs['id'], 'categoryname' => $rs['categoryname'], 'seo' => $rs['seo'], 'keywordtitle' => $rs['keyword_title'], 'keyword' => $rs['keyword'], 'keyworddescription' => $rs['keyword_description'], 'distinction' => $rs['distinction'], 'parent' => $rs['parent']);
        }
        return $Data;
    }