/** * Executes parent method parent::render(), creates oxwrapping, oxshops and oxlist * objects, passes data to Smarty engine and returns name of template * file "wrapping_main.tpl". * * @return string */ public function render() { parent::render(); $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId(); if ($soxId != "-1" && isset($soxId)) { // load object $oWrapping = oxNew("oxwrapping"); $oWrapping->loadInLang($this->_iEditLang, $soxId); $oOtherLang = $oWrapping->getAvailableInLangs(); if (!isset($oOtherLang[$this->_iEditLang])) { // echo "language entry doesn't exist! using: ".key($oOtherLang); $oWrapping->loadInLang(key($oOtherLang), $soxId); } $this->_aViewData["edit"] = $oWrapping; // remove already created languages $aLang = array_diff(oxLang::getInstance()->getLanguageNames(), $oOtherLang); if (count($aLang)) { $this->_aViewData["posslang"] = $aLang; } foreach ($oOtherLang as $id => $language) { $oLang = new oxStdClass(); $oLang->sLangDesc = $language; $oLang->selected = $id == $this->_iEditLang; $this->_aViewData["otherlang"][$id] = clone $oLang; } } return "wrapping_main.tpl"; }
/** * Executes parent method parent::render(), creates deliveryset category tree, * passes data to Smarty engine and returns name of template file "deliveryset_main.tpl". * * @return string */ public function render() { $myConfig = $this->getConfig(); parent::render(); $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId(); if ($soxId != "-1" && isset($soxId)) { // load object $odeliveryset = oxNew("oxdeliveryset"); $odeliveryset->loadInLang($this->_iEditLang, $soxId); $oOtherLang = $odeliveryset->getAvailableInLangs(); if (!isset($oOtherLang[$this->_iEditLang])) { // echo "language entry doesn't exist! using: ".key($oOtherLang); $odeliveryset->loadInLang(key($oOtherLang), $soxId); } $this->_aViewData["edit"] = $odeliveryset; // remove already created languages $aLang = array_diff(oxLang::getInstance()->getLanguageNames(), $oOtherLang); if (count($aLang)) { $this->_aViewData["posslang"] = $aLang; } foreach ($oOtherLang as $id => $language) { $oLang = new oxStdClass(); $oLang->sLangDesc = $language; $oLang->selected = $id == $this->_iEditLang; $this->_aViewData["otherlang"][$id] = clone $oLang; } } if (oxConfig::getParameter("aoc")) { $aColumns = array(); include_once 'inc/' . strtolower(__CLASS__) . '.inc.php'; $this->_aViewData['oxajax'] = $aColumns; return "popups/deliveryset_main.tpl"; } return "deliveryset_main.tpl"; }
/** * Creates shop object, passes shop data to Smarty engine and returns name of * template file "dyn_trusted.tpl". * * @return string */ public function render() { parent::render(); $this->_aViewData['oxid'] = $this->getConfig()->getShopId(); $this->_aViewData["alllang"] = oxLang::getInstance()->getLanguageArray(); return "dyn_trusted_ratings.tpl"; }
/** * Executes parent method parent::render(), creates oxuser and oxbase objects, * passes data to Smarty engine and returns name of template file * "user_address.tpl". * * @return string */ public function render() { parent::render(); $soxId = $this->getEditObjectId(); if ($soxId != "-1" && isset($soxId)) { // load object $oUser = oxNew("oxuser"); $oUser->load($soxId); // load adress $soxAddressId = isset($this->sSavedOxid) ? $this->sSavedOxid : oxConfig::getParameter("oxaddressid"); if ($soxAddressId != "-1" && isset($soxAddressId)) { $oAdress = oxNew("oxaddress"); $oAdress->load($soxAddressId); $this->_aViewData["edit"] = $oAdress; } $this->_aViewData["oxaddressid"] = $soxAddressId; // generate selected $oAddressList = $oUser->getUserAddresses(); foreach ($oAddressList as $oAddress) { if ($oAddress->oxaddress__oxid->value == $soxAddressId) { $oAddress->selected = 1; break; } } $this->_aViewData["edituser"] = $oUser; } $oCountryList = oxNew("oxCountryList"); $oCountryList->loadActiveCountries(oxLang::getInstance()->getObjectTplLanguage()); $this->_aViewData["countrylist"] = $oCountryList; if (!$this->_allowAdminEdit($soxId)) { $this->_aViewData['readonly'] = true; } return "user_address.tpl"; }
/** * Smarty function * ------------------------------------------------------------- * Purpose: Output multilang string * add [{ oxmultilang ident="..." }] where you want to display content * ------------------------------------------------------------- * * @param array $params params * @param Smarty &$smarty clever simulation of a method * * @return string */ function smarty_function_oxmultilang($params, &$smarty) { startProfile("smarty_function_oxmultilang"); $sIdent = isset($params['ident']) ? $params['ident'] : 'IDENT MISSING'; $iLang = null; $blAdmin = isAdmin(); $oLang = oxLang::getInstance(); if ($blAdmin) { $iLang = $oLang->getTplLanguage(); if (!isset($iLang)) { $iLang = 0; } } try { $sTranslation = $oLang->translateString($sIdent, $iLang, $blAdmin); } catch (oxLanguageException $oEx) { // is thrown in debug mode and has to be caught here, as smarty hangs otherwise! } if ($blAdmin && $sTranslation == $sIdent && (!isset($params['noerror']) || !$params['noerror'])) { $sTranslation = '<b>ERROR : Translation for ' . $sIdent . ' not found!</b>'; } if ($sTranslation == $sIdent && isset($params['alternative'])) { $sTranslation = $params['alternative']; } stopProfile("smarty_function_oxmultilang"); return $sTranslation; }
/** * Executes parent method parent::render(), creates oxnews object and * passes news text to smarty. Returns name of template file "news_text.tpl". * * @return string */ public function render() { $myConfig = $this->getConfig(); parent::render(); $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId(); if ($soxId != "-1" && isset($soxId)) { // load object $oNews = oxNew("oxnews"); $iNewsLang = oxConfig::getParameter("newslang"); if (!isset($iNewsLang)) { $iNewsLang = $this->_iEditLang; } $this->_aViewData["newslang"] = $iNewsLang; $oNews->loadInLang($iNewsLang, $soxId); foreach (oxLang::getInstance()->getLanguageNames() as $id => $language) { $oLang = new oxStdClass(); $oLang->sLangDesc = $language; $oLang->selected = $id == $this->_iEditLang; $this->_aViewData["otherlang"][$id] = clone $oLang; } $this->_aViewData["edit"] = $oNews; } $this->_aViewData["editor"] = $this->_generateTextEditor("100%", 255, $oNews, "oxnews__oxlongdesc", "news.tpl.css"); return "news_text.tpl"; }
/** * Return message for the given error code * * @param string $code * @return string */ private function _getErrorMessage($code) { $message = 'PAYMILL_10001'; if (array_key_exists($code, $this->_responseCodes)) { $message = $this->_responseCodes[$code]; } return $this->convertToUtf(oxLang::getInstance()->translateString($message, oxLang::getInstance()->getBaseLanguage(), false)); }
/** * Returns Bread Crumb - you are here page1/page2/page3... * * @return array */ public function getBreadCrumb() { $aPaths = array(); $aPath = array(); $aPath['title'] = oxLang::getInstance()->translateString('PAGE_INFO_LINKS_TITLE', oxLang::getInstance()->getBaseLanguage(), false); $aPath['link'] = $this->getLink(); $aPaths[] = $aPath; return $aPaths; }
/** * Executes parent method parent::render(), creates oxCategoryList object, * passes it's data to Smarty engine and returns name of template file * "selectlist_main.tpl". * * @return string */ public function render() { $myConfig = $this->getConfig(); parent::render(); $sOxId = $this->_aViewData["oxid"] = $this->getEditObjectId(); $sArticleTable = getViewName('oxarticles'); //create empty edit object $this->_aViewData["edit"] = oxNew("oxselectlist"); if ($sOxId != "-1" && isset($sOxId)) { // generating category tree for select list // A. hack - passing language by post as lists uses only language passed by POST/GET/SESSION $_POST["language"] = $this->_iEditLang; $sChosenArtCat = $this->_getCategoryTree("artcattree", $sChosenArtCat, $sOxId); // load object $oAttr = oxNew("oxselectlist"); $oAttr->loadInLang($this->_iEditLang, $sOxId); $aFieldList = $oAttr->getFieldList(); if (is_array($aFieldList)) { foreach ($aFieldList as $key => $oField) { if ($oField->priceUnit == '%') { $oField->price = $oField->fprice; } } } $oOtherLang = $oAttr->getAvailableInLangs(); if (!isset($oOtherLang[$this->_iEditLang])) { // echo "language entry doesn't exist! using: ".key($oOtherLang); $oAttr->loadInLang(key($oOtherLang), $sOxId); } $this->_aViewData["edit"] = $oAttr; // remove already created languages $aLang = array_diff(oxLang::getInstance()->getLanguageNames(), $oOtherLang); if (count($aLang)) { $this->_aViewData["posslang"] = $aLang; } foreach ($oOtherLang as $id => $language) { $oLang = new oxStdClass(); $oLang->sLangDesc = $language; $oLang->selected = $id == $this->_iEditLang; $this->_aViewData["otherlang"][$id] = clone $oLang; } $iErr = oxSession::getVar("iErrorCode"); if (!$iErr) { $iErr = ERR_SUCCESS; } $this->_aViewData["iErrorCode"] = $iErr; oxSession::setVar("iErrorCode", ERR_SUCCESS); } if (oxConfig::getParameter("aoc")) { $aColumns = array(); include_once 'inc/' . strtolower(__CLASS__) . '.inc.php'; $this->_aViewData['oxajax'] = $aColumns; return "popups/selectlist_main.tpl"; } return "selectlist_main.tpl"; }
/** * Loads article parameters and passes them to Smarty engine, returns * name of template file "article_main.tpl". * * @return string */ public function render() { $myConfig = $this->getConfig(); parent::render(); $this->_aViewData['edit'] = $oArticle = oxNew('oxarticle'); $soxId = $this->getEditObjectId(); $svoxId = oxConfig::getParameter("voxid"); $soxparentId = oxConfig::getParameter("oxparentid"); // new variant ? if (isset($svoxId) && $svoxId == "-1" && isset($soxparentId) && $soxparentId && $soxparentId != "-1") { $oParentArticle = oxNew("oxarticle"); $oParentArticle->load($soxparentId); $this->_aViewData["parentarticle"] = $oParentArticle; $this->_aViewData["oxparentid"] = $soxparentId; $this->_aViewData["oxid"] = $soxId = "-1"; } if ($soxId && $soxId != "-1") { // load object $oArticle->loadInLang($this->_iEditLang, $soxId); // load object in other languages $oOtherLang = $oArticle->getAvailableInLangs(); if (!isset($oOtherLang[$this->_iEditLang])) { // echo "language entry doesn't exist! using: ".key($oOtherLang); $oArticle->loadInLang(key($oOtherLang), $soxId); } // variant handling if ($oArticle->oxarticles__oxparentid->value) { $oParentArticle = oxNew("oxarticle"); $oParentArticle->load($oArticle->oxarticles__oxparentid->value); $this->_aViewData["parentarticle"] = $oParentArticle; $this->_aViewData["oxparentid"] = $oArticle->oxarticles__oxparentid->value; $this->_aViewData["issubvariant"] = 1; } // #381A $this->_formJumpList($oArticle, $oParentArticle); //loading tags $oTagCloud = oxNew("oxTagCloud"); $oArticle->tags = $oTagCloud->getTagTitle($oArticle->getTags()); $aLang = array_diff(oxLang::getInstance()->getLanguageNames(), $oOtherLang); if (count($aLang)) { $this->_aViewData["posslang"] = $aLang; } foreach ($oOtherLang as $id => $language) { $oLang = new oxStdClass(); $oLang->sLangDesc = $language; $oLang->selected = $id == $this->_iEditLang; $this->_aViewData["otherlang"][$id] = clone $oLang; } } $this->_aViewData["editor"] = $this->_generateTextEditor("100%", 300, $oArticle, "oxarticles__oxlongdesc", "details.tpl.css"); $this->_aViewData["blUseTimeCheck"] = $myConfig->getConfigParam('blUseTimeCheck'); return "article_main.tpl"; }
/** * Loads article variants data, passes it to Smarty engine and returns name of * template file "article_variant.tpl". * * @return string */ public function render() { parent::render(); $soxId = $this->getEditObjectId(); $sSLViewName = getViewName('oxselectlist'); // all selectlists $oAllSel = oxNew("oxlist"); $oAllSel->init("oxselectlist"); $sQ = "select * from {$sSLViewName}"; $oAllSel->selectString($sQ); $this->_aViewData["allsel"] = $oAllSel; $oArticle = oxNew("oxarticle"); $this->_aViewData["edit"] = $oArticle; if ($soxId != "-1" && isset($soxId)) { // load object $oArticle->loadInLang($this->_iEditLang, $soxId); $_POST["language"] = $_GET["language"] = $this->_iEditLang; $oVariants = $oArticle->getAdminVariants($this->_iEditLang); $this->_aViewData["mylist"] = $oVariants; // load object in other languages $oOtherLang = $oArticle->getAvailableInLangs(); if (!isset($oOtherLang[$this->_iEditLang])) { // echo "language entry doesn't exist! using: ".key($oOtherLang); $oArticle->loadInLang(key($oOtherLang), $soxId); } foreach ($oOtherLang as $id => $language) { $oLang = new oxStdClass(); $oLang->sLangDesc = $language; $oLang->selected = $id == $this->_iEditLang; $this->_aViewData["otherlang"][$id] = clone $oLang; } if ($oArticle->oxarticles__oxparentid->value) { $this->_aViewData["parentarticle"] = $this->_getProductParent($oArticle->oxarticles__oxparentid->value); $this->_aViewData["oxparentid"] = $oArticle->oxarticles__oxparentid->value; $this->_aViewData["issubvariant"] = 1; // A. disable variant information editing for variant $this->_aViewData["readonly"] = 1; } $this->_aViewData["editlanguage"] = $this->_iEditLang; $aLang = array_diff(oxLang::getInstance()->getLanguageNames(), $oOtherLang); if (count($aLang)) { $this->_aViewData["posslang"] = $aLang; } foreach ($oOtherLang as $id => $language) { $oLang = new oxStdClass(); $oLang->sLangDesc = $language; $oLang->selected = $id == $this->_iEditLang; $this->_aViewData["otherlang"][$id] = $oLang; } } return "article_variant.tpl"; }
/** * Executes parent method parent::render(), passes shop configuration parameters * to Smarty and returns name of template file "shop_config.tpl". * * @return string */ public function render() { $myConfig = $this->getConfig(); parent::render(); $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId(); if ($soxId != "-1" && isset($soxId)) { // load object $this->_aViewData["edit"] = $oShop = $this->_getEditShop($soxId); try { // category choosen as default $this->_aViewData["defcat"] = null; if ($oShop->oxshops__oxdefcat->value) { $oCat = oxNew("oxCategory"); if ($oCat->load($oShop->oxshops__oxdefcat->value)) { $this->_aViewData["defcat"] = $oCat; } } } catch (Exception $oExcp) { // on most cases this means that views are broken, so just // outputting notice and keeping functionality flow .. $this->_aViewData["updateViews"] = 1; } $iAoc = oxConfig::getParameter("aoc"); if ($iAoc == 1) { include_once 'inc/shop_default_category.inc.php'; $this->_aViewData['oxajax'] = $aColumns; return "popups/shop_default_category.tpl"; } } $aDbVariables = $this->_loadConfVars($soxId, $this->_getModuleForConfigVars()); $aConfVars = $aDbVariables['vars']; $aConfVars['str']['sVersion'] = $myConfig->getConfigParam('sVersion'); $this->_aViewData["var_constraints"] = $aDbVariables['constraints']; $this->_aViewData["var_grouping"] = $aDbVariables['grouping']; foreach ($this->_aConfParams as $sType => $sParam) { $this->_aViewData[$sParam] = $aConfVars[$sType]; } // #251A passing country list $oCountryList = oxNew("oxCountryList"); $oCountryList->loadActiveCountries(oxLang::getInstance()->getObjectTplLanguage()); if (isset($aConfVars['arr']["aHomeCountry"]) && count($aConfVars['arr']["aHomeCountry"]) && count($oCountryList)) { foreach ($oCountryList as $sCountryId => $oCountry) { if (in_array($oCountry->oxcountry__oxid->value, $aConfVars['arr']["aHomeCountry"])) { $oCountryList[$sCountryId]->selected = "1"; } } } $this->_aViewData["countrylist"] = $oCountryList; // checking if cUrl is enabled $this->_aViewData["blCurlIsActive"] = !function_exists('curl_init') ? false : true; return $this->_sThisTemplate; }
/** * Executes parent::render() and returns array with languages. * * @return array $this->aLanguages languages */ public function render() { parent::render(); // Performance if ($this->getConfig()->getConfigParam('bl_perfLoadLanguages')) { $aLanguages = oxLang::getInstance()->getLanguageArray(null, true, true); reset($aLanguages); while (list($sKey, $oVal) = each($aLanguages)) { $aLanguages[$sKey]->link = $this->getParent()->getLink($oVal->id); } return $aLanguages; } }
/** * Returns VAT values sum separated to different array elements depending on VAT * * @return array */ public function getVatInfo() { $oLang = oxLang::getInstance(); $aVatValues = array(); foreach ($this->_aList as $oPrice) { $sVatKey = (string) $oLang->formatVat($oPrice->getVat()); if (!isset($aVatValues[$sVatKey])) { $aVatValues[$sVatKey] = 0; } $aVatValues[$sVatKey] += $oPrice->getVATValue(); } return $aVatValues; }
/** * Loads contents info, passes it to Smarty engine and * returns name of template file "content_main.tpl". * * @return string */ public function render() { $myConfig = $this->getConfig(); parent::render(); $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId(); // categorie tree $oCatTree = oxNew("oxCategoryList"); $oCatTree->buildList($myConfig->getConfigParam('bl_perfLoadCatTree')); $oContent = oxNew("oxcontent"); if ($soxId != "-1" && isset($soxId)) { // load object $oContent->loadInLang($this->_iEditLang, $soxId); $oOtherLang = $oContent->getAvailableInLangs(); if (!isset($oOtherLang[$this->_iEditLang])) { // echo "language entry doesn't exist! using: ".key($oOtherLang); $oContent->loadInLang(key($oOtherLang), $soxId); } // remove already created languages $aLang = array_diff(oxLang::getInstance()->getLanguageNames(), $oOtherLang); if (count($aLang)) { $this->_aViewData["posslang"] = $aLang; } foreach ($oOtherLang as $id => $language) { $oLang = new oxStdClass(); $oLang->sLangDesc = $language; $oLang->selected = $id == $this->_iEditLang; $this->_aViewData["otherlang"][$id] = clone $oLang; } // mark selected if ($oContent->oxcontents__oxcatid->value && isset($oCatTree[$oContent->oxcontents__oxcatid->value])) { $oCatTree[$oContent->oxcontents__oxcatid->value]->selected = 1; } } else { // create ident to make life easier $sUId = oxUtilsObject::getInstance()->generateUId(); $oContent->oxcontents__oxloadid = new oxField($sUId); } $this->_aViewData["edit"] = $oContent; $this->_aViewData["link"] = "[{ oxgetseourl ident="" . $oContent->oxcontents__oxloadid->value . "" type="oxcontent" }]"; $this->_aViewData["cattree"] = $oCatTree; // generate editor $sCSS = "content.tpl.css"; if ($oContent->oxcontents__oxsnippet->value == '1') { $sCSS = null; } $this->_aViewData["editor"] = $this->_generateTextEditor("100%", 300, $oContent, "oxcontents__oxcontent", $sCSS); $this->_aViewData["afolder"] = $myConfig->getConfigParam('aCMSfolder'); return "content_main.tpl"; }
/** * Downloads connector, displays message on success, error on failure. * * @return null */ public function getConnector() { $oConfig = $this->getConfig(); $sEtUsername = $this->getConfig()->getParameter("etUsername"); $sEtPassword = $this->getConfig()->getParameter("etPassword"); $sShopVersion = $this->getConfig()->getEdition() . " " . $this->getConfig()->getVersion(); $blSaveCredentials = $this->getConfig()->getParameter('blSaveCredentials'); try { $oConnector = oxNew("oxefidownloader"); $oConnector->downloadConnector($sEtUsername, $sEtPassword, $sShopVersion, $blSaveCredentials); $this->_aViewData['message'] = oxLang::getInstance()->translateString('EFIRE_DOWNLOADER_SUCCESS'); } catch (Exception $e) { oxUtilsView::getInstance()->addErrorToDisplay(sprintf(oxLang::getInstance()->translateString('EFIRE_DOWNLOADER_ERROR'), $e->getMessage())); } }
/** * Executes parent method parent::render(), creates oxorder object * and passes it's data to Smarty engine. Returns name of template * file "order_address.tpl". * * @return string */ public function render() { parent::render(); $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId(); if ($soxId != "-1" && isset($soxId)) { // load object $oOrder = oxNew("oxorder"); $oOrder->load($soxId); $this->_aViewData["edit"] = $oOrder; } $oCountryList = oxNew("oxCountryList"); $oCountryList->loadActiveCountries(oxLang::getInstance()->getObjectTplLanguage()); $this->_aViewData["countrylist"] = $oCountryList; return "order_address.tpl"; }
/** * getChannel * * modified to return shop language specific channel * * @return string */ public function getChannel() { if (class_exists('oxRegistry')) { $oLang = \oxRegistry::getLang(); $oConfig = \oxRegistry::getConfig(); } else { $oLang = \oxLang::getInstance(); $oConfig = \oxConfig::getInstance(); } $sChannel = parent::getChannel(); // #1085 if ($oConfig->getConfigParam("bl_perfLoadLanguages")) { $sChannel .= '_' . $oLang->getLanguageAbbr(); } return $sChannel; }
/** * Loads article category data, passes it to Smarty engine, returns * name of template file "category_main.tpl". * * @return string */ public function render() { $myConfig = $this->getConfig(); parent::render(); $this->_aViewData["edit"] = $oCategory = oxNew("oxcategory"); $sChosenArtCat = oxConfig::getParameter("artcat"); $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId(); if ($soxId != "-1" && isset($soxId)) { // generating category tree for select list $sChosenArtCat = $this->_getCategoryTree("artcattree", $sChosenArtCat, $soxId); // load object $oCategory->loadInLang($this->_iEditLang, $soxId); $oOtherLang = $oCategory->getAvailableInLangs(); if (!isset($oOtherLang[$this->_iEditLang])) { // echo "language entry doesn't exist! using: ".key($oOtherLang); $oCategory->loadInLang(key($oOtherLang), $soxId); } // remove already created languages $aLang = array_diff(oxLang::getInstance()->getLanguageNames(), $oOtherLang); if (count($aLang)) { $this->_aViewData["posslang"] = $aLang; } foreach ($oOtherLang as $id => $language) { $oLang = new oxStdClass(); $oLang->sLangDesc = $language; $oLang->selected = $id == $this->_iEditLang; $this->_aViewData["otherlang"][$id] = clone $oLang; } if ($oCategory->oxcategories__oxparentid->value == 'oxrootid') { $oCategory->oxcategories__oxparentid->setValue(''); } $this->_getCategoryTree("cattree", $oCategory->oxcategories__oxparentid->value, $oCategory->oxcategories__oxid->value, true, $oCategory->oxcategories__oxshopid->value); $this->_aViewData["defsort"] = $oCategory->oxcategories__oxdefsort->value; } else { $this->_getCategoryTree("cattree", "", "", true, $myConfig->getShopId()); } $this->_aViewData["sortableFields"] = $this->getSortableFields(); if (oxConfig::getParameter("aoc")) { $aColumns = array(); include_once 'inc/' . strtolower(__CLASS__) . '.inc.php'; $this->_aViewData['oxajax'] = $aColumns; return "popups/category_main.tpl"; } //print_r($this); return "category_main.tpl"; }
/** * Executes parent method parent::render(), cretes oxstatistic object, * passes it's data to Smarty engine and returns name of template file * "statistic_main.tpl". * * @return string */ public function render() { $myConfig = $this->getConfig(); $oLang = oxLang::getInstance(); parent::render(); $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId(); $aReports = array(); if ($soxId != "-1" && isset($soxId)) { // load object $oStat = oxNew("oxstatistic"); $oStat->load($soxId); $aReports = $oStat->getReports(); $this->_aViewData["edit"] = $oStat; } // setting all reports data: check for reports and load them $sPath = getShopBasePath() . $myConfig->getConfigParam('sAdminDir') . "/reports"; $iLanguage = (int) oxConfig::getParameter("editlanguage"); $aAllreports = array(); $aReportFiles = glob($sPath . "/*.php"); foreach ($aReportFiles as $sFile) { if (is_file($sFile) && !is_dir($sFile)) { $sConst = strtoupper(str_replace('.php', '', basename($sFile))); // skipping base report class if ($sConst == 'REPORT_BASE') { continue; } include $sFile; $oItem = new oxStdClass(); $oItem->filename = basename($sFile); $oItem->name = $oLang->translateString($sConst, $iLanguage); $aAllreports[] = $oItem; } } // setting reports data oxSession::setVar("allstat_reports", $aAllreports); oxSession::setVar("stat_reports_{$soxId}", $aReports); // passing assigned reports count $this->_aViewData['ireports'] = count($aReports); if (oxConfig::getParameter("aoc")) { $aColumns = array(); include_once 'inc/' . strtolower(__CLASS__) . '.inc.php'; $this->_aViewData['oxajax'] = $aColumns; return "popups/statistic_main.tpl"; } return "statistic_main.tpl"; }
/** * Smarty function * ------------------------------------------------------------- * Purpose: Output translated salutation field * add [{ $ }] where you want to display content * ------------------------------------------------------------- * * @param string $sIdent language constant ident * * @return string */ function smarty_modifier_oxmultilangsal($sIdent) { $oLang = oxLang::getInstance(); $iLang = $oLang->getTplLanguage(); if (!isset($iLang)) { $iLang = $oLang->getBaseLanguage(); if (!isset($iLang)) { $iLang = 0; } } try { $sTranslation = $oLang->translateString($sIdent, $iLang, isAdmin()); } catch (oxLanguageException $oEx) { // is thrown in debug mode and has to be caught here, as smarty hangs otherwise! } return $sTranslation; }
/** * Renders requested RSS feed * * Template variables: * <b>rss</b> * * @return string $this->_sThisTemplate current template file name */ public function render() { parent::render(); $oSmarty = oxUtilsView::getInstance()->getSmarty(); // #2873: In demoshop for RSS we set php_handling to SMARTY_PHP_PASSTHRU // as SMARTY_PHP_REMOVE removes not only php tags, but also xml if ($this->getConfig()->isDemoShop()) { $oSmarty->php_handling = SMARTY_PHP_PASSTHRU; } foreach (array_keys($this->_aViewData) as $sViewName) { $oSmarty->assign_by_ref($sViewName, $this->_aViewData[$sViewName]); } // variables are set as deprecated, use getters // $oSmarty->assign('xmldef', $this->getXmlDef()); // return rss xml, no further processing oxUtils::getInstance()->setHeader("Content-Type: text/xml; charset=" . oxLang::getInstance()->translateString("charset")); oxUtils::getInstance()->showMessageAndExit($this->_processOutput($oSmarty->fetch($this->_sThisTemplate, $this->getViewId()))); }
/** * Executes parent method parent::render(), creates oxuser object and * returns name of template file "user_extend.tpl". * * @return string */ public function render() { parent::render(); $soxId = $this->getEditObjectId(); if ($soxId != "-1" && isset($soxId)) { // load object $oUser = oxNew("oxuser"); $oUser->load($soxId); //show country in active language $oCountry = oxNew("oxCountry"); $oCountry->loadInLang(oxLang::getInstance()->getObjectTplLanguage(), $oUser->oxuser__oxcountryid->value); $oUser->oxuser__oxcountry = new oxField($oCountry->oxcountry__oxtitle->value); $this->_aViewData["edit"] = $oUser; } if (!$this->_allowAdminEdit($soxId)) { $this->_aViewData['readonly'] = true; } return "user_extend.tpl"; }
/** * Smarty modifier * ------------------------------------------------------------- * Name: smarty_modifier_oxformdate<br> * Purpose: Formats number for chosen locale * Example: {$object|oxformdate:"foo"} * ------------------------------------------------------------- * * @param string $sFormat Number formatting rules (use default currency formattin rules defined in Admin) * @param string $sValue Number to format * * @return string */ function smarty_modifier_oxnumberformat($sFormat = "EUR@ 1.00@ ,@ .@ ¤@ 2", $sValue) { // logic copied from oxconfig::getCurrencyArray() $sCur = explode("@", $sFormat); $oCur = new oxStdClass(); $oCur->id = 0; $oCur->name = @trim($sCur[0]); $oCur->rate = @trim($sCur[1]); $oCur->dec = @trim($sCur[2]); $oCur->thousand = @trim($sCur[3]); $oCur->sign = @trim($sCur[4]); $oCur->decimal = 0; //trim($sCur[5]); // change for US version if (isset($sCur[6])) { $oCur->side = @trim($sCur[6]); } return oxLang::getInstance()->formatCurrency($sValue, $oCur); }
/** * Executes parent method parent::render(), creates oxlist object, * passes it's data to Smarty engine and retutns name of template * file "payment_main.tpl". * * @return string */ public function render() { parent::render(); // remove itm from list unset($this->_aViewData["sumtype"][2]); // all usergroups $oGroups = oxNew("oxlist"); $oGroups->init("oxgroups"); $oGroups->selectString("select * from " . getViewName("oxgroups", $this->_iEditLang)); $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId(); if ($soxId != "-1" && isset($soxId)) { // load object $oPayment = oxNew("oxpayment"); $oPayment->loadInLang($this->_iEditLang, $soxId); $oOtherLang = $oPayment->getAvailableInLangs(); if (!isset($oOtherLang[$this->_iEditLang])) { // echo "language entry doesn't exist! using: ".key($oOtherLang); $oPayment->loadInLang(key($oOtherLang), $soxId); } $this->_aViewData["edit"] = $oPayment; // remove already created languages $aLang = array_diff(oxLang::getInstance()->getLanguageNames(), $oOtherLang); if (count($aLang)) { $this->_aViewData["posslang"] = $aLang; } foreach ($oOtherLang as $id => $language) { $oLang = new oxStdClass(); $oLang->sLangDesc = $language; $oLang->selected = $id == $this->_iEditLang; $this->_aViewData["otherlang"][$id] = clone $oLang; } // #708 $this->_aViewData['aFieldNames'] = oxUtils::getInstance()->assignValuesFromText($oPayment->oxpayments__oxvaldesc->value); } if (oxConfig::getParameter("aoc")) { $aColumns = array(); include_once 'inc/' . strtolower(__CLASS__) . '.inc.php'; $this->_aViewData['oxajax'] = $aColumns; return "popups/payment_main.tpl"; } $this->_aViewData["editor"] = $this->_generateTextEditor("100%", 300, $oPayment, "oxpayments__oxlongdesc"); return "payment_main.tpl"; }
/** * (Re)generates shop views * * @param bool $blMultishopInherit config option blMultishopInherit * @param array $aMallInherit array of config options blMallInherit * * @return null */ public function generateViews($blMultishopInherit = false, $aMallInherit = null) { $oDB = oxDb::getDb(); $aLanguages = oxLang::getInstance()->getLanguageIds(); $aTables = $aMultilangTables = oxLang::getInstance()->getMultiLangTables(); $aQ = array(); // Generate multitable views foreach ($aTables as $sTable) { $aQ[] = 'CREATE OR REPLACE VIEW oxv_' . $sTable . ' AS SELECT * FROM ' . $sTable . ' ' . $this->_getViewJoinAll($sTable); if (in_array($sTable, $aMultilangTables)) { foreach ($aLanguages as $iLang => $sLang) { $aQ[] = 'CREATE OR REPLACE VIEW oxv_' . $sTable . '_' . $sLang . ' AS SELECT ' . $this->_getViewSelect($sTable, $iLang) . ' FROM ' . $sTable . ' ' . $this->_getViewJoinLang($sTable, $iLang); } } } foreach ($aQ as $sQ) { $oDB->execute($sQ); } }
/** * Executes parent method parent::render(), creates article category tree, passes * data to Smarty engine and returns name of template file "discount_main.tpl". * * @return string */ public function render() { $myConfig = $this->getConfig(); parent::render(); $sOxId = $this->_aViewData["oxid"] = $this->getEditObjectId(); if ($sOxId != "-1" && isset($sOxId)) { // load object $oDiscount = oxNew("oxdiscount"); $oDiscount->loadInLang($this->_iEditLang, $sOxId); $oOtherLang = $oDiscount->getAvailableInLangs(); if (!isset($oOtherLang[$this->_iEditLang])) { // echo "language entry doesn't exist! using: ".key($oOtherLang); $oDiscount->loadInLang(key($oOtherLang), $sOxId); } $this->_aViewData["edit"] = $oDiscount; // remove already created languages $aLang = array_diff(oxLang::getInstance()->getLanguageNames(), $oOtherLang); if (count($aLang)) { $this->_aViewData["posslang"] = $aLang; } foreach ($oOtherLang as $id => $language) { $oLang = new oxStdClass(); $oLang->sLangDesc = $language; $oLang->selected = $id == $this->_iEditLang; $this->_aViewData["otherlang"][$id] = clone $oLang; } } if ($iAoc = oxConfig::getParameter("aoc")) { $aColumns = array(); if ($iAoc == "1") { include_once 'inc/' . strtolower(__CLASS__) . '.inc.php'; $this->_aViewData['oxajax'] = $aColumns; return "popups/discount_main.tpl"; } elseif ($iAoc == "2") { // generating category tree for artikel choose select list $this->_getCategoryTree("artcattree", null); include_once 'inc/discount_item.inc.php'; $this->_aViewData['oxajax'] = $aColumns; return "popups/discount_item.tpl"; } } return "discount_main.tpl"; }
/** * Executes parent method parent::render(), passes shop configuration parameters * to Smarty and returns name of template file "shop_system.tpl". * * @return string */ public function render() { $myConfig = $this->getConfig(); parent::render(); $aConfArrs = array(); $oLang = oxLang::getInstance(); $aLanguages = $oLang->getLanguageArray(); $sLangAbbr = $aLanguages[$oLang->getObjectTplLanguage()]->abbr; // loading shop location countries list (defines in which country shop exists) include "shop_countries.php"; $soxId = $this->getEditObjectId(); if (!$soxId) { $soxId = $myConfig->getShopId(); } $oDb = oxDb::getDb(); $sShopCountry = $oDb->getOne("select DECODE( oxvarvalue, " . $oDb->quote($myConfig->getConfigParam('sConfigKey')) . ") as oxvarvalue from oxconfig where oxshopid = '{$soxId}' and oxvarname = 'sShopCountry'"); $this->_aViewData["shop_countries"] = $aLocationCountries[$sLangAbbr]; $this->_aViewData["confstrs"]["sShopCountry"] = $sShopCountry; return $this->_sThisTemplate; }
/** * [_addUserInfoOrderEMail description] * @param [type] $oOrder [description] */ protected function _addUserInfoOrderEMail($oOrder) { $isPaymillElv = false; $date = null; if ($oOrder->oxorder__oxpaymenttype->rawValue == "paymill_elv") { $oLang = oxLang::getInstance(); $iLang = $oLang->getTplLanguage(); $isPaymillElv = true; $myConfig = $this->getConfig(); $daysUntilWithdraw = $myConfig->getConfigParam('PAYMILL_PRENOTIFICATION'); $orderDate = $oOrder->oxorder__oxorderdate->value; $dateTime = new DateTime($orderDate); $dateTime->modify('+' . $daysUntilWithdraw . ' day'); $dateFormat = $oLang->translateString('PAYMILL_DATE_FORMAT', $iLang); $date = $dateTime->format($dateFormat); } $this->setViewData('paymillIsPaymillElv', $isPaymillElv); $this->setViewData('paymillDaysUntilWithdraw', $date); return parent::_addUserInfoOrderEMail($oOrder); }
/** * Smarty function * ------------------------------------------------------------- * Purpose: Output help popup icon and help text * add [{ oxinputhelp ident="..." }] where you want to display content * ------------------------------------------------------------- * * @param array $params params * @param Smarty &$smarty clever simulation of a method * * @return string */ function smarty_function_oxinputhelp($params, &$smarty) { $sIdent = $params['ident']; $myConfig = oxConfig::getInstance(); $oLang = oxLang::getInstance(); $iLang = $oLang->getTplLanguage(); try { $sTranslation = $oLang->translateString($sIdent, $iLang, $blAdmin); } catch (oxLanguageException $oEx) { // is thrown in debug mode and has to be caught here, as smarty hangs otherwise! } if (!$sTranslation || $sTranslation == $sIdent) { //no translation, return empty string return ''; } //name of template file where is stored message text $sTemplate = 'inputhelp.tpl'; $smarty->assign('sHelpId', $sIdent); $smarty->assign('sHelpText', $sTranslation); return $smarty->fetch($sTemplate); }