repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
OXID-eSales/oxideshop_ce | source/Setup/Controller/ModuleStateMapGenerator.php | ModuleStateMapGenerator.applyModuleNameTranslateFunction | private function applyModuleNameTranslateFunction($moduleStateMap)
{
return $this->applyModuleStateMapFilterFunction(
$moduleStateMap,
$this->moduleNameTranslateFunction,
function ($moduleData, $translateFunction) {
$moduleId = $moduleData[self::MODULE_ID_KEY];
$moduleData[self::MODULE_NAME_KEY] = $translateFunction($moduleId);
return $moduleData;
}
);
} | php | private function applyModuleNameTranslateFunction($moduleStateMap)
{
return $this->applyModuleStateMapFilterFunction(
$moduleStateMap,
$this->moduleNameTranslateFunction,
function ($moduleData, $translateFunction) {
$moduleId = $moduleData[self::MODULE_ID_KEY];
$moduleData[self::MODULE_NAME_KEY] = $translateFunction($moduleId);
return $moduleData;
}
);
} | [
"private",
"function",
"applyModuleNameTranslateFunction",
"(",
"$",
"moduleStateMap",
")",
"{",
"return",
"$",
"this",
"->",
"applyModuleStateMapFilterFunction",
"(",
"$",
"moduleStateMap",
",",
"$",
"this",
"->",
"moduleNameTranslateFunction",
",",
"function",
"(",
... | Apply function which translates module id into module name.
@param array $moduleStateMap An array of format described in `getModuleStateMap`.
@return array An array of format described in `getModuleStateMap`. | [
"Apply",
"function",
"which",
"translates",
"module",
"id",
"into",
"module",
"name",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Setup/Controller/ModuleStateMapGenerator.php#L127-L139 | train |
OXID-eSales/oxideshop_ce | source/Setup/Controller/ModuleStateMapGenerator.php | ModuleStateMapGenerator.applyModuleGroupNameTranslateFunction | private function applyModuleGroupNameTranslateFunction($moduleStateMap)
{
$moduleGroupNameTranslateFilterFunction = $this->moduleGroupNameTranslateFunction;
if (!$moduleGroupNameTranslateFilterFunction) {
return $moduleStateMap;
}
$translatedModuleStateMap = [];
foreach ($this->iterateThroughModuleStateMapByGroup($moduleStateMap) as list($groupId, $modules)) {
$groupName = $moduleGroupNameTranslateFilterFunction($groupId);
$translatedModuleStateMap[$groupName] = $modules;
}
return $translatedModuleStateMap;
} | php | private function applyModuleGroupNameTranslateFunction($moduleStateMap)
{
$moduleGroupNameTranslateFilterFunction = $this->moduleGroupNameTranslateFunction;
if (!$moduleGroupNameTranslateFilterFunction) {
return $moduleStateMap;
}
$translatedModuleStateMap = [];
foreach ($this->iterateThroughModuleStateMapByGroup($moduleStateMap) as list($groupId, $modules)) {
$groupName = $moduleGroupNameTranslateFilterFunction($groupId);
$translatedModuleStateMap[$groupName] = $modules;
}
return $translatedModuleStateMap;
} | [
"private",
"function",
"applyModuleGroupNameTranslateFunction",
"(",
"$",
"moduleStateMap",
")",
"{",
"$",
"moduleGroupNameTranslateFilterFunction",
"=",
"$",
"this",
"->",
"moduleGroupNameTranslateFunction",
";",
"if",
"(",
"!",
"$",
"moduleGroupNameTranslateFilterFunction",... | Apply function which translates module group id into module group name.
@param array $moduleStateMap An array of format described in `getModuleStateMap`.
@return array An array of format described in `getModuleStateMap`. | [
"Apply",
"function",
"which",
"translates",
"module",
"group",
"id",
"into",
"module",
"group",
"name",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Setup/Controller/ModuleStateMapGenerator.php#L148-L164 | train |
OXID-eSales/oxideshop_ce | source/Setup/Controller/ModuleStateMapGenerator.php | ModuleStateMapGenerator.applyModuleStateMapFilterFunction | private function applyModuleStateMapFilterFunction($moduleStateMap, $helpFunction, $moduleStateMapUpdateFunction)
{
if (!$helpFunction) {
return $moduleStateMap;
}
foreach ($this->iterateThroughModuleStateMap($moduleStateMap) as list($groupId, $moduleIndex, $moduleData)) {
$moduleStateMap[$groupId][$moduleIndex] = $moduleStateMapUpdateFunction($moduleData, $helpFunction);
}
return $moduleStateMap;
} | php | private function applyModuleStateMapFilterFunction($moduleStateMap, $helpFunction, $moduleStateMapUpdateFunction)
{
if (!$helpFunction) {
return $moduleStateMap;
}
foreach ($this->iterateThroughModuleStateMap($moduleStateMap) as list($groupId, $moduleIndex, $moduleData)) {
$moduleStateMap[$groupId][$moduleIndex] = $moduleStateMapUpdateFunction($moduleData, $helpFunction);
}
return $moduleStateMap;
} | [
"private",
"function",
"applyModuleStateMapFilterFunction",
"(",
"$",
"moduleStateMap",
",",
"$",
"helpFunction",
",",
"$",
"moduleStateMapUpdateFunction",
")",
"{",
"if",
"(",
"!",
"$",
"helpFunction",
")",
"{",
"return",
"$",
"moduleStateMap",
";",
"}",
"foreach... | Apply filter function to update the contents of module state map.
@param array $moduleStateMap An array of format described in `getModuleStateMap`.
@param \Closure $helpFunction Help function which will be passed to moduleStateMapUpdateFunction
as 2nd argument.
@param \Closure $moduleStateMapUpdateFunction Function which will be used to modify contents of module state map.
@return array An array of format described in `getModuleStateMap`. | [
"Apply",
"filter",
"function",
"to",
"update",
"the",
"contents",
"of",
"module",
"state",
"map",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Setup/Controller/ModuleStateMapGenerator.php#L247-L258 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminDetailsController.php | AdminDetailsController.getDocumentationLanguageId | protected function getDocumentationLanguageId()
{
$language = \OxidEsales\Eshop\Core\Registry::getLang();
$languageAbbr = $language->getLanguageAbbr($language->getTplLanguage());
return $languageAbbr === "de" ? 0 : 1;
} | php | protected function getDocumentationLanguageId()
{
$language = \OxidEsales\Eshop\Core\Registry::getLang();
$languageAbbr = $language->getLanguageAbbr($language->getTplLanguage());
return $languageAbbr === "de" ? 0 : 1;
} | [
"protected",
"function",
"getDocumentationLanguageId",
"(",
")",
"{",
"$",
"language",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getLang",
"(",
")",
";",
"$",
"languageAbbr",
"=",
"$",
"language",
"->",
"getLanguageAbbr",
... | Get language id for documentation by current language id.
@return int | [
"Get",
"language",
"id",
"for",
"documentation",
"by",
"current",
"language",
"id",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminDetailsController.php#L53-L59 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminDetailsController.php | AdminDetailsController._getEditValue | protected function _getEditValue($oObject, $sField)
{
$sEditObjectValue = '';
if ($oObject && $sField && isset($oObject->$sField)) {
if ($oObject->$sField instanceof \OxidEsales\Eshop\Core\Field) {
$sEditObjectValue = $oObject->$sField->getRawValue();
} else {
$sEditObjectValue = $oObject->$sField->value;
}
$sEditObjectValue = $this->_processEditValue($sEditObjectValue);
$oObject->$sField = new \OxidEsales\Eshop\Core\Field($sEditObjectValue, \OxidEsales\Eshop\Core\Field::T_RAW);
}
return $sEditObjectValue;
} | php | protected function _getEditValue($oObject, $sField)
{
$sEditObjectValue = '';
if ($oObject && $sField && isset($oObject->$sField)) {
if ($oObject->$sField instanceof \OxidEsales\Eshop\Core\Field) {
$sEditObjectValue = $oObject->$sField->getRawValue();
} else {
$sEditObjectValue = $oObject->$sField->value;
}
$sEditObjectValue = $this->_processEditValue($sEditObjectValue);
$oObject->$sField = new \OxidEsales\Eshop\Core\Field($sEditObjectValue, \OxidEsales\Eshop\Core\Field::T_RAW);
}
return $sEditObjectValue;
} | [
"protected",
"function",
"_getEditValue",
"(",
"$",
"oObject",
",",
"$",
"sField",
")",
"{",
"$",
"sEditObjectValue",
"=",
"''",
";",
"if",
"(",
"$",
"oObject",
"&&",
"$",
"sField",
"&&",
"isset",
"(",
"$",
"oObject",
"->",
"$",
"sField",
")",
")",
"... | Returns string which must be edited by editor.
@param \OxidEsales\Eshop\Core\Model\BaseModel $oObject object used for editing
@param string $sField name of editable field
@return string | [
"Returns",
"string",
"which",
"must",
"be",
"edited",
"by",
"editor",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminDetailsController.php#L69-L84 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminDetailsController.php | AdminDetailsController._processEditValue | protected function _processEditValue($sValue)
{
// A. replace ONLY if long description is not processed by smarty, or users will not be able to
// store smarty tags ([{$shop->currenthomedir}]/[{$oViewConf->getCurrentHomeDir()}]) in long
// descriptions, which are filled dynamically
if (!\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('bl_perfParseLongDescinSmarty')) {
$aReplace = ['[{$shop->currenthomedir}]', '[{$oViewConf->getCurrentHomeDir()}]'];
$sValue = str_replace($aReplace, \OxidEsales\Eshop\Core\Registry::getConfig()->getCurrentShopURL(false), $sValue);
}
return $sValue;
} | php | protected function _processEditValue($sValue)
{
// A. replace ONLY if long description is not processed by smarty, or users will not be able to
// store smarty tags ([{$shop->currenthomedir}]/[{$oViewConf->getCurrentHomeDir()}]) in long
// descriptions, which are filled dynamically
if (!\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('bl_perfParseLongDescinSmarty')) {
$aReplace = ['[{$shop->currenthomedir}]', '[{$oViewConf->getCurrentHomeDir()}]'];
$sValue = str_replace($aReplace, \OxidEsales\Eshop\Core\Registry::getConfig()->getCurrentShopURL(false), $sValue);
}
return $sValue;
} | [
"protected",
"function",
"_processEditValue",
"(",
"$",
"sValue",
")",
"{",
"// A. replace ONLY if long description is not processed by smarty, or users will not be able to",
"// store smarty tags ([{$shop->currenthomedir}]/[{$oViewConf->getCurrentHomeDir()}]) in long",
"// descriptions, which a... | Processes edit value.
@param string $sValue string to process
@return string | [
"Processes",
"edit",
"value",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminDetailsController.php#L93-L104 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminDetailsController.php | AdminDetailsController._getPlainEditor | protected function _getPlainEditor($width, $height, $object, $field)
{
$objectValue = $this->_getEditValue($object, $field);
$textEditor = oxNew(\OxidEsales\Eshop\Application\Controller\TextEditorHandler::class);
return $textEditor->renderPlainTextEditor($width, $height, $objectValue, $field);
} | php | protected function _getPlainEditor($width, $height, $object, $field)
{
$objectValue = $this->_getEditValue($object, $field);
$textEditor = oxNew(\OxidEsales\Eshop\Application\Controller\TextEditorHandler::class);
return $textEditor->renderPlainTextEditor($width, $height, $objectValue, $field);
} | [
"protected",
"function",
"_getPlainEditor",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"object",
",",
"$",
"field",
")",
"{",
"$",
"objectValue",
"=",
"$",
"this",
"->",
"_getEditValue",
"(",
"$",
"object",
",",
"$",
"field",
")",
";",
"$",
"te... | Returns textarea filled with text to edit.
@param int $width editor width
@param int $height editor height
@param \OxidEsales\Eshop\Core\Model\BaseModel $object object passed to editor
@param string $field object field which content is passed to editor
@deprecated since v6.0 (2017-06-29); Please use TextEditorHandler::renderPlainTextEditor() method.
@return string | [
"Returns",
"textarea",
"filled",
"with",
"text",
"to",
"edit",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminDetailsController.php#L118-L125 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminDetailsController.php | AdminDetailsController._createCategoryTree | protected function _createCategoryTree($sTplVarName, $sEditCatId = '', $blForceNonCache = false, $iTreeShopId = null)
{
// caching category tree, to load it once, not many times
if (!isset($this->oCatTree) || $blForceNonCache) {
$this->oCatTree = oxNew(\OxidEsales\Eshop\Application\Model\CategoryList::class);
$this->oCatTree->setShopID($iTreeShopId);
// setting language
$oBase = $this->oCatTree->getBaseObject();
$oBase->setLanguage($this->_iEditLang);
$this->oCatTree->loadList();
}
// copying tree
$oCatTree = $this->oCatTree;
//removing current category
if ($sEditCatId && isset($oCatTree[$sEditCatId])) {
unset($oCatTree[$sEditCatId]);
}
// add first fake category for not assigned articles
$oRoot = oxNew(\OxidEsales\Eshop\Application\Model\Category::class);
$oRoot->oxcategories__oxtitle = new \OxidEsales\Eshop\Core\Field('--');
$oCatTree->assign(array_merge(['' => $oRoot], $oCatTree->getArray()));
// passing to view
$this->_aViewData[$sTplVarName] = $oCatTree;
return $oCatTree;
} | php | protected function _createCategoryTree($sTplVarName, $sEditCatId = '', $blForceNonCache = false, $iTreeShopId = null)
{
// caching category tree, to load it once, not many times
if (!isset($this->oCatTree) || $blForceNonCache) {
$this->oCatTree = oxNew(\OxidEsales\Eshop\Application\Model\CategoryList::class);
$this->oCatTree->setShopID($iTreeShopId);
// setting language
$oBase = $this->oCatTree->getBaseObject();
$oBase->setLanguage($this->_iEditLang);
$this->oCatTree->loadList();
}
// copying tree
$oCatTree = $this->oCatTree;
//removing current category
if ($sEditCatId && isset($oCatTree[$sEditCatId])) {
unset($oCatTree[$sEditCatId]);
}
// add first fake category for not assigned articles
$oRoot = oxNew(\OxidEsales\Eshop\Application\Model\Category::class);
$oRoot->oxcategories__oxtitle = new \OxidEsales\Eshop\Core\Field('--');
$oCatTree->assign(array_merge(['' => $oRoot], $oCatTree->getArray()));
// passing to view
$this->_aViewData[$sTplVarName] = $oCatTree;
return $oCatTree;
} | [
"protected",
"function",
"_createCategoryTree",
"(",
"$",
"sTplVarName",
",",
"$",
"sEditCatId",
"=",
"''",
",",
"$",
"blForceNonCache",
"=",
"false",
",",
"$",
"iTreeShopId",
"=",
"null",
")",
"{",
"// caching category tree, to load it once, not many times",
"if",
... | Function creates category tree for select list used in "Category main", "Article extend" etc.
@param string $sTplVarName name of template variable where is stored category tree
@param string $sEditCatId ID of category witch we are editing
@param bool $blForceNonCache Set to true to disable caching
@param int $iTreeShopId tree shop id
@return string | [
"Function",
"creates",
"category",
"tree",
"for",
"select",
"list",
"used",
"in",
"Category",
"main",
"Article",
"extend",
"etc",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminDetailsController.php#L203-L234 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminDetailsController.php | AdminDetailsController._getCategoryTree | protected function _getCategoryTree($sTplVarName, $sSelectedCatId, $sEditCatId = '', $blForceNonCache = false, $iTreeShopId = null)
{
$oCatTree = $this->_createCategoryTree($sTplVarName, $sEditCatId, $blForceNonCache, $iTreeShopId);
// mark selected
if ($sSelectedCatId) {
// fixed parent category in select list
foreach ($oCatTree as $oCategory) {
if (strcmp($oCategory->getId(), $sSelectedCatId) == 0) {
$oCategory->selected = 1;
break;
}
}
} else {
// no category selected - opening first available
$oCatTree->rewind();
if ($oCat = $oCatTree->current()) {
$oCat->selected = 1;
$sSelectedCatId = $oCat->getId();
}
}
// passing to view
$this->_aViewData[$sTplVarName] = $oCatTree;
return $sSelectedCatId;
} | php | protected function _getCategoryTree($sTplVarName, $sSelectedCatId, $sEditCatId = '', $blForceNonCache = false, $iTreeShopId = null)
{
$oCatTree = $this->_createCategoryTree($sTplVarName, $sEditCatId, $blForceNonCache, $iTreeShopId);
// mark selected
if ($sSelectedCatId) {
// fixed parent category in select list
foreach ($oCatTree as $oCategory) {
if (strcmp($oCategory->getId(), $sSelectedCatId) == 0) {
$oCategory->selected = 1;
break;
}
}
} else {
// no category selected - opening first available
$oCatTree->rewind();
if ($oCat = $oCatTree->current()) {
$oCat->selected = 1;
$sSelectedCatId = $oCat->getId();
}
}
// passing to view
$this->_aViewData[$sTplVarName] = $oCatTree;
return $sSelectedCatId;
} | [
"protected",
"function",
"_getCategoryTree",
"(",
"$",
"sTplVarName",
",",
"$",
"sSelectedCatId",
",",
"$",
"sEditCatId",
"=",
"''",
",",
"$",
"blForceNonCache",
"=",
"false",
",",
"$",
"iTreeShopId",
"=",
"null",
")",
"{",
"$",
"oCatTree",
"=",
"$",
"this... | Function creates category tree for select list used in "Category main", "Article extend" etc.
Returns ID of selected category if available.
@param string $sTplVarName name of template variable where is stored category tree
@param string $sSelectedCatId ID of category witch was selected in select list
@param string $sEditCatId ID of category witch we are editing
@param bool $blForceNonCache Set to true to disable caching
@param int $iTreeShopId tree shop id
@return string | [
"Function",
"creates",
"category",
"tree",
"for",
"select",
"list",
"used",
"in",
"Category",
"main",
"Article",
"extend",
"etc",
".",
"Returns",
"ID",
"of",
"selected",
"category",
"if",
"available",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminDetailsController.php#L248-L274 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminDetailsController.php | AdminDetailsController.changeFolder | public function changeFolder()
{
$sFolder = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('setfolder');
$sFolderClass = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('folderclass');
if ($sFolderClass == 'oxcontent' && $sFolder == 'CMSFOLDER_NONE') {
$sFolder = '';
}
$oObject = oxNew($sFolderClass);
if ($oObject->load($this->getEditObjectId())) {
$oObject->{$oObject->getCoreTableName() . '__oxfolder'} = new \OxidEsales\Eshop\Core\Field($sFolder);
$oObject->save();
}
} | php | public function changeFolder()
{
$sFolder = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('setfolder');
$sFolderClass = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('folderclass');
if ($sFolderClass == 'oxcontent' && $sFolder == 'CMSFOLDER_NONE') {
$sFolder = '';
}
$oObject = oxNew($sFolderClass);
if ($oObject->load($this->getEditObjectId())) {
$oObject->{$oObject->getCoreTableName() . '__oxfolder'} = new \OxidEsales\Eshop\Core\Field($sFolder);
$oObject->save();
}
} | [
"public",
"function",
"changeFolder",
"(",
")",
"{",
"$",
"sFolder",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getRequestParameter",
"(",
"'setfolder'",
")",
";",
"$",
"sFolderClass",
"=",
"... | Updates object folder parameters. | [
"Updates",
"object",
"folder",
"parameters",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminDetailsController.php#L279-L293 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminDetailsController.php | AdminDetailsController._setupNavigation | protected function _setupNavigation($sNode)
{
// navigation according to class
if ($sNode) {
$myAdminNavig = $this->getNavigation();
// default tab
$this->_aViewData['default_edit'] = $myAdminNavig->getActiveTab($sNode, $this->_iDefEdit);
// buttons
$this->_aViewData['bottom_buttons'] = $myAdminNavig->getBtn($sNode);
}
} | php | protected function _setupNavigation($sNode)
{
// navigation according to class
if ($sNode) {
$myAdminNavig = $this->getNavigation();
// default tab
$this->_aViewData['default_edit'] = $myAdminNavig->getActiveTab($sNode, $this->_iDefEdit);
// buttons
$this->_aViewData['bottom_buttons'] = $myAdminNavig->getBtn($sNode);
}
} | [
"protected",
"function",
"_setupNavigation",
"(",
"$",
"sNode",
")",
"{",
"// navigation according to class",
"if",
"(",
"$",
"sNode",
")",
"{",
"$",
"myAdminNavig",
"=",
"$",
"this",
"->",
"getNavigation",
"(",
")",
";",
"// default tab",
"$",
"this",
"->",
... | Sets-up navigation parameters.
@param string $sNode active view id | [
"Sets",
"-",
"up",
"navigation",
"parameters",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminDetailsController.php#L300-L312 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminDetailsController.php | AdminDetailsController.configureTextEditorHandler | protected function configureTextEditorHandler(
\OxidEsales\Eshop\Application\Controller\TextEditorHandler $textEditorHandler,
$editedObject,
$field,
$stylesheet
) {
$textEditorHandler->setStyleSheet($stylesheet);
} | php | protected function configureTextEditorHandler(
\OxidEsales\Eshop\Application\Controller\TextEditorHandler $textEditorHandler,
$editedObject,
$field,
$stylesheet
) {
$textEditorHandler->setStyleSheet($stylesheet);
} | [
"protected",
"function",
"configureTextEditorHandler",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Controller",
"\\",
"TextEditorHandler",
"$",
"textEditorHandler",
",",
"$",
"editedObject",
",",
"$",
"field",
",",
"$",
"stylesheet",
")",
"... | Create the handler for the text editor.
Note: the parameters editedObject and field are not used here but in the enterprise edition.
@param \OxidEsales\Eshop\Application\Controller\TextEditorHandler $textEditorHandler
@param mixed $editedObject The object we want to edit.
Either type of
\OxidEsales\Eshop\Core\BaseModel
if you want to persist or
anything else
@param string $field The input field we want to edit
@param string $stylesheet The name of the CSS file | [
"Create",
"the",
"handler",
"for",
"the",
"text",
"editor",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminDetailsController.php#L350-L357 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminListController.php | AdminListController.getListFilter | public function getListFilter()
{
if ($this->_aListFilter === null) {
$this->_aListFilter = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("where");
}
return $this->_aListFilter;
} | php | public function getListFilter()
{
if ($this->_aListFilter === null) {
$this->_aListFilter = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("where");
}
return $this->_aListFilter;
} | [
"public",
"function",
"getListFilter",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_aListFilter",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_aListFilter",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"("... | Returns list filter array
@return array | [
"Returns",
"list",
"filter",
"array"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminListController.php#L143-L150 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminListController.php | AdminListController._getViewListSize | protected function _getViewListSize()
{
if (!$this->_iViewListSize) {
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
if ($profile = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('profile')) {
if (isset($profile[1])) {
$config->setConfigParam('iAdminListSize', (int)$profile[1]);
}
}
$this->_iViewListSize = (int)$config->getConfigParam('iAdminListSize');
if (!$this->_iViewListSize) {
$this->_iViewListSize = 10;
$config->setConfigParam('iAdminListSize', $this->_iViewListSize);
}
}
return $this->_iViewListSize;
} | php | protected function _getViewListSize()
{
if (!$this->_iViewListSize) {
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
if ($profile = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('profile')) {
if (isset($profile[1])) {
$config->setConfigParam('iAdminListSize', (int)$profile[1]);
}
}
$this->_iViewListSize = (int)$config->getConfigParam('iAdminListSize');
if (!$this->_iViewListSize) {
$this->_iViewListSize = 10;
$config->setConfigParam('iAdminListSize', $this->_iViewListSize);
}
}
return $this->_iViewListSize;
} | [
"protected",
"function",
"_getViewListSize",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_iViewListSize",
")",
"{",
"$",
"config",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"if",
"(... | Viewable list size getter
@return int | [
"Viewable",
"list",
"size",
"getter"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminListController.php#L157-L175 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminListController.php | AdminListController.deleteEntry | public function deleteEntry()
{
$delete = oxNew($this->_sListClass);
//disabling deletion for derived items
if ($delete->isDerived()) {
return;
}
$blDelete = $delete->delete($this->getEditObjectId());
// #A - we must reset object ID
if ($blDelete && isset($_POST['oxid'])) {
$_POST['oxid'] = -1;
}
$this->resetContentCache();
$this->init();
} | php | public function deleteEntry()
{
$delete = oxNew($this->_sListClass);
//disabling deletion for derived items
if ($delete->isDerived()) {
return;
}
$blDelete = $delete->delete($this->getEditObjectId());
// #A - we must reset object ID
if ($blDelete && isset($_POST['oxid'])) {
$_POST['oxid'] = -1;
}
$this->resetContentCache();
$this->init();
} | [
"public",
"function",
"deleteEntry",
"(",
")",
"{",
"$",
"delete",
"=",
"oxNew",
"(",
"$",
"this",
"->",
"_sListClass",
")",
";",
"//disabling deletion for derived items",
"if",
"(",
"$",
"delete",
"->",
"isDerived",
"(",
")",
")",
"{",
"return",
";",
"}",... | Deletes this entry from the database
@return null | [
"Deletes",
"this",
"entry",
"from",
"the",
"database"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminListController.php#L227-L246 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminListController.php | AdminListController._calcListItemsCount | protected function _calcListItemsCount($sql)
{
$stringModifier = getStr();
// count SQL
$sql = $stringModifier->preg_replace('/select .* from/i', 'select count(*) from ', $sql);
// removing order by
$sql = $stringModifier->preg_replace('/order by .*$/i', '', $sql);
// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
// con of list items which fits current search conditions
$this->_iListSize = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster()->getOne($sql);
// set it into session that other frames know about size of DB
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('iArtCnt', $this->_iListSize);
} | php | protected function _calcListItemsCount($sql)
{
$stringModifier = getStr();
// count SQL
$sql = $stringModifier->preg_replace('/select .* from/i', 'select count(*) from ', $sql);
// removing order by
$sql = $stringModifier->preg_replace('/order by .*$/i', '', $sql);
// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
// con of list items which fits current search conditions
$this->_iListSize = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster()->getOne($sql);
// set it into session that other frames know about size of DB
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('iArtCnt', $this->_iListSize);
} | [
"protected",
"function",
"_calcListItemsCount",
"(",
"$",
"sql",
")",
"{",
"$",
"stringModifier",
"=",
"getStr",
"(",
")",
";",
"// count SQL",
"$",
"sql",
"=",
"$",
"stringModifier",
"->",
"preg_replace",
"(",
"'/select .* from/i'",
",",
"'select count(*) from '"... | Calculates list items count
@param string $sql SQL query used co select list items | [
"Calculates",
"list",
"items",
"count"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminListController.php#L253-L269 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminListController.php | AdminListController._setCurrentListPosition | protected function _setCurrentListPosition($page = null)
{
$adminListSize = $this->_getViewListSize();
$jumpToPage = $page ? ((int)$page) : ((int)((int)\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('lstrt')) / $adminListSize);
$jumpToPage = ($page && $jumpToPage) ? ($jumpToPage - 1) : $jumpToPage;
$jumpToPage = $jumpToPage * $adminListSize;
if ($jumpToPage < 1) {
$jumpToPage = 0;
} elseif ($jumpToPage >= $this->_iListSize) {
$jumpToPage = floor($this->_iListSize / $adminListSize - 1) * $adminListSize;
}
$this->_iCurrListPos = $this->_iOverPos = (int)$jumpToPage;
} | php | protected function _setCurrentListPosition($page = null)
{
$adminListSize = $this->_getViewListSize();
$jumpToPage = $page ? ((int)$page) : ((int)((int)\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('lstrt')) / $adminListSize);
$jumpToPage = ($page && $jumpToPage) ? ($jumpToPage - 1) : $jumpToPage;
$jumpToPage = $jumpToPage * $adminListSize;
if ($jumpToPage < 1) {
$jumpToPage = 0;
} elseif ($jumpToPage >= $this->_iListSize) {
$jumpToPage = floor($this->_iListSize / $adminListSize - 1) * $adminListSize;
}
$this->_iCurrListPos = $this->_iOverPos = (int)$jumpToPage;
} | [
"protected",
"function",
"_setCurrentListPosition",
"(",
"$",
"page",
"=",
"null",
")",
"{",
"$",
"adminListSize",
"=",
"$",
"this",
"->",
"_getViewListSize",
"(",
")",
";",
"$",
"jumpToPage",
"=",
"$",
"page",
"?",
"(",
"(",
"int",
")",
"$",
"page",
"... | Set current list position
@param string $page jump page string | [
"Set",
"current",
"list",
"position"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminListController.php#L276-L291 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminListController.php | AdminListController._prepareOrderByQuery | protected function _prepareOrderByQuery($query = null)
{
// sorting
$sortFields = $this->getListSorting();
if (is_array($sortFields) && count($sortFields)) {
// only add order by at full sql not for count(*)
$query .= ' order by ';
$addSeparator = false;
$listItem = $this->getItemListBaseObject();
$languageId = $listItem->isMultilang() ? $listItem->getLanguage() : \OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage();
$descending = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('adminorder');
$descending = $descending !== null ? (bool)$descending : $this->_blDesc;
foreach ($sortFields as $table => $fieldData) {
$table = $table ? (getViewName($table, $languageId) . '.') : '';
foreach ($fieldData as $column => $sortDirectory) {
$field = $table . $column;
//add table name to column name if no table name found attached to column name
$query .= ((($addSeparator) ? ', ' : '')) . \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteIdentifier($field);
//V oxActive field search always DESC
if ($descending || $column == "oxactive" || strcasecmp($sortDirectory, 'desc') == 0) {
$query .= ' desc ';
}
$addSeparator = true;
}
}
}
return $query;
} | php | protected function _prepareOrderByQuery($query = null)
{
// sorting
$sortFields = $this->getListSorting();
if (is_array($sortFields) && count($sortFields)) {
// only add order by at full sql not for count(*)
$query .= ' order by ';
$addSeparator = false;
$listItem = $this->getItemListBaseObject();
$languageId = $listItem->isMultilang() ? $listItem->getLanguage() : \OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage();
$descending = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('adminorder');
$descending = $descending !== null ? (bool)$descending : $this->_blDesc;
foreach ($sortFields as $table => $fieldData) {
$table = $table ? (getViewName($table, $languageId) . '.') : '';
foreach ($fieldData as $column => $sortDirectory) {
$field = $table . $column;
//add table name to column name if no table name found attached to column name
$query .= ((($addSeparator) ? ', ' : '')) . \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteIdentifier($field);
//V oxActive field search always DESC
if ($descending || $column == "oxactive" || strcasecmp($sortDirectory, 'desc') == 0) {
$query .= ' desc ';
}
$addSeparator = true;
}
}
}
return $query;
} | [
"protected",
"function",
"_prepareOrderByQuery",
"(",
"$",
"query",
"=",
"null",
")",
"{",
"// sorting",
"$",
"sortFields",
"=",
"$",
"this",
"->",
"getListSorting",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"sortFields",
")",
"&&",
"count",
"(",
"... | Adds order by to SQL query string.
@param string $query sql string
@return string | [
"Adds",
"order",
"by",
"to",
"SQL",
"query",
"string",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminListController.php#L300-L335 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminListController.php | AdminListController._buildFilter | protected function _buildFilter($value, $isSearchValue)
{
if ($isSearchValue) {
//is search string, using LIKE
$query = " like " . \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quote('%' . $value . '%') . " ";
} else {
//not search string, values must be equal
$query = " = " . \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quote($value) . " ";
}
return $query;
} | php | protected function _buildFilter($value, $isSearchValue)
{
if ($isSearchValue) {
//is search string, using LIKE
$query = " like " . \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quote('%' . $value . '%') . " ";
} else {
//not search string, values must be equal
$query = " = " . \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quote($value) . " ";
}
return $query;
} | [
"protected",
"function",
"_buildFilter",
"(",
"$",
"value",
",",
"$",
"isSearchValue",
")",
"{",
"if",
"(",
"$",
"isSearchValue",
")",
"{",
"//is search string, using LIKE",
"$",
"query",
"=",
"\" like \"",
".",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",... | Builds part of SQL query
@param string $value filter value
@param bool $isSearchValue filter value type, true means surrount search key with '%'
@return string | [
"Builds",
"part",
"of",
"SQL",
"query"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminListController.php#L377-L388 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminListController.php | AdminListController._convertDate | protected function _convertDate($date)
{
// regexps to validate input
$datePatterns = [
"/^([0-9]{2})\.([0-9]{4})/" => "EUR2", // MM.YYYY
"/^([0-9]{2})\.([0-9]{2})/" => "EUR1", // DD.MM
"/^([0-9]{2})\/([0-9]{4})/" => "USA2", // MM.YYYY
"/^([0-9]{2})\/([0-9]{2})/" => "USA1" // DD.MM
];
// date/time formatting rules
$dateFormats = [
"EUR1" => [2, 1],
"EUR2" => [2, 1],
"USA1" => [1, 2],
"USA2" => [2, 1]
];
// looking for date field
$dateMatches = [];
$stringModifier = getStr();
foreach ($datePatterns as $pattern => $type) {
if ($stringModifier->preg_match($pattern, $date, $dateMatches)) {
$date = $dateMatches[$dateFormats[$type][0]] . "-" . $dateMatches[$dateFormats[$type][1]];
break;
}
}
return $date;
} | php | protected function _convertDate($date)
{
// regexps to validate input
$datePatterns = [
"/^([0-9]{2})\.([0-9]{4})/" => "EUR2", // MM.YYYY
"/^([0-9]{2})\.([0-9]{2})/" => "EUR1", // DD.MM
"/^([0-9]{2})\/([0-9]{4})/" => "USA2", // MM.YYYY
"/^([0-9]{2})\/([0-9]{2})/" => "USA1" // DD.MM
];
// date/time formatting rules
$dateFormats = [
"EUR1" => [2, 1],
"EUR2" => [2, 1],
"USA1" => [1, 2],
"USA2" => [2, 1]
];
// looking for date field
$dateMatches = [];
$stringModifier = getStr();
foreach ($datePatterns as $pattern => $type) {
if ($stringModifier->preg_match($pattern, $date, $dateMatches)) {
$date = $dateMatches[$dateFormats[$type][0]] . "-" . $dateMatches[$dateFormats[$type][1]];
break;
}
}
return $date;
} | [
"protected",
"function",
"_convertDate",
"(",
"$",
"date",
")",
"{",
"// regexps to validate input",
"$",
"datePatterns",
"=",
"[",
"\"/^([0-9]{2})\\.([0-9]{4})/\"",
"=>",
"\"EUR2\"",
",",
"// MM.YYYY",
"\"/^([0-9]{2})\\.([0-9]{2})/\"",
"=>",
"\"EUR1\"",
",",
"// DD.MM",
... | Converter for date field search. If not full date will be searched.
@param string $date searched date
@return string | [
"Converter",
"for",
"date",
"field",
"search",
".",
"If",
"not",
"full",
"date",
"will",
"be",
"searched",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminListController.php#L557-L586 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminListController.php | AdminListController._convertTime | protected function _convertTime($fullDate)
{
$date = substr($fullDate, 0, 10);
$convertedObject = new \OxidEsales\Eshop\Core\Field();
$convertedObject->setValue($date);
\OxidEsales\Eshop\Core\Registry::getUtilsDate()->convertDBDate($convertedObject, true);
$stringModifier = getStr();
// looking for time field
$time = substr($fullDate, 11);
if ($stringModifier->preg_match("/([0-9]{2}):([0-9]{2}) ([AP]{1}[M]{1})$/", $time, $timeMatches)) {
if ($timeMatches[3] == "PM") {
$intVal = (int)$timeMatches[1];
if ($intVal < 13) {
$time = ($intVal + 12) . ":" . $timeMatches[2];
}
} else {
$time = $timeMatches[1] . ":" . $timeMatches[2];
}
} elseif ($stringModifier->preg_match("/([0-9]{2}) ([AP]{1}[M]{1})$/", $time, $timeMatches)) {
if ($timeMatches[2] == "PM") {
$intVal = (int)$timeMatches[1];
if ($intVal < 13) {
$time = ($intVal + 12);
}
} else {
$time = $timeMatches[1];
}
} else {
$time = str_replace(".", ":", $time);
}
return $convertedObject->value . " " . $time;
} | php | protected function _convertTime($fullDate)
{
$date = substr($fullDate, 0, 10);
$convertedObject = new \OxidEsales\Eshop\Core\Field();
$convertedObject->setValue($date);
\OxidEsales\Eshop\Core\Registry::getUtilsDate()->convertDBDate($convertedObject, true);
$stringModifier = getStr();
// looking for time field
$time = substr($fullDate, 11);
if ($stringModifier->preg_match("/([0-9]{2}):([0-9]{2}) ([AP]{1}[M]{1})$/", $time, $timeMatches)) {
if ($timeMatches[3] == "PM") {
$intVal = (int)$timeMatches[1];
if ($intVal < 13) {
$time = ($intVal + 12) . ":" . $timeMatches[2];
}
} else {
$time = $timeMatches[1] . ":" . $timeMatches[2];
}
} elseif ($stringModifier->preg_match("/([0-9]{2}) ([AP]{1}[M]{1})$/", $time, $timeMatches)) {
if ($timeMatches[2] == "PM") {
$intVal = (int)$timeMatches[1];
if ($intVal < 13) {
$time = ($intVal + 12);
}
} else {
$time = $timeMatches[1];
}
} else {
$time = str_replace(".", ":", $time);
}
return $convertedObject->value . " " . $time;
} | [
"protected",
"function",
"_convertTime",
"(",
"$",
"fullDate",
")",
"{",
"$",
"date",
"=",
"substr",
"(",
"$",
"fullDate",
",",
"0",
",",
"10",
")",
";",
"$",
"convertedObject",
"=",
"new",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Field"... | Converter for datetime field search. If not full time will be searched.
@param string $fullDate searched date
@return string | [
"Converter",
"for",
"datetime",
"field",
"search",
".",
"If",
"not",
"full",
"time",
"will",
"be",
"searched",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminListController.php#L595-L628 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminListController.php | AdminListController.getItemList | public function getItemList()
{
if ($this->_oList === null && $this->_sListClass) {
$this->_oList = oxNew($this->_sListType);
$this->_oList->clear();
$this->_oList->init($this->_sListClass);
$where = $this->buildWhere();
$listObject = $this->_oList->getBaseObject();
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('tabelle', $this->_sListClass);
$this->_aViewData['listTable'] = getViewName($listObject->getCoreTableName());
\OxidEsales\Eshop\Core\Registry::getConfig()->setGlobalParameter('ListCoreTable', $listObject->getCoreTableName());
if ($listObject->isMultilang()) {
// is the object multilingual?
/** @var \OxidEsales\Eshop\Core\Model\MultiLanguageModel $listObject */
$listObject->setLanguage(\OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage());
if (isset($this->_blEmployMultilanguage)) {
$listObject->setEnableMultilang($this->_blEmployMultilanguage);
}
}
$query = $this->_buildSelectString($listObject);
$query = $this->_prepareWhereQuery($where, $query);
$query = $this->_prepareOrderByQuery($query);
$query = $this->_changeselect($query);
// calculates count of list items
$this->_calcListItemsCount($query);
// setting current list position (page)
$this->_setCurrentListPosition(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('jumppage'));
// setting addition params for list: current list size
$this->_oList->setSqlLimit($this->_iCurrListPos, $this->_getViewListSize());
$this->_oList->selectString($query);
}
return $this->_oList;
} | php | public function getItemList()
{
if ($this->_oList === null && $this->_sListClass) {
$this->_oList = oxNew($this->_sListType);
$this->_oList->clear();
$this->_oList->init($this->_sListClass);
$where = $this->buildWhere();
$listObject = $this->_oList->getBaseObject();
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('tabelle', $this->_sListClass);
$this->_aViewData['listTable'] = getViewName($listObject->getCoreTableName());
\OxidEsales\Eshop\Core\Registry::getConfig()->setGlobalParameter('ListCoreTable', $listObject->getCoreTableName());
if ($listObject->isMultilang()) {
// is the object multilingual?
/** @var \OxidEsales\Eshop\Core\Model\MultiLanguageModel $listObject */
$listObject->setLanguage(\OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage());
if (isset($this->_blEmployMultilanguage)) {
$listObject->setEnableMultilang($this->_blEmployMultilanguage);
}
}
$query = $this->_buildSelectString($listObject);
$query = $this->_prepareWhereQuery($where, $query);
$query = $this->_prepareOrderByQuery($query);
$query = $this->_changeselect($query);
// calculates count of list items
$this->_calcListItemsCount($query);
// setting current list position (page)
$this->_setCurrentListPosition(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('jumppage'));
// setting addition params for list: current list size
$this->_oList->setSqlLimit($this->_iCurrListPos, $this->_getViewListSize());
$this->_oList->selectString($query);
}
return $this->_oList;
} | [
"public",
"function",
"getItemList",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oList",
"===",
"null",
"&&",
"$",
"this",
"->",
"_sListClass",
")",
"{",
"$",
"this",
"->",
"_oList",
"=",
"oxNew",
"(",
"$",
"this",
"->",
"_sListType",
")",
";",
... | Returns items list
@return oxList | [
"Returns",
"items",
"list"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminListController.php#L754-L797 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminListController.php | AdminListController.getItemListBaseObject | public function getItemListBaseObject()
{
$baseObject = null;
if (($itemsList = $this->getItemList())) {
$baseObject = $itemsList->getBaseObject();
}
return $baseObject;
} | php | public function getItemListBaseObject()
{
$baseObject = null;
if (($itemsList = $this->getItemList())) {
$baseObject = $itemsList->getBaseObject();
}
return $baseObject;
} | [
"public",
"function",
"getItemListBaseObject",
"(",
")",
"{",
"$",
"baseObject",
"=",
"null",
";",
"if",
"(",
"(",
"$",
"itemsList",
"=",
"$",
"this",
"->",
"getItemList",
"(",
")",
")",
")",
"{",
"$",
"baseObject",
"=",
"$",
"itemsList",
"->",
"getBas... | Returns item list base object
@return oxBase|null | [
"Returns",
"item",
"list",
"base",
"object"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminListController.php#L812-L820 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/BasketReservation.php | BasketReservation._getReservationsId | protected function _getReservationsId()
{
$sId = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('basketReservationToken');
if (!$sId) {
$utilsObject = $this->getUtilsObjectInstance();
$sId = $utilsObject->generateUId();
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('basketReservationToken', $sId);
}
return $sId;
} | php | protected function _getReservationsId()
{
$sId = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('basketReservationToken');
if (!$sId) {
$utilsObject = $this->getUtilsObjectInstance();
$sId = $utilsObject->generateUId();
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('basketReservationToken', $sId);
}
return $sId;
} | [
"protected",
"function",
"_getReservationsId",
"(",
")",
"{",
"$",
"sId",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getSession",
"(",
")",
"->",
"getVariable",
"(",
"'basketReservationToken'",
")",
";",
"if",
"(",
"!",
... | return the ID of active resevations user basket
@return string | [
"return",
"the",
"ID",
"of",
"active",
"resevations",
"user",
"basket"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/BasketReservation.php#L42-L52 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/BasketReservation.php | BasketReservation._loadReservations | protected function _loadReservations($sBasketId)
{
$oReservations = oxNew(\OxidEsales\Eshop\Application\Model\UserBasket::class);
$aWhere = ['oxuserbaskets.oxuserid' => $sBasketId, 'oxuserbaskets.oxtitle' => 'reservations'];
// creating if it does not exist
if (!$oReservations->assignRecord($oReservations->buildSelectString($aWhere))) {
$oReservations->oxuserbaskets__oxtitle = new \OxidEsales\Eshop\Core\Field('reservations');
$oReservations->oxuserbaskets__oxuserid = new \OxidEsales\Eshop\Core\Field($sBasketId);
// marking basket as new (it will not be saved in DB yet)
$oReservations->setIsNewBasket();
}
return $oReservations;
} | php | protected function _loadReservations($sBasketId)
{
$oReservations = oxNew(\OxidEsales\Eshop\Application\Model\UserBasket::class);
$aWhere = ['oxuserbaskets.oxuserid' => $sBasketId, 'oxuserbaskets.oxtitle' => 'reservations'];
// creating if it does not exist
if (!$oReservations->assignRecord($oReservations->buildSelectString($aWhere))) {
$oReservations->oxuserbaskets__oxtitle = new \OxidEsales\Eshop\Core\Field('reservations');
$oReservations->oxuserbaskets__oxuserid = new \OxidEsales\Eshop\Core\Field($sBasketId);
// marking basket as new (it will not be saved in DB yet)
$oReservations->setIsNewBasket();
}
return $oReservations;
} | [
"protected",
"function",
"_loadReservations",
"(",
"$",
"sBasketId",
")",
"{",
"$",
"oReservations",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
"\\",
"UserBasket",
"::",
"class",
")",
";",
"$",
"aWhere",
"=",
... | load reservation or create new reservation user basket
@param string $sBasketId basket id for this user basket
@return \OxidEsales\EshopCommunity\Application\Model\UserBasket | [
"load",
"reservation",
"or",
"create",
"new",
"reservation",
"user",
"basket"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/BasketReservation.php#L61-L75 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/BasketReservation.php | BasketReservation.getReservations | public function getReservations()
{
if ($this->_oReservations) {
return $this->_oReservations;
}
if (!$sBasketId = $this->_getReservationsId()) {
return null;
}
$this->_oReservations = $this->_loadReservations($sBasketId);
return $this->_oReservations;
} | php | public function getReservations()
{
if ($this->_oReservations) {
return $this->_oReservations;
}
if (!$sBasketId = $this->_getReservationsId()) {
return null;
}
$this->_oReservations = $this->_loadReservations($sBasketId);
return $this->_oReservations;
} | [
"public",
"function",
"getReservations",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oReservations",
")",
"{",
"return",
"$",
"this",
"->",
"_oReservations",
";",
"}",
"if",
"(",
"!",
"$",
"sBasketId",
"=",
"$",
"this",
"->",
"_getReservationsId",
"("... | get reservations collection
@return \OxidEsales\EshopCommunity\Application\Model\UserBasket | [
"get",
"reservations",
"collection"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/BasketReservation.php#L82-L95 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/BasketReservation.php | BasketReservation.getReservedAmount | public function getReservedAmount($sArticleId)
{
$aCurrentlyReserved = $this->_getReservedItems();
if (isset($aCurrentlyReserved[$sArticleId])) {
return $aCurrentlyReserved[$sArticleId];
}
return 0;
} | php | public function getReservedAmount($sArticleId)
{
$aCurrentlyReserved = $this->_getReservedItems();
if (isset($aCurrentlyReserved[$sArticleId])) {
return $aCurrentlyReserved[$sArticleId];
}
return 0;
} | [
"public",
"function",
"getReservedAmount",
"(",
"$",
"sArticleId",
")",
"{",
"$",
"aCurrentlyReserved",
"=",
"$",
"this",
"->",
"_getReservedItems",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"aCurrentlyReserved",
"[",
"$",
"sArticleId",
"]",
")",
")",
"... | return currently reserved amount for an article
@param string $sArticleId article id
@return double | [
"return",
"currently",
"reserved",
"amount",
"for",
"an",
"article"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/BasketReservation.php#L131-L139 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/BasketReservation.php | BasketReservation._basketDifference | protected function _basketDifference(\OxidEsales\Eshop\Application\Model\Basket $oBasket)
{
$aDiff = $this->_getReservedItems();
// refreshing history
foreach ($oBasket->getContents() as $oItem) {
$sProdId = $oItem->getProductId();
if (!isset($aDiff[$sProdId])) {
$aDiff[$sProdId] = -$oItem->getAmount();
} else {
$aDiff[$sProdId] -= $oItem->getAmount();
}
}
return $aDiff;
} | php | protected function _basketDifference(\OxidEsales\Eshop\Application\Model\Basket $oBasket)
{
$aDiff = $this->_getReservedItems();
// refreshing history
foreach ($oBasket->getContents() as $oItem) {
$sProdId = $oItem->getProductId();
if (!isset($aDiff[$sProdId])) {
$aDiff[$sProdId] = -$oItem->getAmount();
} else {
$aDiff[$sProdId] -= $oItem->getAmount();
}
}
return $aDiff;
} | [
"protected",
"function",
"_basketDifference",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
"\\",
"Basket",
"$",
"oBasket",
")",
"{",
"$",
"aDiff",
"=",
"$",
"this",
"->",
"_getReservedItems",
"(",
")",
";",
"// refreshing history... | compute difference of reserved amounts vs basket items
@param \OxidEsales\Eshop\Application\Model\Basket $oBasket basket object
@return array | [
"compute",
"difference",
"of",
"reserved",
"amounts",
"vs",
"basket",
"items"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/BasketReservation.php#L148-L162 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/BasketReservation.php | BasketReservation._reserveArticles | protected function _reserveArticles($aBasketDiff)
{
$blAllowNegativeStock = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blAllowNegativeStock');
$oReserved = $this->getReservations();
foreach ($aBasketDiff as $sId => $dAmount) {
if ($dAmount != 0) {
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
if ($oArticle->load($sId)) {
$oArticle->reduceStock(-$dAmount, $blAllowNegativeStock);
$oReserved->addItemToBasket($sId, -$dAmount);
}
}
}
$this->_aCurrentlyReserved = null;
} | php | protected function _reserveArticles($aBasketDiff)
{
$blAllowNegativeStock = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blAllowNegativeStock');
$oReserved = $this->getReservations();
foreach ($aBasketDiff as $sId => $dAmount) {
if ($dAmount != 0) {
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
if ($oArticle->load($sId)) {
$oArticle->reduceStock(-$dAmount, $blAllowNegativeStock);
$oReserved->addItemToBasket($sId, -$dAmount);
}
}
}
$this->_aCurrentlyReserved = null;
} | [
"protected",
"function",
"_reserveArticles",
"(",
"$",
"aBasketDiff",
")",
"{",
"$",
"blAllowNegativeStock",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getConfigParam",
"(",
"'blAllowNegativeStock'",... | reserve articles given the basket difference array
@param array $aBasketDiff basket difference array
@see oxBasketReservation::_basketDifference | [
"reserve",
"articles",
"given",
"the",
"basket",
"difference",
"array"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/BasketReservation.php#L171-L186 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/BasketReservation.php | BasketReservation.reserveBasket | public function reserveBasket(\OxidEsales\Eshop\Application\Model\Basket $oBasket)
{
if (!$this->isAdmin()) {
$this->_reserveArticles($this->_basketDifference($oBasket));
}
} | php | public function reserveBasket(\OxidEsales\Eshop\Application\Model\Basket $oBasket)
{
if (!$this->isAdmin()) {
$this->_reserveArticles($this->_basketDifference($oBasket));
}
} | [
"public",
"function",
"reserveBasket",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
"\\",
"Basket",
"$",
"oBasket",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isAdmin",
"(",
")",
")",
"{",
"$",
"this",
"->",
"_reserveA... | reserve given basket items, only when not in admin mode
@param \OxidEsales\Eshop\Application\Model\Basket $oBasket basket object | [
"reserve",
"given",
"basket",
"items",
"only",
"when",
"not",
"in",
"admin",
"mode"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/BasketReservation.php#L193-L198 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/BasketReservation.php | BasketReservation.commitArticleReservation | public function commitArticleReservation($sArticleId, $dAmount)
{
$dReserved = $this->getReservedAmount($sArticleId);
if ($dReserved < $dAmount) {
$dAmount = $dReserved;
}
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$oArticle->load($sArticleId);
$this->getReservations()->addItemToBasket($sArticleId, -$dAmount);
$oArticle->beforeUpdate();
$oArticle->updateSoldAmount($dAmount);
$this->_aCurrentlyReserved = null;
} | php | public function commitArticleReservation($sArticleId, $dAmount)
{
$dReserved = $this->getReservedAmount($sArticleId);
if ($dReserved < $dAmount) {
$dAmount = $dReserved;
}
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$oArticle->load($sArticleId);
$this->getReservations()->addItemToBasket($sArticleId, -$dAmount);
$oArticle->beforeUpdate();
$oArticle->updateSoldAmount($dAmount);
$this->_aCurrentlyReserved = null;
} | [
"public",
"function",
"commitArticleReservation",
"(",
"$",
"sArticleId",
",",
"$",
"dAmount",
")",
"{",
"$",
"dReserved",
"=",
"$",
"this",
"->",
"getReservedAmount",
"(",
"$",
"sArticleId",
")",
";",
"if",
"(",
"$",
"dReserved",
"<",
"$",
"dAmount",
")",... | commit reservation of given article amount
deletes this amount from active reservations userBasket,
update sold amount
@param string $sArticleId article id
@param double $dAmount amount to use | [
"commit",
"reservation",
"of",
"given",
"article",
"amount",
"deletes",
"this",
"amount",
"from",
"active",
"reservations",
"userBasket",
"update",
"sold",
"amount"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/BasketReservation.php#L208-L223 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/BasketReservation.php | BasketReservation.discardArticleReservation | public function discardArticleReservation($sArticleId)
{
$dReserved = $this->getReservedAmount($sArticleId);
if ($dReserved) {
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
if ($oArticle->load($sArticleId)) {
$oArticle->reduceStock(-$dReserved, true);
$this->getReservations()->addItemToBasket($sArticleId, 0, null, true);
$this->_aCurrentlyReserved = null;
}
}
} | php | public function discardArticleReservation($sArticleId)
{
$dReserved = $this->getReservedAmount($sArticleId);
if ($dReserved) {
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
if ($oArticle->load($sArticleId)) {
$oArticle->reduceStock(-$dReserved, true);
$this->getReservations()->addItemToBasket($sArticleId, 0, null, true);
$this->_aCurrentlyReserved = null;
}
}
} | [
"public",
"function",
"discardArticleReservation",
"(",
"$",
"sArticleId",
")",
"{",
"$",
"dReserved",
"=",
"$",
"this",
"->",
"getReservedAmount",
"(",
"$",
"sArticleId",
")",
";",
"if",
"(",
"$",
"dReserved",
")",
"{",
"$",
"oArticle",
"=",
"oxNew",
"(",... | discard one article reservation
return the reserved stock to article
@param string $sArticleId article id | [
"discard",
"one",
"article",
"reservation",
"return",
"the",
"reserved",
"stock",
"to",
"article"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/BasketReservation.php#L231-L242 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/BasketReservation.php | BasketReservation.discardReservations | public function discardReservations()
{
foreach (array_keys($this->_getReservedItems()) as $sArticleId) {
$this->discardArticleReservation($sArticleId);
}
if ($this->_oReservations) {
$this->_oReservations->delete();
$this->_oReservations = null;
$this->_aCurrentlyReserved = null;
}
} | php | public function discardReservations()
{
foreach (array_keys($this->_getReservedItems()) as $sArticleId) {
$this->discardArticleReservation($sArticleId);
}
if ($this->_oReservations) {
$this->_oReservations->delete();
$this->_oReservations = null;
$this->_aCurrentlyReserved = null;
}
} | [
"public",
"function",
"discardReservations",
"(",
")",
"{",
"foreach",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"_getReservedItems",
"(",
")",
")",
"as",
"$",
"sArticleId",
")",
"{",
"$",
"this",
"->",
"discardArticleReservation",
"(",
"$",
"sArticleId",
"... | discard all reserved articles | [
"discard",
"all",
"reserved",
"articles"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/BasketReservation.php#L247-L257 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/BasketReservation.php | BasketReservation.renewExpiration | public function renewExpiration()
{
if ($oReserved = $this->getReservations()) {
$iTime = \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime();
$oReserved->oxuserbaskets__oxupdate = new \OxidEsales\Eshop\Core\Field($iTime);
$oReserved->save();
\OxidEsales\Eshop\Core\Registry::getSession()->deleteVariable("iBasketReservationTimeout");
}
} | php | public function renewExpiration()
{
if ($oReserved = $this->getReservations()) {
$iTime = \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime();
$oReserved->oxuserbaskets__oxupdate = new \OxidEsales\Eshop\Core\Field($iTime);
$oReserved->save();
\OxidEsales\Eshop\Core\Registry::getSession()->deleteVariable("iBasketReservationTimeout");
}
} | [
"public",
"function",
"renewExpiration",
"(",
")",
"{",
"if",
"(",
"$",
"oReserved",
"=",
"$",
"this",
"->",
"getReservations",
"(",
")",
")",
"{",
"$",
"iTime",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getUtilsDate"... | renews expiration timer to maximum value | [
"renews",
"expiration",
"timer",
"to",
"maximum",
"value"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/BasketReservation.php#L339-L348 | train |
OXID-eSales/oxideshop_ce | source/Core/DbMetaDataHandler.php | DbMetaDataHandler.getIndices | public function getIndices($tableName)
{
$result = [];
if ($this->tableExists($tableName)) {
$result = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC)->getAll("SHOW INDEX FROM $tableName");
}
return $result;
} | php | public function getIndices($tableName)
{
$result = [];
if ($this->tableExists($tableName)) {
$result = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC)->getAll("SHOW INDEX FROM $tableName");
}
return $result;
} | [
"public",
"function",
"getIndices",
"(",
"$",
"tableName",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"tableExists",
"(",
"$",
"tableName",
")",
")",
"{",
"$",
"result",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
... | Get the indices of a table
@param string $tableName The name of the table for which we want the
@return array The indices of the given table | [
"Get",
"the",
"indices",
"of",
"a",
"table"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DbMetaDataHandler.php#L111-L120 | train |
OXID-eSales/oxideshop_ce | source/Core/DbMetaDataHandler.php | DbMetaDataHandler.hasIndex | public function hasIndex($indexName, $tableName)
{
$result = false;
foreach ($this->getIndices($tableName) as $index) {
if ($indexName === $index['Column_name']) {
$result = true;
}
}
return $result;
} | php | public function hasIndex($indexName, $tableName)
{
$result = false;
foreach ($this->getIndices($tableName) as $index) {
if ($indexName === $index['Column_name']) {
$result = true;
}
}
return $result;
} | [
"public",
"function",
"hasIndex",
"(",
"$",
"indexName",
",",
"$",
"tableName",
")",
"{",
"$",
"result",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"getIndices",
"(",
"$",
"tableName",
")",
"as",
"$",
"index",
")",
"{",
"if",
"(",
"$",
"... | Check, if the table has an index with the given name
@param string $indexName The name of the index we want to check
@param string $tableName The table to check for the index
@return bool Has the table the given index? | [
"Check",
"if",
"the",
"table",
"has",
"an",
"index",
"with",
"the",
"given",
"name"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DbMetaDataHandler.php#L130-L141 | train |
OXID-eSales/oxideshop_ce | source/Core/DbMetaDataHandler.php | DbMetaDataHandler.getIndexByName | public function getIndexByName($indexName, $tableName)
{
$indices = $this->getIndices($tableName);
$result = null;
foreach ($indices as $index) {
if ($indexName === $index['Column_name']) {
$result = $index;
}
}
return $result;
} | php | public function getIndexByName($indexName, $tableName)
{
$indices = $this->getIndices($tableName);
$result = null;
foreach ($indices as $index) {
if ($indexName === $index['Column_name']) {
$result = $index;
}
}
return $result;
} | [
"public",
"function",
"getIndexByName",
"(",
"$",
"indexName",
",",
"$",
"tableName",
")",
"{",
"$",
"indices",
"=",
"$",
"this",
"->",
"getIndices",
"(",
"$",
"tableName",
")",
";",
"$",
"result",
"=",
"null",
";",
"foreach",
"(",
"$",
"indices",
"as"... | Get the index of a given table by its name
@param string $indexName The name of the index
@param string $tableName The name of the table from which we want the index
@return null|array The index with the given name | [
"Get",
"the",
"index",
"of",
"a",
"given",
"table",
"by",
"its",
"name"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DbMetaDataHandler.php#L151-L164 | train |
OXID-eSales/oxideshop_ce | source/Core/DbMetaDataHandler.php | DbMetaDataHandler.getAllTables | public function getAllTables()
{
if (empty($this->_aTables)) {
$tables = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getAll("show tables");
foreach ($tables as $tableInfo) {
if ($this->validateTableName($tableInfo[0])) {
$this->_aTables[] = $tableInfo[0];
}
}
}
return $this->_aTables;
} | php | public function getAllTables()
{
if (empty($this->_aTables)) {
$tables = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getAll("show tables");
foreach ($tables as $tableInfo) {
if ($this->validateTableName($tableInfo[0])) {
$this->_aTables[] = $tableInfo[0];
}
}
}
return $this->_aTables;
} | [
"public",
"function",
"getAllTables",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_aTables",
")",
")",
"{",
"$",
"tables",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
")",
"->",
... | Get all tables names from db. Views tables are not included in
this list.
@return array | [
"Get",
"all",
"tables",
"names",
"from",
"db",
".",
"Views",
"tables",
"are",
"not",
"included",
"in",
"this",
"list",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DbMetaDataHandler.php#L172-L185 | train |
OXID-eSales/oxideshop_ce | source/Core/DbMetaDataHandler.php | DbMetaDataHandler.getAllMultiTables | public function getAllMultiTables($table)
{
$mLTables = [];
foreach (array_keys(\OxidEsales\Eshop\Core\Registry::getLang()->getLanguageIds()) as $langId) {
$langTableName = getLangTableName($table, $langId);
if ($table != $langTableName && !in_array($langTableName, $mLTables)) {
$mLTables[] = $langTableName;
}
}
return $mLTables;
} | php | public function getAllMultiTables($table)
{
$mLTables = [];
foreach (array_keys(\OxidEsales\Eshop\Core\Registry::getLang()->getLanguageIds()) as $langId) {
$langTableName = getLangTableName($table, $langId);
if ($table != $langTableName && !in_array($langTableName, $mLTables)) {
$mLTables[] = $langTableName;
}
}
return $mLTables;
} | [
"public",
"function",
"getAllMultiTables",
"(",
"$",
"table",
")",
"{",
"$",
"mLTables",
"=",
"[",
"]",
";",
"foreach",
"(",
"array_keys",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getLang",
"(",
")",
"->",
"getLangua... | return all DB tables for the language sets
@param string $table table name to check
@return array | [
"return",
"all",
"DB",
"tables",
"for",
"the",
"language",
"sets"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DbMetaDataHandler.php#L194-L205 | train |
OXID-eSales/oxideshop_ce | source/Core/DbMetaDataHandler.php | DbMetaDataHandler._getCreateTableSetSql | protected function _getCreateTableSetSql($table, $lang)
{
$tableSet = getLangTableName($table, $lang);
$res = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getAll("show create table {$table}");
return "CREATE TABLE `{$tableSet}` (" .
"`OXID` char(32) NOT NULL, " .
"PRIMARY KEY (`OXID`)" .
") " . strstr($res[0][1], 'ENGINE=');
} | php | protected function _getCreateTableSetSql($table, $lang)
{
$tableSet = getLangTableName($table, $lang);
$res = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getAll("show create table {$table}");
return "CREATE TABLE `{$tableSet}` (" .
"`OXID` char(32) NOT NULL, " .
"PRIMARY KEY (`OXID`)" .
") " . strstr($res[0][1], 'ENGINE=');
} | [
"protected",
"function",
"_getCreateTableSetSql",
"(",
"$",
"table",
",",
"$",
"lang",
")",
"{",
"$",
"tableSet",
"=",
"getLangTableName",
"(",
"$",
"table",
",",
"$",
"lang",
")",
";",
"$",
"res",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
... | Get sql for new multi-language table set creation
@param string $table core table name
@param string $lang language id
@return string | [
"Get",
"sql",
"for",
"new",
"multi",
"-",
"language",
"table",
"set",
"creation"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DbMetaDataHandler.php#L216-L226 | train |
OXID-eSales/oxideshop_ce | source/Core/DbMetaDataHandler.php | DbMetaDataHandler.getAddFieldSql | public function getAddFieldSql($table, $field, $newField, $prevField, $tableSet = null)
{
if (!$tableSet) {
$tableSet = $table;
}
$res = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getAll("show create table {$table}");
$tableSql = $res[0][1];
// removing comments;
$tableSql = preg_replace('/COMMENT \\\'.*?\\\'/', '', $tableSql);
preg_match("/.*,\s+(['`]?" . preg_quote($field, '/') . "['`]?\s+[^,]+),.*/", $tableSql, $match);
$fieldSql = $match[1];
$sql = "";
if (!empty($fieldSql)) {
$fieldSql = preg_replace("/" . preg_quote($field, '/') . "/", $newField, $fieldSql);
$sql = "ALTER TABLE `$tableSet` ADD " . $fieldSql;
if ($this->tableExists($tableSet) && $this->fieldExists($prevField, $tableSet)) {
$sql .= " AFTER `$prevField`";
}
}
return $sql;
} | php | public function getAddFieldSql($table, $field, $newField, $prevField, $tableSet = null)
{
if (!$tableSet) {
$tableSet = $table;
}
$res = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getAll("show create table {$table}");
$tableSql = $res[0][1];
// removing comments;
$tableSql = preg_replace('/COMMENT \\\'.*?\\\'/', '', $tableSql);
preg_match("/.*,\s+(['`]?" . preg_quote($field, '/') . "['`]?\s+[^,]+),.*/", $tableSql, $match);
$fieldSql = $match[1];
$sql = "";
if (!empty($fieldSql)) {
$fieldSql = preg_replace("/" . preg_quote($field, '/') . "/", $newField, $fieldSql);
$sql = "ALTER TABLE `$tableSet` ADD " . $fieldSql;
if ($this->tableExists($tableSet) && $this->fieldExists($prevField, $tableSet)) {
$sql .= " AFTER `$prevField`";
}
}
return $sql;
} | [
"public",
"function",
"getAddFieldSql",
"(",
"$",
"table",
",",
"$",
"field",
",",
"$",
"newField",
",",
"$",
"prevField",
",",
"$",
"tableSet",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"tableSet",
")",
"{",
"$",
"tableSet",
"=",
"$",
"table",
"... | Get sql for new multi-language field creation
@param string $table core table name
@param string $field field name
@param string $newField new field name
@param string $prevField previous field in table
@param string $tableSet table to change (if not set take core table)
@return string | [
"Get",
"sql",
"for",
"new",
"multi",
"-",
"language",
"field",
"creation"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DbMetaDataHandler.php#L239-L262 | train |
OXID-eSales/oxideshop_ce | source/Core/DbMetaDataHandler.php | DbMetaDataHandler.getAddFieldIndexSql | public function getAddFieldIndexSql($table, $field, $newField, $tableSet = null)
{
$res = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getAll("show create table {$table}");
$tableSql = $res[0][1];
preg_match_all("/([\w]+\s+)?\bKEY\s+(`[^`]+`)?\s*\([^)]+(\(\d++\))*\)/iU", $tableSql, $match);
$index = $match[0];
$usingTableSet = $tableSet ? true : false;
if (!$tableSet) {
$tableSet = $table;
}
$indexQueries = [];
$sql = [];
if (count($index)) {
foreach ($index as $key => $indexQuery) {
if (preg_match("/\([^)]*\b" . $field . "\b[^)]*\)/i", $indexQuery)) {
//removing index name - new will be added automaticly
$indexQuery = preg_replace("/(.*\bKEY\s+)`[^`]+`/", "$1", $indexQuery);
if ($usingTableSet) {
// replacing multiple fields to one (#3269)
$indexQuery = preg_replace("/\([^\)]+\)+/", "(`$newField`{$match[3][$key]})", $indexQuery);
} else {
//replacing previous field name with new one
$indexQuery = preg_replace("/\b" . $field . "\b/", $newField, $indexQuery);
}
$indexQueries[] = "ADD " . $indexQuery;
}
}
if (count($indexQueries)) {
$sql = ["ALTER TABLE `$tableSet` " . implode(", ", $indexQueries)];
}
}
return $sql;
} | php | public function getAddFieldIndexSql($table, $field, $newField, $tableSet = null)
{
$res = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getAll("show create table {$table}");
$tableSql = $res[0][1];
preg_match_all("/([\w]+\s+)?\bKEY\s+(`[^`]+`)?\s*\([^)]+(\(\d++\))*\)/iU", $tableSql, $match);
$index = $match[0];
$usingTableSet = $tableSet ? true : false;
if (!$tableSet) {
$tableSet = $table;
}
$indexQueries = [];
$sql = [];
if (count($index)) {
foreach ($index as $key => $indexQuery) {
if (preg_match("/\([^)]*\b" . $field . "\b[^)]*\)/i", $indexQuery)) {
//removing index name - new will be added automaticly
$indexQuery = preg_replace("/(.*\bKEY\s+)`[^`]+`/", "$1", $indexQuery);
if ($usingTableSet) {
// replacing multiple fields to one (#3269)
$indexQuery = preg_replace("/\([^\)]+\)+/", "(`$newField`{$match[3][$key]})", $indexQuery);
} else {
//replacing previous field name with new one
$indexQuery = preg_replace("/\b" . $field . "\b/", $newField, $indexQuery);
}
$indexQueries[] = "ADD " . $indexQuery;
}
}
if (count($indexQueries)) {
$sql = ["ALTER TABLE `$tableSet` " . implode(", ", $indexQueries)];
}
}
return $sql;
} | [
"public",
"function",
"getAddFieldIndexSql",
"(",
"$",
"table",
",",
"$",
"field",
",",
"$",
"newField",
",",
"$",
"tableSet",
"=",
"null",
")",
"{",
"$",
"res",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb... | Get sql for new multi-language field index creation
@param string $table core table name
@param string $field field name
@param string $newField new field name
@param string $tableSet table to change (if not set take core table)
@return string | [
"Get",
"sql",
"for",
"new",
"multi",
"-",
"language",
"field",
"index",
"creation"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DbMetaDataHandler.php#L275-L314 | train |
OXID-eSales/oxideshop_ce | source/Core/DbMetaDataHandler.php | DbMetaDataHandler.getCurrentMaxLangId | public function getCurrentMaxLangId()
{
if (isset($this->_iCurrentMaxLangId)) {
return $this->_iCurrentMaxLangId;
}
$table = $tableSet = "oxarticles";
$field = $fieldSet = "oxtitle";
$lang = 0;
while ($this->tableExists($tableSet) && $this->fieldExists($fieldSet, $tableSet)) {
$lang++;
$tableSet = getLangTableName($table, $lang);
$fieldSet = $field . '_' . $lang;
}
return $this->_iCurrentMaxLangId = --$lang;
} | php | public function getCurrentMaxLangId()
{
if (isset($this->_iCurrentMaxLangId)) {
return $this->_iCurrentMaxLangId;
}
$table = $tableSet = "oxarticles";
$field = $fieldSet = "oxtitle";
$lang = 0;
while ($this->tableExists($tableSet) && $this->fieldExists($fieldSet, $tableSet)) {
$lang++;
$tableSet = getLangTableName($table, $lang);
$fieldSet = $field . '_' . $lang;
}
return $this->_iCurrentMaxLangId = --$lang;
} | [
"public",
"function",
"getCurrentMaxLangId",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_iCurrentMaxLangId",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_iCurrentMaxLangId",
";",
"}",
"$",
"table",
"=",
"$",
"tableSet",
"=",
"\"oxarticles... | Get max language ID used in shop. For checking is used table "oxarticle"
field "oxtitle"
@return int | [
"Get",
"max",
"language",
"ID",
"used",
"in",
"shop",
".",
"For",
"checking",
"is",
"used",
"table",
"oxarticle",
"field",
"oxtitle"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DbMetaDataHandler.php#L322-L338 | train |
OXID-eSales/oxideshop_ce | source/Core/DbMetaDataHandler.php | DbMetaDataHandler.getMultilangFields | public function getMultilangFields($table)
{
$fields = $this->getFields($table);
$multiLangFields = [];
foreach ($fields as $field) {
if (preg_match("/({$table}\.)?(?<field>.+)_1$/", $field, $matches)) {
$multiLangFields[] = $matches['field'];
}
}
return $multiLangFields;
} | php | public function getMultilangFields($table)
{
$fields = $this->getFields($table);
$multiLangFields = [];
foreach ($fields as $field) {
if (preg_match("/({$table}\.)?(?<field>.+)_1$/", $field, $matches)) {
$multiLangFields[] = $matches['field'];
}
}
return $multiLangFields;
} | [
"public",
"function",
"getMultilangFields",
"(",
"$",
"table",
")",
"{",
"$",
"fields",
"=",
"$",
"this",
"->",
"getFields",
"(",
"$",
"table",
")",
";",
"$",
"multiLangFields",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"field",
"... | Get table multi-language fields
@param string $table table name
@return array | [
"Get",
"table",
"multi",
"-",
"language",
"fields"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DbMetaDataHandler.php#L357-L369 | train |
OXID-eSales/oxideshop_ce | source/Core/DbMetaDataHandler.php | DbMetaDataHandler.getSinglelangFields | public function getSinglelangFields($table, $lang)
{
$langTable = getLangTableName($table, $lang);
$baseFields = $this->getFields($table);
$langFields = $this->getFields($langTable);
//Some fields (for example OXID) must be taken from core table.
$langFields = $this->filterCoreFields($langFields);
$fields = array_merge($baseFields, $langFields);
$singleLangFields = [];
foreach ($fields as $fieldName => $field) {
if (preg_match("/(({$table}|{$langTable})\.)?(?<field>.+)_(?<lang>[0-9]+)$/", $field, $matches)) {
if ($matches['lang'] == $lang) {
$singleLangFields[$matches['field']] = $field;
}
} else {
$singleLangFields[$fieldName] = $field;
}
}
return $singleLangFields;
} | php | public function getSinglelangFields($table, $lang)
{
$langTable = getLangTableName($table, $lang);
$baseFields = $this->getFields($table);
$langFields = $this->getFields($langTable);
//Some fields (for example OXID) must be taken from core table.
$langFields = $this->filterCoreFields($langFields);
$fields = array_merge($baseFields, $langFields);
$singleLangFields = [];
foreach ($fields as $fieldName => $field) {
if (preg_match("/(({$table}|{$langTable})\.)?(?<field>.+)_(?<lang>[0-9]+)$/", $field, $matches)) {
if ($matches['lang'] == $lang) {
$singleLangFields[$matches['field']] = $field;
}
} else {
$singleLangFields[$fieldName] = $field;
}
}
return $singleLangFields;
} | [
"public",
"function",
"getSinglelangFields",
"(",
"$",
"table",
",",
"$",
"lang",
")",
"{",
"$",
"langTable",
"=",
"getLangTableName",
"(",
"$",
"table",
",",
"$",
"lang",
")",
";",
"$",
"baseFields",
"=",
"$",
"this",
"->",
"getFields",
"(",
"$",
"tab... | Get single language fields
@param string $table table name
@param int $lang language id
@return array | [
"Get",
"single",
"language",
"fields"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DbMetaDataHandler.php#L379-L403 | train |
OXID-eSales/oxideshop_ce | source/Core/DbMetaDataHandler.php | DbMetaDataHandler.ensureAllMultiLanguageFields | public function ensureAllMultiLanguageFields($table)
{
$max = $this->getCurrentMaxLangId();
for ($index = 1; $index <= $max; $index++) {
$this->ensureMultiLanguageFields($table, $index);
}
} | php | public function ensureAllMultiLanguageFields($table)
{
$max = $this->getCurrentMaxLangId();
for ($index = 1; $index <= $max; $index++) {
$this->ensureMultiLanguageFields($table, $index);
}
} | [
"public",
"function",
"ensureAllMultiLanguageFields",
"(",
"$",
"table",
")",
"{",
"$",
"max",
"=",
"$",
"this",
"->",
"getCurrentMaxLangId",
"(",
")",
";",
"for",
"(",
"$",
"index",
"=",
"1",
";",
"$",
"index",
"<=",
"$",
"max",
";",
"$",
"index",
"... | Ensure, that all multi language fields of the given table are present.
@param string $table The table we want to assure, that the multi language fields are present. | [
"Ensure",
"that",
"all",
"multi",
"language",
"fields",
"of",
"the",
"given",
"table",
"are",
"present",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DbMetaDataHandler.php#L423-L430 | train |
OXID-eSales/oxideshop_ce | source/Core/DbMetaDataHandler.php | DbMetaDataHandler.resetMultilangFields | public function resetMultilangFields($langId, $tableName)
{
$langId = (int) $langId;
if ($langId === 0) {
return;
}
$sql = [];
$fields = $this->getMultilangFields($tableName);
if (is_array($fields) && count($fields) > 0) {
foreach ($fields as $fieldName) {
$fieldName = $fieldName . "_" . $langId;
if ($this->fieldExists($fieldName, $tableName)) {
//resetting field value to default
$sql[] = "UPDATE {$tableName} SET {$fieldName} = DEFAULT;";
}
}
}
if (!empty($sql)) {
$this->executeSql($sql);
}
} | php | public function resetMultilangFields($langId, $tableName)
{
$langId = (int) $langId;
if ($langId === 0) {
return;
}
$sql = [];
$fields = $this->getMultilangFields($tableName);
if (is_array($fields) && count($fields) > 0) {
foreach ($fields as $fieldName) {
$fieldName = $fieldName . "_" . $langId;
if ($this->fieldExists($fieldName, $tableName)) {
//resetting field value to default
$sql[] = "UPDATE {$tableName} SET {$fieldName} = DEFAULT;";
}
}
}
if (!empty($sql)) {
$this->executeSql($sql);
}
} | [
"public",
"function",
"resetMultilangFields",
"(",
"$",
"langId",
",",
"$",
"tableName",
")",
"{",
"$",
"langId",
"=",
"(",
"int",
")",
"$",
"langId",
";",
"if",
"(",
"$",
"langId",
"===",
"0",
")",
"{",
"return",
";",
"}",
"$",
"sql",
"=",
"[",
... | Resetting all multi-language fields with specific language id
to default value in selected table
@param int $langId Language id
@param string $tableName Table name
@return null | [
"Resetting",
"all",
"multi",
"-",
"language",
"fields",
"with",
"specific",
"language",
"id",
"to",
"default",
"value",
"in",
"selected",
"table"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DbMetaDataHandler.php#L441-L466 | train |
OXID-eSales/oxideshop_ce | source/Core/DbMetaDataHandler.php | DbMetaDataHandler.addNewLangToDb | public function addNewLangToDb()
{
//reset max count
$this->_iCurrentMaxLangId = null;
$table = $this->getAllTables();
foreach ($table as $tableName) {
$this->addNewMultilangField($tableName);
}
//updating views
$this->updateViews();
} | php | public function addNewLangToDb()
{
//reset max count
$this->_iCurrentMaxLangId = null;
$table = $this->getAllTables();
foreach ($table as $tableName) {
$this->addNewMultilangField($tableName);
}
//updating views
$this->updateViews();
} | [
"public",
"function",
"addNewLangToDb",
"(",
")",
"{",
"//reset max count",
"$",
"this",
"->",
"_iCurrentMaxLangId",
"=",
"null",
";",
"$",
"table",
"=",
"$",
"this",
"->",
"getAllTables",
"(",
")",
";",
"foreach",
"(",
"$",
"table",
"as",
"$",
"tableName"... | Add new language to database. Scans all tables and adds new
multi-language fields | [
"Add",
"new",
"language",
"to",
"database",
".",
"Scans",
"all",
"tables",
"and",
"adds",
"new",
"multi",
"-",
"language",
"fields"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DbMetaDataHandler.php#L472-L485 | train |
OXID-eSales/oxideshop_ce | source/Core/DbMetaDataHandler.php | DbMetaDataHandler.resetLanguage | public function resetLanguage($langId)
{
if ((int) $langId === 0) {
return;
}
$tables = $this->getAllTables();
// removing tables which does not requires reset
foreach ($this->_aSkipTablesOnReset as $skipTable) {
if (($skipId = array_search($skipTable, $tables)) !== false) {
unset($tables[$skipId]);
}
}
foreach ($tables as $tableName) {
$this->resetMultilangFields($langId, $tableName);
}
} | php | public function resetLanguage($langId)
{
if ((int) $langId === 0) {
return;
}
$tables = $this->getAllTables();
// removing tables which does not requires reset
foreach ($this->_aSkipTablesOnReset as $skipTable) {
if (($skipId = array_search($skipTable, $tables)) !== false) {
unset($tables[$skipId]);
}
}
foreach ($tables as $tableName) {
$this->resetMultilangFields($langId, $tableName);
}
} | [
"public",
"function",
"resetLanguage",
"(",
"$",
"langId",
")",
"{",
"if",
"(",
"(",
"int",
")",
"$",
"langId",
"===",
"0",
")",
"{",
"return",
";",
"}",
"$",
"tables",
"=",
"$",
"this",
"->",
"getAllTables",
"(",
")",
";",
"// removing tables which do... | Resetting all multi-language fields with specific language id
to default value in all tables. Only if language ID > 0.
@param int $langId Language id
@return null | [
"Resetting",
"all",
"multi",
"-",
"language",
"fields",
"with",
"specific",
"language",
"id",
"to",
"default",
"value",
"in",
"all",
"tables",
".",
"Only",
"if",
"language",
"ID",
">",
"0",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DbMetaDataHandler.php#L495-L513 | train |
OXID-eSales/oxideshop_ce | source/Core/DbMetaDataHandler.php | DbMetaDataHandler.executeSql | public function executeSql($queries)
{
$db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
if (is_array($queries) && !empty($queries)) {
foreach ($queries as $query) {
$query = trim($query);
if (!empty($query)) {
$db->execute($query);
}
}
}
} | php | public function executeSql($queries)
{
$db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
if (is_array($queries) && !empty($queries)) {
foreach ($queries as $query) {
$query = trim($query);
if (!empty($query)) {
$db->execute($query);
}
}
}
} | [
"public",
"function",
"executeSql",
"(",
"$",
"queries",
")",
"{",
"$",
"db",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"queries",
")",
"&&",
"!",
"e... | Executes array of sql strings
@param array $queries SQL query array | [
"Executes",
"array",
"of",
"sql",
"strings"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DbMetaDataHandler.php#L520-L532 | train |
OXID-eSales/oxideshop_ce | source/Core/DbMetaDataHandler.php | DbMetaDataHandler.updateViews | public function updateViews($tables = null)
{
set_time_limit(0);
$db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$configFile = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Core\ConfigFile::class);
$originalSkipViewUsageStatus = $configFile->getVar('blSkipViewUsage');
$this->setConfigToDoNotUseViews($config);
$this->safeGuardAdditionalMultiLanguageTables();
$shops = $db->getAll("select * from oxshops");
$tables = $tables ? $tables : $config->getConfigParam('aMultiShopTables');
$success = true;
foreach ($shops as $shopValues) {
$shopId = $shopValues[0];
$shop = oxNew(\OxidEsales\Eshop\Application\Model\Shop::class);
$shop->load($shopId);
$shop->setMultiShopTables($tables);
$mallInherit = [];
foreach ($tables as $table) {
$mallInherit[$table] = $config->getShopConfVar('blMallInherit_' . $table, $shopId);
}
if (!$shop->generateViews(false, $mallInherit) && $success) {
$success = false;
}
}
$config->setConfigParam('blSkipViewUsage', $originalSkipViewUsageStatus);
return $success;
} | php | public function updateViews($tables = null)
{
set_time_limit(0);
$db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$configFile = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Core\ConfigFile::class);
$originalSkipViewUsageStatus = $configFile->getVar('blSkipViewUsage');
$this->setConfigToDoNotUseViews($config);
$this->safeGuardAdditionalMultiLanguageTables();
$shops = $db->getAll("select * from oxshops");
$tables = $tables ? $tables : $config->getConfigParam('aMultiShopTables');
$success = true;
foreach ($shops as $shopValues) {
$shopId = $shopValues[0];
$shop = oxNew(\OxidEsales\Eshop\Application\Model\Shop::class);
$shop->load($shopId);
$shop->setMultiShopTables($tables);
$mallInherit = [];
foreach ($tables as $table) {
$mallInherit[$table] = $config->getShopConfVar('blMallInherit_' . $table, $shopId);
}
if (!$shop->generateViews(false, $mallInherit) && $success) {
$success = false;
}
}
$config->setConfigParam('blSkipViewUsage', $originalSkipViewUsageStatus);
return $success;
} | [
"public",
"function",
"updateViews",
"(",
"$",
"tables",
"=",
"null",
")",
"{",
"set_time_limit",
"(",
"0",
")",
";",
"$",
"db",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
")",
";",
"$",
"config"... | Updates all views
@param array $tables array of DB table name that can store different data per shop like oxArticle
@return bool | [
"Updates",
"all",
"views"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DbMetaDataHandler.php#L541-L577 | train |
OXID-eSales/oxideshop_ce | source/Core/Form/FormFieldsTrimmer.php | FormFieldsTrimmer.trim | public function trim(EshopFormFields $fields)
{
$updatableFields = $fields->getUpdatableFields();
array_walk_recursive($updatableFields, function (&$value) {
$value = $this->isTrimmableField($value) ? $this->trimField($value) : $value;
});
return $updatableFields;
} | php | public function trim(EshopFormFields $fields)
{
$updatableFields = $fields->getUpdatableFields();
array_walk_recursive($updatableFields, function (&$value) {
$value = $this->isTrimmableField($value) ? $this->trimField($value) : $value;
});
return $updatableFields;
} | [
"public",
"function",
"trim",
"(",
"EshopFormFields",
"$",
"fields",
")",
"{",
"$",
"updatableFields",
"=",
"$",
"fields",
"->",
"getUpdatableFields",
"(",
")",
";",
"array_walk_recursive",
"(",
"$",
"updatableFields",
",",
"function",
"(",
"&",
"$",
"value",
... | Returns trimmed fields.
@param EshopFormFields $fields to trim.
@return array | [
"Returns",
"trimmed",
"fields",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Form/FormFieldsTrimmer.php#L24-L33 | train |
OXID-eSales/oxideshop_ce | source/Internal/Console/CommandsProvider/ServicesCommandsProvider.php | ServicesCommandsProvider.setShopAwareCommands | private function setShopAwareCommands(Command $service)
{
if ($service instanceof AbstractShopAwareCommand && $service->isActive()) {
$this->commands[] = $service;
}
} | php | private function setShopAwareCommands(Command $service)
{
if ($service instanceof AbstractShopAwareCommand && $service->isActive()) {
$this->commands[] = $service;
}
} | [
"private",
"function",
"setShopAwareCommands",
"(",
"Command",
"$",
"service",
")",
"{",
"if",
"(",
"$",
"service",
"instanceof",
"AbstractShopAwareCommand",
"&&",
"$",
"service",
"->",
"isActive",
"(",
")",
")",
"{",
"$",
"this",
"->",
"commands",
"[",
"]",... | Set commands for modules.
@param Command $service | [
"Set",
"commands",
"for",
"modules",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Internal/Console/CommandsProvider/ServicesCommandsProvider.php#L57-L62 | train |
OXID-eSales/oxideshop_ce | source/Internal/Console/CommandsProvider/ServicesCommandsProvider.php | ServicesCommandsProvider.setNonShopAwareCommands | private function setNonShopAwareCommands(Command $service)
{
if (!$service instanceof AbstractShopAwareCommand && $service instanceof Command) {
$this->commands[] = $service;
}
} | php | private function setNonShopAwareCommands(Command $service)
{
if (!$service instanceof AbstractShopAwareCommand && $service instanceof Command) {
$this->commands[] = $service;
}
} | [
"private",
"function",
"setNonShopAwareCommands",
"(",
"Command",
"$",
"service",
")",
"{",
"if",
"(",
"!",
"$",
"service",
"instanceof",
"AbstractShopAwareCommand",
"&&",
"$",
"service",
"instanceof",
"Command",
")",
"{",
"$",
"this",
"->",
"commands",
"[",
"... | Sets commands which should be shown independently from active shop.
@param Command $service | [
"Sets",
"commands",
"which",
"should",
"be",
"shown",
"independently",
"from",
"active",
"shop",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Internal/Console/CommandsProvider/ServicesCommandsProvider.php#L69-L74 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/AmountPriceList.php | AmountPriceList.load | public function load($article)
{
$this->setArticle($article);
$aData = $this->_loadFromDb();
$this->assignArray($aData);
} | php | public function load($article)
{
$this->setArticle($article);
$aData = $this->_loadFromDb();
$this->assignArray($aData);
} | [
"public",
"function",
"load",
"(",
"$",
"article",
")",
"{",
"$",
"this",
"->",
"setArticle",
"(",
"$",
"article",
")",
";",
"$",
"aData",
"=",
"$",
"this",
"->",
"_loadFromDb",
"(",
")",
";",
"$",
"this",
"->",
"assignArray",
"(",
"$",
"aData",
")... | Load category list data
@param \OxidEsales\Eshop\Application\Model\Article $article Article | [
"Load",
"category",
"list",
"data"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/AmountPriceList.php#L65-L72 | train |
OXID-eSales/oxideshop_ce | source/Core/OnlineModuleVersionNotifier.php | OnlineModuleVersionNotifier.versionNotify | public function versionNotify()
{
if (true === \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('preventModuleVersionNotify')) {
return;
}
$oOMNCaller = $this->_getOnlineModuleNotifierCaller();
$oOMNCaller->doRequest($this->_formRequest());
} | php | public function versionNotify()
{
if (true === \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('preventModuleVersionNotify')) {
return;
}
$oOMNCaller = $this->_getOnlineModuleNotifierCaller();
$oOMNCaller->doRequest($this->_formRequest());
} | [
"public",
"function",
"versionNotify",
"(",
")",
"{",
"if",
"(",
"true",
"===",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getConfigParam",
"(",
"'preventModuleVersionNotify'",
")",
")",
"{",
"retur... | Perform Online Module version Notification. Returns result
@return null | [
"Perform",
"Online",
"Module",
"version",
"Notification",
".",
"Returns",
"result"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/OnlineModuleVersionNotifier.php#L49-L57 | train |
OXID-eSales/oxideshop_ce | source/Core/OnlineModuleVersionNotifier.php | OnlineModuleVersionNotifier._prepareModulesInformation | protected function _prepareModulesInformation()
{
$aPreparedModules = [];
$aModules = $this->_getModules();
foreach ($aModules as $oModule) {
/** @var \OxidEsales\Eshop\Core\Module\Module $oModule */
$oPreparedModule = new stdClass();
$oPreparedModule->id = $oModule->getId();
$oPreparedModule->version = $oModule->getInfo('version');
$oPreparedModule->activeInShops = new stdClass();
$oPreparedModule->activeInShops->activeInShop = [];
if ($oModule->isActive()) {
$oPreparedModule->activeInShops->activeInShop[] = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopUrl();
}
$aPreparedModules[] = $oPreparedModule;
}
return $aPreparedModules;
} | php | protected function _prepareModulesInformation()
{
$aPreparedModules = [];
$aModules = $this->_getModules();
foreach ($aModules as $oModule) {
/** @var \OxidEsales\Eshop\Core\Module\Module $oModule */
$oPreparedModule = new stdClass();
$oPreparedModule->id = $oModule->getId();
$oPreparedModule->version = $oModule->getInfo('version');
$oPreparedModule->activeInShops = new stdClass();
$oPreparedModule->activeInShops->activeInShop = [];
if ($oModule->isActive()) {
$oPreparedModule->activeInShops->activeInShop[] = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopUrl();
}
$aPreparedModules[] = $oPreparedModule;
}
return $aPreparedModules;
} | [
"protected",
"function",
"_prepareModulesInformation",
"(",
")",
"{",
"$",
"aPreparedModules",
"=",
"[",
"]",
";",
"$",
"aModules",
"=",
"$",
"this",
"->",
"_getModules",
"(",
")",
";",
"foreach",
"(",
"$",
"aModules",
"as",
"$",
"oModule",
")",
"{",
"/*... | Collects only required modules information and returns as array.
@return null | [
"Collects",
"only",
"required",
"modules",
"information",
"and",
"returns",
"as",
"array",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/OnlineModuleVersionNotifier.php#L64-L84 | train |
OXID-eSales/oxideshop_ce | source/Core/OnlineModuleVersionNotifier.php | OnlineModuleVersionNotifier._formRequest | protected function _formRequest()
{
$oRequestParams = new \OxidEsales\Eshop\Core\OnlineModulesNotifierRequest();
$oRequestParams->modules = new stdClass();
$oRequestParams->modules->module = $this->_prepareModulesInformation();
return $oRequestParams;
} | php | protected function _formRequest()
{
$oRequestParams = new \OxidEsales\Eshop\Core\OnlineModulesNotifierRequest();
$oRequestParams->modules = new stdClass();
$oRequestParams->modules->module = $this->_prepareModulesInformation();
return $oRequestParams;
} | [
"protected",
"function",
"_formRequest",
"(",
")",
"{",
"$",
"oRequestParams",
"=",
"new",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"OnlineModulesNotifierRequest",
"(",
")",
";",
"$",
"oRequestParams",
"->",
"modules",
"=",
"new",
"stdClass",
"("... | Send request message to Online Module Version Notifier web service.
@return oxOnlineModulesNotifierRequest | [
"Send",
"request",
"message",
"to",
"Online",
"Module",
"Version",
"Notifier",
"web",
"service",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/OnlineModuleVersionNotifier.php#L91-L99 | train |
OXID-eSales/oxideshop_ce | source/Core/Service/ApplicationServerExporter.php | ApplicationServerExporter.exportAppServerList | public function exportAppServerList()
{
$activeServerCollection = [];
$activeServers = $this->appServerService->loadActiveAppServerList();
if (is_array($activeServers) && !empty($activeServers)) {
foreach ($activeServers as $server) {
$activeServerCollection[] = $this->convertToArray($server);
}
}
return $activeServerCollection;
} | php | public function exportAppServerList()
{
$activeServerCollection = [];
$activeServers = $this->appServerService->loadActiveAppServerList();
if (is_array($activeServers) && !empty($activeServers)) {
foreach ($activeServers as $server) {
$activeServerCollection[] = $this->convertToArray($server);
}
}
return $activeServerCollection;
} | [
"public",
"function",
"exportAppServerList",
"(",
")",
"{",
"$",
"activeServerCollection",
"=",
"[",
"]",
";",
"$",
"activeServers",
"=",
"$",
"this",
"->",
"appServerService",
"->",
"loadActiveAppServerList",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
... | Return an array of active application servers.
@return array | [
"Return",
"an",
"array",
"of",
"active",
"application",
"servers",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Service/ApplicationServerExporter.php#L39-L51 | train |
OXID-eSales/oxideshop_ce | source/Core/Service/ApplicationServerExporter.php | ApplicationServerExporter.convertToArray | private function convertToArray($server)
{
$activeServer = [
'id' => $server->getId(),
'ip' => $server->getIp(),
'lastFrontendUsage' => $server->getLastFrontendUsage(),
'lastAdminUsage' => $server->getLastAdminUsage()
];
return $activeServer;
} | php | private function convertToArray($server)
{
$activeServer = [
'id' => $server->getId(),
'ip' => $server->getIp(),
'lastFrontendUsage' => $server->getLastFrontendUsage(),
'lastAdminUsage' => $server->getLastAdminUsage()
];
return $activeServer;
} | [
"private",
"function",
"convertToArray",
"(",
"$",
"server",
")",
"{",
"$",
"activeServer",
"=",
"[",
"'id'",
"=>",
"$",
"server",
"->",
"getId",
"(",
")",
",",
"'ip'",
"=>",
"$",
"server",
"->",
"getIp",
"(",
")",
",",
"'lastFrontendUsage'",
"=>",
"$"... | Converts ApplicationServer object into array for export.
@param \OxidEsales\Eshop\Core\DataObject\ApplicationServer $server
@return array | [
"Converts",
"ApplicationServer",
"object",
"into",
"array",
"for",
"export",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Service/ApplicationServerExporter.php#L60-L69 | train |
OXID-eSales/oxideshop_ce | source/Core/Module/ModuleMetadataValidator.php | ModuleMetadataValidator.validate | public function validate(\OxidEsales\Eshop\Core\Module\Module $module)
{
return file_exists($module->getMetadataPath());
} | php | public function validate(\OxidEsales\Eshop\Core\Module\Module $module)
{
return file_exists($module->getMetadataPath());
} | [
"public",
"function",
"validate",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Module",
"\\",
"Module",
"$",
"module",
")",
"{",
"return",
"file_exists",
"(",
"$",
"module",
"->",
"getMetadataPath",
"(",
")",
")",
";",
"}"
] | Validates module metadata.
Return true if module metadata is valid.
Return false if module metadata is not valid, or if metadata file does not exist.
@param \OxidEsales\Eshop\Core\Module\Module $module object to validate metadata.
@return bool | [
"Validates",
"module",
"metadata",
".",
"Return",
"true",
"if",
"module",
"metadata",
"is",
"valid",
".",
"Return",
"false",
"if",
"module",
"metadata",
"is",
"not",
"valid",
"or",
"if",
"metadata",
"file",
"does",
"not",
"exist",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Module/ModuleMetadataValidator.php#L30-L33 | train |
OXID-eSales/oxideshop_ce | source/Core/Module/ModuleMetadataValidator.php | ModuleMetadataValidator.checkModuleExtensionsForIncorrectNamespaceClasses | public function checkModuleExtensionsForIncorrectNamespaceClasses(\OxidEsales\Eshop\Core\Module\Module $module)
{
$incorrect = $this->getIncorrectExtensions($module);
if (!empty($incorrect)) {
$message = $this->prepareMessage('MODULE_METADATA_PROBLEMATIC_DATA_IN_EXTEND', $incorrect);
throw new \OxidEsales\Eshop\Core\Exception\ModuleValidationException($message);
}
} | php | public function checkModuleExtensionsForIncorrectNamespaceClasses(\OxidEsales\Eshop\Core\Module\Module $module)
{
$incorrect = $this->getIncorrectExtensions($module);
if (!empty($incorrect)) {
$message = $this->prepareMessage('MODULE_METADATA_PROBLEMATIC_DATA_IN_EXTEND', $incorrect);
throw new \OxidEsales\Eshop\Core\Exception\ModuleValidationException($message);
}
} | [
"public",
"function",
"checkModuleExtensionsForIncorrectNamespaceClasses",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Module",
"\\",
"Module",
"$",
"module",
")",
"{",
"$",
"incorrect",
"=",
"$",
"this",
"->",
"getIncorrectExtensions",
"(",
"$",
... | Check module metadata for incorrect namespace shop classes.
Class might be misspelled or not found in Unified Namespace.
@param \OxidEsales\Eshop\Core\Module\Module $module
@throws \OxidEsales\Eshop\Core\Exception\ModuleValidationException | [
"Check",
"module",
"metadata",
"for",
"incorrect",
"namespace",
"shop",
"classes",
".",
"Class",
"might",
"be",
"misspelled",
"or",
"not",
"found",
"in",
"Unified",
"Namespace",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Module/ModuleMetadataValidator.php#L43-L50 | train |
OXID-eSales/oxideshop_ce | source/Core/Module/ModuleMetadataValidator.php | ModuleMetadataValidator.getIncorrectExtensions | public function getIncorrectExtensions(\OxidEsales\Eshop\Core\Module\Module $module)
{
$incorrect = [];
$rawExtensions = $module->getExtensions();
foreach ($rawExtensions as $classToBePatched => $moduleClass) {
if (NamespaceInformationProvider::isNamespacedClass($classToBePatched)
&& (NamespaceInformationProvider::classBelongsToShopEditionNamespace($classToBePatched)
|| (NamespaceInformationProvider::classBelongsToShopUnifiedNamespace($classToBePatched) && !class_exists($classToBePatched))
)
) {
$incorrect[$classToBePatched] = $moduleClass;
}
}
return $incorrect;
} | php | public function getIncorrectExtensions(\OxidEsales\Eshop\Core\Module\Module $module)
{
$incorrect = [];
$rawExtensions = $module->getExtensions();
foreach ($rawExtensions as $classToBePatched => $moduleClass) {
if (NamespaceInformationProvider::isNamespacedClass($classToBePatched)
&& (NamespaceInformationProvider::classBelongsToShopEditionNamespace($classToBePatched)
|| (NamespaceInformationProvider::classBelongsToShopUnifiedNamespace($classToBePatched) && !class_exists($classToBePatched))
)
) {
$incorrect[$classToBePatched] = $moduleClass;
}
}
return $incorrect;
} | [
"public",
"function",
"getIncorrectExtensions",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Module",
"\\",
"Module",
"$",
"module",
")",
"{",
"$",
"incorrect",
"=",
"[",
"]",
";",
"$",
"rawExtensions",
"=",
"$",
"module",
"->",
"getExtensi... | Getter for possible incorrect extension info in metadata.php.
If the module patches a namespace class it must either belong to the shop
Unified Namespace or to another module.
@param \OxidEsales\Eshop\Core\Module\Module $module
@return array | [
"Getter",
"for",
"possible",
"incorrect",
"extension",
"info",
"in",
"metadata",
".",
"php",
".",
"If",
"the",
"module",
"patches",
"a",
"namespace",
"class",
"it",
"must",
"either",
"belong",
"to",
"the",
"shop",
"Unified",
"Namespace",
"or",
"to",
"another... | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Module/ModuleMetadataValidator.php#L61-L76 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DeliverySetMain.php | DeliverySetMain.save | public function save()
{
parent::save();
$soxId = $this->getEditObjectId();
$aParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editval");
$oDelSet = oxNew(\OxidEsales\Eshop\Application\Model\DeliverySet::class);
if ($soxId != "-1") {
$oDelSet->loadInLang($this->_iEditLang, $soxId);
} else {
$aParams['oxdeliveryset__oxid'] = null;
}
// checkbox handling
if (!isset($aParams['oxdeliveryset__oxactive'])) {
$aParams['oxdeliveryset__oxactive'] = 0;
}
//Disable editing for derived articles
if ($oDelSet->isDerived()) {
return;
}
//$aParams = $oDelSet->ConvertNameArray2Idx( $aParams);
$oDelSet->setLanguage(0);
$oDelSet->assign($aParams);
$oDelSet->setLanguage($this->_iEditLang);
$oDelSet = \OxidEsales\Eshop\Core\Registry::getUtilsFile()->processFiles($oDelSet);
$oDelSet->save();
// set oxid if inserted
$this->setEditObjectId($oDelSet->getId());
} | php | public function save()
{
parent::save();
$soxId = $this->getEditObjectId();
$aParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editval");
$oDelSet = oxNew(\OxidEsales\Eshop\Application\Model\DeliverySet::class);
if ($soxId != "-1") {
$oDelSet->loadInLang($this->_iEditLang, $soxId);
} else {
$aParams['oxdeliveryset__oxid'] = null;
}
// checkbox handling
if (!isset($aParams['oxdeliveryset__oxactive'])) {
$aParams['oxdeliveryset__oxactive'] = 0;
}
//Disable editing for derived articles
if ($oDelSet->isDerived()) {
return;
}
//$aParams = $oDelSet->ConvertNameArray2Idx( $aParams);
$oDelSet->setLanguage(0);
$oDelSet->assign($aParams);
$oDelSet->setLanguage($this->_iEditLang);
$oDelSet = \OxidEsales\Eshop\Core\Registry::getUtilsFile()->processFiles($oDelSet);
$oDelSet->save();
// set oxid if inserted
$this->setEditObjectId($oDelSet->getId());
} | [
"public",
"function",
"save",
"(",
")",
"{",
"parent",
"::",
"save",
"(",
")",
";",
"$",
"soxId",
"=",
"$",
"this",
"->",
"getEditObjectId",
"(",
")",
";",
"$",
"aParams",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
... | Saves deliveryset information changes.
@return mixed | [
"Saves",
"deliveryset",
"information",
"changes",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DeliverySetMain.php#L77-L111 | train |
OXID-eSales/oxideshop_ce | source/Core/CompanyVatInValidator.php | CompanyVatInValidator.validate | public function validate(\OxidEsales\Eshop\Application\Model\CompanyVatIn $companyVatNumber)
{
$result = false;
$validators = $this->getCheckers();
foreach ($validators as $validator) {
$result = true;
if ($validator instanceof \OxidEsales\Eshop\Core\Contract\ICountryAware) {
$validator->setCountry($this->getCountry());
}
if (!$validator->validate($companyVatNumber)) {
$result = false;
$this->setError($validator->getError());
break;
}
}
return $result;
} | php | public function validate(\OxidEsales\Eshop\Application\Model\CompanyVatIn $companyVatNumber)
{
$result = false;
$validators = $this->getCheckers();
foreach ($validators as $validator) {
$result = true;
if ($validator instanceof \OxidEsales\Eshop\Core\Contract\ICountryAware) {
$validator->setCountry($this->getCountry());
}
if (!$validator->validate($companyVatNumber)) {
$result = false;
$this->setError($validator->getError());
break;
}
}
return $result;
} | [
"public",
"function",
"validate",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
"\\",
"CompanyVatIn",
"$",
"companyVatNumber",
")",
"{",
"$",
"result",
"=",
"false",
";",
"$",
"validators",
"=",
"$",
"this",
"->",
"getCheckers",... | Validate company VAT identification number.
@param \OxidEsales\Eshop\Application\Model\CompanyVatIn $companyVatNumber
@return bool | [
"Validate",
"company",
"VAT",
"identification",
"number",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/CompanyVatInValidator.php#L110-L129 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ArticleAccessoriesAjax.php | ArticleAccessoriesAjax.addArticleAcc | public function addArticleAcc()
{
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$aChosenArt = $this->_getActionIds('oxarticles.oxid');
$soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');
// adding
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) {
$sArtTable = $this->_getViewName('oxarticles');
$aChosenArt = $this->_getAll(parent::_addFilter("select $sArtTable.oxid " . $this->_getQuery()));
}
if ($oArticle->load($soxId) && $soxId && $soxId != "-1" && is_array($aChosenArt)) {
foreach ($aChosenArt as $sChosenArt) {
$oNewGroup = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
$oNewGroup->init("oxaccessoire2article");
$oNewGroup->oxaccessoire2article__oxobjectid = new \OxidEsales\Eshop\Core\Field($sChosenArt);
$oNewGroup->oxaccessoire2article__oxarticlenid = new \OxidEsales\Eshop\Core\Field($oArticle->oxarticles__oxid->value);
$oNewGroup->oxaccessoire2article__oxsort = new \OxidEsales\Eshop\Core\Field(0);
$oNewGroup->save();
}
$this->onArticleAccessoryRelationChange($oArticle);
}
} | php | public function addArticleAcc()
{
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$aChosenArt = $this->_getActionIds('oxarticles.oxid');
$soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');
// adding
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) {
$sArtTable = $this->_getViewName('oxarticles');
$aChosenArt = $this->_getAll(parent::_addFilter("select $sArtTable.oxid " . $this->_getQuery()));
}
if ($oArticle->load($soxId) && $soxId && $soxId != "-1" && is_array($aChosenArt)) {
foreach ($aChosenArt as $sChosenArt) {
$oNewGroup = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
$oNewGroup->init("oxaccessoire2article");
$oNewGroup->oxaccessoire2article__oxobjectid = new \OxidEsales\Eshop\Core\Field($sChosenArt);
$oNewGroup->oxaccessoire2article__oxarticlenid = new \OxidEsales\Eshop\Core\Field($oArticle->oxarticles__oxid->value);
$oNewGroup->oxaccessoire2article__oxsort = new \OxidEsales\Eshop\Core\Field(0);
$oNewGroup->save();
}
$this->onArticleAccessoryRelationChange($oArticle);
}
} | [
"public",
"function",
"addArticleAcc",
"(",
")",
"{",
"$",
"oArticle",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
"\\",
"Article",
"::",
"class",
")",
";",
"$",
"aChosenArt",
"=",
"$",
"this",
"->",
"_getAct... | Adding article to accessories article list | [
"Adding",
"article",
"to",
"accessories",
"article",
"list"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleAccessoriesAjax.php#L149-L173 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ArticleAccessoriesAjax.php | ArticleAccessoriesAjax.sortAccessoriesList | public function sortAccessoriesList()
{
$oxidRelationId = Registry::getConfig()->getRequestEscapedParameter('oxid');
$selectedIdForSort = Registry::getConfig()->getRequestEscapedParameter('sortoxid');
$sortDirection = Registry::getConfig()->getRequestEscapedParameter('direction');
$accessoriesList = oxNew(ListModel::class);
$accessoriesList->init("oxbase", "oxaccessoire2article");
$sortQuery = "select * from oxaccessoire2article where OXARTICLENID= " . DatabaseProvider::getDb()->quote($oxidRelationId) . " order by oxsort,oxid";
$accessoriesList->selectString($sortQuery);
$rebuildList = $this->rebuildAccessoriesSortIndexes($accessoriesList);
if (($selectedPosition = array_search($selectedIdForSort, $rebuildList)) !== false) {
$selectedSortRecord = $accessoriesList->offsetGet($rebuildList[$selectedPosition]);
$currentPosition = $selectedSortRecord->oxaccessoire2article__oxsort->value;
// get current selected row sort position
if (($sortDirection == 'up' && $currentPosition > 0) || ($sortDirection == 'down' && $currentPosition < count($rebuildList) - 1)) {
$newPosition = ($sortDirection == 'up') ? ($currentPosition - 1) : ($currentPosition + 1);
// exchanging indexes
$currentRecord = $accessoriesList->offsetGet($rebuildList[$currentPosition]);
$newRecord = $accessoriesList->offsetGet($rebuildList[$newPosition]);
$currentRecord->oxaccessoire2article__oxsort = new Field($newPosition);
$newRecord->oxaccessoire2article__oxsort = new Field($currentPosition);
$currentRecord->save();
$newRecord->save();
}
}
$outputQuery = $this->_getQuery();
$normalQuery = 'select ' . $this->_getQueryCols() . $outputQuery;
$countQuery = 'select count( * ) ' . $outputQuery;
$this->_outputResponse($this->_getData($countQuery, $normalQuery));
} | php | public function sortAccessoriesList()
{
$oxidRelationId = Registry::getConfig()->getRequestEscapedParameter('oxid');
$selectedIdForSort = Registry::getConfig()->getRequestEscapedParameter('sortoxid');
$sortDirection = Registry::getConfig()->getRequestEscapedParameter('direction');
$accessoriesList = oxNew(ListModel::class);
$accessoriesList->init("oxbase", "oxaccessoire2article");
$sortQuery = "select * from oxaccessoire2article where OXARTICLENID= " . DatabaseProvider::getDb()->quote($oxidRelationId) . " order by oxsort,oxid";
$accessoriesList->selectString($sortQuery);
$rebuildList = $this->rebuildAccessoriesSortIndexes($accessoriesList);
if (($selectedPosition = array_search($selectedIdForSort, $rebuildList)) !== false) {
$selectedSortRecord = $accessoriesList->offsetGet($rebuildList[$selectedPosition]);
$currentPosition = $selectedSortRecord->oxaccessoire2article__oxsort->value;
// get current selected row sort position
if (($sortDirection == 'up' && $currentPosition > 0) || ($sortDirection == 'down' && $currentPosition < count($rebuildList) - 1)) {
$newPosition = ($sortDirection == 'up') ? ($currentPosition - 1) : ($currentPosition + 1);
// exchanging indexes
$currentRecord = $accessoriesList->offsetGet($rebuildList[$currentPosition]);
$newRecord = $accessoriesList->offsetGet($rebuildList[$newPosition]);
$currentRecord->oxaccessoire2article__oxsort = new Field($newPosition);
$newRecord->oxaccessoire2article__oxsort = new Field($currentPosition);
$currentRecord->save();
$newRecord->save();
}
}
$outputQuery = $this->_getQuery();
$normalQuery = 'select ' . $this->_getQueryCols() . $outputQuery;
$countQuery = 'select count( * ) ' . $outputQuery;
$this->_outputResponse($this->_getData($countQuery, $normalQuery));
} | [
"public",
"function",
"sortAccessoriesList",
"(",
")",
"{",
"$",
"oxidRelationId",
"=",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getRequestEscapedParameter",
"(",
"'oxid'",
")",
";",
"$",
"selectedIdForSort",
"=",
"Registry",
"::",
"getConfig",
"(",
")",
... | Applies sorting for Accessories list | [
"Applies",
"sorting",
"for",
"Accessories",
"list"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleAccessoriesAjax.php#L188-L228 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ArticleAccessoriesAjax.php | ArticleAccessoriesAjax.rebuildAccessoriesSortIndexes | private function rebuildAccessoriesSortIndexes(ListModel $inputList): array
{
$counter = 0;
$outputList = [];
foreach ($inputList as $key => $value) {
if (isset($value->oxaccessoire2article__oxsort)) {
if ($value->oxaccessoire2article__oxsort->value != $counter) {
$value->oxaccessoire2article__oxsort = new Field($counter);
$value->save();
}
}
$outputList[$counter] = $key;
$counter++;
}
return $outputList;
} | php | private function rebuildAccessoriesSortIndexes(ListModel $inputList): array
{
$counter = 0;
$outputList = [];
foreach ($inputList as $key => $value) {
if (isset($value->oxaccessoire2article__oxsort)) {
if ($value->oxaccessoire2article__oxsort->value != $counter) {
$value->oxaccessoire2article__oxsort = new Field($counter);
$value->save();
}
}
$outputList[$counter] = $key;
$counter++;
}
return $outputList;
} | [
"private",
"function",
"rebuildAccessoriesSortIndexes",
"(",
"ListModel",
"$",
"inputList",
")",
":",
"array",
"{",
"$",
"counter",
"=",
"0",
";",
"$",
"outputList",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"inputList",
"as",
"$",
"key",
"=>",
"$",
"valu... | rebuild Accessories sort indexes
@param ListModel $inputList
@return array | [
"rebuild",
"Accessories",
"sort",
"indexes"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleAccessoriesAjax.php#L238-L255 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/PriceAlarm.php | PriceAlarm._insert | protected function _insert()
{
// set oxinsert value
$this->oxpricealarm__oxinsert = new \OxidEsales\Eshop\Core\Field(date('Y-m-d', \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime()));
return parent::_insert();
} | php | protected function _insert()
{
// set oxinsert value
$this->oxpricealarm__oxinsert = new \OxidEsales\Eshop\Core\Field(date('Y-m-d', \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime()));
return parent::_insert();
} | [
"protected",
"function",
"_insert",
"(",
")",
"{",
"// set oxinsert value",
"$",
"this",
"->",
"oxpricealarm__oxinsert",
"=",
"new",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Field",
"(",
"date",
"(",
"'Y-m-d'",
",",
"\\",
"OxidEsales",
"\\",
"... | Inserts object data into DB, returns true on success.
@return bool | [
"Inserts",
"object",
"data",
"into",
"DB",
"returns",
"true",
"on",
"success",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/PriceAlarm.php#L90-L96 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/PriceAlarm.php | PriceAlarm.getArticle | public function getArticle()
{
if ($this->_oArticle == null) {
$this->_oArticle = false;
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
if ($oArticle->load($this->oxpricealarm__oxartid->value)) {
$this->_oArticle = $oArticle;
}
}
return $this->_oArticle;
} | php | public function getArticle()
{
if ($this->_oArticle == null) {
$this->_oArticle = false;
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
if ($oArticle->load($this->oxpricealarm__oxartid->value)) {
$this->_oArticle = $oArticle;
}
}
return $this->_oArticle;
} | [
"public",
"function",
"getArticle",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oArticle",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"_oArticle",
"=",
"false",
";",
"$",
"oArticle",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"App... | Loads pricealarm article
@return object | [
"Loads",
"pricealarm",
"article"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/PriceAlarm.php#L103-L114 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/PriceAlarm.php | PriceAlarm.getFPrice | public function getFPrice()
{
if ($this->_fPrice == null) {
$this->_fPrice = false;
if ($dArtPrice = $this->getPrice()) {
$myLang = \OxidEsales\Eshop\Core\Registry::getLang();
$oThisCurr = $this->getPriceAlarmCurrency();
$this->_fPrice = $myLang->formatCurrency($dArtPrice, $oThisCurr);
}
}
return $this->_fPrice;
} | php | public function getFPrice()
{
if ($this->_fPrice == null) {
$this->_fPrice = false;
if ($dArtPrice = $this->getPrice()) {
$myLang = \OxidEsales\Eshop\Core\Registry::getLang();
$oThisCurr = $this->getPriceAlarmCurrency();
$this->_fPrice = $myLang->formatCurrency($dArtPrice, $oThisCurr);
}
}
return $this->_fPrice;
} | [
"public",
"function",
"getFPrice",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_fPrice",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"_fPrice",
"=",
"false",
";",
"if",
"(",
"$",
"dArtPrice",
"=",
"$",
"this",
"->",
"getPrice",
"(",
")",
")",
"{... | Returns formatted pricealarm article original price
@return string | [
"Returns",
"formatted",
"pricealarm",
"article",
"original",
"price"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/PriceAlarm.php#L121-L133 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/PriceAlarm.php | PriceAlarm.getPrice | public function getPrice()
{
if ($this->_dPrice == null) {
$this->_dPrice = false;
if ($oArticle = $this->getArticle()) {
$myUtils = \OxidEsales\Eshop\Core\Registry::getUtils();
$oThisCurr = $this->getPriceAlarmCurrency();
// #889C - Netto prices in Admin
// (we have to call $oArticle->getPrice() to get price with VAT)
$dArtPrice = $oArticle->getPrice()->getBruttoPrice() * $oThisCurr->rate;
$dArtPrice = $myUtils->fRound($dArtPrice);
$this->_dPrice = $dArtPrice;
}
}
return $this->_dPrice;
} | php | public function getPrice()
{
if ($this->_dPrice == null) {
$this->_dPrice = false;
if ($oArticle = $this->getArticle()) {
$myUtils = \OxidEsales\Eshop\Core\Registry::getUtils();
$oThisCurr = $this->getPriceAlarmCurrency();
// #889C - Netto prices in Admin
// (we have to call $oArticle->getPrice() to get price with VAT)
$dArtPrice = $oArticle->getPrice()->getBruttoPrice() * $oThisCurr->rate;
$dArtPrice = $myUtils->fRound($dArtPrice);
$this->_dPrice = $dArtPrice;
}
}
return $this->_dPrice;
} | [
"public",
"function",
"getPrice",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_dPrice",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"_dPrice",
"=",
"false",
";",
"if",
"(",
"$",
"oArticle",
"=",
"$",
"this",
"->",
"getArticle",
"(",
")",
")",
"{... | Returns pricealarm article original price
@return double | [
"Returns",
"pricealarm",
"article",
"original",
"price"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/PriceAlarm.php#L140-L158 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/PriceAlarm.php | PriceAlarm.getTitle | public function getTitle()
{
if ($this->_sTitle == null) {
$this->_sTitle = false;
if ($oArticle = $this->getArticle()) {
$this->_sTitle = $oArticle->oxarticles__oxtitle->value;
if ($oArticle->oxarticles__oxparentid->value && !$oArticle->oxarticles__oxtitle->value) {
$oParent = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$oParent->load($oArticle->oxarticles__oxparentid->value);
$this->_sTitle = $oParent->oxarticles__oxtitle->value . " " . $oArticle->oxarticles__oxvarselect->value;
}
}
}
return $this->_sTitle;
} | php | public function getTitle()
{
if ($this->_sTitle == null) {
$this->_sTitle = false;
if ($oArticle = $this->getArticle()) {
$this->_sTitle = $oArticle->oxarticles__oxtitle->value;
if ($oArticle->oxarticles__oxparentid->value && !$oArticle->oxarticles__oxtitle->value) {
$oParent = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$oParent->load($oArticle->oxarticles__oxparentid->value);
$this->_sTitle = $oParent->oxarticles__oxtitle->value . " " . $oArticle->oxarticles__oxvarselect->value;
}
}
}
return $this->_sTitle;
} | [
"public",
"function",
"getTitle",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_sTitle",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"_sTitle",
"=",
"false",
";",
"if",
"(",
"$",
"oArticle",
"=",
"$",
"this",
"->",
"getArticle",
"(",
")",
")",
"{... | Returns pricealarm article full title
@return string | [
"Returns",
"pricealarm",
"article",
"full",
"title"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/PriceAlarm.php#L165-L180 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/PriceAlarm.php | PriceAlarm.getPriceAlarmCurrency | public function getPriceAlarmCurrency()
{
if ($this->_oCurrency == null) {
$this->_oCurrency = false;
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$oThisCurr = $myConfig->getCurrencyObject($this->oxpricealarm__oxcurrency->value);
// #869A we should perform currency conversion
// (older versions doesn't have currency info - assume as it is default - first in currency array)
if (!$oThisCurr) {
$oDefCurr = $myConfig->getActShopCurrencyObject();
$oThisCurr = $myConfig->getCurrencyObject($oDefCurr->name);
$this->oxpricealarm__oxcurrency->setValue($oDefCurr->name);
}
$this->_oCurrency = $oThisCurr;
}
return $this->_oCurrency;
} | php | public function getPriceAlarmCurrency()
{
if ($this->_oCurrency == null) {
$this->_oCurrency = false;
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$oThisCurr = $myConfig->getCurrencyObject($this->oxpricealarm__oxcurrency->value);
// #869A we should perform currency conversion
// (older versions doesn't have currency info - assume as it is default - first in currency array)
if (!$oThisCurr) {
$oDefCurr = $myConfig->getActShopCurrencyObject();
$oThisCurr = $myConfig->getCurrencyObject($oDefCurr->name);
$this->oxpricealarm__oxcurrency->setValue($oDefCurr->name);
}
$this->_oCurrency = $oThisCurr;
}
return $this->_oCurrency;
} | [
"public",
"function",
"getPriceAlarmCurrency",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oCurrency",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"_oCurrency",
"=",
"false",
";",
"$",
"myConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
... | Returns pricealarm currency object
@return object | [
"Returns",
"pricealarm",
"currency",
"object"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/PriceAlarm.php#L187-L205 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/PriceAlarm.php | PriceAlarm.getFProposedPrice | public function getFProposedPrice()
{
if ($this->_fProposedPrice == null) {
$this->_fProposedPrice = false;
if ($oThisCurr = $this->getPriceAlarmCurrency()) {
$myLang = \OxidEsales\Eshop\Core\Registry::getLang();
$this->_fProposedPrice = $myLang->formatCurrency($this->oxpricealarm__oxprice->value, $oThisCurr);
}
}
return $this->_fProposedPrice;
} | php | public function getFProposedPrice()
{
if ($this->_fProposedPrice == null) {
$this->_fProposedPrice = false;
if ($oThisCurr = $this->getPriceAlarmCurrency()) {
$myLang = \OxidEsales\Eshop\Core\Registry::getLang();
$this->_fProposedPrice = $myLang->formatCurrency($this->oxpricealarm__oxprice->value, $oThisCurr);
}
}
return $this->_fProposedPrice;
} | [
"public",
"function",
"getFProposedPrice",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_fProposedPrice",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"_fProposedPrice",
"=",
"false",
";",
"if",
"(",
"$",
"oThisCurr",
"=",
"$",
"this",
"->",
"getPriceAlar... | Returns formatted proposed price
@return string | [
"Returns",
"formatted",
"proposed",
"price"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/PriceAlarm.php#L212-L223 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/PriceAlarm.php | PriceAlarm.getPriceAlarmStatus | public function getPriceAlarmStatus()
{
if ($this->_iStatus == null) {
// neutral status
$this->_iStatus = 0;
// shop price is less or equal
$dArtPrice = $this->getPrice();
if ($this->oxpricealarm__oxprice->value >= $dArtPrice) {
$this->_iStatus = 1;
}
// suggestion to user is sent
if ($this->oxpricealarm__oxsended->value != "0000-00-00 00:00:00") {
$this->_iStatus = 2;
}
}
return $this->_iStatus;
} | php | public function getPriceAlarmStatus()
{
if ($this->_iStatus == null) {
// neutral status
$this->_iStatus = 0;
// shop price is less or equal
$dArtPrice = $this->getPrice();
if ($this->oxpricealarm__oxprice->value >= $dArtPrice) {
$this->_iStatus = 1;
}
// suggestion to user is sent
if ($this->oxpricealarm__oxsended->value != "0000-00-00 00:00:00") {
$this->_iStatus = 2;
}
}
return $this->_iStatus;
} | [
"public",
"function",
"getPriceAlarmStatus",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_iStatus",
"==",
"null",
")",
"{",
"// neutral status",
"$",
"this",
"->",
"_iStatus",
"=",
"0",
";",
"// shop price is less or equal",
"$",
"dArtPrice",
"=",
"$",
"th... | Returns pricealarm status
@return integer | [
"Returns",
"pricealarm",
"status"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/PriceAlarm.php#L230-L249 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/CountryList.php | CountryList.loadActiveCountries | public function loadActiveCountries($iLang = null)
{
$sViewName = getViewName('oxcountry', $iLang);
$sSelect = "SELECT oxid, oxtitle, oxisoalpha2 FROM {$sViewName} WHERE oxactive = '1' ORDER BY oxorder, oxtitle ";
$this->selectString($sSelect);
} | php | public function loadActiveCountries($iLang = null)
{
$sViewName = getViewName('oxcountry', $iLang);
$sSelect = "SELECT oxid, oxtitle, oxisoalpha2 FROM {$sViewName} WHERE oxactive = '1' ORDER BY oxorder, oxtitle ";
$this->selectString($sSelect);
} | [
"public",
"function",
"loadActiveCountries",
"(",
"$",
"iLang",
"=",
"null",
")",
"{",
"$",
"sViewName",
"=",
"getViewName",
"(",
"'oxcountry'",
",",
"$",
"iLang",
")",
";",
"$",
"sSelect",
"=",
"\"SELECT oxid, oxtitle, oxisoalpha2 FROM {$sViewName} WHERE oxactive = '... | Selects and loads all active countries
@param integer $iLang language | [
"Selects",
"and",
"loads",
"all",
"active",
"countries"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/CountryList.php#L29-L34 | train |
OXID-eSales/oxideshop_ce | source/Internal/Module/Setup/Validator/EventsModuleSettingValidator.php | EventsModuleSettingValidator.validate | public function validate(ModuleSetting $moduleSetting, string $moduleId, int $shopId)
{
if (!$this->canValidate($moduleSetting)) {
throw new WrongModuleSettingException($moduleSetting, self::class);
}
$events = $moduleSetting->getValue();
foreach ($this->validEvents as $validEventName) {
if (is_array($events) && array_key_exists($validEventName, $events)) {
$this->checkIfMethodIsCallable($events[$validEventName]);
}
}
} | php | public function validate(ModuleSetting $moduleSetting, string $moduleId, int $shopId)
{
if (!$this->canValidate($moduleSetting)) {
throw new WrongModuleSettingException($moduleSetting, self::class);
}
$events = $moduleSetting->getValue();
foreach ($this->validEvents as $validEventName) {
if (is_array($events) && array_key_exists($validEventName, $events)) {
$this->checkIfMethodIsCallable($events[$validEventName]);
}
}
} | [
"public",
"function",
"validate",
"(",
"ModuleSetting",
"$",
"moduleSetting",
",",
"string",
"$",
"moduleId",
",",
"int",
"$",
"shopId",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"canValidate",
"(",
"$",
"moduleSetting",
")",
")",
"{",
"throw",
"new",... | There is another service for syntax validation and we won't validate syntax in this method.
@param ModuleSetting $moduleSetting
@param string $moduleId
@param int $shopId
@throws WrongModuleSettingException | [
"There",
"is",
"another",
"service",
"for",
"syntax",
"validation",
"and",
"we",
"won",
"t",
"validate",
"syntax",
"in",
"this",
"method",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Internal/Module/Setup/Validator/EventsModuleSettingValidator.php#L32-L44 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/VariantHandler.php | VariantHandler.genVariantFromSell | public function genVariantFromSell($aSels, $oArticle)
{
$oVariants = $oArticle->getAdminVariants();
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$myUtils = \OxidEsales\Eshop\Core\Registry::getUtils();
$myLang = \OxidEsales\Eshop\Core\Registry::getLang();
$aConfLanguages = $myLang->getLanguageIds();
foreach ($aSels as $sSelId) {
$oSel = oxNew(\OxidEsales\Eshop\Core\Model\MultiLanguageModel::class);
$oSel->setEnableMultilang(false);
$oSel->init('oxselectlist');
$oSel->load($sSelId);
$sVarNameUpdate = "";
foreach ($aConfLanguages as $sKey => $sLang) {
$sPrefix = $myLang->getLanguageTag($sKey);
$aSelValues = $myUtils->assignValuesFromText($oSel->{"oxselectlist__oxvaldesc" . $sPrefix}->value);
foreach ($aSelValues as $sI => $oValue) {
$aValues[$sI][$sKey] = $oValue;
}
$aSelTitle[$sKey] = $oSel->{"oxselectlist__oxtitle" . $sPrefix}->value;
$sMdSeparator = ($oArticle->oxarticles__oxvarname->value) ? $this->_sMdSeparator : '';
if ($sVarNameUpdate) {
$sVarNameUpdate .= ", ";
}
$sVarName = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quote($sMdSeparator . $aSelTitle[$sKey]);
$sVarNameUpdate .= "oxvarname" . $sPrefix . " = CONCAT(oxvarname" . $sPrefix . ", " . $sVarName . ")";
}
$oMDVariants = $this->_assignValues($aValues, $oVariants, $oArticle, $aConfLanguages);
if ($myConfig->getConfigParam('blUseMultidimensionVariants')) {
$oAttribute = oxNew(\OxidEsales\Eshop\Application\Model\Attribute::class);
$oAttribute->assignVarToAttribute($oMDVariants, $aSelTitle);
}
$this->_updateArticleVarName($sVarNameUpdate, $oArticle->oxarticles__oxid->value);
}
} | php | public function genVariantFromSell($aSels, $oArticle)
{
$oVariants = $oArticle->getAdminVariants();
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$myUtils = \OxidEsales\Eshop\Core\Registry::getUtils();
$myLang = \OxidEsales\Eshop\Core\Registry::getLang();
$aConfLanguages = $myLang->getLanguageIds();
foreach ($aSels as $sSelId) {
$oSel = oxNew(\OxidEsales\Eshop\Core\Model\MultiLanguageModel::class);
$oSel->setEnableMultilang(false);
$oSel->init('oxselectlist');
$oSel->load($sSelId);
$sVarNameUpdate = "";
foreach ($aConfLanguages as $sKey => $sLang) {
$sPrefix = $myLang->getLanguageTag($sKey);
$aSelValues = $myUtils->assignValuesFromText($oSel->{"oxselectlist__oxvaldesc" . $sPrefix}->value);
foreach ($aSelValues as $sI => $oValue) {
$aValues[$sI][$sKey] = $oValue;
}
$aSelTitle[$sKey] = $oSel->{"oxselectlist__oxtitle" . $sPrefix}->value;
$sMdSeparator = ($oArticle->oxarticles__oxvarname->value) ? $this->_sMdSeparator : '';
if ($sVarNameUpdate) {
$sVarNameUpdate .= ", ";
}
$sVarName = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quote($sMdSeparator . $aSelTitle[$sKey]);
$sVarNameUpdate .= "oxvarname" . $sPrefix . " = CONCAT(oxvarname" . $sPrefix . ", " . $sVarName . ")";
}
$oMDVariants = $this->_assignValues($aValues, $oVariants, $oArticle, $aConfLanguages);
if ($myConfig->getConfigParam('blUseMultidimensionVariants')) {
$oAttribute = oxNew(\OxidEsales\Eshop\Application\Model\Attribute::class);
$oAttribute->assignVarToAttribute($oMDVariants, $aSelTitle);
}
$this->_updateArticleVarName($sVarNameUpdate, $oArticle->oxarticles__oxid->value);
}
} | [
"public",
"function",
"genVariantFromSell",
"(",
"$",
"aSels",
",",
"$",
"oArticle",
")",
"{",
"$",
"oVariants",
"=",
"$",
"oArticle",
"->",
"getAdminVariants",
"(",
")",
";",
"$",
"myConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"... | Generate variants from selection lists
@param array $aSels ids of selection list
@param object $oArticle parent article | [
"Generate",
"variants",
"from",
"selection",
"lists"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/VariantHandler.php#L84-L119 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/VariantHandler.php | VariantHandler._getValuePrice | protected function _getValuePrice($oValue, $dParentPrice)
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$dPriceMod = 0;
if ($myConfig->getConfigParam('bl_perfLoadSelectLists') && $myConfig->getConfigParam('bl_perfUseSelectlistPrice')) {
if ($oValue->priceUnit == 'abs') {
$dPriceMod = $oValue->price;
} elseif ($oValue->priceUnit == '%') {
$dPriceModPerc = abs($oValue->price) * $dParentPrice / 100.0;
if (($oValue->price) >= 0.0) {
$dPriceMod = $dPriceModPerc;
} else {
$dPriceMod = -$dPriceModPerc;
}
}
}
return $dPriceMod;
} | php | protected function _getValuePrice($oValue, $dParentPrice)
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$dPriceMod = 0;
if ($myConfig->getConfigParam('bl_perfLoadSelectLists') && $myConfig->getConfigParam('bl_perfUseSelectlistPrice')) {
if ($oValue->priceUnit == 'abs') {
$dPriceMod = $oValue->price;
} elseif ($oValue->priceUnit == '%') {
$dPriceModPerc = abs($oValue->price) * $dParentPrice / 100.0;
if (($oValue->price) >= 0.0) {
$dPriceMod = $dPriceModPerc;
} else {
$dPriceMod = -$dPriceModPerc;
}
}
}
return $dPriceMod;
} | [
"protected",
"function",
"_getValuePrice",
"(",
"$",
"oValue",
",",
"$",
"dParentPrice",
")",
"{",
"$",
"myConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"dPriceMod",
"=",
"0",
";",... | Returns article price
@param object $oValue selection list value
@param double $dParentPrice parent article price
@return double | [
"Returns",
"article",
"price"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/VariantHandler.php#L217-L235 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/VariantHandler.php | VariantHandler._createNewVariant | protected function _createNewVariant($aParams = null, $sParentId = null)
{
// checkbox handling
$aParams['oxarticles__oxactive'] = 0;
// shopid
$sShopID = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("actshop");
$aParams['oxarticles__oxshopid'] = $sShopID;
// varianthandling
$aParams['oxarticles__oxparentid'] = $sParentId;
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$oArticle->setEnableMultilang(false);
$oArticle->assign($aParams);
$oArticle->save();
return $oArticle->getId();
} | php | protected function _createNewVariant($aParams = null, $sParentId = null)
{
// checkbox handling
$aParams['oxarticles__oxactive'] = 0;
// shopid
$sShopID = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("actshop");
$aParams['oxarticles__oxshopid'] = $sShopID;
// varianthandling
$aParams['oxarticles__oxparentid'] = $sParentId;
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$oArticle->setEnableMultilang(false);
$oArticle->assign($aParams);
$oArticle->save();
return $oArticle->getId();
} | [
"protected",
"function",
"_createNewVariant",
"(",
"$",
"aParams",
"=",
"null",
",",
"$",
"sParentId",
"=",
"null",
")",
"{",
"// checkbox handling",
"$",
"aParams",
"[",
"'oxarticles__oxactive'",
"]",
"=",
"0",
";",
"// shopid",
"$",
"sShopID",
"=",
"\\",
"... | Creates new article variant.
@param array $aParams assigned parameters
@param string $sParentId parent article id
@return null | [
"Creates",
"new",
"article",
"variant",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/VariantHandler.php#L245-L263 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/VariantHandler.php | VariantHandler._updateArticleVarName | protected function _updateArticleVarName($sUpdate, $sArtId)
{
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sUpdate = "update oxarticles set " . $sUpdate . " where oxid = " . $oDb->quote($sArtId);
$oDb->Execute($sUpdate);
} | php | protected function _updateArticleVarName($sUpdate, $sArtId)
{
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sUpdate = "update oxarticles set " . $sUpdate . " where oxid = " . $oDb->quote($sArtId);
$oDb->Execute($sUpdate);
} | [
"protected",
"function",
"_updateArticleVarName",
"(",
"$",
"sUpdate",
",",
"$",
"sArtId",
")",
"{",
"$",
"oDb",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
")",
";",
"$",
"sUpdate",
"=",
"\"update ox... | Inserts article variant name for all languages
@param string $sUpdate query for update variant name
@param string $sArtId parent article id | [
"Inserts",
"article",
"variant",
"name",
"for",
"all",
"languages"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/VariantHandler.php#L271-L276 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/VariantHandler.php | VariantHandler.isMdVariant | public function isMdVariant($oArticle)
{
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blUseMultidimensionVariants')) {
if (strpos($oArticle->oxarticles__oxvarselect->value, trim($this->_sMdSeparator)) !== false) {
return true;
}
}
return false;
} | php | public function isMdVariant($oArticle)
{
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blUseMultidimensionVariants')) {
if (strpos($oArticle->oxarticles__oxvarselect->value, trim($this->_sMdSeparator)) !== false) {
return true;
}
}
return false;
} | [
"public",
"function",
"isMdVariant",
"(",
"$",
"oArticle",
")",
"{",
"if",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getConfigParam",
"(",
"'blUseMultidimensionVariants'",
")",
")",
"{",
"if",... | Check if variant is multidimensional
@param \OxidEsales\Eshop\Application\Model\Article $oArticle Article object
@return bool | [
"Check",
"if",
"variant",
"is",
"multidimensional"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/VariantHandler.php#L285-L294 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/VariantHandler.php | VariantHandler._cleanFilter | protected function _cleanFilter($aFilter)
{
$aCleanFilter = false;
if (is_array($aFilter) && count($aFilter)) {
foreach ($aFilter as $iKey => $sFilter) {
if ($sFilter) {
$aCleanFilter[$iKey] = $sFilter;
}
}
}
return $aCleanFilter;
} | php | protected function _cleanFilter($aFilter)
{
$aCleanFilter = false;
if (is_array($aFilter) && count($aFilter)) {
foreach ($aFilter as $iKey => $sFilter) {
if ($sFilter) {
$aCleanFilter[$iKey] = $sFilter;
}
}
}
return $aCleanFilter;
} | [
"protected",
"function",
"_cleanFilter",
"(",
"$",
"aFilter",
")",
"{",
"$",
"aCleanFilter",
"=",
"false",
";",
"if",
"(",
"is_array",
"(",
"$",
"aFilter",
")",
"&&",
"count",
"(",
"$",
"aFilter",
")",
")",
"{",
"foreach",
"(",
"$",
"aFilter",
"as",
... | Cleans up user given filter. If filter was empty - returns false
@param array $aFilter user given filter
@return array | bool | [
"Cleans",
"up",
"user",
"given",
"filter",
".",
"If",
"filter",
"was",
"empty",
"-",
"returns",
"false"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/VariantHandler.php#L339-L351 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/VariantHandler.php | VariantHandler._applyVariantSelectionsFilter | protected function _applyVariantSelectionsFilter($aSelections, $aFilter)
{
$iMaxActiveCount = 0;
$sMostSuitableVariantId = null;
$blPerfectFit = false;
// applying filters, disabling/activating items
if (($aFilter = $this->_cleanFilter($aFilter))) {
$aFilterKeys = array_keys($aFilter);
$iFilterKeysCount = count($aFilter);
foreach ($aSelections as $sVariantId => &$aLineSelections) {
$iActive = 0;
foreach ($aFilter as $iKey => $sVal) {
if (strcmp($aLineSelections[$iKey]['hash'], $sVal) === 0) {
$aLineSelections[$iKey]['active'] = true;
$iActive++;
} else {
foreach ($aLineSelections as $iOtherKey => &$aLineOtherVariant) {
if ($iKey != $iOtherKey) {
$aLineOtherVariant['disabled'] = true;
}
}
}
}
foreach ($aLineSelections as $iOtherKey => &$aLineOtherVariant) {
if (!in_array($iOtherKey, $aFilterKeys)) {
$aLineOtherVariant['disabled'] = !($iFilterKeysCount == $iActive);
}
}
$blFitsAll = $iActive && (count($aLineSelections) == $iActive) && ($iFilterKeysCount == $iActive);
if (($iActive > $iMaxActiveCount) || (!$blPerfectFit && $blFitsAll)) {
$blPerfectFit = $blFitsAll;
$sMostSuitableVariantId = $sVariantId;
$iMaxActiveCount = $iActive;
}
unset($aLineSelections);
}
}
return [$aSelections, $sMostSuitableVariantId, $blPerfectFit];
} | php | protected function _applyVariantSelectionsFilter($aSelections, $aFilter)
{
$iMaxActiveCount = 0;
$sMostSuitableVariantId = null;
$blPerfectFit = false;
// applying filters, disabling/activating items
if (($aFilter = $this->_cleanFilter($aFilter))) {
$aFilterKeys = array_keys($aFilter);
$iFilterKeysCount = count($aFilter);
foreach ($aSelections as $sVariantId => &$aLineSelections) {
$iActive = 0;
foreach ($aFilter as $iKey => $sVal) {
if (strcmp($aLineSelections[$iKey]['hash'], $sVal) === 0) {
$aLineSelections[$iKey]['active'] = true;
$iActive++;
} else {
foreach ($aLineSelections as $iOtherKey => &$aLineOtherVariant) {
if ($iKey != $iOtherKey) {
$aLineOtherVariant['disabled'] = true;
}
}
}
}
foreach ($aLineSelections as $iOtherKey => &$aLineOtherVariant) {
if (!in_array($iOtherKey, $aFilterKeys)) {
$aLineOtherVariant['disabled'] = !($iFilterKeysCount == $iActive);
}
}
$blFitsAll = $iActive && (count($aLineSelections) == $iActive) && ($iFilterKeysCount == $iActive);
if (($iActive > $iMaxActiveCount) || (!$blPerfectFit && $blFitsAll)) {
$blPerfectFit = $blFitsAll;
$sMostSuitableVariantId = $sVariantId;
$iMaxActiveCount = $iActive;
}
unset($aLineSelections);
}
}
return [$aSelections, $sMostSuitableVariantId, $blPerfectFit];
} | [
"protected",
"function",
"_applyVariantSelectionsFilter",
"(",
"$",
"aSelections",
",",
"$",
"aFilter",
")",
"{",
"$",
"iMaxActiveCount",
"=",
"0",
";",
"$",
"sMostSuitableVariantId",
"=",
"null",
";",
"$",
"blPerfectFit",
"=",
"false",
";",
"// applying filters, ... | Applies filter on variant selection array
@param array $aSelections selections
@param array $aFilter filter
@return array | [
"Applies",
"filter",
"on",
"variant",
"selection",
"array"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/VariantHandler.php#L361-L402 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/VariantHandler.php | VariantHandler._buildVariantSelectionsList | protected function _buildVariantSelectionsList($aVarSelects, $aSelections)
{
// creating selection lists
foreach ($aVarSelects as $iKey => $sLabel) {
$aVariantSelections[$iKey] = oxNew(\OxidEsales\Eshop\Application\Model\VariantSelectList::class, $sLabel, $iKey);
}
// building variant selections
foreach ($aSelections as $aLineSelections) {
foreach ($aLineSelections as $oPos => $aLine) {
$aVariantSelections[$oPos]->addVariant($aLine['name'], $aLine['hash'], $aLine['disabled'], $aLine['active']);
}
}
return $aVariantSelections;
} | php | protected function _buildVariantSelectionsList($aVarSelects, $aSelections)
{
// creating selection lists
foreach ($aVarSelects as $iKey => $sLabel) {
$aVariantSelections[$iKey] = oxNew(\OxidEsales\Eshop\Application\Model\VariantSelectList::class, $sLabel, $iKey);
}
// building variant selections
foreach ($aSelections as $aLineSelections) {
foreach ($aLineSelections as $oPos => $aLine) {
$aVariantSelections[$oPos]->addVariant($aLine['name'], $aLine['hash'], $aLine['disabled'], $aLine['active']);
}
}
return $aVariantSelections;
} | [
"protected",
"function",
"_buildVariantSelectionsList",
"(",
"$",
"aVarSelects",
",",
"$",
"aSelections",
")",
"{",
"// creating selection lists",
"foreach",
"(",
"$",
"aVarSelects",
"as",
"$",
"iKey",
"=>",
"$",
"sLabel",
")",
"{",
"$",
"aVariantSelections",
"[",... | Builds variant selections list - array containing oxVariantSelectList
@param array $aVarSelects variant selection titles
@param array $aSelections variant selections
@return array | [
"Builds",
"variant",
"selections",
"list",
"-",
"array",
"containing",
"oxVariantSelectList"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/VariantHandler.php#L412-L427 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/VariantHandler.php | VariantHandler._getSelections | protected function _getSelections($sTitle)
{
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blUseMultidimensionVariants')) {
$aSelections = explode($this->_sMdSeparator, $sTitle);
} else {
$aSelections = [$sTitle];
}
return $aSelections;
} | php | protected function _getSelections($sTitle)
{
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blUseMultidimensionVariants')) {
$aSelections = explode($this->_sMdSeparator, $sTitle);
} else {
$aSelections = [$sTitle];
}
return $aSelections;
} | [
"protected",
"function",
"_getSelections",
"(",
"$",
"sTitle",
")",
"{",
"if",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getConfigParam",
"(",
"'blUseMultidimensionVariants'",
")",
")",
"{",
"... | In case multidimentional variants ON explodes title by _sMdSeparator
and returns array, else - returns array containing title
@param string $sTitle title to process
@return array | [
"In",
"case",
"multidimentional",
"variants",
"ON",
"explodes",
"title",
"by",
"_sMdSeparator",
"and",
"returns",
"array",
"else",
"-",
"returns",
"array",
"containing",
"title"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/VariantHandler.php#L437-L447 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/VariantHandler.php | VariantHandler.buildVariantSelections | public function buildVariantSelections($sVarName, $oVariantList, $aFilter, $sActVariantId, $iLimit = 0)
{
// assigning variants
$aVarSelects = $this->_getSelections($sVarName);
if ($iLimit) {
$aVarSelects = array_slice($aVarSelects, 0, $iLimit);
}
if (($iVarSelCnt = count($aVarSelects))) {
// filling selections
$aRawVariantSelections = $this->_fillVariantSelections($oVariantList, $iVarSelCnt, $aFilter, $sActVariantId);
// applying filters, disabling/activating items
list($aRawVariantSelections, $sActVariantId, $blPerfectFit) = $this->_applyVariantSelectionsFilter($aRawVariantSelections, $aFilter);
// creating selection lists
$aVariantSelections = $this->_buildVariantSelectionsList($aVarSelects, $aRawVariantSelections);
$oCurrentVariant = null;
if ($sActVariantId) {
$oCurrentVariant = $oVariantList[$sActVariantId];
}
return [
'selections' => $aVariantSelections,
'rawselections' => $aRawVariantSelections,
'oActiveVariant' => $oCurrentVariant,
'blPerfectFit' => $blPerfectFit
];
}
return false;
} | php | public function buildVariantSelections($sVarName, $oVariantList, $aFilter, $sActVariantId, $iLimit = 0)
{
// assigning variants
$aVarSelects = $this->_getSelections($sVarName);
if ($iLimit) {
$aVarSelects = array_slice($aVarSelects, 0, $iLimit);
}
if (($iVarSelCnt = count($aVarSelects))) {
// filling selections
$aRawVariantSelections = $this->_fillVariantSelections($oVariantList, $iVarSelCnt, $aFilter, $sActVariantId);
// applying filters, disabling/activating items
list($aRawVariantSelections, $sActVariantId, $blPerfectFit) = $this->_applyVariantSelectionsFilter($aRawVariantSelections, $aFilter);
// creating selection lists
$aVariantSelections = $this->_buildVariantSelectionsList($aVarSelects, $aRawVariantSelections);
$oCurrentVariant = null;
if ($sActVariantId) {
$oCurrentVariant = $oVariantList[$sActVariantId];
}
return [
'selections' => $aVariantSelections,
'rawselections' => $aRawVariantSelections,
'oActiveVariant' => $oCurrentVariant,
'blPerfectFit' => $blPerfectFit
];
}
return false;
} | [
"public",
"function",
"buildVariantSelections",
"(",
"$",
"sVarName",
",",
"$",
"oVariantList",
",",
"$",
"aFilter",
",",
"$",
"sActVariantId",
",",
"$",
"iLimit",
"=",
"0",
")",
"{",
"// assigning variants",
"$",
"aVarSelects",
"=",
"$",
"this",
"->",
"_get... | Builds variant selection list
@param string $sVarName product (parent product) oxvarname value
@param \OxidEsales\Eshop\Application\Model\ArticleList $oVariantList variant list
@param array $aFilter variant filter
@param string $sActVariantId active variant id
@param int $iLimit limit variant lists count (if non zero, return limited number of multidimensional variant selections)
@return Ambigous false | array | [
"Builds",
"variant",
"selection",
"list"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/VariantHandler.php#L460-L491 | train |
OXID-eSales/oxideshop_ce | source/Internal/Review/Service/ReviewAndRatingMergingService.php | ReviewAndRatingMergingService.mergeReviewAndRating | public function mergeReviewAndRating(ArrayCollection $reviews, ArrayCollection $ratings)
{
$ratingAndReviewList = array_merge(
$this->getReviewDataWithRating($reviews, $ratings),
$this->getRatingWithoutReviewData($reviews, $ratings)
);
return $this->mapReviewAndRatingList($ratingAndReviewList);
} | php | public function mergeReviewAndRating(ArrayCollection $reviews, ArrayCollection $ratings)
{
$ratingAndReviewList = array_merge(
$this->getReviewDataWithRating($reviews, $ratings),
$this->getRatingWithoutReviewData($reviews, $ratings)
);
return $this->mapReviewAndRatingList($ratingAndReviewList);
} | [
"public",
"function",
"mergeReviewAndRating",
"(",
"ArrayCollection",
"$",
"reviews",
",",
"ArrayCollection",
"$",
"ratings",
")",
"{",
"$",
"ratingAndReviewList",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"getReviewDataWithRating",
"(",
"$",
"reviews",
",",
"$"... | Merges Reviews and Ratings to Collection of ReviewAndRating view objects.
@param ArrayCollection $reviews
@param ArrayCollection $ratings
@return ArrayCollection | [
"Merges",
"Reviews",
"and",
"Ratings",
"to",
"Collection",
"of",
"ReviewAndRating",
"view",
"objects",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Internal/Review/Service/ReviewAndRatingMergingService.php#L27-L35 | train |
OXID-eSales/oxideshop_ce | source/Internal/Review/Service/ReviewAndRatingMergingService.php | ReviewAndRatingMergingService.isRatingWithoutReview | private function isRatingWithoutReview(Rating $rating, ArrayCollection $reviews)
{
$withoutReview = true;
foreach ($reviews as $review) {
if ($this->isReviewRating($review, $rating)) {
$withoutReview = false;
break;
}
}
return $withoutReview;
} | php | private function isRatingWithoutReview(Rating $rating, ArrayCollection $reviews)
{
$withoutReview = true;
foreach ($reviews as $review) {
if ($this->isReviewRating($review, $rating)) {
$withoutReview = false;
break;
}
}
return $withoutReview;
} | [
"private",
"function",
"isRatingWithoutReview",
"(",
"Rating",
"$",
"rating",
",",
"ArrayCollection",
"$",
"reviews",
")",
"{",
"$",
"withoutReview",
"=",
"true",
";",
"foreach",
"(",
"$",
"reviews",
"as",
"$",
"review",
")",
"{",
"if",
"(",
"$",
"this",
... | Returns true if Rating doesn't belong to any review.
@param Rating $rating
@param ArrayCollection $reviews
@return bool | [
"Returns",
"true",
"if",
"Rating",
"doesn",
"t",
"belong",
"to",
"any",
"review",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Internal/Review/Service/ReviewAndRatingMergingService.php#L108-L120 | train |
OXID-eSales/oxideshop_ce | source/Internal/Review/Service/ReviewAndRatingMergingService.php | ReviewAndRatingMergingService.isReviewRating | private function isReviewRating(Review $review, Rating $rating)
{
return $rating->getType() === $review->getType()
&& $rating->getObjectId() === $review->getObjectId()
&& $rating->getRating() === $review->getRating()
&& $rating->getUserId() === $review->getUserId();
} | php | private function isReviewRating(Review $review, Rating $rating)
{
return $rating->getType() === $review->getType()
&& $rating->getObjectId() === $review->getObjectId()
&& $rating->getRating() === $review->getRating()
&& $rating->getUserId() === $review->getUserId();
} | [
"private",
"function",
"isReviewRating",
"(",
"Review",
"$",
"review",
",",
"Rating",
"$",
"rating",
")",
"{",
"return",
"$",
"rating",
"->",
"getType",
"(",
")",
"===",
"$",
"review",
"->",
"getType",
"(",
")",
"&&",
"$",
"rating",
"->",
"getObjectId",
... | Returns true if Rating belongs to Review.
@param Review $review
@param Rating $rating
@return bool | [
"Returns",
"true",
"if",
"Rating",
"belongs",
"to",
"Review",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Internal/Review/Service/ReviewAndRatingMergingService.php#L130-L136 | train |
OXID-eSales/oxideshop_ce | source/Internal/Review/Service/ReviewAndRatingMergingService.php | ReviewAndRatingMergingService.mapReviewAndRatingList | private function mapReviewAndRatingList($reviewAndRatingDataList)
{
$mappedReviewAndRating = new ArrayCollection();
foreach ($reviewAndRatingDataList as $reviewAndRatingData) {
$mappedReviewAndRating[] = $this->mapReviewAndRating($reviewAndRatingData);
}
return $mappedReviewAndRating;
} | php | private function mapReviewAndRatingList($reviewAndRatingDataList)
{
$mappedReviewAndRating = new ArrayCollection();
foreach ($reviewAndRatingDataList as $reviewAndRatingData) {
$mappedReviewAndRating[] = $this->mapReviewAndRating($reviewAndRatingData);
}
return $mappedReviewAndRating;
} | [
"private",
"function",
"mapReviewAndRatingList",
"(",
"$",
"reviewAndRatingDataList",
")",
"{",
"$",
"mappedReviewAndRating",
"=",
"new",
"ArrayCollection",
"(",
")",
";",
"foreach",
"(",
"$",
"reviewAndRatingDataList",
"as",
"$",
"reviewAndRatingData",
")",
"{",
"$... | Maps Reviews and Ratings data to Collection of ReviewAndRating view objects.
@param array $reviewAndRatingDataList
@return ArrayCollection | [
"Maps",
"Reviews",
"and",
"Ratings",
"data",
"to",
"Collection",
"of",
"ReviewAndRating",
"view",
"objects",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Internal/Review/Service/ReviewAndRatingMergingService.php#L145-L154 | train |
OXID-eSales/oxideshop_ce | source/Internal/Review/Service/ReviewAndRatingMergingService.php | ReviewAndRatingMergingService.mapReviewAndRating | private function mapReviewAndRating($reviewAndRatingData)
{
$reviewAndRating = new ReviewAndRating();
$reviewAndRating
->setReviewId($reviewAndRatingData['reviewId'])
->setRatingId($reviewAndRatingData['ratingId'])
->setRating($reviewAndRatingData['rating'])
->setReviewText($reviewAndRatingData['text'])
->setObjectId($reviewAndRatingData['objectId'])
->setObjectType($reviewAndRatingData['objectType'])
->setCreatedAt($reviewAndRatingData['createdAt']);
return $reviewAndRating;
} | php | private function mapReviewAndRating($reviewAndRatingData)
{
$reviewAndRating = new ReviewAndRating();
$reviewAndRating
->setReviewId($reviewAndRatingData['reviewId'])
->setRatingId($reviewAndRatingData['ratingId'])
->setRating($reviewAndRatingData['rating'])
->setReviewText($reviewAndRatingData['text'])
->setObjectId($reviewAndRatingData['objectId'])
->setObjectType($reviewAndRatingData['objectType'])
->setCreatedAt($reviewAndRatingData['createdAt']);
return $reviewAndRating;
} | [
"private",
"function",
"mapReviewAndRating",
"(",
"$",
"reviewAndRatingData",
")",
"{",
"$",
"reviewAndRating",
"=",
"new",
"ReviewAndRating",
"(",
")",
";",
"$",
"reviewAndRating",
"->",
"setReviewId",
"(",
"$",
"reviewAndRatingData",
"[",
"'reviewId'",
"]",
")",... | Maps Review and Rating data to ReviewAndRating view object.
@param array $reviewAndRatingData
@return ReviewAndRating | [
"Maps",
"Review",
"and",
"Rating",
"data",
"to",
"ReviewAndRating",
"view",
"object",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Internal/Review/Service/ReviewAndRatingMergingService.php#L163-L176 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/VendorMainAjax.php | VendorMainAjax.removeVendor | public function removeVendor()
{
$oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$aRemoveArt = $this->_getActionIds('oxarticles.oxid');
if ($oConfig->getRequestParameter('all')) {
$sArtTable = $this->_getViewName('oxarticles');
$aRemoveArt = $this->_getAll($this->_addFilter("select $sArtTable.oxid " . $this->_getQuery()));
}
if (is_array($aRemoveArt)) {
$sSelect = "update oxarticles set oxvendorid = null where "
. $this->onVendorActionArticleUpdateConditions($aRemoveArt);
\OxidEsales\Eshop\Core\DatabaseProvider::getDb()->Execute($sSelect);
$this->resetCounter("vendorArticle", $oConfig->getRequestParameter('oxid'));
$this->onVendorAction($oConfig->getRequestParameter('oxid'));
}
} | php | public function removeVendor()
{
$oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$aRemoveArt = $this->_getActionIds('oxarticles.oxid');
if ($oConfig->getRequestParameter('all')) {
$sArtTable = $this->_getViewName('oxarticles');
$aRemoveArt = $this->_getAll($this->_addFilter("select $sArtTable.oxid " . $this->_getQuery()));
}
if (is_array($aRemoveArt)) {
$sSelect = "update oxarticles set oxvendorid = null where "
. $this->onVendorActionArticleUpdateConditions($aRemoveArt);
\OxidEsales\Eshop\Core\DatabaseProvider::getDb()->Execute($sSelect);
$this->resetCounter("vendorArticle", $oConfig->getRequestParameter('oxid'));
$this->onVendorAction($oConfig->getRequestParameter('oxid'));
}
} | [
"public",
"function",
"removeVendor",
"(",
")",
"{",
"$",
"oConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"aRemoveArt",
"=",
"$",
"this",
"->",
"_getActionIds",
"(",
"'oxarticles.oxi... | Removes article from Vendor | [
"Removes",
"article",
"from",
"Vendor"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/VendorMainAjax.php#L105-L124 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/VendorMainAjax.php | VendorMainAjax.addVendor | public function addVendor()
{
$oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$aAddArticle = $this->_getActionIds('oxarticles.oxid');
$soxId = $oConfig->getRequestParameter('synchoxid');
if ($oConfig->getRequestParameter('all')) {
$sArtTable = $this->_getViewName('oxarticles');
$aAddArticle = $this->_getAll($this->_addFilter("select $sArtTable.oxid " . $this->_getQuery()));
}
if ($soxId && $soxId != "-1" && is_array($aAddArticle)) {
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sSelect = "update oxarticles set oxvendorid = " . $oDb->quote($soxId) . " where "
. $this->onVendorActionArticleUpdateConditions($aAddArticle);
$oDb->Execute($sSelect);
$this->resetCounter("vendorArticle", $soxId);
$this->onVendorAction($soxId);
}
} | php | public function addVendor()
{
$oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$aAddArticle = $this->_getActionIds('oxarticles.oxid');
$soxId = $oConfig->getRequestParameter('synchoxid');
if ($oConfig->getRequestParameter('all')) {
$sArtTable = $this->_getViewName('oxarticles');
$aAddArticle = $this->_getAll($this->_addFilter("select $sArtTable.oxid " . $this->_getQuery()));
}
if ($soxId && $soxId != "-1" && is_array($aAddArticle)) {
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sSelect = "update oxarticles set oxvendorid = " . $oDb->quote($soxId) . " where "
. $this->onVendorActionArticleUpdateConditions($aAddArticle);
$oDb->Execute($sSelect);
$this->resetCounter("vendorArticle", $soxId);
$this->onVendorAction($soxId);
}
} | [
"public",
"function",
"addVendor",
"(",
")",
"{",
"$",
"oConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"aAddArticle",
"=",
"$",
"this",
"->",
"_getActionIds",
"(",
"'oxarticles.oxid'... | Adds article to Vendor config | [
"Adds",
"article",
"to",
"Vendor",
"config"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/VendorMainAjax.php#L129-L151 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsFile.php | UtilsFile.copyDir | public function copyDir($sSourceDir, $sTargetDir)
{
$oStr = getStr();
$handle = opendir($sSourceDir);
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..') {
if (is_dir($sSourceDir . '/' . $file)) {
// recursive
$sNewSourceDir = $sSourceDir . '/' . $file;
$sNewTargetDir = $sTargetDir . '/' . $file;
if (strcasecmp($file, 'CVS') && strcasecmp($file, '.svn')) {
@mkdir($sNewTargetDir, 0777);
$this->copyDir($sNewSourceDir, $sNewTargetDir);
}
} else {
$sSourceFile = $sSourceDir . '/' . $file;
$sTargetFile = $sTargetDir . '/' . $file;
//do not copy files within dyn_images
if (!$oStr->strstr($sSourceDir, 'dyn_images') || $file == 'nopic.jpg' || $file == 'nopic_ico.jpg') {
@copy($sSourceFile, $sTargetFile);
}
}
}
}
closedir($handle);
} | php | public function copyDir($sSourceDir, $sTargetDir)
{
$oStr = getStr();
$handle = opendir($sSourceDir);
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..') {
if (is_dir($sSourceDir . '/' . $file)) {
// recursive
$sNewSourceDir = $sSourceDir . '/' . $file;
$sNewTargetDir = $sTargetDir . '/' . $file;
if (strcasecmp($file, 'CVS') && strcasecmp($file, '.svn')) {
@mkdir($sNewTargetDir, 0777);
$this->copyDir($sNewSourceDir, $sNewTargetDir);
}
} else {
$sSourceFile = $sSourceDir . '/' . $file;
$sTargetFile = $sTargetDir . '/' . $file;
//do not copy files within dyn_images
if (!$oStr->strstr($sSourceDir, 'dyn_images') || $file == 'nopic.jpg' || $file == 'nopic_ico.jpg') {
@copy($sSourceFile, $sTargetFile);
}
}
}
}
closedir($handle);
} | [
"public",
"function",
"copyDir",
"(",
"$",
"sSourceDir",
",",
"$",
"sTargetDir",
")",
"{",
"$",
"oStr",
"=",
"getStr",
"(",
")",
";",
"$",
"handle",
"=",
"opendir",
"(",
"$",
"sSourceDir",
")",
";",
"while",
"(",
"false",
"!==",
"(",
"$",
"file",
"... | Copies directory tree for creating a new shop.
@param string $sSourceDir Source directory
@param string $sTargetDir Target directory | [
"Copies",
"directory",
"tree",
"for",
"creating",
"a",
"new",
"shop",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsFile.php#L169-L195 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsFile.php | UtilsFile.deleteDir | public function deleteDir($sSourceDir)
{
if (is_dir($sSourceDir)) {
if ($oDir = dir($sSourceDir)) {
while (false !== $sFile = $oDir->read()) {
if ($sFile == '.' || $sFile == '..') {
continue;
}
if (!$this->deleteDir($oDir->path . DIRECTORY_SEPARATOR . $sFile)) {
$oDir->close();
return false;
}
}
$oDir->close();
return rmdir($sSourceDir);
}
} elseif (file_exists($sSourceDir)) {
return unlink($sSourceDir);
}
} | php | public function deleteDir($sSourceDir)
{
if (is_dir($sSourceDir)) {
if ($oDir = dir($sSourceDir)) {
while (false !== $sFile = $oDir->read()) {
if ($sFile == '.' || $sFile == '..') {
continue;
}
if (!$this->deleteDir($oDir->path . DIRECTORY_SEPARATOR . $sFile)) {
$oDir->close();
return false;
}
}
$oDir->close();
return rmdir($sSourceDir);
}
} elseif (file_exists($sSourceDir)) {
return unlink($sSourceDir);
}
} | [
"public",
"function",
"deleteDir",
"(",
"$",
"sSourceDir",
")",
"{",
"if",
"(",
"is_dir",
"(",
"$",
"sSourceDir",
")",
")",
"{",
"if",
"(",
"$",
"oDir",
"=",
"dir",
"(",
"$",
"sSourceDir",
")",
")",
"{",
"while",
"(",
"false",
"!==",
"$",
"sFile",
... | Deletes directory tree.
@param string $sSourceDir Path to directory
@return null | [
"Deletes",
"directory",
"tree",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsFile.php#L204-L227 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsFile.php | UtilsFile.readRemoteFileAsString | public function readRemoteFileAsString($sPath)
{
$sRet = '';
$hFile = @fopen($sPath, 'r');
if ($hFile) {
socket_set_timeout($hFile, 2);
while (!feof($hFile)) {
$sLine = fgets($hFile, 4096);
$sRet .= $sLine;
}
fclose($hFile);
}
return $sRet;
} | php | public function readRemoteFileAsString($sPath)
{
$sRet = '';
$hFile = @fopen($sPath, 'r');
if ($hFile) {
socket_set_timeout($hFile, 2);
while (!feof($hFile)) {
$sLine = fgets($hFile, 4096);
$sRet .= $sLine;
}
fclose($hFile);
}
return $sRet;
} | [
"public",
"function",
"readRemoteFileAsString",
"(",
"$",
"sPath",
")",
"{",
"$",
"sRet",
"=",
"''",
";",
"$",
"hFile",
"=",
"@",
"fopen",
"(",
"$",
"sPath",
",",
"'r'",
")",
";",
"if",
"(",
"$",
"hFile",
")",
"{",
"socket_set_timeout",
"(",
"$",
"... | Reads remote stored file. Returns contents of file.
@param string $sPath Remote file path & name
@return string | [
"Reads",
"remote",
"stored",
"file",
".",
"Returns",
"contents",
"of",
"file",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsFile.php#L236-L250 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsFile.php | UtilsFile._prepareImageName | protected function _prepareImageName($sValue, $sType, $blDemo, $sImagePath, $blUnique = true)
{
if ($sValue) {
// add type to name
$aFilename = explode(".", $sValue);
$sFileType = trim($aFilename[count($aFilename) - 1]);
if (isset($sFileType)) {
$oStr = getStr();
// unallowed files ?
if (in_array($sFileType, $this->_aBadFiles) || ($blDemo && !in_array($sFileType, $this->_aAllowedFiles))) {
\OxidEsales\Eshop\Core\Registry::getUtils()->showMessageAndExit("File didn't pass our allowed files filter.");
}
// removing file type
if (count($aFilename) > 0) {
unset($aFilename[count($aFilename) - 1]);
}
$sFName = '';
if (isset($aFilename[0])) {
$sFName = $oStr->preg_replace('/[^a-zA-Z0-9()_\.-]/', '', implode('.', $aFilename));
}
$sValue = $this->_getUniqueFileName($sImagePath, "{$sFName}", $sFileType, "", $blUnique);
}
}
return $sValue;
} | php | protected function _prepareImageName($sValue, $sType, $blDemo, $sImagePath, $blUnique = true)
{
if ($sValue) {
// add type to name
$aFilename = explode(".", $sValue);
$sFileType = trim($aFilename[count($aFilename) - 1]);
if (isset($sFileType)) {
$oStr = getStr();
// unallowed files ?
if (in_array($sFileType, $this->_aBadFiles) || ($blDemo && !in_array($sFileType, $this->_aAllowedFiles))) {
\OxidEsales\Eshop\Core\Registry::getUtils()->showMessageAndExit("File didn't pass our allowed files filter.");
}
// removing file type
if (count($aFilename) > 0) {
unset($aFilename[count($aFilename) - 1]);
}
$sFName = '';
if (isset($aFilename[0])) {
$sFName = $oStr->preg_replace('/[^a-zA-Z0-9()_\.-]/', '', implode('.', $aFilename));
}
$sValue = $this->_getUniqueFileName($sImagePath, "{$sFName}", $sFileType, "", $blUnique);
}
}
return $sValue;
} | [
"protected",
"function",
"_prepareImageName",
"(",
"$",
"sValue",
",",
"$",
"sType",
",",
"$",
"blDemo",
",",
"$",
"sImagePath",
",",
"$",
"blUnique",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"sValue",
")",
"{",
"// add type to name",
"$",
"aFilename",
"="... | Prepares image file name
@param object $sValue uploadable file name
@param string $sType image type
@param object $blDemo if true = whecks if file type is defined in \OxidEsales\Eshop\Core\UtilsFile::_aAllowedFiles
@param string $sImagePath final image file location
@param bool $blUnique if TRUE - generates unique file name
@return string | [
"Prepares",
"image",
"file",
"name"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsFile.php#L263-L294 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsFile.php | UtilsFile._getImageSize | protected function _getImageSize($sImgType, $iImgNum, $sImgConf)
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
switch ($sImgConf) {
case 'aDetailImageSizes':
$aDetailImageSizes = $myConfig->getConfigParam($sImgConf);
$sSize = $myConfig->getConfigParam('sDetailImageSize');
if (isset($aDetailImageSizes['oxpic' . $iImgNum])) {
$sSize = $aDetailImageSizes['oxpic' . $iImgNum];
}
break;
default:
$sSize = $myConfig->getConfigParam($sImgConf);
break;
}
if ($sSize) {
return explode('*', $sSize);
}
} | php | protected function _getImageSize($sImgType, $iImgNum, $sImgConf)
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
switch ($sImgConf) {
case 'aDetailImageSizes':
$aDetailImageSizes = $myConfig->getConfigParam($sImgConf);
$sSize = $myConfig->getConfigParam('sDetailImageSize');
if (isset($aDetailImageSizes['oxpic' . $iImgNum])) {
$sSize = $aDetailImageSizes['oxpic' . $iImgNum];
}
break;
default:
$sSize = $myConfig->getConfigParam($sImgConf);
break;
}
if ($sSize) {
return explode('*', $sSize);
}
} | [
"protected",
"function",
"_getImageSize",
"(",
"$",
"sImgType",
",",
"$",
"iImgNum",
",",
"$",
"sImgConf",
")",
"{",
"$",
"myConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"switch",
"(",... | Returns array of sizes which are used to resize images. If size is not
defined - NULL will be returned
@param string $sImgType image type (TH, TC, ICO etc), can be useful for modules
@param int $iImgNum number of image (e.g. numper of ZOOM1 is 1)
@param string $sImgConf config parameter name, which keeps size info
@return array | null | [
"Returns",
"array",
"of",
"sizes",
"which",
"are",
"used",
"to",
"resize",
"images",
".",
"If",
"size",
"is",
"not",
"defined",
"-",
"NULL",
"will",
"be",
"returned"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsFile.php#L320-L339 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.