コード例 #1
0
 /**
  * Get translated string by the translation code.
  *
  * @param string  $sCode
  * @param boolean $blUseModulePrefix If True - adds the module translations prefix, if False - not.
  *
  * @return string
  */
 public function translate($sCode, $blUseModulePrefix = true)
 {
     if ($blUseModulePrefix) {
         $sCode = 'HBO_VARMAPPER_' . $sCode;
     }
     return oxRegistry::getLang()->translateString($sCode, oxRegistry::getLang()->getBaseLanguage(), false);
 }
コード例 #2
0
ファイル: news_main.php プロジェクト: ioanok/symfoxid
 /**
  * Executes parent method parent::render(), creates oxlist object and
  * collects user groups information, passes data to Smarty engine,
  * returns name of template file "news_main.tpl".
  *
  * @return string
  */
 public function render()
 {
     $myConfig = $this->getConfig();
     parent::render();
     // 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
         $oNews = oxNew("oxnews");
         $oNews->loadInLang($this->_iEditLang, $soxId);
         $oOtherLang = $oNews->getAvailableInLangs();
         if (!isset($oOtherLang[$this->_iEditLang])) {
             // echo "language entry doesn't exist! using: ".key($oOtherLang);
             $oNews->loadInLang(key($oOtherLang), $soxId);
         }
         $this->_aViewData["edit"] = $oNews;
         // remove already created languages
         $this->_aViewData["posslang"] = array_diff(oxRegistry::getLang()->getLanguageNames(), $oOtherLang);
         foreach ($oOtherLang as $id => $language) {
             $oLang = new stdClass();
             $oLang->sLangDesc = $language;
             $oLang->selected = $id == $this->_iEditLang;
             $this->_aViewData["otherlang"][$id] = clone $oLang;
         }
     }
     if (oxRegistry::getConfig()->getRequestParameter("aoc")) {
         $oNewsMainAjax = oxNew('news_main_ajax');
         $this->_aViewData['oxajax'] = $oNewsMainAjax->getColumns();
         return "popups/news_main.tpl";
     }
     return "news_main.tpl";
 }
コード例 #3
0
 /**
  * Executes parent method parent::render(), creates oxOrder, passes
  * it's data to Smarty engine and returns name of template file
  * "order_overview.tpl".
  *
  * @return string
  */
 public function render()
 {
     $myConfig = $this->getConfig();
     parent::render();
     $oOrder = oxNew("oxOrder");
     $oCur = $myConfig->getActShopCurrencyObject();
     $oLang = oxRegistry::getLang();
     $soxId = $this->getEditObjectId();
     if ($soxId != "-1" && isset($soxId)) {
         // load object
         $oOrder->load($soxId);
         $this->_aViewData["edit"] = $oOrder;
         $this->_aViewData["aProductVats"] = $oOrder->getProductVats();
         $this->_aViewData["orderArticles"] = $oOrder->getOrderArticles();
         $this->_aViewData["giftCard"] = $oOrder->getGiftCard();
         $this->_aViewData["paymentType"] = $this->_getPaymentType($oOrder);
         $this->_aViewData["deliveryType"] = $oOrder->getDelSet();
         $sTsProtectsField = 'oxorder__oxtsprotectcosts';
         if ($oOrder->{$sTsProtectsField}->value) {
             $this->_aViewData["tsprotectcosts"] = $oLang->formatCurrency($oOrder->{$sTsProtectsField}->value, $oCur);
         }
     }
     // orders today
     $dSum = $oOrder->getOrderSum(true);
     $this->_aViewData["ordersum"] = $oLang->formatCurrency($dSum, $oCur);
     $this->_aViewData["ordercnt"] = $oOrder->getOrderCnt(true);
     // ALL orders
     $dSum = $oOrder->getOrderSum();
     $this->_aViewData["ordertotalsum"] = $oLang->formatCurrency($dSum, $oCur);
     $this->_aViewData["ordertotalcnt"] = $oOrder->getOrderCnt();
     $this->_aViewData["afolder"] = $myConfig->getConfigParam('aOrderfolder');
     $this->_aViewData["alangs"] = $oLang->getLanguageNames();
     $this->_aViewData["currency"] = $oCur;
     return "order_overview.tpl";
 }
コード例 #4
0
ファイル: wrapping_main.php プロジェクト: ioanok/symfoxid
 /**
  * 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(oxRegistry::getLang()->getLanguageNames(), $oOtherLang);
         if (count($aLang)) {
             $this->_aViewData["posslang"] = $aLang;
         }
         foreach ($oOtherLang as $id => $language) {
             $oLang = new stdClass();
             $oLang->sLangDesc = $language;
             $oLang->selected = $id == $this->_iEditLang;
             $this->_aViewData["otherlang"][$id] = clone $oLang;
         }
     }
     return "wrapping_main.tpl";
 }
コード例 #5
0
 public function request_product()
 {
     $myConfig = $this->getConfig();
     $myUtils = oxRegistry::getUtils();
     //control captcha
     $sMac = oxRegistry::getConfig()->getRequestParameter('c_mac');
     $sMacHash = oxRegistry::getConfig()->getRequestParameter('c_mach');
     $oCaptcha = $this->getCaptcha();
     if (!$oCaptcha->pass($sMac, $sMacHash)) {
         oxRegistry::get("oxUtilsView")->addErrorToDisplay('MESSAGE_WRONG_VERIFICATION_CODE');
         return;
     }
     /** @var oxMailValidator $oMailValidator */
     $oMailValidator = oxNew('oxMailValidator');
     $aParams = oxRegistry::getConfig()->getRequestParameter('pa');
     if (!isset($aParams['email']) || !$oMailValidator->isValidEmail($aParams['email'])) {
         oxRegistry::get("oxUtilsView")->addErrorToDisplay('MESSAGE_INVALID_EMAIL');
         return;
     }
     $aParams['aid'] = $this->getProduct()->getId();
     $oArticleRequest = oxNew("psarticlerequest");
     $oArticleRequest->psarticlerequest__oxuserid = new oxField(oxRegistry::getSession()->getVariable('usr'));
     $oArticleRequest->psarticlerequest__oxemail = new oxField($aParams['email']);
     $oArticleRequest->psarticlerequest__oxartid = new oxField($aParams['aid']);
     $oArticleRequest->psarticlerequest__oxshopid = new oxField($myConfig->getShopId());
     $oArticleRequest->psarticlerequest__oxlang = new oxField(oxRegistry::getLang()->getBaseLanguage());
     $oArticleRequest->psarticlerequest__oxstatus = new oxField(psArticleRequest::STATUS_RECEIVED);
     $oArticleRequest->save();
     $oEmail = oxNew("oxEmail");
     $oEmail->sendArticleRequestNotification($aParams, $oArticleRequest);
     $this->_iArticleRequestStatus = 1;
     oxRegistry::get("oxUtilsView")->addErrorToDisplay('PS_ARTICLEREQUEST_SUCCESS');
 }
コード例 #6
0
 /**
  * Add Languages to parameters.
  *
  * @return string
  */
 public function render()
 {
     $return = parent::render();
     $oLang = oxRegistry::getLang();
     $this->_aViewData["alangs"] = $oLang->getLanguageNames();
     return $return;
 }
コード例 #7
0
 /**
  * Loads category object data, pases it to Smarty engine and returns
  * name of template file "category_text.tpl".
  *
  * @return string
  */
 public function render()
 {
     parent::render();
     $this->_aViewData['edit'] = $oCategory = oxNew('oxCategory');
     $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
     if (isset($soxId) && $soxId != "-1") {
         // load object
         $iCatLang = oxRegistry::getConfig()->getRequestParameter("catlang");
         if (!isset($iCatLang)) {
             $iCatLang = $this->_iEditLang;
         }
         $this->_aViewData["catlang"] = $iCatLang;
         $oCategory->loadInLang($iCatLang, $soxId);
         //Disable editing for derived items
         if ($oCategory->isDerived()) {
             $this->_aViewData['readonly'] = true;
         }
         foreach (oxRegistry::getLang()->getLanguageNames() as $id => $language) {
             $oLang = new stdClass();
             $oLang->sLangDesc = $language;
             $oLang->selected = $id == $this->_iEditLang;
             $this->_aViewData["otherlang"][$id] = clone $oLang;
         }
     }
     $this->_aViewData["editor"] = $this->_generateTextEditor("100%", 300, $oCategory, "oxcategories__oxlongdesc", "list.tpl.css");
     return "category_text.tpl";
 }
コード例 #8
0
ファイル: object_seo.php プロジェクト: Crease29/oxideshop_ce
 /**
  * Executes parent method parent::render(),
  * and returns name of template file
  * "object_main.tpl".
  *
  * @return string
  */
 public function render()
 {
     parent::render();
     if ($sType = $this->_getType()) {
         $oObject = oxNew($sType);
         if ($oObject->load($this->getEditObjectId())) {
             $oOtherLang = $oObject->getAvailableInLangs();
             if (!isset($oOtherLang[$iLang])) {
                 $oObject->loadInLang(key($oOtherLang), $this->getEditObjectId());
             }
             $this->_aViewData['edit'] = $oObject;
         }
         if ($oObject->isDerived()) {
             $this->_aViewData['readonly'] = true;
         }
     }
     $iLang = $this->getEditLang();
     $aLangs = oxRegistry::getLang()->getLanguageNames();
     foreach ($aLangs as $sLangId => $sLanguage) {
         $oLang = new stdClass();
         $oLang->sLangDesc = $sLanguage;
         $oLang->selected = $sLangId == $iLang;
         $this->_aViewData['otherlang'][$sLangId] = clone $oLang;
     }
     return 'object_seo.tpl';
 }
コード例 #9
0
ファイル: StylaSEO_Setup.php プロジェクト: styladev/oxid
 public static function updateSeoUrls()
 {
     $shop_id = oxRegistry::getConfig()->getShopId();
     self::cleanup();
     // prevent duplicate entries
     $aLanguages = oxRegistry::getLang()->getLanguageArray();
     $defaultLang = oxRegistry::getConfig()->getConfigParam('sDefaultLang');
     $basedir = oxRegistry::getConfig()->getConfigParam('styla_seo_basedir');
     if ($basedir == '') {
         $basedir = self::STYLA_BASEDIR;
     }
     $basedir = rtrim($basedir, '/') . '/';
     foreach (self::$_urls as $item) {
         foreach ($aLanguages as $lang) {
             $oxId = md5(uniqid());
             if ($lang->id == $defaultLang) {
                 $lang_prefix = '';
             } else {
                 $lang_prefix = $lang->abbr . '/';
             }
             $url = $lang_prefix . $basedir . $item['seo_action'];
             $sQuery = "INSERT INTO `oxseo` (`OXOBJECTID`, `OXIDENT`, `OXSHOPID`, `OXLANG`, `OXSTDURL`, `OXSEOURL`, `OXTYPE`, `OXFIXED`, `OXEXPIRED`, `OXPARAMS`) VALUES\n                  ('" . $oxId . "', '" . md5(strtolower($url)) . "', '" . $shop_id . "', {$lang->id}, '" . $item['orig_url'] . "', '" . $url . "', 'static', 0, 0, '');";
             oxDb::getDb()->Execute($sQuery);
         }
     }
 }
コード例 #10
0
 public function sendArticleRequestToCustomer($sRecipient, $oArticleRequest, $sBody = null, $sReturnMailBody = null)
 {
     $this->_clearMailer();
     $oViewConfig = oxNew("oxViewConfig");
     $oShop = $this->_getShop();
     $iRequestLang = $oArticleRequest->psarticlerequest__oxlang->value;
     $oLang = oxRegistry::getLang();
     if ($oShop->getId() != $oArticleRequest->psarticlerequest__oxshopid->value) {
         $oShop = oxNew("oxshop");
         $oShop->load($oArticleRequest->psarticlerequest__oxshopid->value);
         $this->setShop($oShop);
     }
     //set mail params (from, fromName, smtp)
     $this->_setMailParams($oShop);
     // create messages
     $oSmarty = $this->_getSmarty();
     $oArticle = $oArticleRequest->getArticle();
     $this->setViewData("product", $oArticle);
     $this->setViewData("oArticleRequest", $oArticleRequest);
     // Process view data array through oxoutput processor
     $this->_processViewArray();
     $this->setRecipient($sRecipient, $sRecipient);
     $this->setSubject($oLang->translateString('PS_ARTICLEREQUEST_SEND_SUBJECT_AV', $iRequestLang) . " " . $oArticle->oxarticles__oxtitle->value);
     if ($sBody === null) {
         $sBody = $oSmarty->fetch($this->_sArticleRequestCustomerTemplate);
     }
     $this->setBody($sBody);
     $this->addAddress($sRecipient, $sRecipient);
     $this->setReplyTo($oShop->oxshops__oxorderemail->value, $oShop->oxshops__oxname->getRawValue());
     if ($sReturnMailBody) {
         return $this->getBody();
     } else {
         return $this->send();
     }
 }
コード例 #11
0
 /**
  * Extends the startup checks with Barzahlen plugin version check.
  *
  * @return array
  */
 protected function _doStartUpChecks()
 {
     $aMessage = parent::_doStartUpChecks();
     $oxConfig = $this->getConfig();
     $sShopId = $oxConfig->getShopId();
     $sModule = oxConfig::OXMODULE_MODULE_PREFIX . $this->_sModuleId;
     $sPluginCheck = $oxConfig->getShopConfVar('bzPluginCheck', $sShopId, $sModule);
     // only check once a week
     if ($sPluginCheck != null && $sPluginCheck > strtotime("-1 week")) {
         return $aMessage;
     }
     $oxConfig->saveShopConfVar('str', 'bzPluginCheck', time(), $sShopId, $sModule);
     $sBzShopId = $oxConfig->getShopConfVar('bzShopId', $sShopId, $sModule);
     $sShopsystem = 'OXID 4.7/5.0';
     $sShopsystemVersion = $oxConfig->getVersion();
     $sPluginVersion = self::CURRENTVERSION;
     try {
         $oChecker = new Barzahlen_Version_Check();
         $newAvailable = $oChecker->isNewVersionAvailable($sBzShopId, $sShopsystem, $sShopsystemVersion, $sPluginVersion);
     } catch (Exception $e) {
         oxRegistry::getUtils()->writeToLog(date('c') . " " . $e . "\r\r", self::LOGFILE);
     }
     if ($newAvailable) {
         $aMessage['warning'] .= (!empty($aMessage['warning']) ? "<br>" : '') . sprintf(oxRegistry::getLang()->translateString('BZ__NEW_PLUGIN_AVAILABLE'), $oChecker->getNewPluginVersion(), $oChecker->getNewPluginUrl());
     }
     return $aMessage;
 }
コード例 #12
0
 /**
  * Executes parent method parent::render(), creates oxgroups object,
  * passes data to Smarty engine and returns name of template file
  * "usergroup_main.tpl".
  *
  * @return string
  */
 public function render()
 {
     parent::render();
     $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
     if (isset($soxId) && $soxId != "-1") {
         // load object
         $oGroup = oxNew("oxgroups");
         $oGroup->loadInLang($this->_iEditLang, $soxId);
         $oOtherLang = $oGroup->getAvailableInLangs();
         if (!isset($oOtherLang[$this->_iEditLang])) {
             // echo "language entry doesn't exist! using: ".key($oOtherLang);
             $oGroup->loadInLang(key($oOtherLang), $soxId);
         }
         $this->_aViewData["edit"] = $oGroup;
         // remove already created languages
         $aLang = array_diff(oxRegistry::getLang()->getLanguageNames(), $oOtherLang);
         if (count($aLang)) {
             $this->_aViewData["posslang"] = $aLang;
         }
         foreach ($oOtherLang as $id => $language) {
             $oLang = new stdClass();
             $oLang->sLangDesc = $language;
             $oLang->selected = $id == $this->_iEditLang;
             $this->_aViewData["otherlang"][$id] = clone $oLang;
         }
     }
     if (oxRegistry::getConfig()->getRequestParameter("aoc")) {
         $oUsergroupMainAjax = oxNew('usergroup_main_ajax');
         $this->_aViewData['oxajax'] = $oUsergroupMainAjax->getColumns();
         return "popups/usergroup_main.tpl";
     }
     return "usergroup_main.tpl";
 }
コード例 #13
0
ファイル: user_address.php プロジェクト: ioanok/symfoxid
 /**
  * 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
         $sAddressIdParameter = oxRegistry::getConfig()->getRequestParameter("oxaddressid");
         $soxAddressId = isset($this->sSavedOxid) ? $this->sSavedOxid : $sAddressIdParameter;
         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(oxRegistry::getLang()->getObjectTplLanguage());
     $this->_aViewData["countrylist"] = $oCountryList;
     if (!$this->_allowAdminEdit($soxId)) {
         $this->_aViewData['readonly'] = true;
     }
     return "user_address.tpl";
 }
コード例 #14
0
 /**
  * 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"] = oxRegistry::getLang()->getLanguageArray();
     return "dyn_trusted_ratings.tpl";
 }
コード例 #15
0
ファイル: news_text.php プロジェクト: Crease29/oxideshop_ce
 /**
  * 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()
 {
     parent::render();
     $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
     if (isset($soxId) && $soxId != "-1") {
         // load object
         $oNews = oxNew("oxnews");
         $iNewsLang = oxRegistry::getConfig()->getRequestParameter("newslang");
         if (!isset($iNewsLang)) {
             $iNewsLang = $this->_iEditLang;
         }
         $this->_aViewData["newslang"] = $iNewsLang;
         $oNews->loadInLang($iNewsLang, $soxId);
         foreach (oxRegistry::getLang()->getLanguageNames() as $id => $language) {
             $oLang = new stdClass();
             $oLang->sLangDesc = $language;
             $oLang->selected = $id == $this->_iEditLang;
             $this->_aViewData["otherlang"][$id] = clone $oLang;
         }
         // Disable editing for derived items.
         if ($oNews->isDerived()) {
             $this->_aViewData['readonly'] = true;
         }
         $this->_aViewData["edit"] = $oNews;
     }
     $this->_aViewData["editor"] = $this->_generateTextEditor("100%", 255, $oNews, "oxnews__oxlongdesc", "news.tpl.css");
     return "news_text.tpl";
 }
コード例 #16
0
 /**
  * Executes the current command.
  *
  * @param InputInterface $input An InputInterface instance
  * @param OutputInterface $output An OutputInterface instance
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $oxContent = oxNew('oxcontent');
     $oxContent->loadByIdent($input->getArgument('ident'));
     if (!$oxContent) {
         $output->writeLn("<error>Content with ident {$input->getArgument('ident')} not found.</error>");
         return;
     }
     if ($input->getOption('language') !== false) {
         $language = $input->getOption('language');
     } else {
         $language = \oxRegistry::getLang()->getBaseLanguage();
     }
     $oxContent->setLanguage($language);
     if ($input->getOption('title')) {
         $oxContent->oxcontents__oxtitle = new \oxField($input->getOption('title'));
     }
     if ($input->getOption('content')) {
         if (is_file(getcwd() . '/' . $input->getOption('content'))) {
             $content = file_get_contents(getcwd() . '/' . $input->getOption('content'));
         } else {
             $content = $input->getOption('content');
         }
         $oxContent->oxcontents__oxcontent = new \oxField($content);
     }
     if ($input->getOption('active')) {
         $oxContent->oxcontents__oxactive = new \oxField($input->getOption('active'));
     }
     if ($oxContent->save()) {
         $output->writeLn("<info>Content with ident {$input->getArgument('ident')} updated.</info>");
     }
 }
コード例 #17
0
 protected function tearDown()
 {
     oxRegistry::getLang()->setBaseLanguage($this->originalBaseLanguageId);
     $this->storeLanguageConfiguration($this->originalLanguageArray);
     $this->updateViews();
     parent::tearDown();
 }
コード例 #18
0
/**
 * Smarty function
 * -------------------------------------------------------------
 * Purpose: Modifies provided language constant with it's translation
 * usage: [{$val|oxmultilangassign}]
 * -------------------------------------------------------------
 *
 * @param string $sIdent language constant ident
 * @param mixed  $args   for constants using %s notations
 *
 * @return string
 */
function smarty_modifier_oxmultilangassign($sIdent, $args = null)
{
    if (!isset($sIdent)) {
        $sIdent = 'IDENT MISSING';
    }
    $oLang = oxRegistry::getLang();
    $oConfig = oxRegistry::getConfig();
    $oShop = $oConfig->getActiveShop();
    $iLang = $oLang->getTplLanguage();
    $blShowError = true;
    if ($oShop->isProductiveMode()) {
        $blShowError = false;
    }
    try {
        $sTranslation = $oLang->translateString($sIdent, $iLang, $oLang->isAdmin());
        $blTranslationNotFound = !$oLang->isTranslated();
    } catch (\OxidEsales\EshopCommunity\Core\Exception\LanguageException $oEx) {
        // is thrown in debug mode and has to be caught here, as smarty hangs otherwise!
    }
    if (!$blTranslationNotFound) {
        if ($args) {
            if (is_array($args)) {
                $sTranslation = vsprintf($sTranslation, $args);
            } else {
                $sTranslation = sprintf($sTranslation, $args);
            }
        }
    } elseif ($blShowError) {
        $sTranslation = 'ERROR: Translation for ' . $sIdent . ' not found!';
    }
    return $sTranslation;
}
コード例 #19
0
ファイル: vtec_oxbasket.php プロジェクト: Themroc/VTEC_Pfand
 /**
  * Vergibt eine ArtikelID für den Pfandartikel und schreibt den Pfandpreis in die DB
  */
 protected function PfandArtikelID($price)
 {
     /* $oxLang = oxLang::getInstance(); */
     // bis CE 4.8.9
     $oxLang = oxRegistry::getLang();
     // ab CE 4.9.0
     $title = $oxLang->translateString('VTEC_PFAND', 0);
     /* $vtec_mwst = oxConfig::getInstance()->getConfigParam('vtec_pfand_mwst');  */
     // bis CE 4.8.9
     $vtec_mwst = oxRegistry::getConfig()->getConfigParam('vtec_pfand_mwst');
     // ab CE 4.9.0
     $sSelect = "SELECT oxid FROM oxarticles WHERE oxtitle = '" . $title . "' AND oxprice = '" . $price . "' LIMIT 1";
     $qResult = oxDb::getDb(ADODB_FETCH_ASSOC)->getOne($sSelect);
     if ($qResult == false || $qResult == null) {
         $oArticle = oxNew("oxarticle");
         $aLangs = $oxLang->getLanguageIds();
         $oArticle->assign(array('oxarticles__active' => 1, 'oxarticles__oxissearch' => 0, 'oxarticles__oxprice' => $price, 'oxarticles__oxpricea' => $price, 'oxarticles__oxpriceb' => $price, 'oxarticels__oxpricec' => $price, 'oxarticles__oxpic1' => 'pfand.jpg', 'oxarticles__oxvat' => $vtec_mwst));
         $oArticle->save();
         //foreach ($aLangs as $iLang){
         for ($i = 0; $i < count($aLangs); $i++) {
             $oArticle->setLanguage($i);
             $oArticle->assign(array("oxarticles__oxtitle" => $oxLang->translateString('VTEC_PFAND', $i)));
             $oArticle->save();
         }
         $qResult = $oArticle->oxarticles__oxid->value;
     }
     return $qResult;
 }
コード例 #20
0
 /**
  * Formats message using vsprintf if property _aFormatParameters was set and returns translated message.
  *
  * @return string stored message
  */
 public function getOxMessage()
 {
     $sTranslatedMessage = oxRegistry::getLang()->translateString($this->_sMessage);
     if (!empty($this->_aFormatParameters)) {
         $sTranslatedMessage = vsprintf($sTranslatedMessage, $this->_aFormatParameters);
     }
     return $sTranslatedMessage;
 }
コード例 #21
0
ファイル: vtec_pfand.php プロジェクト: Themroc/VTEC_Pfand
 /**
  * Gibt formatierten Pfandwert zurück
  */
 public function getFormatPfand()
 {
     if (empty($this->oxarticles__vtecpfand->value)) {
         return;
     }
     $pfand = oxRegistry::getLang()->formatCurrency($this->oxarticles__vtecpfand->value);
     return $pfand;
 }
コード例 #22
0
 /**
  * Testing getShopHomeUrl for widget getter
  *
  * @param int $iLang Shop basic language.
  *
  * @dataProvider providerGetWidgetUrlAddCorrectLanguage
  */
 public function testGetWidgetUrlAddCorrectLanguageWithParameter($iLang)
 {
     oxRegistry::getLang()->setBaseLanguage(1);
     $config = oxNew('oxConfig');
     $config->setConfigParam('sShopURL', $this->shopUrl);
     $config->init();
     $this->assertEquals($this->shopUrl . 'widget.php?lang=' . $iLang, $config->getWidgetUrl($iLang));
 }
コード例 #23
0
 /**
  * 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()
 {
     parent::render();
     $sOxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
     $sArticleTable = getViewName('oxarticles');
     //create empty edit object
     $this->_aViewData["edit"] = oxNew("oxselectlist");
     if (isset($sOxId) && $sOxId != "-1") {
         // 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;
         $this->_createCategoryTree("artcattree", $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;
         // Disable editing for derived items.
         if ($oAttr->isDerived()) {
             $this->_aViewData['readonly'] = true;
         }
         // remove already created languages
         $aLang = array_diff(oxRegistry::getLang()->getLanguageNames(), $oOtherLang);
         if (count($aLang)) {
             $this->_aViewData["posslang"] = $aLang;
         }
         foreach ($oOtherLang as $id => $language) {
             $oLang = new stdClass();
             $oLang->sLangDesc = $language;
             $oLang->selected = $id == $this->_iEditLang;
             $this->_aViewData["otherlang"][$id] = clone $oLang;
         }
         $iErr = oxRegistry::getSession()->getVariable("iErrorCode");
         if (!$iErr) {
             $iErr = ERR_SUCCESS;
         }
         $this->_aViewData["iErrorCode"] = $iErr;
         oxRegistry::getSession()->setVariable("iErrorCode", ERR_SUCCESS);
     }
     if (oxRegistry::getConfig()->getRequestParameter("aoc")) {
         $oSelectlistMainAjax = oxNew('selectlist_main_ajax');
         $this->_aViewData['oxajax'] = $oSelectlistMainAjax->getColumns();
         return "popups/selectlist_main.tpl";
     }
     return "selectlist_main.tpl";
 }
コード例 #24
0
 /**
  * Returns email content dependent on days left till grace period ends.
  *
  * @param integer $iDaysLeft Days left.
  *
  * @return string
  */
 private function _getBody($iDaysLeft)
 {
     if ($iDaysLeft <= self::LEFT_DAYS_TO_SEND_LAST_EMAIL) {
         $sBody = oxRegistry::getLang()->translateString('SHOP_LICENSE_ERROR_GRACE_WILL_EXPIRE', null, true);
     } else {
         $sBody = oxRegistry::getLang()->translateString('SHOP_LICENSE_ERROR_shop_unlicensed', null, true);
     }
     return $sBody;
 }
コード例 #25
0
ファイル: StylaSEO_Output.php プロジェクト: styladev/oxid
 public function getBreadCrumb()
 {
     $aPaths = array();
     $aPath = array();
     $aPath['title'] = oxRegistry::getLang()->translateString('Magazine', oxRegistry::getLang()->getBaseLanguage(), false);
     $aPath['link'] = $this->getConfig()->getCurrentShopUrl() . $this->getConfig()->getConfigParam('styla_seo_basedir');
     $aPaths[] = $aPath;
     return $aPaths;
 }
コード例 #26
0
ファイル: user_main.php プロジェクト: Crease29/oxideshop_ce
 /**
  * Executes parent method parent::render(), creates oxuser, oxshops and oxlist
  * objects, passes data to Smarty engine and returns name of template
  * file "user_main.tpl".
  *
  * @return string
  */
 public function render()
 {
     parent::render();
     // malladmin stuff
     $oAuthUser = oxNew('oxuser');
     $oAuthUser->loadAdminUser();
     $blisMallAdmin = $oAuthUser->oxuser__oxrights->value == "malladmin";
     // User rights
     $aUserRights = array();
     $oLang = oxRegistry::getLang();
     $iTplLang = $oLang->getTplLanguage();
     $iPos = count($aUserRights);
     $aUserRights[$iPos] = new stdClass();
     $aUserRights[$iPos]->name = $oLang->translateString("user", $iTplLang);
     $aUserRights[$iPos]->id = "user";
     if ($blisMallAdmin) {
         $iPos = count($aUserRights);
         $aUserRights[$iPos] = new stdClass();
         $aUserRights[$iPos]->id = "malladmin";
         $aUserRights[$iPos]->name = $oLang->translateString("Admin", $iTplLang);
     }
     $aUserRights = $this->calculateAdditionalRights($aUserRights);
     $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
     if (isset($soxId) && $soxId != "-1") {
         // load object
         $oUser = oxNew("oxuser");
         $oUser->load($soxId);
         $this->_aViewData["edit"] = $oUser;
         if (!($oUser->oxuser__oxrights->value == "malladmin" && !$blisMallAdmin)) {
             // generate selected right
             reset($aUserRights);
             while (list(, $val) = each($aUserRights)) {
                 if ($val->id == $oUser->oxuser__oxrights->value) {
                     $val->selected = 1;
                     break;
                 }
             }
         }
     }
     // passing country list
     $oCountryList = oxNew("oxCountryList");
     $oCountryList->loadActiveCountries($oLang->getObjectTplLanguage());
     $this->_aViewData["countrylist"] = $oCountryList;
     $this->_aViewData["rights"] = $aUserRights;
     if ($this->_sSaveError) {
         $this->_aViewData["sSaveError"] = $this->_sSaveError;
     }
     if (!$this->_allowAdminEdit($soxId)) {
         $this->_aViewData['readonly'] = true;
     }
     if (oxRegistry::getConfig()->getRequestParameter("aoc")) {
         $oUserMainAjax = oxNew('user_main_ajax');
         $this->_aViewData['oxajax'] = $oUserMainAjax->getColumns();
         return "popups/user_main.tpl";
     }
     return "user_main.tpl";
 }
コード例 #27
0
 /**
  * Gibt formatiertes Pfandtotal zurück
  */
 public function FormTotalPfand()
 {
     $oArticle = $this->getArticle(true);
     if (empty($oArticle->oxarticles__vtecpfand->value)) {
         return;
     }
     $pfand = oxRegistry::getLang()->formatCurrency($oArticle->oxarticles__vtecpfand->value * $this->getAmount());
     return $pfand;
 }
コード例 #28
0
 /**
  * oxViewconfig::getTsRatingUrl() test case
  *
  * @return null
  */
 public function testGetTsRatingUrl()
 {
     $this->getConfig()->setConfigParam("aTsConfig", $this->_aTsConfig);
     $sLangId = oxRegistry::getLang()->getLanguageAbbr();
     $sTsInfoUri = isset($this->_aTsConfig["sTsRatingUri"]) && isset($this->_aTsConfig["sTsRatingUri"][$sLangId]) ? $this->_aTsConfig["sTsRatingUri"][$sLangId] : false;
     $oViewConf = $this->getMock("oxViewConfig", array("getTsId"));
     $oViewConf->expects($this->once())->method("getTsId")->will($this->returnValue("xyz"));
     $this->assertEquals("https://www.trustedshops.com/" . sprintf($sTsInfoUri, "xyz"), $oViewConf->getTsRatingUrl());
 }
コード例 #29
0
 /**
  * Loads article parameters and passes them to Smarty engine, returns
  * name of template file "article_main.tpl".
  *
  * @return string
  */
 public function render()
 {
     parent::render();
     $this->getConfig()->setConfigParam('bl_perfLoadPrice', true);
     $oArticle = oxNew('oxArticle');
     $oArticle->enablePriceLoad();
     $this->_aViewData['edit'] = $oArticle;
     $sOxId = $this->getEditObjectId();
     $sVoxId = $this->getConfig()->getRequestParameter("voxid");
     $sOxParentId = $this->getConfig()->getRequestParameter("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 = $this->updateArticle($oArticle, $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
         $oArticleTagList = oxNew("oxArticleTagList");
         $oArticleTagList->loadInLang($this->_iEditLang, $oArticle->getId());
         $oArticle->tags = $oArticleTagList->get();
         $aLang = array_diff(oxRegistry::getLang()->getLanguageNames(), $oOtherLang);
         if (count($aLang)) {
             $this->_aViewData["posslang"] = $aLang;
         }
         foreach ($oOtherLang as $id => $language) {
             $oLang = new stdClass();
             $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"] = $this->getConfig()->getConfigParam('blUseTimeCheck');
     return "article_main.tpl";
 }
コード例 #30
0
ファイル: tags.php プロジェクト: ioanok/symfoxid
 /**
  * Returns Bread Crumb - you are here page1/page2/page3...
  *
  * @return array
  */
 public function getBreadCrumb()
 {
     $aPaths = array();
     $aCatPath = array();
     $iBaseLanguage = oxRegistry::getLang()->getBaseLanguage();
     $aCatPath['title'] = oxRegistry::getLang()->translateString('TAGS', $iBaseLanguage, false);
     $aCatPath['link'] = $this->getLink();
     $aPaths[] = $aCatPath;
     return $aPaths;
 }