本文整理汇总了PHP中oxLang类的典型用法代码示例。如果您正苦于以下问题:PHP oxLang类的具体用法?PHP oxLang怎么用?PHP oxLang使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了oxLang类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetGetLang
public function testSetGetLang()
{
$oLang = new oxLang();
$oLang->setBaseLanguage(0);
$oPayPalIPNRequestValidator = new oePayPalIPNPaymentValidator();
$oPayPalIPNRequestValidator->setLang($oLang);
$this->assertEquals($oLang, $oPayPalIPNRequestValidator->getLang(), 'Getter should return same as set in setter.');
}
示例2: render
/**
* 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";
}
示例3: render
/**
* 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";
}
示例4: render
/**
* 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";
}
示例5: render
/**
* 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";
}
示例6: smarty_function_oxmultilang
/**
* 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;
}
示例7: render
/**
* 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";
}
示例8: _getErrorMessage
/**
* 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));
}
示例9: getBreadCrumb
/**
* 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;
}
示例10: render
/**
* 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";
}
示例11: render
/**
* 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";
}
示例12: render
/**
* 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";
}
示例13: render
/**
* 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;
}
示例14: render
/**
* 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;
}
}
示例15: getVatInfo
/**
* 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;
}