本文整理汇总了PHP中oxRegistry类的典型用法代码示例。如果您正苦于以下问题:PHP oxRegistry类的具体用法?PHP oxRegistry怎么用?PHP oxRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了oxRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getQuery
/**
* Returns SQL query for data to fetc
*
* @return string
*/
protected function _getQuery()
{
// looking for table/view
$sArtTable = $this->_getViewName('oxarticles');
$sO2CView = $this->_getViewName('oxobject2category');
$oDb = oxDb::getDb();
$oConfig = oxRegistry::getConfig();
$sVendorId = $oConfig->getRequestParameter('oxid');
$sSynchVendorId = $oConfig->getRequestParameter('synchoxid');
// vendor selected or not ?
if (!$sVendorId) {
$sQAdd = ' from ' . $sArtTable . ' where ' . $sArtTable . '.oxshopid="' . $oConfig->getShopId() . '" and 1 ';
$sQAdd .= $oConfig->getConfigParam('blVariantsSelection') ? '' : " and {$sArtTable}.oxparentid = '' and {$sArtTable}.oxvendorid != " . $oDb->quote($sSynchVendorId);
} else {
// selected category ?
if ($sSynchVendorId && $sSynchVendorId != $sVendorId) {
$sQAdd = " from {$sO2CView} left join {$sArtTable} on ";
$sQAdd .= $oConfig->getConfigParam('blVariantsSelection') ? " ( {$sArtTable}.oxid = {$sO2CView}.oxobjectid or {$sArtTable}.oxparentid = oxobject2category.oxobjectid )" : " {$sArtTable}.oxid = {$sO2CView}.oxobjectid ";
$sQAdd .= 'where ' . $sArtTable . '.oxshopid="' . $oConfig->getShopId() . '" and ' . $sO2CView . '.oxcatnid = ' . $oDb->quote($sVendorId) . ' and ' . $sArtTable . '.oxvendorid != ' . $oDb->quote($sSynchVendorId);
} else {
$sQAdd = " from {$sArtTable} where {$sArtTable}.oxvendorid = " . $oDb->quote($sVendorId);
}
$sQAdd .= $oConfig->getConfigParam('blVariantsSelection') ? '' : " and {$sArtTable}.oxparentid = '' ";
}
return $sQAdd;
}
示例2: _prepareWhereQuery
/**
* Adds active promotion check
*
* @param array $aWhere SQL condition array
* @param string $sqlFull SQL query string
*
* @return $sQ
*/
protected function _prepareWhereQuery($aWhere, $sqlFull)
{
$sQ = parent::_prepareWhereQuery($aWhere, $sqlFull);
$sDisplayType = (int) oxRegistry::getConfig()->getRequestParameter('displaytype');
$sTable = getViewName("oxactions");
//searchong for empty oxfolder fields
if ($sDisplayType) {
$sNow = date('Y-m-d H:i:s', oxRegistry::get("oxUtilsDate")->getTime());
switch ($sDisplayType) {
case 1:
// active
$sQ .= " and {$sTable}.oxactivefrom < '{$sNow}' and {$sTable}.oxactiveto > '{$sNow}' ";
break;
case 2:
// upcoming
$sQ .= " and {$sTable}.oxactivefrom > '{$sNow}' ";
break;
case 3:
// expired
$sQ .= " and {$sTable}.oxactiveto < '{$sNow}' and {$sTable}.oxactiveto != '0000-00-00 00:00:00' ";
break;
}
}
return $sQ;
}
示例3: render
/**
* Collects article crosselling and attributes information, passes
* them to Smarty engine and returns name or template file
* "article_crossselling.tpl".
*
* @return string
*/
public function render()
{
parent::render();
$this->_aViewData['edit'] = $oArticle = oxNew('oxarticle');
// crossselling
$this->_createCategoryTree("artcattree");
// accessoires
$this->_createCategoryTree("artcattree2");
$soxId = $this->getEditObjectId();
if ($soxId != "-1" && isset($soxId)) {
// load object
$oArticle->load($soxId);
if ($oArticle->isDerived()) {
$this->_aViewData['readonly'] = true;
}
}
$iAoc = oxRegistry::getConfig()->getRequestParameter("aoc");
if ($iAoc == 1) {
$oArticleCrossellingAjax = oxNew('article_crossselling_ajax');
$this->_aViewData['oxajax'] = $oArticleCrossellingAjax->getColumns();
return "popups/article_crossselling.tpl";
} elseif ($iAoc == 2) {
$oArticleAccessoriesAjax = oxNew('article_accessories_ajax');
$this->_aViewData['oxajax'] = $oArticleAccessoriesAjax->getColumns();
return "popups/article_accessories.tpl";
}
return "article_crossselling.tpl";
}
示例4: 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();
$sTheme = $this->_sTheme = $this->getEditObjectId();
$sShopId = $myConfig->getShopId();
if (!isset($sTheme)) {
$sTheme = $this->_sTheme = $this->getConfig()->getConfigParam('sTheme');
}
$oTheme = oxNew('oxTheme');
if ($oTheme->load($sTheme)) {
$this->_aViewData["oTheme"] = $oTheme;
try {
$aDbVariables = $this->loadConfVars($sShopId, $this->_getModuleForConfigVars());
$this->_aViewData["var_constraints"] = $aDbVariables['constraints'];
$this->_aViewData["var_grouping"] = $aDbVariables['grouping'];
foreach ($this->_aConfParams as $sType => $sParam) {
$this->_aViewData[$sParam] = $aDbVariables['vars'][$sType];
}
} catch (oxException $oEx) {
oxRegistry::get("oxUtilsView")->addErrorToDisplay($oEx);
$oEx->debugOut();
}
} else {
oxRegistry::get("oxUtilsView")->addErrorToDisplay(oxNew("oxException", 'EXCEPTION_THEME_NOT_LOADED'));
}
return 'theme_config.tpl';
}
示例5: smarty_insert_oxid_nocache
/**
* Smarty plugin
* -------------------------------------------------------------
* File: insert.oxid_nocache.php
* Type: string, html
* Name: oxid_nocache
* Purpose: Inserts Items not cached
* -------------------------------------------------------------
*
* @param array $params params
* @param Smarty &$smarty clever simulation of a method
*
* @return string
*/
function smarty_insert_oxid_nocache($params, &$smarty)
{
$myConfig = oxRegistry::getConfig();
$smarty->caching = false;
/* if( isset( $smarty->oxobject->oProduct))
$smarty->assign_by_ref( "product", $smarty->oxobject->oProduct);*/
// #1184M - specialchar search
$sSearchParamForHTML = oxRegistry::getConfig()->getRequestParameter("searchparam");
$sSearchParamForLink = rawurlencode(oxRegistry::getConfig()->getRequestParameter("searchparam", true));
if ($sSearchParamForHTML) {
$smarty->assign_by_ref("searchparamforhtml", $sSearchParamForHTML);
$smarty->assign_by_ref("searchparam", $sSearchParamForLink);
}
$sSearchCat = oxRegistry::getConfig()->getRequestParameter("searchcnid");
if ($sSearchCat) {
$smarty->assign_by_ref("searchcnid", rawurldecode($sSearchCat));
}
foreach (array_keys($params) as $key) {
$viewData =& $params[$key];
$smarty->assign_by_ref($key, $viewData);
}
$sOutput = $smarty->fetch($params['tpl']);
$smarty->caching = false;
return $sOutput;
}
示例6: addSel
/**
* Adds selection lists to article.
*/
public function addSel()
{
$aAddSel = $this->_getActionIds('oxselectlist.oxid');
$soxId = oxRegistry::getConfig()->getRequestParameter('synchoxid');
// adding
if (oxRegistry::getConfig()->getRequestParameter('all')) {
$sSLViewName = $this->_getViewName('oxselectlist');
$aAddSel = $this->_getAll($this->_addFilter("select {$sSLViewName}.oxid " . $this->_getQuery()));
}
if ($soxId && $soxId != "-1" && is_array($aAddSel)) {
$oDb = oxDb::getDb();
foreach ($aAddSel as $sAdd) {
$oNew = oxNew("oxbase");
$oNew->init("oxobject2selectlist");
$sObjectIdField = 'oxobject2selectlist__oxobjectid';
$sSelectetionIdField = 'oxobject2selectlist__oxselnid';
$sOxSortField = 'oxobject2selectlist__oxsort';
$oNew->{$sObjectIdField} = new oxField($soxId);
$oNew->{$sSelectetionIdField} = new oxField($sAdd);
$sSql = "select max(oxsort) + 1 from oxobject2selectlist where oxobjectid = {$oDb->quote($soxId)} ";
$oNew->{$sOxSortField} = new oxField((int) $oDb->getOne($sSql, false, false));
$oNew->save();
}
}
}
示例7: onActivate
/**
* Setup routine
*/
public static function onActivate()
{
if (class_exists('oxRegistry')) {
$myConfig = oxRegistry::getConfig();
} else {
$myConfig = oxConfig::getInstance()->getConfig();
}
$bIsEE = $myConfig->getEdition() === "EE";
try {
$db = oxDb::getDb();
// create oxjson groups
if ($bIsEE) {
$maxRRId = intval($db->getOne("select MAX(OXRRID) from oxgroups"));
$nextRRId = $maxRRId + 1;
$sQ = "INSERT IGNORE INTO oxgroups (OXID, OXACTIVE, OXTITLE, OXTITLE_1, OXRRID) VALUES ('oxjsonro', '1', 'OXJSON Read-only', 'OXJSON Read-only', '{$nextRRId}');";
$db->Execute($sQ);
$nextRRId++;
$sQ = "INSERT IGNORE INTO oxgroups (OXID, OXACTIVE, OXTITLE, OXTITLE_1, OXRRID) VALUES ('oxjsonfull', '1', 'OXJSON Full', 'OXJSON Full', '{$nextRRId}');";
$db->Execute($sQ);
} else {
$sQ = "INSERT IGNORE INTO oxgroups (OXID, OXACTIVE, OXTITLE, OXTITLE_1) VALUES ('oxjsonro', '1', 'OXJSON Read-only', 'OXJSON Read-only');";
$db->Execute($sQ);
$nextRRId++;
$sQ = "INSERT IGNORE INTO oxgroups (OXID, OXACTIVE, OXTITLE, OXTITLE_1) VALUES ('oxjsonfull', '1', 'OXJSON Full', 'OXJSON Full');";
$db->Execute($sQ);
}
} catch (Exception $ex) {
error_log("Error activating module: " . $ex->getMessage());
}
}
示例8: runAsserts
/**
* Runs all asserts
*
* @param array $aExpectedResult
*/
protected function runAsserts($aExpectedResult)
{
$oConfig = oxRegistry::getConfig();
$oValidator = new Validator($oConfig);
if (isset($aExpectedResult['blocks'])) {
$this->assertTrue($oValidator->checkBlocks($aExpectedResult['blocks']), 'Blocks do not match expectations');
}
if (isset($aExpectedResult['extend'])) {
$this->assertTrue($oValidator->checkExtensions($aExpectedResult['extend']), 'Extensions do not match expectations');
}
if (isset($aExpectedResult['files'])) {
$this->assertTrue($oValidator->checkFiles($aExpectedResult['files']), 'Files do not match expectations');
}
if (isset($aExpectedResult['events'])) {
$this->assertTrue($oValidator->checkEvents($aExpectedResult['events']), 'Events do not match expectations');
}
if (isset($aExpectedResult['settings'])) {
$this->assertTrue($oValidator->checkConfigAmount($aExpectedResult['settings']), 'Configs do not match expectations');
}
if (isset($aExpectedResult['versions'])) {
$this->assertTrue($oValidator->checkVersions($aExpectedResult['versions']), 'Versions do not match expectations');
}
if (isset($aExpectedResult['templates'])) {
$this->assertTrue($oValidator->checkTemplates($aExpectedResult['templates']), 'Templates do not match expectations');
}
if (isset($aExpectedResult['disabledModules'])) {
$this->assertTrue($oValidator->checkDisabledModules($aExpectedResult['disabledModules']), 'Disabled modules do not match expectations');
}
if (isset($aExpectedResult['settings_values'])) {
$this->assertTrue($oValidator->checkConfigValues($aExpectedResult['settings_values']), 'Config values does not match expectations');
}
}
示例9: smarty_function_newestCategoryArticles
function smarty_function_newestCategoryArticles($params, &$smarty)
{
// default values
$oxid = $params['oxid'] ? $params['oxid'] : oxRegistry::getConfig()->getRequestParameter('cnid');
$am = $params['amount'] ? $params['amount'] : null;
$head = $params['head'] ? $params['head'] : "vtnca_newestarticles";
$file = $params['file'] ? $params['file'] : "widget/product/boxproducts.tpl";
//_oBoxProducts=$oView->getTop5ArticleList() _sHeaderIdent="TOP_OF_THE_SHOP"}]
if (!$oxid) {
return "<!-- vt-nca: no category id given -->";
}
// exit if no oxID given
// getting newest category articles
$oArtList = oxNew('oxarticlelist');
$oArtList->loadNewestCategoryArticles($oxid, $am);
if (!$oArtList->count()) {
return;
}
// exit if no products in category
if ($params['assign']) {
$smarty->assign($params['assign'], $oArtList);
return;
}
// for default boxproducts
$smarty->assign("_sHeaderIdent", $head);
$smarty->assign("_oBoxProducts", $oArtList);
// for stabdard list.tpl
$smarty->assign("head", $head);
$smarty->assign("products", $oArtList);
$html = $smarty->fetch($file);
//$smarty->clear_assign("__nca_".$oxid);
return $html;
}
示例10: _doStartUpChecks
/**
* 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;
}
示例11: smarty_insert_oxid_newbasketitem
/**
* Smarty plugin
* -------------------------------------------------------------
* File: insert.oxid_newbasketitem.php
* Type: string, html
* Name: newbasketitem
* Purpose: Used for tracking in econda, etracker etc.
* -------------------------------------------------------------
*
* @param array $params params
* @param Smarty &$smarty clever simulation of a method
*
* @return string
*/
function smarty_insert_oxid_newbasketitem($params, &$smarty)
{
$myConfig = oxRegistry::getConfig();
$aTypes = array('0' => 'none', '1' => 'message', '2' => 'popup', '3' => 'basket');
$iType = $myConfig->getConfigParam('iNewBasketItemMessage');
// If corect type of message is expected
if ($iType && $params['type'] && $params['type'] != $aTypes[$iType]) {
return '';
}
//name of template file where is stored message text
$sTemplate = $params['tpl'] ? $params['tpl'] : 'inc_newbasketitem.snippet.tpl';
//allways render for ajaxstyle popup
$blRender = $params['ajax'] && $iType == 2;
//fetching article data
$oNewItem = oxRegistry::getSession()->getVariable('_newitem');
$oBasket = oxRegistry::getSession()->getBasket();
if ($oNewItem) {
// loading article object here because on some system passing article by session couses problems
$oNewItem->oArticle = oxNew('oxarticle');
$oNewItem->oArticle->Load($oNewItem->sId);
// passing variable to template with unique name
$smarty->assign('_newitem', $oNewItem);
// deleting article object data
oxRegistry::getSession()->deleteVariable('_newitem');
$blRender = true;
}
// returning generated message content
if ($blRender) {
return $smarty->fetch($sTemplate);
}
}
示例12: PfandArtikelID
/**
* 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;
}
示例13: save
/**
* Saves news text.
*
* @return mixed
*/
public function save()
{
parent::save();
$soxId = $this->getEditObjectId();
$aParams = oxRegistry::getConfig()->getRequestParameter("editval");
$oNews = oxNew("oxnews");
$iNewsLang = oxRegistry::getConfig()->getRequestParameter("newslang");
if (!isset($iNewsLang)) {
$iNewsLang = $this->_iEditLang;
}
if ($soxId != "-1") {
$oNews->loadInLang($iNewsLang, $soxId);
} else {
$aParams['oxnews__oxid'] = null;
}
// Disable editing for derived items.
if ($oNews->isDerived()) {
return;
}
$oNews->setLanguage(0);
$oNews->assign($aParams);
$oNews->setLanguage($iNewsLang);
$oNews->save();
// set oxid if inserted
$this->setEditObjectId($oNews->getId());
}
示例14: save
/**
* Saves changed shop configuration parameters.
*/
public function save()
{
$myConfig = $this->getConfig();
$sOxId = $this->getEditObjectId();
// base parameters
$aConfStrs = oxRegistry::getConfig()->getRequestParameter("confstrs");
$aConfAArs = oxRegistry::getConfig()->getRequestParameter("confaarrs");
$aConfBools = oxRegistry::getConfig()->getRequestParameter("confbools");
// validating language Ids
if (is_array($aConfAArs['aTsLangIds'])) {
$blActive = isset($aConfBools["blTsWidget"]) && $aConfBools["blTsWidget"] == "true" ? true : false;
$sPkg = "OXID_ESALES";
$aActiveLangs = array();
foreach ($aConfAArs['aTsLangIds'] as $sLangId => $sId) {
$aActiveLangs[$sLangId] = false;
if ($sId) {
$sTsUser = $myConfig->getConfigParam('sTsUser');
$sTsPass = $myConfig->getConfigParam('sTsPass');
// validating and switching on/off
$sResult = $this->_validateId($sId, (bool) $blActive, $sTsUser, $sTsPass, $sPkg);
// keeping activation state
$aActiveLangs[$sLangId] = $sResult == "OK" ? true : false;
// error message
if ($sResult && $sResult != "OK") {
$this->_aViewData["errorsaving"] = "DYN_TRUSTED_RATINGS_ERR_{$sResult}";
}
}
}
$myConfig->saveShopConfVar("arr", "aTsActiveLangIds", $aActiveLangs, $sOxId);
}
parent::save();
}
示例15: onDeactivate
/**
* Is called on module deactivation. Deletes the theme settings. Note that after deactivation the settings
* will be lost.
*/
public static function onDeactivate()
{
$iShopId = oxRegistry::getConfig()->getShopId();
$sThemeName = self::_getThemeName();
$sDeleteSQL = "\n DELETE\n oxconfig.*,\n oxconfigdisplay.*\n FROM `oxconfig`\n LEFT JOIN `oxconfigdisplay`\n ON ( `oxconfig`.`OXID` = `oxconfigdisplay`.`OXID` )\n WHERE `oxconfig`.`OXMODULE` = ? AND `oxconfig`.`oxshopid` = ?\n ";
oxDb::getDb()->Execute($sDeleteSQL, array('theme:' . $sThemeName, $iShopId));
}