id int32 0 241k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
32,000 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php | TShopBasketArticleCoreList.ObserverRegister | public function ObserverRegister($sObserverName, &$oObserver)
{
if (!array_key_exists($sObserverName, $this->aObservers)) {
$this->aObservers[$sObserverName] = &$oObserver;
}
} | php | public function ObserverRegister($sObserverName, &$oObserver)
{
if (!array_key_exists($sObserverName, $this->aObservers)) {
$this->aObservers[$sObserverName] = &$oObserver;
}
} | [
"public",
"function",
"ObserverRegister",
"(",
"$",
"sObserverName",
",",
"&",
"$",
"oObserver",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"sObserverName",
",",
"$",
"this",
"->",
"aObservers",
")",
")",
"{",
"$",
"this",
"->",
"aObservers",
"[",
"$",
"sObserverName",
"]",
"=",
"&",
"$",
"oObserver",
";",
"}",
"}"
] | register an observer with the user.
@param string $sObserverName
@param IDataExtranetUserObserver $oObserver | [
"register",
"an",
"observer",
"with",
"the",
"user",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L62-L67 |
32,001 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php | TShopBasketArticleCoreList.Refresh | public function Refresh()
{
$iPt = $this->getItemPointer();
$this->GoToStart();
while ($oTmp = $this->Next()) {
if (false === $oTmp->sqlData || ($oTmp->dAmount <= 0)) {
$this->RemoveArticle($oTmp);
} else {
// refresh stock from db
$oTmp->RefreshDataFromDatabase();
}
}
if ($iPt > $this->Length()) {
$iPt = $this->Length();
}
$this->setItemPointer($iPt);
$this->UpdateListData();
} | php | public function Refresh()
{
$iPt = $this->getItemPointer();
$this->GoToStart();
while ($oTmp = $this->Next()) {
if (false === $oTmp->sqlData || ($oTmp->dAmount <= 0)) {
$this->RemoveArticle($oTmp);
} else {
// refresh stock from db
$oTmp->RefreshDataFromDatabase();
}
}
if ($iPt > $this->Length()) {
$iPt = $this->Length();
}
$this->setItemPointer($iPt);
$this->UpdateListData();
} | [
"public",
"function",
"Refresh",
"(",
")",
"{",
"$",
"iPt",
"=",
"$",
"this",
"->",
"getItemPointer",
"(",
")",
";",
"$",
"this",
"->",
"GoToStart",
"(",
")",
";",
"while",
"(",
"$",
"oTmp",
"=",
"$",
"this",
"->",
"Next",
"(",
")",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"oTmp",
"->",
"sqlData",
"||",
"(",
"$",
"oTmp",
"->",
"dAmount",
"<=",
"0",
")",
")",
"{",
"$",
"this",
"->",
"RemoveArticle",
"(",
"$",
"oTmp",
")",
";",
"}",
"else",
"{",
"// refresh stock from db",
"$",
"oTmp",
"->",
"RefreshDataFromDatabase",
"(",
")",
";",
"}",
"}",
"if",
"(",
"$",
"iPt",
">",
"$",
"this",
"->",
"Length",
"(",
")",
")",
"{",
"$",
"iPt",
"=",
"$",
"this",
"->",
"Length",
"(",
")",
";",
"}",
"$",
"this",
"->",
"setItemPointer",
"(",
"$",
"iPt",
")",
";",
"$",
"this",
"->",
"UpdateListData",
"(",
")",
";",
"}"
] | check list for dead articles. | [
"check",
"list",
"for",
"dead",
"articles",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L84-L101 |
32,002 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php | TShopBasketArticleCoreList.& | public function &GetArticlesAffectedByShippingType(TdbShopShippingType &$oShippingType)
{
$oArticles = new TShopBasketArticleList();
/** @var $oArticles TShopBasketArticleList */
$iPointer = $this->getItemPointer();
$this->GoToStart();
while ($oItem = &$this->Next()) {
if ($oShippingType->ArticleAffected($oItem)) {
$oArticles->AddItem($oItem);
}
}
if ($oArticles->Length() > 0 && $oShippingType->fieldApplyToAllProducts) {
// this shipping type should match ALL articles... so we now work with all articles
$this->GoToStart();
$oArticles = new TShopBasketArticleList();
/** @var $oArticles TShopBasketArticleList */
while ($oItem = &$this->Next()) {
$oArticles->AddItem($oItem);
}
}
// if at least some items matched, we now need to check if the sume of the items matches the shipping type requirement
if ($oShippingType->ArticleListValidForShippingType($oArticles)) {
// we keep the list. we now need to mark all items in the list with that shipping type
$oArticles->GoToStart();
while ($oItem = &$oArticles->Next()) {
$this->SetShippingTypeForArticle($oItem, $oShippingType);
}
$oArticles->GoToStart();
} else {
// does not match... so reset the list
$oArticles = new TShopBasketArticleList();
/** @var $oArticles TShopBasketArticleList */
}
$this->setItemPointer($iPointer);
return $oArticles;
} | php | public function &GetArticlesAffectedByShippingType(TdbShopShippingType &$oShippingType)
{
$oArticles = new TShopBasketArticleList();
/** @var $oArticles TShopBasketArticleList */
$iPointer = $this->getItemPointer();
$this->GoToStart();
while ($oItem = &$this->Next()) {
if ($oShippingType->ArticleAffected($oItem)) {
$oArticles->AddItem($oItem);
}
}
if ($oArticles->Length() > 0 && $oShippingType->fieldApplyToAllProducts) {
// this shipping type should match ALL articles... so we now work with all articles
$this->GoToStart();
$oArticles = new TShopBasketArticleList();
/** @var $oArticles TShopBasketArticleList */
while ($oItem = &$this->Next()) {
$oArticles->AddItem($oItem);
}
}
// if at least some items matched, we now need to check if the sume of the items matches the shipping type requirement
if ($oShippingType->ArticleListValidForShippingType($oArticles)) {
// we keep the list. we now need to mark all items in the list with that shipping type
$oArticles->GoToStart();
while ($oItem = &$oArticles->Next()) {
$this->SetShippingTypeForArticle($oItem, $oShippingType);
}
$oArticles->GoToStart();
} else {
// does not match... so reset the list
$oArticles = new TShopBasketArticleList();
/** @var $oArticles TShopBasketArticleList */
}
$this->setItemPointer($iPointer);
return $oArticles;
} | [
"public",
"function",
"&",
"GetArticlesAffectedByShippingType",
"(",
"TdbShopShippingType",
"&",
"$",
"oShippingType",
")",
"{",
"$",
"oArticles",
"=",
"new",
"TShopBasketArticleList",
"(",
")",
";",
"/** @var $oArticles TShopBasketArticleList */",
"$",
"iPointer",
"=",
"$",
"this",
"->",
"getItemPointer",
"(",
")",
";",
"$",
"this",
"->",
"GoToStart",
"(",
")",
";",
"while",
"(",
"$",
"oItem",
"=",
"&",
"$",
"this",
"->",
"Next",
"(",
")",
")",
"{",
"if",
"(",
"$",
"oShippingType",
"->",
"ArticleAffected",
"(",
"$",
"oItem",
")",
")",
"{",
"$",
"oArticles",
"->",
"AddItem",
"(",
"$",
"oItem",
")",
";",
"}",
"}",
"if",
"(",
"$",
"oArticles",
"->",
"Length",
"(",
")",
">",
"0",
"&&",
"$",
"oShippingType",
"->",
"fieldApplyToAllProducts",
")",
"{",
"// this shipping type should match ALL articles... so we now work with all articles",
"$",
"this",
"->",
"GoToStart",
"(",
")",
";",
"$",
"oArticles",
"=",
"new",
"TShopBasketArticleList",
"(",
")",
";",
"/** @var $oArticles TShopBasketArticleList */",
"while",
"(",
"$",
"oItem",
"=",
"&",
"$",
"this",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"oArticles",
"->",
"AddItem",
"(",
"$",
"oItem",
")",
";",
"}",
"}",
"// if at least some items matched, we now need to check if the sume of the items matches the shipping type requirement",
"if",
"(",
"$",
"oShippingType",
"->",
"ArticleListValidForShippingType",
"(",
"$",
"oArticles",
")",
")",
"{",
"// we keep the list. we now need to mark all items in the list with that shipping type",
"$",
"oArticles",
"->",
"GoToStart",
"(",
")",
";",
"while",
"(",
"$",
"oItem",
"=",
"&",
"$",
"oArticles",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"this",
"->",
"SetShippingTypeForArticle",
"(",
"$",
"oItem",
",",
"$",
"oShippingType",
")",
";",
"}",
"$",
"oArticles",
"->",
"GoToStart",
"(",
")",
";",
"}",
"else",
"{",
"// does not match... so reset the list",
"$",
"oArticles",
"=",
"new",
"TShopBasketArticleList",
"(",
")",
";",
"/** @var $oArticles TShopBasketArticleList */",
"}",
"$",
"this",
"->",
"setItemPointer",
"(",
"$",
"iPointer",
")",
";",
"return",
"$",
"oArticles",
";",
"}"
] | returns array with pointers to all basket articles that match the shipping type.
@param TdbShopShippingType $oShippingType
@return TShopBasketArticleList | [
"returns",
"array",
"with",
"pointers",
"to",
"all",
"basket",
"articles",
"that",
"match",
"the",
"shipping",
"type",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L110-L147 |
32,003 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php | TShopBasketArticleCoreList.& | public function &GetListMatchingVat(TdbShopVat &$oVat)
{
$oArticles = new TShopBasketArticleList();
/** @var $oArticles TShopBasketArticleList */
$iPointer = $this->getItemPointer();
$this->GoToStart();
while ($oItem = &$this->Next()) {
$oItemVat = $oItem->GetVat();
if (!is_null($oItemVat) && $oItemVat->id == $oVat->id) {
$oArticles->AddItem($oItem);
}
}
$this->setItemPointer($iPointer);
return $oArticles;
} | php | public function &GetListMatchingVat(TdbShopVat &$oVat)
{
$oArticles = new TShopBasketArticleList();
/** @var $oArticles TShopBasketArticleList */
$iPointer = $this->getItemPointer();
$this->GoToStart();
while ($oItem = &$this->Next()) {
$oItemVat = $oItem->GetVat();
if (!is_null($oItemVat) && $oItemVat->id == $oVat->id) {
$oArticles->AddItem($oItem);
}
}
$this->setItemPointer($iPointer);
return $oArticles;
} | [
"public",
"function",
"&",
"GetListMatchingVat",
"(",
"TdbShopVat",
"&",
"$",
"oVat",
")",
"{",
"$",
"oArticles",
"=",
"new",
"TShopBasketArticleList",
"(",
")",
";",
"/** @var $oArticles TShopBasketArticleList */",
"$",
"iPointer",
"=",
"$",
"this",
"->",
"getItemPointer",
"(",
")",
";",
"$",
"this",
"->",
"GoToStart",
"(",
")",
";",
"while",
"(",
"$",
"oItem",
"=",
"&",
"$",
"this",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"oItemVat",
"=",
"$",
"oItem",
"->",
"GetVat",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"oItemVat",
")",
"&&",
"$",
"oItemVat",
"->",
"id",
"==",
"$",
"oVat",
"->",
"id",
")",
"{",
"$",
"oArticles",
"->",
"AddItem",
"(",
"$",
"oItem",
")",
";",
"}",
"}",
"$",
"this",
"->",
"setItemPointer",
"(",
"$",
"iPointer",
")",
";",
"return",
"$",
"oArticles",
";",
"}"
] | return list matchin the vat group.
@param TdbShopVat $oVat
@return TShopBasketArticleList | [
"return",
"list",
"matchin",
"the",
"vat",
"group",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L156-L172 |
32,004 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php | TShopBasketArticleCoreList.SetShippingTypeForArticle | protected function SetShippingTypeForArticle(TShopBasketArticle &$oItem, TdbShopShippingType &$oShippingType)
{
$iCurrentPos = $this->getItemPointer();
$this->GoToStart();
$bFound = false;
while (!$bFound && ($oExistingItem = &$this->Next())) {
/** @var $oExistingItem TShopBasketArticle */
if ($oExistingItem->IsSameAs($oItem)) {
$bFound = true;
}
}
if ($bFound) {
$oExistingItem->SetActingShippingType($oShippingType);
}
$this->setItemPointer($iCurrentPos);
} | php | protected function SetShippingTypeForArticle(TShopBasketArticle &$oItem, TdbShopShippingType &$oShippingType)
{
$iCurrentPos = $this->getItemPointer();
$this->GoToStart();
$bFound = false;
while (!$bFound && ($oExistingItem = &$this->Next())) {
/** @var $oExistingItem TShopBasketArticle */
if ($oExistingItem->IsSameAs($oItem)) {
$bFound = true;
}
}
if ($bFound) {
$oExistingItem->SetActingShippingType($oShippingType);
}
$this->setItemPointer($iCurrentPos);
} | [
"protected",
"function",
"SetShippingTypeForArticle",
"(",
"TShopBasketArticle",
"&",
"$",
"oItem",
",",
"TdbShopShippingType",
"&",
"$",
"oShippingType",
")",
"{",
"$",
"iCurrentPos",
"=",
"$",
"this",
"->",
"getItemPointer",
"(",
")",
";",
"$",
"this",
"->",
"GoToStart",
"(",
")",
";",
"$",
"bFound",
"=",
"false",
";",
"while",
"(",
"!",
"$",
"bFound",
"&&",
"(",
"$",
"oExistingItem",
"=",
"&",
"$",
"this",
"->",
"Next",
"(",
")",
")",
")",
"{",
"/** @var $oExistingItem TShopBasketArticle */",
"if",
"(",
"$",
"oExistingItem",
"->",
"IsSameAs",
"(",
"$",
"oItem",
")",
")",
"{",
"$",
"bFound",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"$",
"bFound",
")",
"{",
"$",
"oExistingItem",
"->",
"SetActingShippingType",
"(",
"$",
"oShippingType",
")",
";",
"}",
"$",
"this",
"->",
"setItemPointer",
"(",
"$",
"iCurrentPos",
")",
";",
"}"
] | marks the item in the list with the shipping type.
@param TShopBasketArticle $oItem
@param TdbShopShippingType $oShippingType | [
"marks",
"the",
"item",
"in",
"the",
"list",
"with",
"the",
"shipping",
"type",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L180-L195 |
32,005 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php | TShopBasketArticleCoreList.UpdateListData | protected function UpdateListData()
{
$this->dNumberOfItems = 0;
$this->dProductPrice = 0;
$this->dTotalWeight = 0;
$this->dTotalVolume = 0;
$tmpPointer = $this->getItemPointer();
$this->GoToStart();
while ($oItem = &$this->Next()) {
if ($oItem->dAmount <= 0) {
$this->RemoveArticle($oItem);
} else {
$this->dNumberOfItems += $oItem->dAmount;
$this->dProductPrice += $oItem->dPriceTotal;
$this->dTotalWeight += $oItem->dTotalWeight;
$this->dTotalVolume += $oItem->dTotalVolume;
}
}
$this->setItemPointer($tmpPointer);
} | php | protected function UpdateListData()
{
$this->dNumberOfItems = 0;
$this->dProductPrice = 0;
$this->dTotalWeight = 0;
$this->dTotalVolume = 0;
$tmpPointer = $this->getItemPointer();
$this->GoToStart();
while ($oItem = &$this->Next()) {
if ($oItem->dAmount <= 0) {
$this->RemoveArticle($oItem);
} else {
$this->dNumberOfItems += $oItem->dAmount;
$this->dProductPrice += $oItem->dPriceTotal;
$this->dTotalWeight += $oItem->dTotalWeight;
$this->dTotalVolume += $oItem->dTotalVolume;
}
}
$this->setItemPointer($tmpPointer);
} | [
"protected",
"function",
"UpdateListData",
"(",
")",
"{",
"$",
"this",
"->",
"dNumberOfItems",
"=",
"0",
";",
"$",
"this",
"->",
"dProductPrice",
"=",
"0",
";",
"$",
"this",
"->",
"dTotalWeight",
"=",
"0",
";",
"$",
"this",
"->",
"dTotalVolume",
"=",
"0",
";",
"$",
"tmpPointer",
"=",
"$",
"this",
"->",
"getItemPointer",
"(",
")",
";",
"$",
"this",
"->",
"GoToStart",
"(",
")",
";",
"while",
"(",
"$",
"oItem",
"=",
"&",
"$",
"this",
"->",
"Next",
"(",
")",
")",
"{",
"if",
"(",
"$",
"oItem",
"->",
"dAmount",
"<=",
"0",
")",
"{",
"$",
"this",
"->",
"RemoveArticle",
"(",
"$",
"oItem",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"dNumberOfItems",
"+=",
"$",
"oItem",
"->",
"dAmount",
";",
"$",
"this",
"->",
"dProductPrice",
"+=",
"$",
"oItem",
"->",
"dPriceTotal",
";",
"$",
"this",
"->",
"dTotalWeight",
"+=",
"$",
"oItem",
"->",
"dTotalWeight",
";",
"$",
"this",
"->",
"dTotalVolume",
"+=",
"$",
"oItem",
"->",
"dTotalVolume",
";",
"}",
"}",
"$",
"this",
"->",
"setItemPointer",
"(",
"$",
"tmpPointer",
")",
";",
"}"
] | used to update class data wenn the class state changes. | [
"used",
"to",
"update",
"class",
"data",
"wenn",
"the",
"class",
"state",
"changes",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L318-L339 |
32,006 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php | TShopBasketArticleCoreList.GetBasketQuantityForVoucher | public function GetBasketQuantityForVoucher(TdbShopVoucher &$oVoucher)
{
$iCurrentPosition = $this->getItemPointer();
$this->GoToStart();
$iAmount = 0;
while ($oItem = &$this->Next()) {
$bIncludeProduct = $oVoucher->AllowVoucherForArticle($oItem);
if ($bIncludeProduct) {
$iAmount = $iAmount + $oItem->dAmount;
}
}
$this->setItemPointer($iCurrentPosition);
return $iAmount;
} | php | public function GetBasketQuantityForVoucher(TdbShopVoucher &$oVoucher)
{
$iCurrentPosition = $this->getItemPointer();
$this->GoToStart();
$iAmount = 0;
while ($oItem = &$this->Next()) {
$bIncludeProduct = $oVoucher->AllowVoucherForArticle($oItem);
if ($bIncludeProduct) {
$iAmount = $iAmount + $oItem->dAmount;
}
}
$this->setItemPointer($iCurrentPosition);
return $iAmount;
} | [
"public",
"function",
"GetBasketQuantityForVoucher",
"(",
"TdbShopVoucher",
"&",
"$",
"oVoucher",
")",
"{",
"$",
"iCurrentPosition",
"=",
"$",
"this",
"->",
"getItemPointer",
"(",
")",
";",
"$",
"this",
"->",
"GoToStart",
"(",
")",
";",
"$",
"iAmount",
"=",
"0",
";",
"while",
"(",
"$",
"oItem",
"=",
"&",
"$",
"this",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"bIncludeProduct",
"=",
"$",
"oVoucher",
"->",
"AllowVoucherForArticle",
"(",
"$",
"oItem",
")",
";",
"if",
"(",
"$",
"bIncludeProduct",
")",
"{",
"$",
"iAmount",
"=",
"$",
"iAmount",
"+",
"$",
"oItem",
"->",
"dAmount",
";",
"}",
"}",
"$",
"this",
"->",
"setItemPointer",
"(",
"$",
"iCurrentPosition",
")",
";",
"return",
"$",
"iAmount",
";",
"}"
] | returns the total number of items affected by a voucher.
@param TdbShopVoucher $oVoucher
@return float | [
"returns",
"the",
"total",
"number",
"of",
"items",
"affected",
"by",
"a",
"voucher",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L525-L539 |
32,007 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php | TShopBasketArticleCoreList.GetBasketSumForDiscount | public function GetBasketSumForDiscount(TdbShopDiscount &$oDiscount)
{
// get the sum of all products (we exclude products with "fieldExcludeFromDiscounts")
$iCurrentPosition = $this->getItemPointer();
$this->GoToStart();
$dProductValue = 0;
while ($oItem = &$this->Next()) {
$bIncludeProduct = $oDiscount->AllowDiscountForArticle($oItem);
if ($bIncludeProduct) {
$dProductValue = $dProductValue + $oItem->dPriceTotal;
}
}
$this->setItemPointer($iCurrentPosition);
return $dProductValue;
} | php | public function GetBasketSumForDiscount(TdbShopDiscount &$oDiscount)
{
// get the sum of all products (we exclude products with "fieldExcludeFromDiscounts")
$iCurrentPosition = $this->getItemPointer();
$this->GoToStart();
$dProductValue = 0;
while ($oItem = &$this->Next()) {
$bIncludeProduct = $oDiscount->AllowDiscountForArticle($oItem);
if ($bIncludeProduct) {
$dProductValue = $dProductValue + $oItem->dPriceTotal;
}
}
$this->setItemPointer($iCurrentPosition);
return $dProductValue;
} | [
"public",
"function",
"GetBasketSumForDiscount",
"(",
"TdbShopDiscount",
"&",
"$",
"oDiscount",
")",
"{",
"// get the sum of all products (we exclude products with \"fieldExcludeFromDiscounts\")",
"$",
"iCurrentPosition",
"=",
"$",
"this",
"->",
"getItemPointer",
"(",
")",
";",
"$",
"this",
"->",
"GoToStart",
"(",
")",
";",
"$",
"dProductValue",
"=",
"0",
";",
"while",
"(",
"$",
"oItem",
"=",
"&",
"$",
"this",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"bIncludeProduct",
"=",
"$",
"oDiscount",
"->",
"AllowDiscountForArticle",
"(",
"$",
"oItem",
")",
";",
"if",
"(",
"$",
"bIncludeProduct",
")",
"{",
"$",
"dProductValue",
"=",
"$",
"dProductValue",
"+",
"$",
"oItem",
"->",
"dPriceTotal",
";",
"}",
"}",
"$",
"this",
"->",
"setItemPointer",
"(",
"$",
"iCurrentPosition",
")",
";",
"return",
"$",
"dProductValue",
";",
"}"
] | returns the total basket value for alle articles that may be used for the discount passed. the method takes
active discounts into account.
@param TdbShopDiscount $oDiscount
@return float | [
"returns",
"the",
"total",
"basket",
"value",
"for",
"alle",
"articles",
"that",
"may",
"be",
"used",
"for",
"the",
"discount",
"passed",
".",
"the",
"method",
"takes",
"active",
"discounts",
"into",
"account",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L549-L564 |
32,008 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php | TShopBasketArticleCoreList.GetBasketQuantityForDiscount | public function GetBasketQuantityForDiscount(TdbShopDiscount &$oDiscount)
{
// get the sum of all products (we exclude products with "fieldExcludeFromDiscounts")
$iCurrentPosition = $this->getItemPointer();
$this->GoToStart();
$iAmount = 0;
while ($oItem = &$this->Next()) {
$bIncludeProduct = $oDiscount->AllowDiscountForArticle($oItem);
if ($bIncludeProduct) {
$iAmount = $iAmount + $oItem->dAmount;
}
}
$this->setItemPointer($iCurrentPosition);
return $iAmount;
} | php | public function GetBasketQuantityForDiscount(TdbShopDiscount &$oDiscount)
{
// get the sum of all products (we exclude products with "fieldExcludeFromDiscounts")
$iCurrentPosition = $this->getItemPointer();
$this->GoToStart();
$iAmount = 0;
while ($oItem = &$this->Next()) {
$bIncludeProduct = $oDiscount->AllowDiscountForArticle($oItem);
if ($bIncludeProduct) {
$iAmount = $iAmount + $oItem->dAmount;
}
}
$this->setItemPointer($iCurrentPosition);
return $iAmount;
} | [
"public",
"function",
"GetBasketQuantityForDiscount",
"(",
"TdbShopDiscount",
"&",
"$",
"oDiscount",
")",
"{",
"// get the sum of all products (we exclude products with \"fieldExcludeFromDiscounts\")",
"$",
"iCurrentPosition",
"=",
"$",
"this",
"->",
"getItemPointer",
"(",
")",
";",
"$",
"this",
"->",
"GoToStart",
"(",
")",
";",
"$",
"iAmount",
"=",
"0",
";",
"while",
"(",
"$",
"oItem",
"=",
"&",
"$",
"this",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"bIncludeProduct",
"=",
"$",
"oDiscount",
"->",
"AllowDiscountForArticle",
"(",
"$",
"oItem",
")",
";",
"if",
"(",
"$",
"bIncludeProduct",
")",
"{",
"$",
"iAmount",
"=",
"$",
"iAmount",
"+",
"$",
"oItem",
"->",
"dAmount",
";",
"}",
"}",
"$",
"this",
"->",
"setItemPointer",
"(",
"$",
"iCurrentPosition",
")",
";",
"return",
"$",
"iAmount",
";",
"}"
] | returns the total number of items affected by a discount.
@param TdbShopDiscount $oDiscount
@return float | [
"returns",
"the",
"total",
"number",
"of",
"items",
"affected",
"by",
"a",
"discount",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L573-L588 |
32,009 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php | TShopBasketArticleCoreList.ApplyDiscount | public function ApplyDiscount(TdbShopDiscount $oDiscount)
{
$iCurrentPosition = $this->getItemPointer();
$this->GoToStart();
$dTotalDiscountValue = 0;
$bIsAbsoluteDiscount = ('absolut' == $oDiscount->fieldValueType);
if ($bIsAbsoluteDiscount) {
$dTotalDiscountValue = $oDiscount->fieldValue;
}
$totalDiscountValueItemCalculated = 0;
while ($oItem = &$this->Next()) {
if ((!$bIsAbsoluteDiscount || $dTotalDiscountValue > 0) && $oDiscount->AllowDiscountForArticle($oItem)) {
$oDiscountToPass = clone $oDiscount;
$oItem->ApplyDiscount($oDiscountToPass, $dTotalDiscountValue);
$totalDiscountValueItemCalculated += $oDiscountToPass->dRealValueUsed;
}
}
$totalDiscountValueOverAll = $oDiscount->GetValue();
if ($totalDiscountValueOverAll !== $totalDiscountValueItemCalculated) {
$missingDiscountValue = $totalDiscountValueOverAll - $totalDiscountValueItemCalculated;
$this->reducePriceForItemsAffectedByDiscount($oDiscount, $missingDiscountValue);
}
$this->setItemPointer($iCurrentPosition);
} | php | public function ApplyDiscount(TdbShopDiscount $oDiscount)
{
$iCurrentPosition = $this->getItemPointer();
$this->GoToStart();
$dTotalDiscountValue = 0;
$bIsAbsoluteDiscount = ('absolut' == $oDiscount->fieldValueType);
if ($bIsAbsoluteDiscount) {
$dTotalDiscountValue = $oDiscount->fieldValue;
}
$totalDiscountValueItemCalculated = 0;
while ($oItem = &$this->Next()) {
if ((!$bIsAbsoluteDiscount || $dTotalDiscountValue > 0) && $oDiscount->AllowDiscountForArticle($oItem)) {
$oDiscountToPass = clone $oDiscount;
$oItem->ApplyDiscount($oDiscountToPass, $dTotalDiscountValue);
$totalDiscountValueItemCalculated += $oDiscountToPass->dRealValueUsed;
}
}
$totalDiscountValueOverAll = $oDiscount->GetValue();
if ($totalDiscountValueOverAll !== $totalDiscountValueItemCalculated) {
$missingDiscountValue = $totalDiscountValueOverAll - $totalDiscountValueItemCalculated;
$this->reducePriceForItemsAffectedByDiscount($oDiscount, $missingDiscountValue);
}
$this->setItemPointer($iCurrentPosition);
} | [
"public",
"function",
"ApplyDiscount",
"(",
"TdbShopDiscount",
"$",
"oDiscount",
")",
"{",
"$",
"iCurrentPosition",
"=",
"$",
"this",
"->",
"getItemPointer",
"(",
")",
";",
"$",
"this",
"->",
"GoToStart",
"(",
")",
";",
"$",
"dTotalDiscountValue",
"=",
"0",
";",
"$",
"bIsAbsoluteDiscount",
"=",
"(",
"'absolut'",
"==",
"$",
"oDiscount",
"->",
"fieldValueType",
")",
";",
"if",
"(",
"$",
"bIsAbsoluteDiscount",
")",
"{",
"$",
"dTotalDiscountValue",
"=",
"$",
"oDiscount",
"->",
"fieldValue",
";",
"}",
"$",
"totalDiscountValueItemCalculated",
"=",
"0",
";",
"while",
"(",
"$",
"oItem",
"=",
"&",
"$",
"this",
"->",
"Next",
"(",
")",
")",
"{",
"if",
"(",
"(",
"!",
"$",
"bIsAbsoluteDiscount",
"||",
"$",
"dTotalDiscountValue",
">",
"0",
")",
"&&",
"$",
"oDiscount",
"->",
"AllowDiscountForArticle",
"(",
"$",
"oItem",
")",
")",
"{",
"$",
"oDiscountToPass",
"=",
"clone",
"$",
"oDiscount",
";",
"$",
"oItem",
"->",
"ApplyDiscount",
"(",
"$",
"oDiscountToPass",
",",
"$",
"dTotalDiscountValue",
")",
";",
"$",
"totalDiscountValueItemCalculated",
"+=",
"$",
"oDiscountToPass",
"->",
"dRealValueUsed",
";",
"}",
"}",
"$",
"totalDiscountValueOverAll",
"=",
"$",
"oDiscount",
"->",
"GetValue",
"(",
")",
";",
"if",
"(",
"$",
"totalDiscountValueOverAll",
"!==",
"$",
"totalDiscountValueItemCalculated",
")",
"{",
"$",
"missingDiscountValue",
"=",
"$",
"totalDiscountValueOverAll",
"-",
"$",
"totalDiscountValueItemCalculated",
";",
"$",
"this",
"->",
"reducePriceForItemsAffectedByDiscount",
"(",
"$",
"oDiscount",
",",
"$",
"missingDiscountValue",
")",
";",
"}",
"$",
"this",
"->",
"setItemPointer",
"(",
"$",
"iCurrentPosition",
")",
";",
"}"
] | apply a discount to the basket item list.
@param TdbShopDiscount $oDiscount | [
"apply",
"a",
"discount",
"to",
"the",
"basket",
"item",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L634-L659 |
32,010 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php | TShopBasketArticleCoreList.GetTotalDiscountValue | public function GetTotalDiscountValue()
{
$iCurrentPosition = $this->getItemPointer();
$this->GoToStart();
$dTotalDiscountValue = 0;
while ($oItem = &$this->Next()) {
$dTotalDiscountValue += ($oItem->dPriceTotal - $oItem->dPriceTotalAfterDiscount);
}
$this->setItemPointer($iCurrentPosition);
return $dTotalDiscountValue;
} | php | public function GetTotalDiscountValue()
{
$iCurrentPosition = $this->getItemPointer();
$this->GoToStart();
$dTotalDiscountValue = 0;
while ($oItem = &$this->Next()) {
$dTotalDiscountValue += ($oItem->dPriceTotal - $oItem->dPriceTotalAfterDiscount);
}
$this->setItemPointer($iCurrentPosition);
return $dTotalDiscountValue;
} | [
"public",
"function",
"GetTotalDiscountValue",
"(",
")",
"{",
"$",
"iCurrentPosition",
"=",
"$",
"this",
"->",
"getItemPointer",
"(",
")",
";",
"$",
"this",
"->",
"GoToStart",
"(",
")",
";",
"$",
"dTotalDiscountValue",
"=",
"0",
";",
"while",
"(",
"$",
"oItem",
"=",
"&",
"$",
"this",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"dTotalDiscountValue",
"+=",
"(",
"$",
"oItem",
"->",
"dPriceTotal",
"-",
"$",
"oItem",
"->",
"dPriceTotalAfterDiscount",
")",
";",
"}",
"$",
"this",
"->",
"setItemPointer",
"(",
"$",
"iCurrentPosition",
")",
";",
"return",
"$",
"dTotalDiscountValue",
";",
"}"
] | return the total discount value for alle articles.
@return float | [
"return",
"the",
"total",
"discount",
"value",
"for",
"alle",
"articles",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L666-L679 |
32,011 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php | TShopBasketArticleCoreList.ResetAllDiscounts | public function ResetAllDiscounts()
{
$iCurrentPosition = $this->getItemPointer();
$this->GoToStart();
while ($oItem = &$this->Next()) {
$oItem->ResetDiscounts();
}
$this->setItemPointer($iCurrentPosition);
} | php | public function ResetAllDiscounts()
{
$iCurrentPosition = $this->getItemPointer();
$this->GoToStart();
while ($oItem = &$this->Next()) {
$oItem->ResetDiscounts();
}
$this->setItemPointer($iCurrentPosition);
} | [
"public",
"function",
"ResetAllDiscounts",
"(",
")",
"{",
"$",
"iCurrentPosition",
"=",
"$",
"this",
"->",
"getItemPointer",
"(",
")",
";",
"$",
"this",
"->",
"GoToStart",
"(",
")",
";",
"while",
"(",
"$",
"oItem",
"=",
"&",
"$",
"this",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"oItem",
"->",
"ResetDiscounts",
"(",
")",
";",
"}",
"$",
"this",
"->",
"setItemPointer",
"(",
"$",
"iCurrentPosition",
")",
";",
"}"
] | resets all discount info for alle articles. | [
"resets",
"all",
"discount",
"info",
"for",
"alle",
"articles",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L684-L693 |
32,012 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php | TShopBasketArticleCoreList.ResetAllShippingMarkers | public function ResetAllShippingMarkers()
{
$iCurrentPosition = $this->getItemPointer();
$this->GoToStart();
while ($oItem = &$this->Next()) {
$oItem->ResetShippingMarker();
}
$this->setItemPointer($iCurrentPosition);
} | php | public function ResetAllShippingMarkers()
{
$iCurrentPosition = $this->getItemPointer();
$this->GoToStart();
while ($oItem = &$this->Next()) {
$oItem->ResetShippingMarker();
}
$this->setItemPointer($iCurrentPosition);
} | [
"public",
"function",
"ResetAllShippingMarkers",
"(",
")",
"{",
"$",
"iCurrentPosition",
"=",
"$",
"this",
"->",
"getItemPointer",
"(",
")",
";",
"$",
"this",
"->",
"GoToStart",
"(",
")",
";",
"while",
"(",
"$",
"oItem",
"=",
"&",
"$",
"this",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"oItem",
"->",
"ResetShippingMarker",
"(",
")",
";",
"}",
"$",
"this",
"->",
"setItemPointer",
"(",
"$",
"iCurrentPosition",
")",
";",
"}"
] | drop the acting shipping type marker from all articles in the basket. this is needed
when we want to recalculate shipping costs. | [
"drop",
"the",
"acting",
"shipping",
"type",
"marker",
"from",
"all",
"articles",
"in",
"the",
"basket",
".",
"this",
"is",
"needed",
"when",
"we",
"want",
"to",
"recalculate",
"shipping",
"costs",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L699-L708 |
32,013 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php | TShopBasketArticleCoreList.validateBasketContentBuyable | private function validateBasketContentBuyable(TShopBasketArticle $oBasketArticle, $sMessageManager)
{
$bValid = true;
if (false === $oBasketArticle->IsBuyable()) {
$oMessage = TCMSMessageManager::GetInstance();
$aErrorCodes = $oBasketArticle->GetSQLWithTablePrefix();
$oMessage->AddMessage($sMessageManager, 'ERROR-ADD-TO-BASKET-ARTICLE-NOT-BUYABLE', $aErrorCodes);
if ($this->IsInList($oBasketArticle)) {
$this->RemoveArticle($oBasketArticle);
}
$bValid = false;
}
return $bValid;
} | php | private function validateBasketContentBuyable(TShopBasketArticle $oBasketArticle, $sMessageManager)
{
$bValid = true;
if (false === $oBasketArticle->IsBuyable()) {
$oMessage = TCMSMessageManager::GetInstance();
$aErrorCodes = $oBasketArticle->GetSQLWithTablePrefix();
$oMessage->AddMessage($sMessageManager, 'ERROR-ADD-TO-BASKET-ARTICLE-NOT-BUYABLE', $aErrorCodes);
if ($this->IsInList($oBasketArticle)) {
$this->RemoveArticle($oBasketArticle);
}
$bValid = false;
}
return $bValid;
} | [
"private",
"function",
"validateBasketContentBuyable",
"(",
"TShopBasketArticle",
"$",
"oBasketArticle",
",",
"$",
"sMessageManager",
")",
"{",
"$",
"bValid",
"=",
"true",
";",
"if",
"(",
"false",
"===",
"$",
"oBasketArticle",
"->",
"IsBuyable",
"(",
")",
")",
"{",
"$",
"oMessage",
"=",
"TCMSMessageManager",
"::",
"GetInstance",
"(",
")",
";",
"$",
"aErrorCodes",
"=",
"$",
"oBasketArticle",
"->",
"GetSQLWithTablePrefix",
"(",
")",
";",
"$",
"oMessage",
"->",
"AddMessage",
"(",
"$",
"sMessageManager",
",",
"'ERROR-ADD-TO-BASKET-ARTICLE-NOT-BUYABLE'",
",",
"$",
"aErrorCodes",
")",
";",
"if",
"(",
"$",
"this",
"->",
"IsInList",
"(",
"$",
"oBasketArticle",
")",
")",
"{",
"$",
"this",
"->",
"RemoveArticle",
"(",
"$",
"oBasketArticle",
")",
";",
"}",
"$",
"bValid",
"=",
"false",
";",
"}",
"return",
"$",
"bValid",
";",
"}"
] | Checks if given basket article is buyable. If not remove it from basket with message.
@param TShopBasketArticle $oBasketArticle
@param string $sMessageManager
@return bool | [
"Checks",
"if",
"given",
"basket",
"article",
"is",
"buyable",
".",
"If",
"not",
"remove",
"it",
"from",
"basket",
"with",
"message",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L755-L769 |
32,014 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php | TShopBasketArticleCoreList.PostUpdateItemHook | protected function PostUpdateItemHook($oUpdatedItem)
{
reset($this->aObservers);
foreach (array_keys($this->aObservers) as $sObserverName) {
$this->aObservers[$sObserverName]->OnBasketItemUpdateEvent($oUpdatedItem);
}
} | php | protected function PostUpdateItemHook($oUpdatedItem)
{
reset($this->aObservers);
foreach (array_keys($this->aObservers) as $sObserverName) {
$this->aObservers[$sObserverName]->OnBasketItemUpdateEvent($oUpdatedItem);
}
} | [
"protected",
"function",
"PostUpdateItemHook",
"(",
"$",
"oUpdatedItem",
")",
"{",
"reset",
"(",
"$",
"this",
"->",
"aObservers",
")",
";",
"foreach",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"aObservers",
")",
"as",
"$",
"sObserverName",
")",
"{",
"$",
"this",
"->",
"aObservers",
"[",
"$",
"sObserverName",
"]",
"->",
"OnBasketItemUpdateEvent",
"(",
"$",
"oUpdatedItem",
")",
";",
"}",
"}"
] | called whenever an item in the basket item list is changed.
@param TShopBasketArticle $oUpdatedItem | [
"called",
"whenever",
"an",
"item",
"in",
"the",
"basket",
"item",
"list",
"is",
"changed",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L776-L782 |
32,015 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php | TShopBasketArticleCoreList.PostDeleteItemHook | protected function PostDeleteItemHook($oDeletedItem)
{
reset($this->aObservers);
foreach (array_keys($this->aObservers) as $sObserverName) {
$this->aObservers[$sObserverName]->OnBasketItemDeleteEvent($oDeletedItem);
}
} | php | protected function PostDeleteItemHook($oDeletedItem)
{
reset($this->aObservers);
foreach (array_keys($this->aObservers) as $sObserverName) {
$this->aObservers[$sObserverName]->OnBasketItemDeleteEvent($oDeletedItem);
}
} | [
"protected",
"function",
"PostDeleteItemHook",
"(",
"$",
"oDeletedItem",
")",
"{",
"reset",
"(",
"$",
"this",
"->",
"aObservers",
")",
";",
"foreach",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"aObservers",
")",
"as",
"$",
"sObserverName",
")",
"{",
"$",
"this",
"->",
"aObservers",
"[",
"$",
"sObserverName",
"]",
"->",
"OnBasketItemDeleteEvent",
"(",
"$",
"oDeletedItem",
")",
";",
"}",
"}"
] | called whenever an item is removed from the item list.
@param TShopBasketArticle $oDeletedItem | [
"called",
"whenever",
"an",
"item",
"is",
"removed",
"from",
"the",
"item",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php#L789-L795 |
32,016 | chameleon-system/chameleon-shop | src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php | TPkgShopPaymentTransactionManagerEndPoint.confirmTransactionById | public function confirmTransactionById($transactionId, $iConfirmedDate)
{
$oTransaction = TdbPkgShopPaymentTransaction::GetNewInstance();
if (false === $oTransaction->Load($transactionId)) {
return null;
}
return $this->confirmTransactionObject($oTransaction, $iConfirmedDate);
} | php | public function confirmTransactionById($transactionId, $iConfirmedDate)
{
$oTransaction = TdbPkgShopPaymentTransaction::GetNewInstance();
if (false === $oTransaction->Load($transactionId)) {
return null;
}
return $this->confirmTransactionObject($oTransaction, $iConfirmedDate);
} | [
"public",
"function",
"confirmTransactionById",
"(",
"$",
"transactionId",
",",
"$",
"iConfirmedDate",
")",
"{",
"$",
"oTransaction",
"=",
"TdbPkgShopPaymentTransaction",
"::",
"GetNewInstance",
"(",
")",
";",
"if",
"(",
"false",
"===",
"$",
"oTransaction",
"->",
"Load",
"(",
"$",
"transactionId",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"this",
"->",
"confirmTransactionObject",
"(",
"$",
"oTransaction",
",",
"$",
"iConfirmedDate",
")",
";",
"}"
] | searches for a transaction with matching id number and confirms it. returns the transaction if found, null if not.
@param $transactionId
@param $iConfirmedDate
@return TdbPkgShopPaymentTransaction | [
"searches",
"for",
"a",
"transaction",
"with",
"matching",
"id",
"number",
"and",
"confirms",
"it",
".",
"returns",
"the",
"transaction",
"if",
"found",
"null",
"if",
"not",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php#L123-L131 |
32,017 | chameleon-system/chameleon-shop | src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php | TPkgShopPaymentTransactionManagerEndPoint.confirmTransaction | public function confirmTransaction($iSequenceNumber, $iConfirmedDate)
{
$oTransaction = TdbPkgShopPaymentTransaction::GetNewInstance();
$loadData = array('shop_order_id' => $this->order->id, 'sequence_number' => $iSequenceNumber);
if (true === $oTransaction->LoadFromFields($loadData)) {
$oTransaction = $this->confirmTransactionObject($oTransaction, $iConfirmedDate);
} else {
$oTransaction = null;
}
return $oTransaction;
} | php | public function confirmTransaction($iSequenceNumber, $iConfirmedDate)
{
$oTransaction = TdbPkgShopPaymentTransaction::GetNewInstance();
$loadData = array('shop_order_id' => $this->order->id, 'sequence_number' => $iSequenceNumber);
if (true === $oTransaction->LoadFromFields($loadData)) {
$oTransaction = $this->confirmTransactionObject($oTransaction, $iConfirmedDate);
} else {
$oTransaction = null;
}
return $oTransaction;
} | [
"public",
"function",
"confirmTransaction",
"(",
"$",
"iSequenceNumber",
",",
"$",
"iConfirmedDate",
")",
"{",
"$",
"oTransaction",
"=",
"TdbPkgShopPaymentTransaction",
"::",
"GetNewInstance",
"(",
")",
";",
"$",
"loadData",
"=",
"array",
"(",
"'shop_order_id'",
"=>",
"$",
"this",
"->",
"order",
"->",
"id",
",",
"'sequence_number'",
"=>",
"$",
"iSequenceNumber",
")",
";",
"if",
"(",
"true",
"===",
"$",
"oTransaction",
"->",
"LoadFromFields",
"(",
"$",
"loadData",
")",
")",
"{",
"$",
"oTransaction",
"=",
"$",
"this",
"->",
"confirmTransactionObject",
"(",
"$",
"oTransaction",
",",
"$",
"iConfirmedDate",
")",
";",
"}",
"else",
"{",
"$",
"oTransaction",
"=",
"null",
";",
"}",
"return",
"$",
"oTransaction",
";",
"}"
] | searches for a transaction with matching sequence number and confirms it. returns the transaction if found, null if not.
@param int $iSequenceNumber
@param int $iConfirmedDate - unix timestamp
@return \TdbPkgShopPaymentTransaction|null | [
"searches",
"for",
"a",
"transaction",
"with",
"matching",
"sequence",
"number",
"and",
"confirms",
"it",
".",
"returns",
"the",
"transaction",
"if",
"found",
"null",
"if",
"not",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php#L141-L152 |
32,018 | chameleon-system/chameleon-shop | src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php | TPkgShopPaymentTransactionManagerEndPoint.confirmTransactionObject | public function confirmTransactionObject(TdbPkgShopPaymentTransaction $transaction, $iConfirmedDate)
{
if (false === $transaction->fieldConfirmed) {
$transaction->AllowEditByAll(true);
$transaction->SaveFieldsFast(
array('confirmed' => '1', 'confirmed_date' => date('Y-m-d H:i:s', $iConfirmedDate))
);
$transaction->AllowEditByAll(false);
// mark order as paid/unpaid depending on the remaining balance
$this->updateOrderPaidStatusBasedOnCurrentBalance();
$this->updateRealUsedVoucherValueBasedOnTransactions($transaction);
}
return $transaction;
} | php | public function confirmTransactionObject(TdbPkgShopPaymentTransaction $transaction, $iConfirmedDate)
{
if (false === $transaction->fieldConfirmed) {
$transaction->AllowEditByAll(true);
$transaction->SaveFieldsFast(
array('confirmed' => '1', 'confirmed_date' => date('Y-m-d H:i:s', $iConfirmedDate))
);
$transaction->AllowEditByAll(false);
// mark order as paid/unpaid depending on the remaining balance
$this->updateOrderPaidStatusBasedOnCurrentBalance();
$this->updateRealUsedVoucherValueBasedOnTransactions($transaction);
}
return $transaction;
} | [
"public",
"function",
"confirmTransactionObject",
"(",
"TdbPkgShopPaymentTransaction",
"$",
"transaction",
",",
"$",
"iConfirmedDate",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"transaction",
"->",
"fieldConfirmed",
")",
"{",
"$",
"transaction",
"->",
"AllowEditByAll",
"(",
"true",
")",
";",
"$",
"transaction",
"->",
"SaveFieldsFast",
"(",
"array",
"(",
"'confirmed'",
"=>",
"'1'",
",",
"'confirmed_date'",
"=>",
"date",
"(",
"'Y-m-d H:i:s'",
",",
"$",
"iConfirmedDate",
")",
")",
")",
";",
"$",
"transaction",
"->",
"AllowEditByAll",
"(",
"false",
")",
";",
"// mark order as paid/unpaid depending on the remaining balance",
"$",
"this",
"->",
"updateOrderPaidStatusBasedOnCurrentBalance",
"(",
")",
";",
"$",
"this",
"->",
"updateRealUsedVoucherValueBasedOnTransactions",
"(",
"$",
"transaction",
")",
";",
"}",
"return",
"$",
"transaction",
";",
"}"
] | confirm given transaction object.
@param TdbPkgShopPaymentTransaction $transaction
@param $iConfirmedDate
@return TdbPkgShopPaymentTransaction | [
"confirm",
"given",
"transaction",
"object",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php#L162-L176 |
32,019 | chameleon-system/chameleon-shop | src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php | TPkgShopPaymentTransactionManagerEndPoint.getNextTransactionSequenceNumber | protected function getNextTransactionSequenceNumber()
{
$query = "SELECT MAX(sequence_number) AS max_sequence_number
FROM `pkg_shop_payment_transaction`
WHERE `pkg_shop_payment_transaction`.`shop_order_id` = '".MySqlLegacySupport::getInstance(
)->real_escape_string(
$this->order->id
)."'
GROUP BY `pkg_shop_payment_transaction`.`shop_order_id`
";
if ($aSum = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
$iSequenceNumber = $aSum['max_sequence_number'] + 1;
} else {
$iSequenceNumber = 1;
}
return $iSequenceNumber;
} | php | protected function getNextTransactionSequenceNumber()
{
$query = "SELECT MAX(sequence_number) AS max_sequence_number
FROM `pkg_shop_payment_transaction`
WHERE `pkg_shop_payment_transaction`.`shop_order_id` = '".MySqlLegacySupport::getInstance(
)->real_escape_string(
$this->order->id
)."'
GROUP BY `pkg_shop_payment_transaction`.`shop_order_id`
";
if ($aSum = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
$iSequenceNumber = $aSum['max_sequence_number'] + 1;
} else {
$iSequenceNumber = 1;
}
return $iSequenceNumber;
} | [
"protected",
"function",
"getNextTransactionSequenceNumber",
"(",
")",
"{",
"$",
"query",
"=",
"\"SELECT MAX(sequence_number) AS max_sequence_number\n FROM `pkg_shop_payment_transaction`\n WHERE `pkg_shop_payment_transaction`.`shop_order_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"order",
"->",
"id",
")",
".",
"\"'\n GROUP BY `pkg_shop_payment_transaction`.`shop_order_id`\n \"",
";",
"if",
"(",
"$",
"aSum",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"fetch_assoc",
"(",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"query",
")",
")",
")",
"{",
"$",
"iSequenceNumber",
"=",
"$",
"aSum",
"[",
"'max_sequence_number'",
"]",
"+",
"1",
";",
"}",
"else",
"{",
"$",
"iSequenceNumber",
"=",
"1",
";",
"}",
"return",
"$",
"iSequenceNumber",
";",
"}"
] | returns the transaction sequence for the next transaction.
@return int | [
"returns",
"the",
"transaction",
"sequence",
"for",
"the",
"next",
"transaction",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php#L332-L349 |
32,020 | chameleon-system/chameleon-shop | src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php | TPkgShopPaymentTransactionManagerEndPoint.getBillableProducts | public function getBillableProducts($bIncludeUnconfirmedTransactions = true)
{
$aProductList = array();
$oOrderItemList = $this->order->GetFieldShopOrderItemList();
$oOrderItemList->GoToStart();
while ($oOrderItem = $oOrderItemList->Next()) {
$iBilled = $this->getProductAmountWithTransactionType(
$oOrderItem->id,
self::TRANSACTION_TYPE_PAYMENT,
$bIncludeUnconfirmedTransactions
);
$iRemaining = round($oOrderItem->fieldOrderAmount - $iBilled);
if ($iRemaining > 0) {
$aProductList[$oOrderItem->id] = $iRemaining;
}
}
$oOrderItemList->GoToStart();
return $aProductList;
} | php | public function getBillableProducts($bIncludeUnconfirmedTransactions = true)
{
$aProductList = array();
$oOrderItemList = $this->order->GetFieldShopOrderItemList();
$oOrderItemList->GoToStart();
while ($oOrderItem = $oOrderItemList->Next()) {
$iBilled = $this->getProductAmountWithTransactionType(
$oOrderItem->id,
self::TRANSACTION_TYPE_PAYMENT,
$bIncludeUnconfirmedTransactions
);
$iRemaining = round($oOrderItem->fieldOrderAmount - $iBilled);
if ($iRemaining > 0) {
$aProductList[$oOrderItem->id] = $iRemaining;
}
}
$oOrderItemList->GoToStart();
return $aProductList;
} | [
"public",
"function",
"getBillableProducts",
"(",
"$",
"bIncludeUnconfirmedTransactions",
"=",
"true",
")",
"{",
"$",
"aProductList",
"=",
"array",
"(",
")",
";",
"$",
"oOrderItemList",
"=",
"$",
"this",
"->",
"order",
"->",
"GetFieldShopOrderItemList",
"(",
")",
";",
"$",
"oOrderItemList",
"->",
"GoToStart",
"(",
")",
";",
"while",
"(",
"$",
"oOrderItem",
"=",
"$",
"oOrderItemList",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"iBilled",
"=",
"$",
"this",
"->",
"getProductAmountWithTransactionType",
"(",
"$",
"oOrderItem",
"->",
"id",
",",
"self",
"::",
"TRANSACTION_TYPE_PAYMENT",
",",
"$",
"bIncludeUnconfirmedTransactions",
")",
";",
"$",
"iRemaining",
"=",
"round",
"(",
"$",
"oOrderItem",
"->",
"fieldOrderAmount",
"-",
"$",
"iBilled",
")",
";",
"if",
"(",
"$",
"iRemaining",
">",
"0",
")",
"{",
"$",
"aProductList",
"[",
"$",
"oOrderItem",
"->",
"id",
"]",
"=",
"$",
"iRemaining",
";",
"}",
"}",
"$",
"oOrderItemList",
"->",
"GoToStart",
"(",
")",
";",
"return",
"$",
"aProductList",
";",
"}"
] | returns an array with all products that have not been billed via a transaction.
@param $bIncludeUnconfirmedTransactions
@return array [shop_order_item_id] = amount | [
"returns",
"an",
"array",
"with",
"all",
"products",
"that",
"have",
"not",
"been",
"billed",
"via",
"a",
"transaction",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php#L415-L434 |
32,021 | chameleon-system/chameleon-shop | src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php | TPkgShopPaymentTransactionManagerEndPoint.getRefundableProducts | public function getRefundableProducts($bIncludeUnconfirmedTransactions = true)
{
$aProductList = array();
$oOrderItemList = $this->order->GetFieldShopOrderItemList();
$oOrderItemList->GoToStart();
while ($oOrderItem = $oOrderItemList->Next()) {
$iBilled = $this->getProductAmountWithTransactionType(
$oOrderItem->id,
self::TRANSACTION_TYPE_PAYMENT,
false
);
$iRefunded = $this->getProductAmountWithTransactionType(
$oOrderItem->id,
self::TRANSACTION_TYPE_CREDIT,
$bIncludeUnconfirmedTransactions
);
$iRefunded += $this->getProductAmountWithTransactionType(
$oOrderItem->id,
self::TRANSACTION_TYPE_PAYMENT_REVERSAL,
$bIncludeUnconfirmedTransactions
);
$iRefundable = round($iBilled + $iRefunded);
if ($iRefundable > 0) {
$aProductList[$oOrderItem->id] = $iRefundable;
}
}
$oOrderItemList->GoToStart();
return $aProductList;
} | php | public function getRefundableProducts($bIncludeUnconfirmedTransactions = true)
{
$aProductList = array();
$oOrderItemList = $this->order->GetFieldShopOrderItemList();
$oOrderItemList->GoToStart();
while ($oOrderItem = $oOrderItemList->Next()) {
$iBilled = $this->getProductAmountWithTransactionType(
$oOrderItem->id,
self::TRANSACTION_TYPE_PAYMENT,
false
);
$iRefunded = $this->getProductAmountWithTransactionType(
$oOrderItem->id,
self::TRANSACTION_TYPE_CREDIT,
$bIncludeUnconfirmedTransactions
);
$iRefunded += $this->getProductAmountWithTransactionType(
$oOrderItem->id,
self::TRANSACTION_TYPE_PAYMENT_REVERSAL,
$bIncludeUnconfirmedTransactions
);
$iRefundable = round($iBilled + $iRefunded);
if ($iRefundable > 0) {
$aProductList[$oOrderItem->id] = $iRefundable;
}
}
$oOrderItemList->GoToStart();
return $aProductList;
} | [
"public",
"function",
"getRefundableProducts",
"(",
"$",
"bIncludeUnconfirmedTransactions",
"=",
"true",
")",
"{",
"$",
"aProductList",
"=",
"array",
"(",
")",
";",
"$",
"oOrderItemList",
"=",
"$",
"this",
"->",
"order",
"->",
"GetFieldShopOrderItemList",
"(",
")",
";",
"$",
"oOrderItemList",
"->",
"GoToStart",
"(",
")",
";",
"while",
"(",
"$",
"oOrderItem",
"=",
"$",
"oOrderItemList",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"iBilled",
"=",
"$",
"this",
"->",
"getProductAmountWithTransactionType",
"(",
"$",
"oOrderItem",
"->",
"id",
",",
"self",
"::",
"TRANSACTION_TYPE_PAYMENT",
",",
"false",
")",
";",
"$",
"iRefunded",
"=",
"$",
"this",
"->",
"getProductAmountWithTransactionType",
"(",
"$",
"oOrderItem",
"->",
"id",
",",
"self",
"::",
"TRANSACTION_TYPE_CREDIT",
",",
"$",
"bIncludeUnconfirmedTransactions",
")",
";",
"$",
"iRefunded",
"+=",
"$",
"this",
"->",
"getProductAmountWithTransactionType",
"(",
"$",
"oOrderItem",
"->",
"id",
",",
"self",
"::",
"TRANSACTION_TYPE_PAYMENT_REVERSAL",
",",
"$",
"bIncludeUnconfirmedTransactions",
")",
";",
"$",
"iRefundable",
"=",
"round",
"(",
"$",
"iBilled",
"+",
"$",
"iRefunded",
")",
";",
"if",
"(",
"$",
"iRefundable",
">",
"0",
")",
"{",
"$",
"aProductList",
"[",
"$",
"oOrderItem",
"->",
"id",
"]",
"=",
"$",
"iRefundable",
";",
"}",
"}",
"$",
"oOrderItemList",
"->",
"GoToStart",
"(",
")",
";",
"return",
"$",
"aProductList",
";",
"}"
] | returns an array of all products that have been billed and not refunded.
@param $bIncludeUnconfirmedTransactions
@return array [shop_order_item_id] = amount | [
"returns",
"an",
"array",
"of",
"all",
"products",
"that",
"have",
"been",
"billed",
"and",
"not",
"refunded",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php#L443-L472 |
32,022 | chameleon-system/chameleon-shop | src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php | TPkgShopPaymentTransactionManagerEndPoint.allProductsAreRefundable | public function allProductsAreRefundable()
{
$bProductsHaveBeenRefunded = $this->hasTransactions(self::TRANSACTION_TYPE_PAYMENT_REVERSAL)
|| $this->hasTransactions(self::TRANSACTION_TYPE_CREDIT);
if (true === $bProductsHaveBeenRefunded) {
return false;
}
if ($this->order->fieldValueTotal == $this->getMaxAllowedValueFor(self::TRANSACTION_TYPE_CREDIT)) {
return true;
}
return false;
} | php | public function allProductsAreRefundable()
{
$bProductsHaveBeenRefunded = $this->hasTransactions(self::TRANSACTION_TYPE_PAYMENT_REVERSAL)
|| $this->hasTransactions(self::TRANSACTION_TYPE_CREDIT);
if (true === $bProductsHaveBeenRefunded) {
return false;
}
if ($this->order->fieldValueTotal == $this->getMaxAllowedValueFor(self::TRANSACTION_TYPE_CREDIT)) {
return true;
}
return false;
} | [
"public",
"function",
"allProductsAreRefundable",
"(",
")",
"{",
"$",
"bProductsHaveBeenRefunded",
"=",
"$",
"this",
"->",
"hasTransactions",
"(",
"self",
"::",
"TRANSACTION_TYPE_PAYMENT_REVERSAL",
")",
"||",
"$",
"this",
"->",
"hasTransactions",
"(",
"self",
"::",
"TRANSACTION_TYPE_CREDIT",
")",
";",
"if",
"(",
"true",
"===",
"$",
"bProductsHaveBeenRefunded",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"order",
"->",
"fieldValueTotal",
"==",
"$",
"this",
"->",
"getMaxAllowedValueFor",
"(",
"self",
"::",
"TRANSACTION_TYPE_CREDIT",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | returns true if all products are refundable. That is the case if.
a) no product has been refunded
b) ALL products have been paid | [
"returns",
"true",
"if",
"all",
"products",
"are",
"refundable",
".",
"That",
"is",
"the",
"case",
"if",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionManagerEndPoint.class.php#L480-L493 |
32,023 | edmondscommerce/doctrine-static-meta | src/Entity/Debug/DebugEntityDataObjectIds.php | DebugEntityDataObjectIds.initDebugIds | private function initDebugIds(bool $created = false)
{
$this->debugIdAsString = (string)$this->id;
$this->debugObjectHash = spl_object_hash($this);
if (false === $created) {
return;
}
static $increment = 0;
$this->debugCreationIncrement = ++$increment;
} | php | private function initDebugIds(bool $created = false)
{
$this->debugIdAsString = (string)$this->id;
$this->debugObjectHash = spl_object_hash($this);
if (false === $created) {
return;
}
static $increment = 0;
$this->debugCreationIncrement = ++$increment;
} | [
"private",
"function",
"initDebugIds",
"(",
"bool",
"$",
"created",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"debugIdAsString",
"=",
"(",
"string",
")",
"$",
"this",
"->",
"id",
";",
"$",
"this",
"->",
"debugObjectHash",
"=",
"spl_object_hash",
"(",
"$",
"this",
")",
";",
"if",
"(",
"false",
"===",
"$",
"created",
")",
"{",
"return",
";",
"}",
"static",
"$",
"increment",
"=",
"0",
";",
"$",
"this",
"->",
"debugCreationIncrement",
"=",
"++",
"$",
"increment",
";",
"}"
] | When creating a new Entity, we track the increment to help with identifying Entities
@param bool $created
@SuppressWarnings(PHPMD.BooleanArgumentFlag) | [
"When",
"creating",
"a",
"new",
"Entity",
"we",
"track",
"the",
"increment",
"to",
"help",
"with",
"identifying",
"Entities"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Debug/DebugEntityDataObjectIds.php#L36-L45 |
32,024 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopVoucherSeries.class.php | TCMSShopTableEditor_ShopVoucherSeries.CreateVoucherCodes | public function CreateVoucherCodes($sCode = null, $iNumberOfVouchers = null)
{
$oReturn = new stdClass();
$oReturn->bError = false;
$oReturn->sMessage = 'Gutscheine erstellt';
if ($this->AllowCreatingVoucherCodes()) {
$oGlobal = TGlobal::instance();
if (is_null($iNumberOfVouchers)) {
$iNumberOfVouchers = intval($oGlobal->GetUserData('iNumberOfVouchers'));
}
if (is_null($sCode)) {
$sCode = $oGlobal->GetUserData('sCode');
}
$bUseRandomCode = (empty($sCode));
if (!$bUseRandomCode) {
// make sure that the code does not exist in another series
$query = "SELECT * FROM `shop_voucher`
WHERE `shop_voucher_series_id` <> '".MySqlLegacySupport::getInstance()->real_escape_string($this->sId)."'
AND `code` = '".MySqlLegacySupport::getInstance()->real_escape_string($sCode)."'";
$tRes = MySqlLegacySupport::getInstance()->query($query);
if (MySqlLegacySupport::getInstance()->num_rows($tRes) > 0) {
// invalid code
$oReturn->bError = true;
$oReturn->sMessage = 'Code wurde bereits in mindestens einer anderen Gutscheinserie verwendet!';
}
}
if (!$oReturn->bError) {
$oVoucher = TdbShopVoucher::GetNewInstance();
/** @var $oVoucher TdbShopVoucher */
$oVoucherCodeTableConf = &$oVoucher->GetTableConf();
$oVoucherCodeEditor = new TCMSTableEditorManager();
/** @var $oEditor TCMSTableEditorManager */
$oVoucherCodeEditor->Init($oVoucherCodeTableConf->id, null);
$oVoucher->AllowEditByAll(true);
TCacheManager::SetDisableCaching(true);
for ($i = 0; $i < $iNumberOfVouchers; ++$i) {
if ($bUseRandomCode) {
do {
$sCode = strtolower(TTools::GenerateVoucherCode(10));
if ($oVoucher->LoadFromFields(array('code' => $sCode))) {
$sCode = '';
}
} while (empty($sCode));
}
$aData = array('shop_voucher_series_id' => $this->sId, 'code' => $sCode, 'datecreated' => date('Y-m-d H:i:s'));
// save entrie...
$oVoucherCodeEditor->Save($aData);
}
TCacheManager::SetDisableCaching(false);
TCacheManager::PerformeTableChange('shop_voucher', null); // flush all cache entries related to the voucher table
}
}
return $oReturn;
} | php | public function CreateVoucherCodes($sCode = null, $iNumberOfVouchers = null)
{
$oReturn = new stdClass();
$oReturn->bError = false;
$oReturn->sMessage = 'Gutscheine erstellt';
if ($this->AllowCreatingVoucherCodes()) {
$oGlobal = TGlobal::instance();
if (is_null($iNumberOfVouchers)) {
$iNumberOfVouchers = intval($oGlobal->GetUserData('iNumberOfVouchers'));
}
if (is_null($sCode)) {
$sCode = $oGlobal->GetUserData('sCode');
}
$bUseRandomCode = (empty($sCode));
if (!$bUseRandomCode) {
// make sure that the code does not exist in another series
$query = "SELECT * FROM `shop_voucher`
WHERE `shop_voucher_series_id` <> '".MySqlLegacySupport::getInstance()->real_escape_string($this->sId)."'
AND `code` = '".MySqlLegacySupport::getInstance()->real_escape_string($sCode)."'";
$tRes = MySqlLegacySupport::getInstance()->query($query);
if (MySqlLegacySupport::getInstance()->num_rows($tRes) > 0) {
// invalid code
$oReturn->bError = true;
$oReturn->sMessage = 'Code wurde bereits in mindestens einer anderen Gutscheinserie verwendet!';
}
}
if (!$oReturn->bError) {
$oVoucher = TdbShopVoucher::GetNewInstance();
/** @var $oVoucher TdbShopVoucher */
$oVoucherCodeTableConf = &$oVoucher->GetTableConf();
$oVoucherCodeEditor = new TCMSTableEditorManager();
/** @var $oEditor TCMSTableEditorManager */
$oVoucherCodeEditor->Init($oVoucherCodeTableConf->id, null);
$oVoucher->AllowEditByAll(true);
TCacheManager::SetDisableCaching(true);
for ($i = 0; $i < $iNumberOfVouchers; ++$i) {
if ($bUseRandomCode) {
do {
$sCode = strtolower(TTools::GenerateVoucherCode(10));
if ($oVoucher->LoadFromFields(array('code' => $sCode))) {
$sCode = '';
}
} while (empty($sCode));
}
$aData = array('shop_voucher_series_id' => $this->sId, 'code' => $sCode, 'datecreated' => date('Y-m-d H:i:s'));
// save entrie...
$oVoucherCodeEditor->Save($aData);
}
TCacheManager::SetDisableCaching(false);
TCacheManager::PerformeTableChange('shop_voucher', null); // flush all cache entries related to the voucher table
}
}
return $oReturn;
} | [
"public",
"function",
"CreateVoucherCodes",
"(",
"$",
"sCode",
"=",
"null",
",",
"$",
"iNumberOfVouchers",
"=",
"null",
")",
"{",
"$",
"oReturn",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"oReturn",
"->",
"bError",
"=",
"false",
";",
"$",
"oReturn",
"->",
"sMessage",
"=",
"'Gutscheine erstellt'",
";",
"if",
"(",
"$",
"this",
"->",
"AllowCreatingVoucherCodes",
"(",
")",
")",
"{",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"iNumberOfVouchers",
")",
")",
"{",
"$",
"iNumberOfVouchers",
"=",
"intval",
"(",
"$",
"oGlobal",
"->",
"GetUserData",
"(",
"'iNumberOfVouchers'",
")",
")",
";",
"}",
"if",
"(",
"is_null",
"(",
"$",
"sCode",
")",
")",
"{",
"$",
"sCode",
"=",
"$",
"oGlobal",
"->",
"GetUserData",
"(",
"'sCode'",
")",
";",
"}",
"$",
"bUseRandomCode",
"=",
"(",
"empty",
"(",
"$",
"sCode",
")",
")",
";",
"if",
"(",
"!",
"$",
"bUseRandomCode",
")",
"{",
"// make sure that the code does not exist in another series",
"$",
"query",
"=",
"\"SELECT * FROM `shop_voucher`\n WHERE `shop_voucher_series_id` <> '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"sId",
")",
".",
"\"'\n AND `code` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"sCode",
")",
".",
"\"'\"",
";",
"$",
"tRes",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"query",
")",
";",
"if",
"(",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"num_rows",
"(",
"$",
"tRes",
")",
">",
"0",
")",
"{",
"// invalid code",
"$",
"oReturn",
"->",
"bError",
"=",
"true",
";",
"$",
"oReturn",
"->",
"sMessage",
"=",
"'Code wurde bereits in mindestens einer anderen Gutscheinserie verwendet!'",
";",
"}",
"}",
"if",
"(",
"!",
"$",
"oReturn",
"->",
"bError",
")",
"{",
"$",
"oVoucher",
"=",
"TdbShopVoucher",
"::",
"GetNewInstance",
"(",
")",
";",
"/** @var $oVoucher TdbShopVoucher */",
"$",
"oVoucherCodeTableConf",
"=",
"&",
"$",
"oVoucher",
"->",
"GetTableConf",
"(",
")",
";",
"$",
"oVoucherCodeEditor",
"=",
"new",
"TCMSTableEditorManager",
"(",
")",
";",
"/** @var $oEditor TCMSTableEditorManager */",
"$",
"oVoucherCodeEditor",
"->",
"Init",
"(",
"$",
"oVoucherCodeTableConf",
"->",
"id",
",",
"null",
")",
";",
"$",
"oVoucher",
"->",
"AllowEditByAll",
"(",
"true",
")",
";",
"TCacheManager",
"::",
"SetDisableCaching",
"(",
"true",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"iNumberOfVouchers",
";",
"++",
"$",
"i",
")",
"{",
"if",
"(",
"$",
"bUseRandomCode",
")",
"{",
"do",
"{",
"$",
"sCode",
"=",
"strtolower",
"(",
"TTools",
"::",
"GenerateVoucherCode",
"(",
"10",
")",
")",
";",
"if",
"(",
"$",
"oVoucher",
"->",
"LoadFromFields",
"(",
"array",
"(",
"'code'",
"=>",
"$",
"sCode",
")",
")",
")",
"{",
"$",
"sCode",
"=",
"''",
";",
"}",
"}",
"while",
"(",
"empty",
"(",
"$",
"sCode",
")",
")",
";",
"}",
"$",
"aData",
"=",
"array",
"(",
"'shop_voucher_series_id'",
"=>",
"$",
"this",
"->",
"sId",
",",
"'code'",
"=>",
"$",
"sCode",
",",
"'datecreated'",
"=>",
"date",
"(",
"'Y-m-d H:i:s'",
")",
")",
";",
"// save entrie...",
"$",
"oVoucherCodeEditor",
"->",
"Save",
"(",
"$",
"aData",
")",
";",
"}",
"TCacheManager",
"::",
"SetDisableCaching",
"(",
"false",
")",
";",
"TCacheManager",
"::",
"PerformeTableChange",
"(",
"'shop_voucher'",
",",
"null",
")",
";",
"// flush all cache entries related to the voucher table",
"}",
"}",
"return",
"$",
"oReturn",
";",
"}"
] | create a number of vouchers in the shop_voucher table.
@param string $sCode - the code to use. if empty, a random unique code will be generated
@param int $iNumberOfVouchers - number of vouchers to create (will fetch this from user input if null given) | [
"create",
"a",
"number",
"of",
"vouchers",
"in",
"the",
"shop_voucher",
"table",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopVoucherSeries.class.php#L70-L127 |
32,025 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopVoucherSeries.class.php | TCMSShopTableEditor_ShopVoucherSeries.AllowCreatingVoucherCodes | protected function AllowCreatingVoucherCodes()
{
$bAllowCreatingCodes = false;
$oTargetTableConf = TdbCmsTblConf::GetNewInstance();
/** @var $oTargetTableConf TdbCmsTblConf */
if ($oTargetTableConf->Loadfromfield('name', 'shop_voucher')) {
$oGlobal = TGlobal::instance();
$bUserIsInCodeTableGroup = $oGlobal->oUser->oAccessManager->user->IsInGroups($oTargetTableConf->fieldCmsUsergroupId);
$bHasNewPermissionOnTargetTable = ($oGlobal->oUser->oAccessManager->HasNewPermission('shop_voucher'));
$bAllowCreatingCodes = ($bUserIsInCodeTableGroup && $bHasNewPermissionOnTargetTable);
}
return $bAllowCreatingCodes;
} | php | protected function AllowCreatingVoucherCodes()
{
$bAllowCreatingCodes = false;
$oTargetTableConf = TdbCmsTblConf::GetNewInstance();
/** @var $oTargetTableConf TdbCmsTblConf */
if ($oTargetTableConf->Loadfromfield('name', 'shop_voucher')) {
$oGlobal = TGlobal::instance();
$bUserIsInCodeTableGroup = $oGlobal->oUser->oAccessManager->user->IsInGroups($oTargetTableConf->fieldCmsUsergroupId);
$bHasNewPermissionOnTargetTable = ($oGlobal->oUser->oAccessManager->HasNewPermission('shop_voucher'));
$bAllowCreatingCodes = ($bUserIsInCodeTableGroup && $bHasNewPermissionOnTargetTable);
}
return $bAllowCreatingCodes;
} | [
"protected",
"function",
"AllowCreatingVoucherCodes",
"(",
")",
"{",
"$",
"bAllowCreatingCodes",
"=",
"false",
";",
"$",
"oTargetTableConf",
"=",
"TdbCmsTblConf",
"::",
"GetNewInstance",
"(",
")",
";",
"/** @var $oTargetTableConf TdbCmsTblConf */",
"if",
"(",
"$",
"oTargetTableConf",
"->",
"Loadfromfield",
"(",
"'name'",
",",
"'shop_voucher'",
")",
")",
"{",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"bUserIsInCodeTableGroup",
"=",
"$",
"oGlobal",
"->",
"oUser",
"->",
"oAccessManager",
"->",
"user",
"->",
"IsInGroups",
"(",
"$",
"oTargetTableConf",
"->",
"fieldCmsUsergroupId",
")",
";",
"$",
"bHasNewPermissionOnTargetTable",
"=",
"(",
"$",
"oGlobal",
"->",
"oUser",
"->",
"oAccessManager",
"->",
"HasNewPermission",
"(",
"'shop_voucher'",
")",
")",
";",
"$",
"bAllowCreatingCodes",
"=",
"(",
"$",
"bUserIsInCodeTableGroup",
"&&",
"$",
"bHasNewPermissionOnTargetTable",
")",
";",
"}",
"return",
"$",
"bAllowCreatingCodes",
";",
"}"
] | return true if the current user has the right to create codes in the shop_voucher table.
@return bool | [
"return",
"true",
"if",
"the",
"current",
"user",
"has",
"the",
"right",
"to",
"create",
"codes",
"in",
"the",
"shop_voucher",
"table",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopVoucherSeries.class.php#L134-L148 |
32,026 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopVoucherSeries.class.php | TCMSShopTableEditor_ShopVoucherSeries.ExportVoucherCodes | public function ExportVoucherCodes()
{
$sReturn = '';
if ($this->AllowExportingVoucherCodes()) {
$oVouchers = TdbShopVoucherList::GetList("SELECT * FROM `shop_voucher` WHERE `shop_voucher_series_id`='".MySqlLegacySupport::getInstance()->real_escape_string($this->sId)."'");
$oVouchers->GoToStart();
$count = 0;
while ($oVoucher = $oVouchers->Next()) {
$aCsvVouchers[$count][0] = str_replace('"', '""', $oVoucher->fieldCode);
if ('0000-00-00 00:00:00' != $oVoucher->fieldDatecreated) {
$aCsvVouchers[$count][1] = date('d.m.Y H:i', strtotime($oVoucher->fieldDatecreated));
} else {
$aCsvVouchers[$count][3] = '';
}
$aCsvVouchers[$count][2] = $oVoucher->fieldIsUsedUp;
if ('0000-00-00 00:00:00' != $oVoucher->fieldDateUsedUp) {
$aCsvVouchers[$count][3] = date('d.m.Y H:i', strtotime($oVoucher->fieldDateUsedUp));
} else {
$aCsvVouchers[$count][3] = '';
}
++$count;
}
$sCsv = '';
for ($i = 0; $i < count($aCsvVouchers); ++$i) {
$sCsv .= '"'.implode('";"', $aCsvVouchers[$i])."\"\n";
}
$sCsv = '"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_code')).'";"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_created')).'";"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_spent')).'";"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_spent_date'))."\"\n".$sCsv;
while (@ob_end_clean()) {
}
header('Cache-Control: must-revalidate');
header('Pragma: must-revalidate');
header('Content-type: application/csv');
header('Content-disposition: attachment; filename=ShopVouchers.csv');
echo $sCsv;
exit(0);
} else {
echo 'Keine Berechtigung';
}
} | php | public function ExportVoucherCodes()
{
$sReturn = '';
if ($this->AllowExportingVoucherCodes()) {
$oVouchers = TdbShopVoucherList::GetList("SELECT * FROM `shop_voucher` WHERE `shop_voucher_series_id`='".MySqlLegacySupport::getInstance()->real_escape_string($this->sId)."'");
$oVouchers->GoToStart();
$count = 0;
while ($oVoucher = $oVouchers->Next()) {
$aCsvVouchers[$count][0] = str_replace('"', '""', $oVoucher->fieldCode);
if ('0000-00-00 00:00:00' != $oVoucher->fieldDatecreated) {
$aCsvVouchers[$count][1] = date('d.m.Y H:i', strtotime($oVoucher->fieldDatecreated));
} else {
$aCsvVouchers[$count][3] = '';
}
$aCsvVouchers[$count][2] = $oVoucher->fieldIsUsedUp;
if ('0000-00-00 00:00:00' != $oVoucher->fieldDateUsedUp) {
$aCsvVouchers[$count][3] = date('d.m.Y H:i', strtotime($oVoucher->fieldDateUsedUp));
} else {
$aCsvVouchers[$count][3] = '';
}
++$count;
}
$sCsv = '';
for ($i = 0; $i < count($aCsvVouchers); ++$i) {
$sCsv .= '"'.implode('";"', $aCsvVouchers[$i])."\"\n";
}
$sCsv = '"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_code')).'";"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_created')).'";"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_spent')).'";"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_spent_date'))."\"\n".$sCsv;
while (@ob_end_clean()) {
}
header('Cache-Control: must-revalidate');
header('Pragma: must-revalidate');
header('Content-type: application/csv');
header('Content-disposition: attachment; filename=ShopVouchers.csv');
echo $sCsv;
exit(0);
} else {
echo 'Keine Berechtigung';
}
} | [
"public",
"function",
"ExportVoucherCodes",
"(",
")",
"{",
"$",
"sReturn",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"AllowExportingVoucherCodes",
"(",
")",
")",
"{",
"$",
"oVouchers",
"=",
"TdbShopVoucherList",
"::",
"GetList",
"(",
"\"SELECT * FROM `shop_voucher` WHERE `shop_voucher_series_id`='\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"sId",
")",
".",
"\"'\"",
")",
";",
"$",
"oVouchers",
"->",
"GoToStart",
"(",
")",
";",
"$",
"count",
"=",
"0",
";",
"while",
"(",
"$",
"oVoucher",
"=",
"$",
"oVouchers",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"aCsvVouchers",
"[",
"$",
"count",
"]",
"[",
"0",
"]",
"=",
"str_replace",
"(",
"'\"'",
",",
"'\"\"'",
",",
"$",
"oVoucher",
"->",
"fieldCode",
")",
";",
"if",
"(",
"'0000-00-00 00:00:00'",
"!=",
"$",
"oVoucher",
"->",
"fieldDatecreated",
")",
"{",
"$",
"aCsvVouchers",
"[",
"$",
"count",
"]",
"[",
"1",
"]",
"=",
"date",
"(",
"'d.m.Y H:i'",
",",
"strtotime",
"(",
"$",
"oVoucher",
"->",
"fieldDatecreated",
")",
")",
";",
"}",
"else",
"{",
"$",
"aCsvVouchers",
"[",
"$",
"count",
"]",
"[",
"3",
"]",
"=",
"''",
";",
"}",
"$",
"aCsvVouchers",
"[",
"$",
"count",
"]",
"[",
"2",
"]",
"=",
"$",
"oVoucher",
"->",
"fieldIsUsedUp",
";",
"if",
"(",
"'0000-00-00 00:00:00'",
"!=",
"$",
"oVoucher",
"->",
"fieldDateUsedUp",
")",
"{",
"$",
"aCsvVouchers",
"[",
"$",
"count",
"]",
"[",
"3",
"]",
"=",
"date",
"(",
"'d.m.Y H:i'",
",",
"strtotime",
"(",
"$",
"oVoucher",
"->",
"fieldDateUsedUp",
")",
")",
";",
"}",
"else",
"{",
"$",
"aCsvVouchers",
"[",
"$",
"count",
"]",
"[",
"3",
"]",
"=",
"''",
";",
"}",
"++",
"$",
"count",
";",
"}",
"$",
"sCsv",
"=",
"''",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"count",
"(",
"$",
"aCsvVouchers",
")",
";",
"++",
"$",
"i",
")",
"{",
"$",
"sCsv",
".=",
"'\"'",
".",
"implode",
"(",
"'\";\"'",
",",
"$",
"aCsvVouchers",
"[",
"$",
"i",
"]",
")",
".",
"\"\\\"\\n\"",
";",
"}",
"$",
"sCsv",
"=",
"'\"'",
".",
"TGlobal",
"::",
"OutHTML",
"(",
"TGlobal",
"::",
"Translate",
"(",
"'chameleon_system_shop.voucher.export_column_code'",
")",
")",
".",
"'\";\"'",
".",
"TGlobal",
"::",
"OutHTML",
"(",
"TGlobal",
"::",
"Translate",
"(",
"'chameleon_system_shop.voucher.export_column_created'",
")",
")",
".",
"'\";\"'",
".",
"TGlobal",
"::",
"OutHTML",
"(",
"TGlobal",
"::",
"Translate",
"(",
"'chameleon_system_shop.voucher.export_column_spent'",
")",
")",
".",
"'\";\"'",
".",
"TGlobal",
"::",
"OutHTML",
"(",
"TGlobal",
"::",
"Translate",
"(",
"'chameleon_system_shop.voucher.export_column_spent_date'",
")",
")",
".",
"\"\\\"\\n\"",
".",
"$",
"sCsv",
";",
"while",
"(",
"@",
"ob_end_clean",
"(",
")",
")",
"{",
"}",
"header",
"(",
"'Cache-Control: must-revalidate'",
")",
";",
"header",
"(",
"'Pragma: must-revalidate'",
")",
";",
"header",
"(",
"'Content-type: application/csv'",
")",
";",
"header",
"(",
"'Content-disposition: attachment; filename=ShopVouchers.csv'",
")",
";",
"echo",
"$",
"sCsv",
";",
"exit",
"(",
"0",
")",
";",
"}",
"else",
"{",
"echo",
"'Keine Berechtigung'",
";",
"}",
"}"
] | export all vouchers from a voucher series as csv-file with Code, Datecreated and UsedUp-Information. | [
"export",
"all",
"vouchers",
"from",
"a",
"voucher",
"series",
"as",
"csv",
"-",
"file",
"with",
"Code",
"Datecreated",
"and",
"UsedUp",
"-",
"Information",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopVoucherSeries.class.php#L173-L216 |
32,027 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneAliasGateway.class.php | TShopPaymentHandlerOgoneAliasGateway.GetAllInputFieldParameter | protected function GetAllInputFieldParameter()
{
$aParameter = array();
$aParameter['PSPID'] = $this->GetConfigParameter('user_id');
$aParameter['ACCEPTURL'] = $this->GetSuccessURL();
$aParameter['EXCEPTIONURL'] = $this->GetErrorURL();
// if the user already requested an alias we want to update that existing one so we need the given order id (ref from ogone) and the alias for the hashing too
if (isset($this->aPaymentUserData['ORDERID']) && '' !== $this->aPaymentUserData['ORDERID']) {
$aParameter['ORDERID'] = $this->aPaymentUserData['ORDERID'];
}
if (isset($this->aPaymentUserData['ALIAS']) && '' !== $this->aPaymentUserData['ALIAS']) {
$aParameter['ALIAS'] = $this->aPaymentUserData['ALIAS'];
}
$aHashParameter = $aParameter;
$aParameter['SHASIGN'] = $this->BuildOutgoingHash($aHashParameter);
return $aParameter;
} | php | protected function GetAllInputFieldParameter()
{
$aParameter = array();
$aParameter['PSPID'] = $this->GetConfigParameter('user_id');
$aParameter['ACCEPTURL'] = $this->GetSuccessURL();
$aParameter['EXCEPTIONURL'] = $this->GetErrorURL();
// if the user already requested an alias we want to update that existing one so we need the given order id (ref from ogone) and the alias for the hashing too
if (isset($this->aPaymentUserData['ORDERID']) && '' !== $this->aPaymentUserData['ORDERID']) {
$aParameter['ORDERID'] = $this->aPaymentUserData['ORDERID'];
}
if (isset($this->aPaymentUserData['ALIAS']) && '' !== $this->aPaymentUserData['ALIAS']) {
$aParameter['ALIAS'] = $this->aPaymentUserData['ALIAS'];
}
$aHashParameter = $aParameter;
$aParameter['SHASIGN'] = $this->BuildOutgoingHash($aHashParameter);
return $aParameter;
} | [
"protected",
"function",
"GetAllInputFieldParameter",
"(",
")",
"{",
"$",
"aParameter",
"=",
"array",
"(",
")",
";",
"$",
"aParameter",
"[",
"'PSPID'",
"]",
"=",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'user_id'",
")",
";",
"$",
"aParameter",
"[",
"'ACCEPTURL'",
"]",
"=",
"$",
"this",
"->",
"GetSuccessURL",
"(",
")",
";",
"$",
"aParameter",
"[",
"'EXCEPTIONURL'",
"]",
"=",
"$",
"this",
"->",
"GetErrorURL",
"(",
")",
";",
"// if the user already requested an alias we want to update that existing one so we need the given order id (ref from ogone) and the alias for the hashing too",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"aPaymentUserData",
"[",
"'ORDERID'",
"]",
")",
"&&",
"''",
"!==",
"$",
"this",
"->",
"aPaymentUserData",
"[",
"'ORDERID'",
"]",
")",
"{",
"$",
"aParameter",
"[",
"'ORDERID'",
"]",
"=",
"$",
"this",
"->",
"aPaymentUserData",
"[",
"'ORDERID'",
"]",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"aPaymentUserData",
"[",
"'ALIAS'",
"]",
")",
"&&",
"''",
"!==",
"$",
"this",
"->",
"aPaymentUserData",
"[",
"'ALIAS'",
"]",
")",
"{",
"$",
"aParameter",
"[",
"'ALIAS'",
"]",
"=",
"$",
"this",
"->",
"aPaymentUserData",
"[",
"'ALIAS'",
"]",
";",
"}",
"$",
"aHashParameter",
"=",
"$",
"aParameter",
";",
"$",
"aParameter",
"[",
"'SHASIGN'",
"]",
"=",
"$",
"this",
"->",
"BuildOutgoingHash",
"(",
"$",
"aHashParameter",
")",
";",
"return",
"$",
"aParameter",
";",
"}"
] | Get all needed parameter for first request to.
@return array | [
"Get",
"all",
"needed",
"parameter",
"for",
"first",
"request",
"to",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneAliasGateway.class.php#L46-L65 |
32,028 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneAliasGateway.class.php | TShopPaymentHandlerOgoneAliasGateway.GetErrorURL | protected function GetErrorURL($sStepName = '')
{
if (empty($sStepName)) {
$sStepName = 'shipping';
}
$sURL = false;
$oShippingStep = TdbShopOrderStep::GetStep($sStepName);
/** @var $oShippingStep TdbShopOrderStep */
if (!is_null($oShippingStep)) {
$sURL = $oShippingStep->GetStepURL(true, true);
if ('/' == substr($sURL, -1)) {
$sURL = substr($sURL, 0, -1);
}
}
return $sURL;
} | php | protected function GetErrorURL($sStepName = '')
{
if (empty($sStepName)) {
$sStepName = 'shipping';
}
$sURL = false;
$oShippingStep = TdbShopOrderStep::GetStep($sStepName);
/** @var $oShippingStep TdbShopOrderStep */
if (!is_null($oShippingStep)) {
$sURL = $oShippingStep->GetStepURL(true, true);
if ('/' == substr($sURL, -1)) {
$sURL = substr($sURL, 0, -1);
}
}
return $sURL;
} | [
"protected",
"function",
"GetErrorURL",
"(",
"$",
"sStepName",
"=",
"''",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"sStepName",
")",
")",
"{",
"$",
"sStepName",
"=",
"'shipping'",
";",
"}",
"$",
"sURL",
"=",
"false",
";",
"$",
"oShippingStep",
"=",
"TdbShopOrderStep",
"::",
"GetStep",
"(",
"$",
"sStepName",
")",
";",
"/** @var $oShippingStep TdbShopOrderStep */",
"if",
"(",
"!",
"is_null",
"(",
"$",
"oShippingStep",
")",
")",
"{",
"$",
"sURL",
"=",
"$",
"oShippingStep",
"->",
"GetStepURL",
"(",
"true",
",",
"true",
")",
";",
"if",
"(",
"'/'",
"==",
"substr",
"(",
"$",
"sURL",
",",
"-",
"1",
")",
")",
"{",
"$",
"sURL",
"=",
"substr",
"(",
"$",
"sURL",
",",
"0",
",",
"-",
"1",
")",
";",
"}",
"}",
"return",
"$",
"sURL",
";",
"}"
] | defines the error url of the "get alias" call
by default we only want to return to the shipping step.
@param string $sStepName
@return string | [
"defines",
"the",
"error",
"url",
"of",
"the",
"get",
"alias",
"call",
"by",
"default",
"we",
"only",
"want",
"to",
"return",
"to",
"the",
"shipping",
"step",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneAliasGateway.class.php#L106-L122 |
32,029 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneAliasGateway.class.php | TShopPaymentHandlerOgoneAliasGateway.GetUserPaymentData | protected function GetUserPaymentData()
{
parent::GetUserPaymentData();
$oGlobal = TGlobal::instance();
//if no new payment data was submitted try to get the data from the active payment method
if (!$oGlobal->UserDataExists(TdbShopPaymentHandler::URL_PAYMENT_USER_INPUT) && !isset($this->aPaymentUserData['NCERROR'])) {
$oBasket = TShopBasket::GetInstance();
$oPaymentMethod = &$oBasket->GetActivePaymentMethod();
if (null !== $oPaymentMethod) {
$oPaymentHandler = $oPaymentMethod->GetFieldShopPaymentHandler();
if ($oPaymentHandler instanceof self) {
$this->aPaymentUserData = $oPaymentHandler->GetUserPaymentDataWithoutLoading();
}
}
}
$this->MapExpireDateFromAPI();
$this->HandleError();
return $this->aPaymentUserData;
} | php | protected function GetUserPaymentData()
{
parent::GetUserPaymentData();
$oGlobal = TGlobal::instance();
//if no new payment data was submitted try to get the data from the active payment method
if (!$oGlobal->UserDataExists(TdbShopPaymentHandler::URL_PAYMENT_USER_INPUT) && !isset($this->aPaymentUserData['NCERROR'])) {
$oBasket = TShopBasket::GetInstance();
$oPaymentMethod = &$oBasket->GetActivePaymentMethod();
if (null !== $oPaymentMethod) {
$oPaymentHandler = $oPaymentMethod->GetFieldShopPaymentHandler();
if ($oPaymentHandler instanceof self) {
$this->aPaymentUserData = $oPaymentHandler->GetUserPaymentDataWithoutLoading();
}
}
}
$this->MapExpireDateFromAPI();
$this->HandleError();
return $this->aPaymentUserData;
} | [
"protected",
"function",
"GetUserPaymentData",
"(",
")",
"{",
"parent",
"::",
"GetUserPaymentData",
"(",
")",
";",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"//if no new payment data was submitted try to get the data from the active payment method",
"if",
"(",
"!",
"$",
"oGlobal",
"->",
"UserDataExists",
"(",
"TdbShopPaymentHandler",
"::",
"URL_PAYMENT_USER_INPUT",
")",
"&&",
"!",
"isset",
"(",
"$",
"this",
"->",
"aPaymentUserData",
"[",
"'NCERROR'",
"]",
")",
")",
"{",
"$",
"oBasket",
"=",
"TShopBasket",
"::",
"GetInstance",
"(",
")",
";",
"$",
"oPaymentMethod",
"=",
"&",
"$",
"oBasket",
"->",
"GetActivePaymentMethod",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"oPaymentMethod",
")",
"{",
"$",
"oPaymentHandler",
"=",
"$",
"oPaymentMethod",
"->",
"GetFieldShopPaymentHandler",
"(",
")",
";",
"if",
"(",
"$",
"oPaymentHandler",
"instanceof",
"self",
")",
"{",
"$",
"this",
"->",
"aPaymentUserData",
"=",
"$",
"oPaymentHandler",
"->",
"GetUserPaymentDataWithoutLoading",
"(",
")",
";",
"}",
"}",
"}",
"$",
"this",
"->",
"MapExpireDateFromAPI",
"(",
")",
";",
"$",
"this",
"->",
"HandleError",
"(",
")",
";",
"return",
"$",
"this",
"->",
"aPaymentUserData",
";",
"}"
] | load user payment data
overload the payment data with post data or the data of the active payment handler from the basket object if there is one.
@return array | [
"load",
"user",
"payment",
"data",
"overload",
"the",
"payment",
"data",
"with",
"post",
"data",
"or",
"the",
"data",
"of",
"the",
"active",
"payment",
"handler",
"from",
"the",
"basket",
"object",
"if",
"there",
"is",
"one",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneAliasGateway.class.php#L163-L183 |
32,030 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneAliasGateway.class.php | TShopPaymentHandlerOgoneAliasGateway.MapExpireDateFromAPI | protected function MapExpireDateFromAPI()
{
if (isset($this->aPaymentUserData['ED']) && '' !== $this->aPaymentUserData['ED']) {
$this->aPaymentUserData['ECOM_CARDINFO_EXPDATE_MONTH'] = substr($this->aPaymentUserData['ED'], 0, 2);
$this->aPaymentUserData['ECOM_CARDINFO_EXPDATE_YEAR'] = '20'.substr($this->aPaymentUserData['ED'], 2, 2);
}
} | php | protected function MapExpireDateFromAPI()
{
if (isset($this->aPaymentUserData['ED']) && '' !== $this->aPaymentUserData['ED']) {
$this->aPaymentUserData['ECOM_CARDINFO_EXPDATE_MONTH'] = substr($this->aPaymentUserData['ED'], 0, 2);
$this->aPaymentUserData['ECOM_CARDINFO_EXPDATE_YEAR'] = '20'.substr($this->aPaymentUserData['ED'], 2, 2);
}
} | [
"protected",
"function",
"MapExpireDateFromAPI",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"aPaymentUserData",
"[",
"'ED'",
"]",
")",
"&&",
"''",
"!==",
"$",
"this",
"->",
"aPaymentUserData",
"[",
"'ED'",
"]",
")",
"{",
"$",
"this",
"->",
"aPaymentUserData",
"[",
"'ECOM_CARDINFO_EXPDATE_MONTH'",
"]",
"=",
"substr",
"(",
"$",
"this",
"->",
"aPaymentUserData",
"[",
"'ED'",
"]",
",",
"0",
",",
"2",
")",
";",
"$",
"this",
"->",
"aPaymentUserData",
"[",
"'ECOM_CARDINFO_EXPDATE_YEAR'",
"]",
"=",
"'20'",
".",
"substr",
"(",
"$",
"this",
"->",
"aPaymentUserData",
"[",
"'ED'",
"]",
",",
"2",
",",
"2",
")",
";",
"}",
"}"
] | the api only returns concatenated date instead of month and year in single fields
so we want to map them because we use the single fields for submitting. | [
"the",
"api",
"only",
"returns",
"concatenated",
"date",
"instead",
"of",
"month",
"and",
"year",
"in",
"single",
"fields",
"so",
"we",
"want",
"to",
"map",
"them",
"because",
"we",
"use",
"the",
"single",
"fields",
"for",
"submitting",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneAliasGateway.class.php#L189-L195 |
32,031 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneAliasGateway.class.php | TShopPaymentHandlerOgoneAliasGateway.HandleError | protected function HandleError()
{
static $bErrorsHandled = false;
if (!$bErrorsHandled) {
$bErrorsHandled = true;
$oMessageManager = TCMSMessageManager::GetInstance();
$oGlobal = TGlobal::instance();
$aErrorFields = $this->GetErrorFields();
$aReturnedParameter = $oGlobal->GetUserData();
$aTrackedErrors = array();
$sConsumerName = self::MSG_MANAGER_NAME;
foreach ($aErrorFields as $sErrorField) {
if (array_key_exists($sErrorField, $aReturnedParameter) && $aReturnedParameter[$sErrorField] > 0) {
if (!in_array($aReturnedParameter[$sErrorField], $aTrackedErrors)) {
TTools::WriteLogEntry('OGONE Alias Gateway: error from alias gateway call: '.$sErrorField.'-'.$aReturnedParameter[$sErrorField], 1, __FILE__, __LINE__);
$oMessageManager->AddMessage($sConsumerName, 'PAYMENT-HANDLER-OGONE-ALIAS-GATEWAY-ERROR-'.$sErrorField.'-'.$aReturnedParameter[$sErrorField]);
$aTrackedErrors[] = $aReturnedParameter[$sErrorField];
}
}
}
}
} | php | protected function HandleError()
{
static $bErrorsHandled = false;
if (!$bErrorsHandled) {
$bErrorsHandled = true;
$oMessageManager = TCMSMessageManager::GetInstance();
$oGlobal = TGlobal::instance();
$aErrorFields = $this->GetErrorFields();
$aReturnedParameter = $oGlobal->GetUserData();
$aTrackedErrors = array();
$sConsumerName = self::MSG_MANAGER_NAME;
foreach ($aErrorFields as $sErrorField) {
if (array_key_exists($sErrorField, $aReturnedParameter) && $aReturnedParameter[$sErrorField] > 0) {
if (!in_array($aReturnedParameter[$sErrorField], $aTrackedErrors)) {
TTools::WriteLogEntry('OGONE Alias Gateway: error from alias gateway call: '.$sErrorField.'-'.$aReturnedParameter[$sErrorField], 1, __FILE__, __LINE__);
$oMessageManager->AddMessage($sConsumerName, 'PAYMENT-HANDLER-OGONE-ALIAS-GATEWAY-ERROR-'.$sErrorField.'-'.$aReturnedParameter[$sErrorField]);
$aTrackedErrors[] = $aReturnedParameter[$sErrorField];
}
}
}
}
} | [
"protected",
"function",
"HandleError",
"(",
")",
"{",
"static",
"$",
"bErrorsHandled",
"=",
"false",
";",
"if",
"(",
"!",
"$",
"bErrorsHandled",
")",
"{",
"$",
"bErrorsHandled",
"=",
"true",
";",
"$",
"oMessageManager",
"=",
"TCMSMessageManager",
"::",
"GetInstance",
"(",
")",
";",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"aErrorFields",
"=",
"$",
"this",
"->",
"GetErrorFields",
"(",
")",
";",
"$",
"aReturnedParameter",
"=",
"$",
"oGlobal",
"->",
"GetUserData",
"(",
")",
";",
"$",
"aTrackedErrors",
"=",
"array",
"(",
")",
";",
"$",
"sConsumerName",
"=",
"self",
"::",
"MSG_MANAGER_NAME",
";",
"foreach",
"(",
"$",
"aErrorFields",
"as",
"$",
"sErrorField",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"sErrorField",
",",
"$",
"aReturnedParameter",
")",
"&&",
"$",
"aReturnedParameter",
"[",
"$",
"sErrorField",
"]",
">",
"0",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"aReturnedParameter",
"[",
"$",
"sErrorField",
"]",
",",
"$",
"aTrackedErrors",
")",
")",
"{",
"TTools",
"::",
"WriteLogEntry",
"(",
"'OGONE Alias Gateway: error from alias gateway call: '",
".",
"$",
"sErrorField",
".",
"'-'",
".",
"$",
"aReturnedParameter",
"[",
"$",
"sErrorField",
"]",
",",
"1",
",",
"__FILE__",
",",
"__LINE__",
")",
";",
"$",
"oMessageManager",
"->",
"AddMessage",
"(",
"$",
"sConsumerName",
",",
"'PAYMENT-HANDLER-OGONE-ALIAS-GATEWAY-ERROR-'",
".",
"$",
"sErrorField",
".",
"'-'",
".",
"$",
"aReturnedParameter",
"[",
"$",
"sErrorField",
"]",
")",
";",
"$",
"aTrackedErrors",
"[",
"]",
"=",
"$",
"aReturnedParameter",
"[",
"$",
"sErrorField",
"]",
";",
"}",
"}",
"}",
"}",
"}"
] | handle error codes from the api. | [
"handle",
"error",
"codes",
"from",
"the",
"api",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneAliasGateway.class.php#L215-L236 |
32,032 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopVatList.class.php | TShopVatList.GetTotalVatValue | public function GetTotalVatValue()
{
$dVal = 0;
$iPointer = $this->getItemPointer();
$this->GoToStart();
while ($oItem = &$this->Next()) {
$dVal += $oItem->GetVatValue();
}
$this->setItemPointer($iPointer);
return $dVal;
} | php | public function GetTotalVatValue()
{
$dVal = 0;
$iPointer = $this->getItemPointer();
$this->GoToStart();
while ($oItem = &$this->Next()) {
$dVal += $oItem->GetVatValue();
}
$this->setItemPointer($iPointer);
return $dVal;
} | [
"public",
"function",
"GetTotalVatValue",
"(",
")",
"{",
"$",
"dVal",
"=",
"0",
";",
"$",
"iPointer",
"=",
"$",
"this",
"->",
"getItemPointer",
"(",
")",
";",
"$",
"this",
"->",
"GoToStart",
"(",
")",
";",
"while",
"(",
"$",
"oItem",
"=",
"&",
"$",
"this",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"dVal",
"+=",
"$",
"oItem",
"->",
"GetVatValue",
"(",
")",
";",
"}",
"$",
"this",
"->",
"setItemPointer",
"(",
"$",
"iPointer",
")",
";",
"return",
"$",
"dVal",
";",
"}"
] | get the total vat value for the current group.
@return float | [
"get",
"the",
"total",
"vat",
"value",
"for",
"the",
"current",
"group",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVatList.class.php#L19-L30 |
32,033 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopVatList.class.php | TShopVatList.GetTotalNetValue | public function GetTotalNetValue()
{
$dVal = 0;
$iPointer = $this->getItemPointer();
$this->GoToStart();
while ($oItem = &$this->Next()) {
$dVal += $oItem->getNetValue();
}
$this->setItemPointer($iPointer);
return $dVal;
} | php | public function GetTotalNetValue()
{
$dVal = 0;
$iPointer = $this->getItemPointer();
$this->GoToStart();
while ($oItem = &$this->Next()) {
$dVal += $oItem->getNetValue();
}
$this->setItemPointer($iPointer);
return $dVal;
} | [
"public",
"function",
"GetTotalNetValue",
"(",
")",
"{",
"$",
"dVal",
"=",
"0",
";",
"$",
"iPointer",
"=",
"$",
"this",
"->",
"getItemPointer",
"(",
")",
";",
"$",
"this",
"->",
"GoToStart",
"(",
")",
";",
"while",
"(",
"$",
"oItem",
"=",
"&",
"$",
"this",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"dVal",
"+=",
"$",
"oItem",
"->",
"getNetValue",
"(",
")",
";",
"}",
"$",
"this",
"->",
"setItemPointer",
"(",
"$",
"iPointer",
")",
";",
"return",
"$",
"dVal",
";",
"}"
] | get the total net value for the current group.
@return float | [
"get",
"the",
"total",
"net",
"value",
"for",
"the",
"current",
"group",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVatList.class.php#L37-L48 |
32,034 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopVatList.class.php | TShopVatList.GetTotalValue | public function GetTotalValue()
{
$dVal = 0;
$iPointer = $this->getItemPointer();
$this->GoToStart();
while ($oItem = &$this->Next()) {
$dVal += $oItem->getTotalValue();
}
$this->setItemPointer($iPointer);
return $dVal;
} | php | public function GetTotalValue()
{
$dVal = 0;
$iPointer = $this->getItemPointer();
$this->GoToStart();
while ($oItem = &$this->Next()) {
$dVal += $oItem->getTotalValue();
}
$this->setItemPointer($iPointer);
return $dVal;
} | [
"public",
"function",
"GetTotalValue",
"(",
")",
"{",
"$",
"dVal",
"=",
"0",
";",
"$",
"iPointer",
"=",
"$",
"this",
"->",
"getItemPointer",
"(",
")",
";",
"$",
"this",
"->",
"GoToStart",
"(",
")",
";",
"while",
"(",
"$",
"oItem",
"=",
"&",
"$",
"this",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"dVal",
"+=",
"$",
"oItem",
"->",
"getTotalValue",
"(",
")",
";",
"}",
"$",
"this",
"->",
"setItemPointer",
"(",
"$",
"iPointer",
")",
";",
"return",
"$",
"dVal",
";",
"}"
] | get the total gross value for the current group.
@return float | [
"get",
"the",
"total",
"gross",
"value",
"for",
"the",
"current",
"group",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVatList.class.php#L55-L66 |
32,035 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopVatList.class.php | TShopVatList.GetMaxItem | public function GetMaxItem()
{
/** @var $oMaxItem null|TdbShopVat */
$oMaxItem = null;
$iPt = $this->getItemPointer();
$this->GoToStart();
while ($oItem = &$this->Next()) {
if ($oItem->getTotalValue() > 0 && (is_null($oMaxItem) || $oItem->getTotalValue() > $oMaxItem->getTotalValue())) {
$oMaxItem = $oItem;
}
}
$this->setItemPointer($iPt);
return $oMaxItem;
} | php | public function GetMaxItem()
{
/** @var $oMaxItem null|TdbShopVat */
$oMaxItem = null;
$iPt = $this->getItemPointer();
$this->GoToStart();
while ($oItem = &$this->Next()) {
if ($oItem->getTotalValue() > 0 && (is_null($oMaxItem) || $oItem->getTotalValue() > $oMaxItem->getTotalValue())) {
$oMaxItem = $oItem;
}
}
$this->setItemPointer($iPt);
return $oMaxItem;
} | [
"public",
"function",
"GetMaxItem",
"(",
")",
"{",
"/** @var $oMaxItem null|TdbShopVat */",
"$",
"oMaxItem",
"=",
"null",
";",
"$",
"iPt",
"=",
"$",
"this",
"->",
"getItemPointer",
"(",
")",
";",
"$",
"this",
"->",
"GoToStart",
"(",
")",
";",
"while",
"(",
"$",
"oItem",
"=",
"&",
"$",
"this",
"->",
"Next",
"(",
")",
")",
"{",
"if",
"(",
"$",
"oItem",
"->",
"getTotalValue",
"(",
")",
">",
"0",
"&&",
"(",
"is_null",
"(",
"$",
"oMaxItem",
")",
"||",
"$",
"oItem",
"->",
"getTotalValue",
"(",
")",
">",
"$",
"oMaxItem",
"->",
"getTotalValue",
"(",
")",
")",
")",
"{",
"$",
"oMaxItem",
"=",
"$",
"oItem",
";",
"}",
"}",
"$",
"this",
"->",
"setItemPointer",
"(",
"$",
"iPt",
")",
";",
"return",
"$",
"oMaxItem",
";",
"}"
] | return largest item in list.
@return TdbShopVat | [
"return",
"largest",
"item",
"in",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVatList.class.php#L73-L87 |
32,036 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopModuleArticleListFilter/TShopModuleArticlelistFilterNoticeList.class.php | TShopModuleArticlelistFilterNoticeList.CreateTempNotice | protected function CreateTempNotice($aNoticeList)
{
$sTmpTableName = MySqlLegacySupport::getInstance()->real_escape_string('_tmp'.session_id().'noticelist');
$query = "CREATE TEMPORARY TABLE `{$sTmpTableName}` (
`date_added` datetime NOT NULL,
`shop_article_id` char(36) NOT NULL,
`amount` decimal(10,2) NOT NULL default '1.00',
KEY `shop_article_id` (`shop_article_id`),
KEY `date_added` (`date_added`)
) ENGINE=MEMORY DEFAULT CHARSET=utf8";
MySqlLegacySupport::getInstance()->query($query);
reset($aNoticeList);
foreach ($aNoticeList as $iArticleId => $oNoteItem) {
/** @var $oNoteItem TdbShopUserNoticeList */
$query = "INSERT INTO `{$sTmpTableName}`
SET `date_added` = '".MySqlLegacySupport::getInstance()->real_escape_string($oNoteItem->fieldDateAdded)."',
`shop_article_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oNoteItem->fieldShopArticleId)."',
`amount` = '".MySqlLegacySupport::getInstance()->real_escape_string($oNoteItem->fieldAmount)."'
";
MySqlLegacySupport::getInstance()->query($query);
}
return $sTmpTableName;
} | php | protected function CreateTempNotice($aNoticeList)
{
$sTmpTableName = MySqlLegacySupport::getInstance()->real_escape_string('_tmp'.session_id().'noticelist');
$query = "CREATE TEMPORARY TABLE `{$sTmpTableName}` (
`date_added` datetime NOT NULL,
`shop_article_id` char(36) NOT NULL,
`amount` decimal(10,2) NOT NULL default '1.00',
KEY `shop_article_id` (`shop_article_id`),
KEY `date_added` (`date_added`)
) ENGINE=MEMORY DEFAULT CHARSET=utf8";
MySqlLegacySupport::getInstance()->query($query);
reset($aNoticeList);
foreach ($aNoticeList as $iArticleId => $oNoteItem) {
/** @var $oNoteItem TdbShopUserNoticeList */
$query = "INSERT INTO `{$sTmpTableName}`
SET `date_added` = '".MySqlLegacySupport::getInstance()->real_escape_string($oNoteItem->fieldDateAdded)."',
`shop_article_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oNoteItem->fieldShopArticleId)."',
`amount` = '".MySqlLegacySupport::getInstance()->real_escape_string($oNoteItem->fieldAmount)."'
";
MySqlLegacySupport::getInstance()->query($query);
}
return $sTmpTableName;
} | [
"protected",
"function",
"CreateTempNotice",
"(",
"$",
"aNoticeList",
")",
"{",
"$",
"sTmpTableName",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"'_tmp'",
".",
"session_id",
"(",
")",
".",
"'noticelist'",
")",
";",
"$",
"query",
"=",
"\"CREATE TEMPORARY TABLE `{$sTmpTableName}` (\n `date_added` datetime NOT NULL,\n `shop_article_id` char(36) NOT NULL,\n `amount` decimal(10,2) NOT NULL default '1.00',\n KEY `shop_article_id` (`shop_article_id`),\n KEY `date_added` (`date_added`)\n ) ENGINE=MEMORY DEFAULT CHARSET=utf8\"",
";",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"query",
")",
";",
"reset",
"(",
"$",
"aNoticeList",
")",
";",
"foreach",
"(",
"$",
"aNoticeList",
"as",
"$",
"iArticleId",
"=>",
"$",
"oNoteItem",
")",
"{",
"/** @var $oNoteItem TdbShopUserNoticeList */",
"$",
"query",
"=",
"\"INSERT INTO `{$sTmpTableName}`\n \t SET `date_added` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"oNoteItem",
"->",
"fieldDateAdded",
")",
".",
"\"',\n \t `shop_article_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"oNoteItem",
"->",
"fieldShopArticleId",
")",
".",
"\"',\n \t `amount` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"oNoteItem",
"->",
"fieldAmount",
")",
".",
"\"'\n \t \"",
";",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"query",
")",
";",
"}",
"return",
"$",
"sTmpTableName",
";",
"}"
] | Crete temp notice list table for guest users and
returns temp table name.
@param array $aNoticeList
@return string | [
"Crete",
"temp",
"notice",
"list",
"table",
"for",
"guest",
"users",
"and",
"returns",
"temp",
"table",
"name",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopModuleArticleListFilter/TShopModuleArticlelistFilterNoticeList.class.php#L89-L112 |
32,037 | edmondscommerce/doctrine-static-meta | src/Entity/DataTransferObjects/DtoFactory.php | DtoFactory.createEmptyDtoFromEntityFqn | public function createEmptyDtoFromEntityFqn(string $entityFqn)
{
$dtoFqn = $this->namespaceHelper->getEntityDtoFqnFromEntityFqn($entityFqn);
$dto = new $dtoFqn();
$this->resetCreationTransaction();
$this->createdDtos[$dtoFqn] = $dto;
$this->setId($dto);
$this->addRequiredItemsToDto($dto);
$this->resetCreationTransaction();
return $dto;
} | php | public function createEmptyDtoFromEntityFqn(string $entityFqn)
{
$dtoFqn = $this->namespaceHelper->getEntityDtoFqnFromEntityFqn($entityFqn);
$dto = new $dtoFqn();
$this->resetCreationTransaction();
$this->createdDtos[$dtoFqn] = $dto;
$this->setId($dto);
$this->addRequiredItemsToDto($dto);
$this->resetCreationTransaction();
return $dto;
} | [
"public",
"function",
"createEmptyDtoFromEntityFqn",
"(",
"string",
"$",
"entityFqn",
")",
"{",
"$",
"dtoFqn",
"=",
"$",
"this",
"->",
"namespaceHelper",
"->",
"getEntityDtoFqnFromEntityFqn",
"(",
"$",
"entityFqn",
")",
";",
"$",
"dto",
"=",
"new",
"$",
"dtoFqn",
"(",
")",
";",
"$",
"this",
"->",
"resetCreationTransaction",
"(",
")",
";",
"$",
"this",
"->",
"createdDtos",
"[",
"$",
"dtoFqn",
"]",
"=",
"$",
"dto",
";",
"$",
"this",
"->",
"setId",
"(",
"$",
"dto",
")",
";",
"$",
"this",
"->",
"addRequiredItemsToDto",
"(",
"$",
"dto",
")",
";",
"$",
"this",
"->",
"resetCreationTransaction",
"(",
")",
";",
"return",
"$",
"dto",
";",
"}"
] | Pass in the FQN for an entity and get an empty DTO, including nested empty DTOs for required relations
@param string $entityFqn
@return mixed | [
"Pass",
"in",
"the",
"FQN",
"for",
"an",
"entity",
"and",
"get",
"an",
"empty",
"DTO",
"including",
"nested",
"empty",
"DTOs",
"for",
"required",
"relations"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/DataTransferObjects/DtoFactory.php#L47-L59 |
32,038 | edmondscommerce/doctrine-static-meta | src/Entity/DataTransferObjects/DtoFactory.php | DtoFactory.setId | private function setId(DataTransferObjectInterface $dto): void
{
$entityFqn = $dto::getEntityFqn();
$reflection = $this->getDsmFromEntityFqn($entityFqn)
->getReflectionClass();
if ($reflection->implementsInterface(UuidPrimaryKeyInterface::class)) {
$dto->setId($entityFqn::buildUuid($this->uuidFactory));
}
} | php | private function setId(DataTransferObjectInterface $dto): void
{
$entityFqn = $dto::getEntityFqn();
$reflection = $this->getDsmFromEntityFqn($entityFqn)
->getReflectionClass();
if ($reflection->implementsInterface(UuidPrimaryKeyInterface::class)) {
$dto->setId($entityFqn::buildUuid($this->uuidFactory));
}
} | [
"private",
"function",
"setId",
"(",
"DataTransferObjectInterface",
"$",
"dto",
")",
":",
"void",
"{",
"$",
"entityFqn",
"=",
"$",
"dto",
"::",
"getEntityFqn",
"(",
")",
";",
"$",
"reflection",
"=",
"$",
"this",
"->",
"getDsmFromEntityFqn",
"(",
"$",
"entityFqn",
")",
"->",
"getReflectionClass",
"(",
")",
";",
"if",
"(",
"$",
"reflection",
"->",
"implementsInterface",
"(",
"UuidPrimaryKeyInterface",
"::",
"class",
")",
")",
"{",
"$",
"dto",
"->",
"setId",
"(",
"$",
"entityFqn",
"::",
"buildUuid",
"(",
"$",
"this",
"->",
"uuidFactory",
")",
")",
";",
"}",
"}"
] | If the Entity that the DTO represents has a settable and buildable UUID, then we should set that at the point of
creating a DTO for a new Entity instance
@param DataTransferObjectInterface $dto | [
"If",
"the",
"Entity",
"that",
"the",
"DTO",
"represents",
"has",
"a",
"settable",
"and",
"buildable",
"UUID",
"then",
"we",
"should",
"set",
"that",
"at",
"the",
"point",
"of",
"creating",
"a",
"DTO",
"for",
"a",
"new",
"Entity",
"instance"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/DataTransferObjects/DtoFactory.php#L82-L90 |
32,039 | edmondscommerce/doctrine-static-meta | src/Entity/DataTransferObjects/DtoFactory.php | DtoFactory.addNestedRequiredDtos | private function addNestedRequiredDtos(DataTransferObjectInterface $dto): void
{
$entityFqn = $dto::getEntityFqn();
$dsm = $this->getDsmFromEntityFqn($entityFqn);
$requiredRelations = $dsm->getRequiredRelationProperties();
foreach ($requiredRelations as $propertyName => $types) {
$numTypes = count($types);
if (1 !== $numTypes) {
throw new \RuntimeException('Unexpected number of types, only expecting 1: ' . print_r($types, true));
}
$entityInterfaceFqn = $types[0];
$getter = 'get' . $propertyName;
if ('[]' === substr($entityInterfaceFqn, -2)) {
if ($dto->$getter()->count() > 0) {
continue;
}
$entityInterfaceFqn = substr($entityInterfaceFqn, 0, -2);
$this->addNestedDtoToCollection($dto, $propertyName, $entityInterfaceFqn);
continue;
}
$issetAsDtoMethod = 'isset' . $propertyName . 'AsDto';
$issetAsEntityMethod = 'isset' . $propertyName . 'AsEntity';
if (true === $dto->$issetAsDtoMethod() || true === $dto->$issetAsEntityMethod()) {
continue;
}
$this->addNestedDto($dto, $propertyName, $entityInterfaceFqn);
}
} | php | private function addNestedRequiredDtos(DataTransferObjectInterface $dto): void
{
$entityFqn = $dto::getEntityFqn();
$dsm = $this->getDsmFromEntityFqn($entityFqn);
$requiredRelations = $dsm->getRequiredRelationProperties();
foreach ($requiredRelations as $propertyName => $types) {
$numTypes = count($types);
if (1 !== $numTypes) {
throw new \RuntimeException('Unexpected number of types, only expecting 1: ' . print_r($types, true));
}
$entityInterfaceFqn = $types[0];
$getter = 'get' . $propertyName;
if ('[]' === substr($entityInterfaceFqn, -2)) {
if ($dto->$getter()->count() > 0) {
continue;
}
$entityInterfaceFqn = substr($entityInterfaceFqn, 0, -2);
$this->addNestedDtoToCollection($dto, $propertyName, $entityInterfaceFqn);
continue;
}
$issetAsDtoMethod = 'isset' . $propertyName . 'AsDto';
$issetAsEntityMethod = 'isset' . $propertyName . 'AsEntity';
if (true === $dto->$issetAsDtoMethod() || true === $dto->$issetAsEntityMethod()) {
continue;
}
$this->addNestedDto($dto, $propertyName, $entityInterfaceFqn);
}
} | [
"private",
"function",
"addNestedRequiredDtos",
"(",
"DataTransferObjectInterface",
"$",
"dto",
")",
":",
"void",
"{",
"$",
"entityFqn",
"=",
"$",
"dto",
"::",
"getEntityFqn",
"(",
")",
";",
"$",
"dsm",
"=",
"$",
"this",
"->",
"getDsmFromEntityFqn",
"(",
"$",
"entityFqn",
")",
";",
"$",
"requiredRelations",
"=",
"$",
"dsm",
"->",
"getRequiredRelationProperties",
"(",
")",
";",
"foreach",
"(",
"$",
"requiredRelations",
"as",
"$",
"propertyName",
"=>",
"$",
"types",
")",
"{",
"$",
"numTypes",
"=",
"count",
"(",
"$",
"types",
")",
";",
"if",
"(",
"1",
"!==",
"$",
"numTypes",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Unexpected number of types, only expecting 1: '",
".",
"print_r",
"(",
"$",
"types",
",",
"true",
")",
")",
";",
"}",
"$",
"entityInterfaceFqn",
"=",
"$",
"types",
"[",
"0",
"]",
";",
"$",
"getter",
"=",
"'get'",
".",
"$",
"propertyName",
";",
"if",
"(",
"'[]'",
"===",
"substr",
"(",
"$",
"entityInterfaceFqn",
",",
"-",
"2",
")",
")",
"{",
"if",
"(",
"$",
"dto",
"->",
"$",
"getter",
"(",
")",
"->",
"count",
"(",
")",
">",
"0",
")",
"{",
"continue",
";",
"}",
"$",
"entityInterfaceFqn",
"=",
"substr",
"(",
"$",
"entityInterfaceFqn",
",",
"0",
",",
"-",
"2",
")",
";",
"$",
"this",
"->",
"addNestedDtoToCollection",
"(",
"$",
"dto",
",",
"$",
"propertyName",
",",
"$",
"entityInterfaceFqn",
")",
";",
"continue",
";",
"}",
"$",
"issetAsDtoMethod",
"=",
"'isset'",
".",
"$",
"propertyName",
".",
"'AsDto'",
";",
"$",
"issetAsEntityMethod",
"=",
"'isset'",
".",
"$",
"propertyName",
".",
"'AsEntity'",
";",
"if",
"(",
"true",
"===",
"$",
"dto",
"->",
"$",
"issetAsDtoMethod",
"(",
")",
"||",
"true",
"===",
"$",
"dto",
"->",
"$",
"issetAsEntityMethod",
"(",
")",
")",
"{",
"continue",
";",
"}",
"$",
"this",
"->",
"addNestedDto",
"(",
"$",
"dto",
",",
"$",
"propertyName",
",",
"$",
"entityInterfaceFqn",
")",
";",
"}",
"}"
] | Take the DTO for a defined EntityFqn and then parse the required relations and create nested DTOs for them
Checks if the required relation is already set and if so, does nothing
@param DataTransferObjectInterface $dto
@throws \ReflectionException
@throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException | [
"Take",
"the",
"DTO",
"for",
"a",
"defined",
"EntityFqn",
"and",
"then",
"parse",
"the",
"required",
"relations",
"and",
"create",
"nested",
"DTOs",
"for",
"them"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/DataTransferObjects/DtoFactory.php#L120-L147 |
32,040 | edmondscommerce/doctrine-static-meta | src/Entity/DataTransferObjects/DtoFactory.php | DtoFactory.addNestedDtoToCollection | private function addNestedDtoToCollection(
DataTransferObjectInterface $dto,
string $propertyName,
string $entityInterfaceFqn
): void {
$collectionGetter = 'get' . $propertyName;
$dto->$collectionGetter()->add(
$this->createDtoRelatedToDto(
$dto,
$this->namespaceHelper->getEntityFqnFromEntityInterfaceFqn($entityInterfaceFqn)
)
);
} | php | private function addNestedDtoToCollection(
DataTransferObjectInterface $dto,
string $propertyName,
string $entityInterfaceFqn
): void {
$collectionGetter = 'get' . $propertyName;
$dto->$collectionGetter()->add(
$this->createDtoRelatedToDto(
$dto,
$this->namespaceHelper->getEntityFqnFromEntityInterfaceFqn($entityInterfaceFqn)
)
);
} | [
"private",
"function",
"addNestedDtoToCollection",
"(",
"DataTransferObjectInterface",
"$",
"dto",
",",
"string",
"$",
"propertyName",
",",
"string",
"$",
"entityInterfaceFqn",
")",
":",
"void",
"{",
"$",
"collectionGetter",
"=",
"'get'",
".",
"$",
"propertyName",
";",
"$",
"dto",
"->",
"$",
"collectionGetter",
"(",
")",
"->",
"add",
"(",
"$",
"this",
"->",
"createDtoRelatedToDto",
"(",
"$",
"dto",
",",
"$",
"this",
"->",
"namespaceHelper",
"->",
"getEntityFqnFromEntityInterfaceFqn",
"(",
"$",
"entityInterfaceFqn",
")",
")",
")",
";",
"}"
] | Create and add a related DTO into the owning DTO collection property
@param DataTransferObjectInterface $dto
@param string $propertyName
@param string $entityInterfaceFqn
@throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException
@throws \ReflectionException | [
"Create",
"and",
"add",
"a",
"related",
"DTO",
"into",
"the",
"owning",
"DTO",
"collection",
"property"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/DataTransferObjects/DtoFactory.php#L159-L171 |
32,041 | edmondscommerce/doctrine-static-meta | src/Entity/DataTransferObjects/DtoFactory.php | DtoFactory.createDtoRelatedToDto | public function createDtoRelatedToDto(
DataTransferObjectInterface $owningDto,
string $relatedEntityFqn
): DataTransferObjectInterface {
$this->resetCreationTransaction();
return $this->createDtoRelatedToEntityDataObject($owningDto, $relatedEntityFqn);
} | php | public function createDtoRelatedToDto(
DataTransferObjectInterface $owningDto,
string $relatedEntityFqn
): DataTransferObjectInterface {
$this->resetCreationTransaction();
return $this->createDtoRelatedToEntityDataObject($owningDto, $relatedEntityFqn);
} | [
"public",
"function",
"createDtoRelatedToDto",
"(",
"DataTransferObjectInterface",
"$",
"owningDto",
",",
"string",
"$",
"relatedEntityFqn",
")",
":",
"DataTransferObjectInterface",
"{",
"$",
"this",
"->",
"resetCreationTransaction",
"(",
")",
";",
"return",
"$",
"this",
"->",
"createDtoRelatedToEntityDataObject",
"(",
"$",
"owningDto",
",",
"$",
"relatedEntityFqn",
")",
";",
"}"
] | Create a DTO with a preset relation to the owning Entity DTO and all other items filled with new objects
@param DataTransferObjectInterface $owningDto
@param string $relatedEntityFqn
@return DataTransferObjectInterface
@throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException
@throws \ReflectionException | [
"Create",
"a",
"DTO",
"with",
"a",
"preset",
"relation",
"to",
"the",
"owning",
"Entity",
"DTO",
"and",
"all",
"other",
"items",
"filled",
"with",
"new",
"objects"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/DataTransferObjects/DtoFactory.php#L183-L189 |
32,042 | edmondscommerce/doctrine-static-meta | src/Entity/DataTransferObjects/DtoFactory.php | DtoFactory.createDtoRelatedToEntityInstance | public function createDtoRelatedToEntityInstance(
EntityInterface $owningEntity,
string $relatedEntityFqn
): DataTransferObjectInterface {
$this->resetCreationTransaction();
return $this->createDtoRelatedToEntityDataObject($owningEntity, $relatedEntityFqn);
} | php | public function createDtoRelatedToEntityInstance(
EntityInterface $owningEntity,
string $relatedEntityFqn
): DataTransferObjectInterface {
$this->resetCreationTransaction();
return $this->createDtoRelatedToEntityDataObject($owningEntity, $relatedEntityFqn);
} | [
"public",
"function",
"createDtoRelatedToEntityInstance",
"(",
"EntityInterface",
"$",
"owningEntity",
",",
"string",
"$",
"relatedEntityFqn",
")",
":",
"DataTransferObjectInterface",
"{",
"$",
"this",
"->",
"resetCreationTransaction",
"(",
")",
";",
"return",
"$",
"this",
"->",
"createDtoRelatedToEntityDataObject",
"(",
"$",
"owningEntity",
",",
"$",
"relatedEntityFqn",
")",
";",
"}"
] | Create a DTO with a preset relation to the owning Entity and all other items filled with new objects
@param EntityInterface $owningEntity
@param string $relatedEntityFqn
@return DataTransferObjectInterface
@throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException
@throws \ReflectionException | [
"Create",
"a",
"DTO",
"with",
"a",
"preset",
"relation",
"to",
"the",
"owning",
"Entity",
"and",
"all",
"other",
"items",
"filled",
"with",
"new",
"objects"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/DataTransferObjects/DtoFactory.php#L315-L321 |
32,043 | edmondscommerce/doctrine-static-meta | src/Entity/DataTransferObjects/DtoFactory.php | DtoFactory.createDtoFromEntity | public function createDtoFromEntity(EntityInterface $entity)
{
$this->resetCreationTransaction();
$dsm = $entity::getDoctrineStaticMeta();
$dtoFqn = $this->namespaceHelper->getEntityDtoFqnFromEntityFqn($dsm->getReflectionClass()->getName());
$dto = new $dtoFqn();
$setters = $dsm->getSetters();
foreach ($setters as $getterName => $setterName) {
$dto->$setterName($entity->$getterName());
}
return $dto;
} | php | public function createDtoFromEntity(EntityInterface $entity)
{
$this->resetCreationTransaction();
$dsm = $entity::getDoctrineStaticMeta();
$dtoFqn = $this->namespaceHelper->getEntityDtoFqnFromEntityFqn($dsm->getReflectionClass()->getName());
$dto = new $dtoFqn();
$setters = $dsm->getSetters();
foreach ($setters as $getterName => $setterName) {
$dto->$setterName($entity->$getterName());
}
return $dto;
} | [
"public",
"function",
"createDtoFromEntity",
"(",
"EntityInterface",
"$",
"entity",
")",
"{",
"$",
"this",
"->",
"resetCreationTransaction",
"(",
")",
";",
"$",
"dsm",
"=",
"$",
"entity",
"::",
"getDoctrineStaticMeta",
"(",
")",
";",
"$",
"dtoFqn",
"=",
"$",
"this",
"->",
"namespaceHelper",
"->",
"getEntityDtoFqnFromEntityFqn",
"(",
"$",
"dsm",
"->",
"getReflectionClass",
"(",
")",
"->",
"getName",
"(",
")",
")",
";",
"$",
"dto",
"=",
"new",
"$",
"dtoFqn",
"(",
")",
";",
"$",
"setters",
"=",
"$",
"dsm",
"->",
"getSetters",
"(",
")",
";",
"foreach",
"(",
"$",
"setters",
"as",
"$",
"getterName",
"=>",
"$",
"setterName",
")",
"{",
"$",
"dto",
"->",
"$",
"setterName",
"(",
"$",
"entity",
"->",
"$",
"getterName",
"(",
")",
")",
";",
"}",
"return",
"$",
"dto",
";",
"}"
] | Create a DTO with the values from teh Entity, optionally with some values directly overridden with your values
to set
@param EntityInterface $entity
@return mixed | [
"Create",
"a",
"DTO",
"with",
"the",
"values",
"from",
"teh",
"Entity",
"optionally",
"with",
"some",
"values",
"directly",
"overridden",
"with",
"your",
"values",
"to",
"set"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/DataTransferObjects/DtoFactory.php#L331-L343 |
32,044 | chameleon-system/chameleon-shop | src/ShopProductExportBundle/objects/TCMSFields/TCMSFieldText_ShowExportURL.class.php | TCMSFieldText_ShowExportURL.GetExportURLList | public function GetExportURLList()
{
$sReturn = '';
if (isset($this->oTableRow) && $this->oTableRow instanceof TdbShop) {
/* @var $oShop TdbShop */
$oShop = $this->oTableRow;
$oPortalList = $oShop->GetFieldCmsPortalList();
$systemPageService = $this->getSystemPageService();
while ($oPortal = $oPortalList->Next()) {
$sExportPageURL = $systemPageService->getLinkToSystemPageRelative('productexport', array(), $oPortal);
if (strstr($sExportPageURL, 'javascript:alert')) {
$sReturn = '<div>'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop_product_export.field_show_export_url.error_export_page_missing')).'</div>';
continue;
}
$sExportPageId = $oPortal->GetSystemPageId('productexport');
$sSpotName = $this->getExportModuleSpotName($sExportPageId);
if ('' == $sSpotName) {
$sReturn = '<div>'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop_product_export.field_show_export_url.error_export_module_missing')).'</div>';
continue;
}
$aViewList = $this->getViewNameList($sExportPageId);
if (0 === count($aViewList)) {
$sReturn = '<div>'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop_product_export.field_show_export_url.error_export_views_missing')).'</div>';
continue;
}
$sReturn .= '<div><h5>'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop_product_export.field_show_export_url.headline', array('%portalName%' => $oPortal->GetName()))).'</h5></div>';
foreach ($aViewList as $sView) {
$sURL = $sExportPageURL.'sModuleSpotName/'.$sSpotName.'/view/'.$sView.'/key/'.$oShop->fieldExportKey;
$sReturn .= '<div><b>'.$sView.' -></b> <a href="'.$sURL.'" title="export" target="_blank">'.$sURL.'</a>';
}
}
} else {
$sReturn = $sReturn = '<div>'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop_product_export.field_show_export_url.error_invalid_field_owner')).'</div>';
}
return $sReturn;
} | php | public function GetExportURLList()
{
$sReturn = '';
if (isset($this->oTableRow) && $this->oTableRow instanceof TdbShop) {
/* @var $oShop TdbShop */
$oShop = $this->oTableRow;
$oPortalList = $oShop->GetFieldCmsPortalList();
$systemPageService = $this->getSystemPageService();
while ($oPortal = $oPortalList->Next()) {
$sExportPageURL = $systemPageService->getLinkToSystemPageRelative('productexport', array(), $oPortal);
if (strstr($sExportPageURL, 'javascript:alert')) {
$sReturn = '<div>'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop_product_export.field_show_export_url.error_export_page_missing')).'</div>';
continue;
}
$sExportPageId = $oPortal->GetSystemPageId('productexport');
$sSpotName = $this->getExportModuleSpotName($sExportPageId);
if ('' == $sSpotName) {
$sReturn = '<div>'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop_product_export.field_show_export_url.error_export_module_missing')).'</div>';
continue;
}
$aViewList = $this->getViewNameList($sExportPageId);
if (0 === count($aViewList)) {
$sReturn = '<div>'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop_product_export.field_show_export_url.error_export_views_missing')).'</div>';
continue;
}
$sReturn .= '<div><h5>'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop_product_export.field_show_export_url.headline', array('%portalName%' => $oPortal->GetName()))).'</h5></div>';
foreach ($aViewList as $sView) {
$sURL = $sExportPageURL.'sModuleSpotName/'.$sSpotName.'/view/'.$sView.'/key/'.$oShop->fieldExportKey;
$sReturn .= '<div><b>'.$sView.' -></b> <a href="'.$sURL.'" title="export" target="_blank">'.$sURL.'</a>';
}
}
} else {
$sReturn = $sReturn = '<div>'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop_product_export.field_show_export_url.error_invalid_field_owner')).'</div>';
}
return $sReturn;
} | [
"public",
"function",
"GetExportURLList",
"(",
")",
"{",
"$",
"sReturn",
"=",
"''",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"oTableRow",
")",
"&&",
"$",
"this",
"->",
"oTableRow",
"instanceof",
"TdbShop",
")",
"{",
"/* @var $oShop TdbShop */",
"$",
"oShop",
"=",
"$",
"this",
"->",
"oTableRow",
";",
"$",
"oPortalList",
"=",
"$",
"oShop",
"->",
"GetFieldCmsPortalList",
"(",
")",
";",
"$",
"systemPageService",
"=",
"$",
"this",
"->",
"getSystemPageService",
"(",
")",
";",
"while",
"(",
"$",
"oPortal",
"=",
"$",
"oPortalList",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"sExportPageURL",
"=",
"$",
"systemPageService",
"->",
"getLinkToSystemPageRelative",
"(",
"'productexport'",
",",
"array",
"(",
")",
",",
"$",
"oPortal",
")",
";",
"if",
"(",
"strstr",
"(",
"$",
"sExportPageURL",
",",
"'javascript:alert'",
")",
")",
"{",
"$",
"sReturn",
"=",
"'<div>'",
".",
"TGlobal",
"::",
"OutHTML",
"(",
"TGlobal",
"::",
"Translate",
"(",
"'chameleon_system_shop_product_export.field_show_export_url.error_export_page_missing'",
")",
")",
".",
"'</div>'",
";",
"continue",
";",
"}",
"$",
"sExportPageId",
"=",
"$",
"oPortal",
"->",
"GetSystemPageId",
"(",
"'productexport'",
")",
";",
"$",
"sSpotName",
"=",
"$",
"this",
"->",
"getExportModuleSpotName",
"(",
"$",
"sExportPageId",
")",
";",
"if",
"(",
"''",
"==",
"$",
"sSpotName",
")",
"{",
"$",
"sReturn",
"=",
"'<div>'",
".",
"TGlobal",
"::",
"OutHTML",
"(",
"TGlobal",
"::",
"Translate",
"(",
"'chameleon_system_shop_product_export.field_show_export_url.error_export_module_missing'",
")",
")",
".",
"'</div>'",
";",
"continue",
";",
"}",
"$",
"aViewList",
"=",
"$",
"this",
"->",
"getViewNameList",
"(",
"$",
"sExportPageId",
")",
";",
"if",
"(",
"0",
"===",
"count",
"(",
"$",
"aViewList",
")",
")",
"{",
"$",
"sReturn",
"=",
"'<div>'",
".",
"TGlobal",
"::",
"OutHTML",
"(",
"TGlobal",
"::",
"Translate",
"(",
"'chameleon_system_shop_product_export.field_show_export_url.error_export_views_missing'",
")",
")",
".",
"'</div>'",
";",
"continue",
";",
"}",
"$",
"sReturn",
".=",
"'<div><h5>'",
".",
"TGlobal",
"::",
"OutHTML",
"(",
"TGlobal",
"::",
"Translate",
"(",
"'chameleon_system_shop_product_export.field_show_export_url.headline'",
",",
"array",
"(",
"'%portalName%'",
"=>",
"$",
"oPortal",
"->",
"GetName",
"(",
")",
")",
")",
")",
".",
"'</h5></div>'",
";",
"foreach",
"(",
"$",
"aViewList",
"as",
"$",
"sView",
")",
"{",
"$",
"sURL",
"=",
"$",
"sExportPageURL",
".",
"'sModuleSpotName/'",
".",
"$",
"sSpotName",
".",
"'/view/'",
".",
"$",
"sView",
".",
"'/key/'",
".",
"$",
"oShop",
"->",
"fieldExportKey",
";",
"$",
"sReturn",
".=",
"'<div><b>'",
".",
"$",
"sView",
".",
"' -></b> <a href=\"'",
".",
"$",
"sURL",
".",
"'\" title=\"export\" target=\"_blank\">'",
".",
"$",
"sURL",
".",
"'</a>'",
";",
"}",
"}",
"}",
"else",
"{",
"$",
"sReturn",
"=",
"$",
"sReturn",
"=",
"'<div>'",
".",
"TGlobal",
"::",
"OutHTML",
"(",
"TGlobal",
"::",
"Translate",
"(",
"'chameleon_system_shop_product_export.field_show_export_url.error_invalid_field_owner'",
")",
")",
".",
"'</div>'",
";",
"}",
"return",
"$",
"sReturn",
";",
"}"
] | get list of all possible export urls as html.
@return string | [
"get",
"list",
"of",
"all",
"possible",
"export",
"urls",
"as",
"html",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TCMSFields/TCMSFieldText_ShowExportURL.class.php#L34-L70 |
32,045 | chameleon-system/chameleon-shop | src/ShopProductExportBundle/objects/TCMSFields/TCMSFieldText_ShowExportURL.class.php | TCMSFieldText_ShowExportURL.getExportModuleSpotName | protected function getExportModuleSpotName($sPageId)
{
$sSpotName = '';
$sQuery = "SELECT `cms_master_pagedef_spot`.`name` FROM `cms_tpl_page_cms_master_pagedef_spot`
INNER JOIN `cms_master_pagedef_spot`ON `cms_master_pagedef_spot`.`id` = `cms_tpl_page_cms_master_pagedef_spot`.`cms_master_pagedef_spot_id`
WHERE `cms_tpl_page_cms_master_pagedef_spot`.`cms_tpl_page_id` = '".$sPageId."'
AND `static` = '0'";
$oRes = MySqlLegacySupport::getInstance()->query($sQuery);
if (MySqlLegacySupport::getInstance()->num_rows($oRes) > 0) {
while ($aRow = MySqlLegacySupport::getInstance()->fetch_assoc($oRes)) {
$sSpotName = $aRow['name'];
}
}
return $sSpotName;
} | php | protected function getExportModuleSpotName($sPageId)
{
$sSpotName = '';
$sQuery = "SELECT `cms_master_pagedef_spot`.`name` FROM `cms_tpl_page_cms_master_pagedef_spot`
INNER JOIN `cms_master_pagedef_spot`ON `cms_master_pagedef_spot`.`id` = `cms_tpl_page_cms_master_pagedef_spot`.`cms_master_pagedef_spot_id`
WHERE `cms_tpl_page_cms_master_pagedef_spot`.`cms_tpl_page_id` = '".$sPageId."'
AND `static` = '0'";
$oRes = MySqlLegacySupport::getInstance()->query($sQuery);
if (MySqlLegacySupport::getInstance()->num_rows($oRes) > 0) {
while ($aRow = MySqlLegacySupport::getInstance()->fetch_assoc($oRes)) {
$sSpotName = $aRow['name'];
}
}
return $sSpotName;
} | [
"protected",
"function",
"getExportModuleSpotName",
"(",
"$",
"sPageId",
")",
"{",
"$",
"sSpotName",
"=",
"''",
";",
"$",
"sQuery",
"=",
"\"SELECT `cms_master_pagedef_spot`.`name` FROM `cms_tpl_page_cms_master_pagedef_spot`\n INNER JOIN `cms_master_pagedef_spot`ON `cms_master_pagedef_spot`.`id` = `cms_tpl_page_cms_master_pagedef_spot`.`cms_master_pagedef_spot_id`\n WHERE `cms_tpl_page_cms_master_pagedef_spot`.`cms_tpl_page_id` = '\"",
".",
"$",
"sPageId",
".",
"\"'\n AND `static` = '0'\"",
";",
"$",
"oRes",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"sQuery",
")",
";",
"if",
"(",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"num_rows",
"(",
"$",
"oRes",
")",
">",
"0",
")",
"{",
"while",
"(",
"$",
"aRow",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"fetch_assoc",
"(",
"$",
"oRes",
")",
")",
"{",
"$",
"sSpotName",
"=",
"$",
"aRow",
"[",
"'name'",
"]",
";",
"}",
"}",
"return",
"$",
"sSpotName",
";",
"}"
] | get spot name for export module on given page.
@param string $sPageId
@return string | [
"get",
"spot",
"name",
"for",
"export",
"module",
"on",
"given",
"page",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TCMSFields/TCMSFieldText_ShowExportURL.class.php#L79-L94 |
32,046 | chameleon-system/chameleon-shop | src/ShopProductExportBundle/objects/TCMSFields/TCMSFieldText_ShowExportURL.class.php | TCMSFieldText_ShowExportURL.getViewNameList | protected function getViewNameList($sPageId)
{
$aViewNameList = array();
$sQuery = "SELECT `cms_tpl_page_cms_master_pagedef_spot`.`model` FROM `cms_tpl_page_cms_master_pagedef_spot`
INNER JOIN `cms_master_pagedef_spot`ON `cms_master_pagedef_spot`.`id` = `cms_tpl_page_cms_master_pagedef_spot`.`cms_master_pagedef_spot_id`
WHERE `cms_tpl_page_cms_master_pagedef_spot`.`cms_tpl_page_id` = '".$sPageId."'
AND `static` = '0'";
$oRes = MySqlLegacySupport::getInstance()->query($sQuery);
if (MySqlLegacySupport::getInstance()->num_rows($oRes) > 0) {
$sModuleName = '';
while ($aRow = MySqlLegacySupport::getInstance()->fetch_assoc($oRes)) {
$sModuleName = $aRow['model'];
}
$sModulePath = realpath(PATH_CUSTOMER_FRAMEWORK.'/modules/'.$sModuleName.'/views/');
if (false != $sModuleName && is_dir($sModulePath)) {
if ($oDirHandle = opendir($sModulePath)) {
while (false !== ($sFile = readdir($oDirHandle))) {
if ('.' !== $sFile && '..' !== $sFile && true === is_file($sModulePath.'/'.$sFile)) {
$sFile = str_replace('.view.php', '', $sFile);
$aViewNameList[] = $sFile;
}
}
}
}
}
return $aViewNameList;
} | php | protected function getViewNameList($sPageId)
{
$aViewNameList = array();
$sQuery = "SELECT `cms_tpl_page_cms_master_pagedef_spot`.`model` FROM `cms_tpl_page_cms_master_pagedef_spot`
INNER JOIN `cms_master_pagedef_spot`ON `cms_master_pagedef_spot`.`id` = `cms_tpl_page_cms_master_pagedef_spot`.`cms_master_pagedef_spot_id`
WHERE `cms_tpl_page_cms_master_pagedef_spot`.`cms_tpl_page_id` = '".$sPageId."'
AND `static` = '0'";
$oRes = MySqlLegacySupport::getInstance()->query($sQuery);
if (MySqlLegacySupport::getInstance()->num_rows($oRes) > 0) {
$sModuleName = '';
while ($aRow = MySqlLegacySupport::getInstance()->fetch_assoc($oRes)) {
$sModuleName = $aRow['model'];
}
$sModulePath = realpath(PATH_CUSTOMER_FRAMEWORK.'/modules/'.$sModuleName.'/views/');
if (false != $sModuleName && is_dir($sModulePath)) {
if ($oDirHandle = opendir($sModulePath)) {
while (false !== ($sFile = readdir($oDirHandle))) {
if ('.' !== $sFile && '..' !== $sFile && true === is_file($sModulePath.'/'.$sFile)) {
$sFile = str_replace('.view.php', '', $sFile);
$aViewNameList[] = $sFile;
}
}
}
}
}
return $aViewNameList;
} | [
"protected",
"function",
"getViewNameList",
"(",
"$",
"sPageId",
")",
"{",
"$",
"aViewNameList",
"=",
"array",
"(",
")",
";",
"$",
"sQuery",
"=",
"\"SELECT `cms_tpl_page_cms_master_pagedef_spot`.`model` FROM `cms_tpl_page_cms_master_pagedef_spot`\n INNER JOIN `cms_master_pagedef_spot`ON `cms_master_pagedef_spot`.`id` = `cms_tpl_page_cms_master_pagedef_spot`.`cms_master_pagedef_spot_id`\n WHERE `cms_tpl_page_cms_master_pagedef_spot`.`cms_tpl_page_id` = '\"",
".",
"$",
"sPageId",
".",
"\"'\n AND `static` = '0'\"",
";",
"$",
"oRes",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"sQuery",
")",
";",
"if",
"(",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"num_rows",
"(",
"$",
"oRes",
")",
">",
"0",
")",
"{",
"$",
"sModuleName",
"=",
"''",
";",
"while",
"(",
"$",
"aRow",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"fetch_assoc",
"(",
"$",
"oRes",
")",
")",
"{",
"$",
"sModuleName",
"=",
"$",
"aRow",
"[",
"'model'",
"]",
";",
"}",
"$",
"sModulePath",
"=",
"realpath",
"(",
"PATH_CUSTOMER_FRAMEWORK",
".",
"'/modules/'",
".",
"$",
"sModuleName",
".",
"'/views/'",
")",
";",
"if",
"(",
"false",
"!=",
"$",
"sModuleName",
"&&",
"is_dir",
"(",
"$",
"sModulePath",
")",
")",
"{",
"if",
"(",
"$",
"oDirHandle",
"=",
"opendir",
"(",
"$",
"sModulePath",
")",
")",
"{",
"while",
"(",
"false",
"!==",
"(",
"$",
"sFile",
"=",
"readdir",
"(",
"$",
"oDirHandle",
")",
")",
")",
"{",
"if",
"(",
"'.'",
"!==",
"$",
"sFile",
"&&",
"'..'",
"!==",
"$",
"sFile",
"&&",
"true",
"===",
"is_file",
"(",
"$",
"sModulePath",
".",
"'/'",
".",
"$",
"sFile",
")",
")",
"{",
"$",
"sFile",
"=",
"str_replace",
"(",
"'.view.php'",
",",
"''",
",",
"$",
"sFile",
")",
";",
"$",
"aViewNameList",
"[",
"]",
"=",
"$",
"sFile",
";",
"}",
"}",
"}",
"}",
"}",
"return",
"$",
"aViewNameList",
";",
"}"
] | get all possible export views for export module on given page.
@param string $sPageId
@return array | [
"get",
"all",
"possible",
"export",
"views",
"for",
"export",
"module",
"on",
"given",
"page",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TCMSFields/TCMSFieldText_ShowExportURL.class.php#L103-L130 |
32,047 | chameleon-system/chameleon-shop | src/ShopProductExportBundle/objects/TCMSFields/TCMSFieldText_ShowExportURL.class.php | TCMSFieldText_ShowExportURL.GetHTML | public function GetHTML()
{
$sHtml = parent::GetHTML();
$sHtml .= '<input id="showExportURLList" type="button" class="btn btn-sm btn-secondary mt-2" value="'.TGlobal::OutHTML($this->getTranslator()->trans('chameleon_system_shop_product_export.field_show_export_url.show_list_button_title')).'"/>';
$sHtml .= '<div id="exportURLListcontainer" class="mt-2"></div>';
$sHtml .= "
<script type=\"text/javascript\">
$(document).ready(function() {
$('#showExportURLList').click(function(){
GetAjaxCallTransparent('".$this->GenerateAjaxURL(
array('_fnc' => 'GetExportURLList', '_fieldName' => $this->name)
)."', GetExportURLList);
return false;});
});
function GetExportURLList(data,statusText) {
$('#exportURLListcontainer').html('');
$('#exportURLListcontainer').append(data);
}
</script>
";
return $sHtml;
} | php | public function GetHTML()
{
$sHtml = parent::GetHTML();
$sHtml .= '<input id="showExportURLList" type="button" class="btn btn-sm btn-secondary mt-2" value="'.TGlobal::OutHTML($this->getTranslator()->trans('chameleon_system_shop_product_export.field_show_export_url.show_list_button_title')).'"/>';
$sHtml .= '<div id="exportURLListcontainer" class="mt-2"></div>';
$sHtml .= "
<script type=\"text/javascript\">
$(document).ready(function() {
$('#showExportURLList').click(function(){
GetAjaxCallTransparent('".$this->GenerateAjaxURL(
array('_fnc' => 'GetExportURLList', '_fieldName' => $this->name)
)."', GetExportURLList);
return false;});
});
function GetExportURLList(data,statusText) {
$('#exportURLListcontainer').html('');
$('#exportURLListcontainer').append(data);
}
</script>
";
return $sHtml;
} | [
"public",
"function",
"GetHTML",
"(",
")",
"{",
"$",
"sHtml",
"=",
"parent",
"::",
"GetHTML",
"(",
")",
";",
"$",
"sHtml",
".=",
"'<input id=\"showExportURLList\" type=\"button\" class=\"btn btn-sm btn-secondary mt-2\" value=\"'",
".",
"TGlobal",
"::",
"OutHTML",
"(",
"$",
"this",
"->",
"getTranslator",
"(",
")",
"->",
"trans",
"(",
"'chameleon_system_shop_product_export.field_show_export_url.show_list_button_title'",
")",
")",
".",
"'\"/>'",
";",
"$",
"sHtml",
".=",
"'<div id=\"exportURLListcontainer\" class=\"mt-2\"></div>'",
";",
"$",
"sHtml",
".=",
"\"\n <script type=\\\"text/javascript\\\">\n\n $(document).ready(function() {\n $('#showExportURLList').click(function(){\n GetAjaxCallTransparent('\"",
".",
"$",
"this",
"->",
"GenerateAjaxURL",
"(",
"array",
"(",
"'_fnc'",
"=>",
"'GetExportURLList'",
",",
"'_fieldName'",
"=>",
"$",
"this",
"->",
"name",
")",
")",
".",
"\"', GetExportURLList);\n return false;});\n });\n\n function GetExportURLList(data,statusText) {\n $('#exportURLListcontainer').html('');\n $('#exportURLListcontainer').append(data);\n }\n </script>\n \"",
";",
"return",
"$",
"sHtml",
";",
"}"
] | adds js to get url list.
@return string | [
"adds",
"js",
"to",
"get",
"url",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TCMSFields/TCMSFieldText_ShowExportURL.class.php#L137-L161 |
32,048 | chameleon-system/chameleon-shop | src/ShopOrderStatusBundle/objects/TPkgShopOrderStatusManagerEndPoint.class.php | TPkgShopOrderStatusManagerEndPoint.validateStatusData | protected function validateStatusData(TPkgShopOrderStatusData $oData)
{
// does the order exists?
$order = $oData->getOrder();
if (!$order) {
throw new TPkgCmsException_Log('order status update: missing order object', array('statusdata' => $oData));
}
// do the items exists and belong to the order? and is the amount shippable?
$aItems = $oData->getItems();
foreach ($aItems as $oItem) {
/** @var TPkgShopOrderStatusItemData $oItem */
$oOrderItem = TdbShopOrderItem::GetNewInstance();
if (false === $oOrderItem->LoadFromFields(
array('shop_order_id' => $order->id, 'id' => $oItem->getShopOrderItemId())
)
) {
throw new TPkgCmsException_Log(
'order status update: order item invalid',
array('statusdata' => $oData, 'item' => $oItem)
);
}
}
} | php | protected function validateStatusData(TPkgShopOrderStatusData $oData)
{
// does the order exists?
$order = $oData->getOrder();
if (!$order) {
throw new TPkgCmsException_Log('order status update: missing order object', array('statusdata' => $oData));
}
// do the items exists and belong to the order? and is the amount shippable?
$aItems = $oData->getItems();
foreach ($aItems as $oItem) {
/** @var TPkgShopOrderStatusItemData $oItem */
$oOrderItem = TdbShopOrderItem::GetNewInstance();
if (false === $oOrderItem->LoadFromFields(
array('shop_order_id' => $order->id, 'id' => $oItem->getShopOrderItemId())
)
) {
throw new TPkgCmsException_Log(
'order status update: order item invalid',
array('statusdata' => $oData, 'item' => $oItem)
);
}
}
} | [
"protected",
"function",
"validateStatusData",
"(",
"TPkgShopOrderStatusData",
"$",
"oData",
")",
"{",
"// does the order exists?",
"$",
"order",
"=",
"$",
"oData",
"->",
"getOrder",
"(",
")",
";",
"if",
"(",
"!",
"$",
"order",
")",
"{",
"throw",
"new",
"TPkgCmsException_Log",
"(",
"'order status update: missing order object'",
",",
"array",
"(",
"'statusdata'",
"=>",
"$",
"oData",
")",
")",
";",
"}",
"// do the items exists and belong to the order? and is the amount shippable?",
"$",
"aItems",
"=",
"$",
"oData",
"->",
"getItems",
"(",
")",
";",
"foreach",
"(",
"$",
"aItems",
"as",
"$",
"oItem",
")",
"{",
"/** @var TPkgShopOrderStatusItemData $oItem */",
"$",
"oOrderItem",
"=",
"TdbShopOrderItem",
"::",
"GetNewInstance",
"(",
")",
";",
"if",
"(",
"false",
"===",
"$",
"oOrderItem",
"->",
"LoadFromFields",
"(",
"array",
"(",
"'shop_order_id'",
"=>",
"$",
"order",
"->",
"id",
",",
"'id'",
"=>",
"$",
"oItem",
"->",
"getShopOrderItemId",
"(",
")",
")",
")",
")",
"{",
"throw",
"new",
"TPkgCmsException_Log",
"(",
"'order status update: order item invalid'",
",",
"array",
"(",
"'statusdata'",
"=>",
"$",
"oData",
",",
"'item'",
"=>",
"$",
"oItem",
")",
")",
";",
"}",
"}",
"}"
] | validates the input.
@param TPkgShopOrderStatusData $oData
@throws TPkgCmsException_Log | [
"validates",
"the",
"input",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopOrderStatusBundle/objects/TPkgShopOrderStatusManagerEndPoint.class.php#L129-L151 |
32,049 | chameleon-system/chameleon-shop | src/ShopOrderStatusBundle/objects/TPkgShopOrderStatusManagerEndPoint.class.php | TPkgShopOrderStatusManagerEndPoint.sendStatusMailToCustomerWithFrontEndAction | protected function sendStatusMailToCustomerWithFrontEndAction(TdbShopOrderStatus $oStatus)
{
$bSuccess = false;
$sPortalId = null;
$oOrder = $oStatus->GetFieldShopOrder();
if (!is_null($oOrder) && '' != $oOrder->fieldCmsPortalId) {
$sPortalId = $oOrder->fieldCmsPortalId;
}
$oAction = TdbPkgRunFrontendAction::CreateAction(
'TPkgRunFrontendAction_SendOrderStatusEMail',
$sPortalId,
array('order_status_id' => $oStatus->id, 'order_id' => $oStatus->fieldShopOrderId)
);
$sURL = $oAction->getUrlToRunAction();
$sURL = str_replace('&', '&', $sURL); // remove encoding
$oToHostHandler = new TPkgCmsCoreSendToHost();
$oToHostHandler->setConfigFromUrl($sURL);
$this->getShopLogger()->info(sprintf('sending mail via frontend action using URL: %s', $sURL));
$executeRequestResponse = $oToHostHandler->executeRequest();
if (preg_match('#{.*}#', $executeRequestResponse, $aMatches)) {
$this->getShopLogger()->info('done sending mail via frontend action. got response ', array('response' => $aMatches[0]));
$aResponse = json_decode($aMatches[0], true);
if (is_array($aResponse) && count(
$aResponse
) > 0 && isset($aResponse['sMessageType']) && 'MESSAGE' == $aResponse['sMessageType']
) {
$bSuccess = true;
}
} else {
$this->getShopLogger()->error('failed sending mail via frontend action. got response', array('response' => $executeRequestResponse));
}
return $bSuccess;
} | php | protected function sendStatusMailToCustomerWithFrontEndAction(TdbShopOrderStatus $oStatus)
{
$bSuccess = false;
$sPortalId = null;
$oOrder = $oStatus->GetFieldShopOrder();
if (!is_null($oOrder) && '' != $oOrder->fieldCmsPortalId) {
$sPortalId = $oOrder->fieldCmsPortalId;
}
$oAction = TdbPkgRunFrontendAction::CreateAction(
'TPkgRunFrontendAction_SendOrderStatusEMail',
$sPortalId,
array('order_status_id' => $oStatus->id, 'order_id' => $oStatus->fieldShopOrderId)
);
$sURL = $oAction->getUrlToRunAction();
$sURL = str_replace('&', '&', $sURL); // remove encoding
$oToHostHandler = new TPkgCmsCoreSendToHost();
$oToHostHandler->setConfigFromUrl($sURL);
$this->getShopLogger()->info(sprintf('sending mail via frontend action using URL: %s', $sURL));
$executeRequestResponse = $oToHostHandler->executeRequest();
if (preg_match('#{.*}#', $executeRequestResponse, $aMatches)) {
$this->getShopLogger()->info('done sending mail via frontend action. got response ', array('response' => $aMatches[0]));
$aResponse = json_decode($aMatches[0], true);
if (is_array($aResponse) && count(
$aResponse
) > 0 && isset($aResponse['sMessageType']) && 'MESSAGE' == $aResponse['sMessageType']
) {
$bSuccess = true;
}
} else {
$this->getShopLogger()->error('failed sending mail via frontend action. got response', array('response' => $executeRequestResponse));
}
return $bSuccess;
} | [
"protected",
"function",
"sendStatusMailToCustomerWithFrontEndAction",
"(",
"TdbShopOrderStatus",
"$",
"oStatus",
")",
"{",
"$",
"bSuccess",
"=",
"false",
";",
"$",
"sPortalId",
"=",
"null",
";",
"$",
"oOrder",
"=",
"$",
"oStatus",
"->",
"GetFieldShopOrder",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"oOrder",
")",
"&&",
"''",
"!=",
"$",
"oOrder",
"->",
"fieldCmsPortalId",
")",
"{",
"$",
"sPortalId",
"=",
"$",
"oOrder",
"->",
"fieldCmsPortalId",
";",
"}",
"$",
"oAction",
"=",
"TdbPkgRunFrontendAction",
"::",
"CreateAction",
"(",
"'TPkgRunFrontendAction_SendOrderStatusEMail'",
",",
"$",
"sPortalId",
",",
"array",
"(",
"'order_status_id'",
"=>",
"$",
"oStatus",
"->",
"id",
",",
"'order_id'",
"=>",
"$",
"oStatus",
"->",
"fieldShopOrderId",
")",
")",
";",
"$",
"sURL",
"=",
"$",
"oAction",
"->",
"getUrlToRunAction",
"(",
")",
";",
"$",
"sURL",
"=",
"str_replace",
"(",
"'&'",
",",
"'&'",
",",
"$",
"sURL",
")",
";",
"// remove encoding",
"$",
"oToHostHandler",
"=",
"new",
"TPkgCmsCoreSendToHost",
"(",
")",
";",
"$",
"oToHostHandler",
"->",
"setConfigFromUrl",
"(",
"$",
"sURL",
")",
";",
"$",
"this",
"->",
"getShopLogger",
"(",
")",
"->",
"info",
"(",
"sprintf",
"(",
"'sending mail via frontend action using URL: %s'",
",",
"$",
"sURL",
")",
")",
";",
"$",
"executeRequestResponse",
"=",
"$",
"oToHostHandler",
"->",
"executeRequest",
"(",
")",
";",
"if",
"(",
"preg_match",
"(",
"'#{.*}#'",
",",
"$",
"executeRequestResponse",
",",
"$",
"aMatches",
")",
")",
"{",
"$",
"this",
"->",
"getShopLogger",
"(",
")",
"->",
"info",
"(",
"'done sending mail via frontend action. got response '",
",",
"array",
"(",
"'response'",
"=>",
"$",
"aMatches",
"[",
"0",
"]",
")",
")",
";",
"$",
"aResponse",
"=",
"json_decode",
"(",
"$",
"aMatches",
"[",
"0",
"]",
",",
"true",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"aResponse",
")",
"&&",
"count",
"(",
"$",
"aResponse",
")",
">",
"0",
"&&",
"isset",
"(",
"$",
"aResponse",
"[",
"'sMessageType'",
"]",
")",
"&&",
"'MESSAGE'",
"==",
"$",
"aResponse",
"[",
"'sMessageType'",
"]",
")",
"{",
"$",
"bSuccess",
"=",
"true",
";",
"}",
"}",
"else",
"{",
"$",
"this",
"->",
"getShopLogger",
"(",
")",
"->",
"error",
"(",
"'failed sending mail via frontend action. got response'",
",",
"array",
"(",
"'response'",
"=>",
"$",
"executeRequestResponse",
")",
")",
";",
"}",
"return",
"$",
"bSuccess",
";",
"}"
] | send status mail simulating a front end action to use twig templates from customer.
@param TdbShopOrderStatus $oStatus
@return bool | [
"send",
"status",
"mail",
"simulating",
"a",
"front",
"end",
"action",
"to",
"use",
"twig",
"templates",
"from",
"customer",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopOrderStatusBundle/objects/TPkgShopOrderStatusManagerEndPoint.class.php#L238-L271 |
32,050 | chameleon-system/chameleon-shop | src/ShopPrimaryNavigationBundle/objects/TPkgShopPrimaryNaviList.class.php | TPkgShopPrimaryNaviList.GetDefaultQuery | public static function GetDefaultQuery($iLanguageId, $sFilterString = false)
{
$sDefaultQuery = 'SELECT `pkg_shop_primary_navi`.*
FROM `pkg_shop_primary_navi`
WHERE [{sFilterConditions}]
ORDER BY `pkg_shop_primary_navi`.`position` ASC';
$sActivePrimaryNavigationQueryRestriction = '';
if (!TGlobal::IsCMSMode()) {
$sActivePrimaryNavigationQueryRestriction = TdbPkgShopPrimaryNaviList::GetActivePrimaryNavigationQueryRestriction();
}
if (strlen($sActivePrimaryNavigationQueryRestriction) > 0) {
if (false === $sFilterString) {
$sFilterString = " $sActivePrimaryNavigationQueryRestriction ";
} else {
$sFilterString = ' ( '.$sFilterString.' ) AND ('.$sActivePrimaryNavigationQueryRestriction.')';
}
} else {
if (false === $sFilterString) {
$sFilterString = ' 1 = 1 ';
}
}
$sDefaultQuery = str_replace('[{sFilterConditions}]', $sFilterString, $sDefaultQuery);
return $sDefaultQuery;
} | php | public static function GetDefaultQuery($iLanguageId, $sFilterString = false)
{
$sDefaultQuery = 'SELECT `pkg_shop_primary_navi`.*
FROM `pkg_shop_primary_navi`
WHERE [{sFilterConditions}]
ORDER BY `pkg_shop_primary_navi`.`position` ASC';
$sActivePrimaryNavigationQueryRestriction = '';
if (!TGlobal::IsCMSMode()) {
$sActivePrimaryNavigationQueryRestriction = TdbPkgShopPrimaryNaviList::GetActivePrimaryNavigationQueryRestriction();
}
if (strlen($sActivePrimaryNavigationQueryRestriction) > 0) {
if (false === $sFilterString) {
$sFilterString = " $sActivePrimaryNavigationQueryRestriction ";
} else {
$sFilterString = ' ( '.$sFilterString.' ) AND ('.$sActivePrimaryNavigationQueryRestriction.')';
}
} else {
if (false === $sFilterString) {
$sFilterString = ' 1 = 1 ';
}
}
$sDefaultQuery = str_replace('[{sFilterConditions}]', $sFilterString, $sDefaultQuery);
return $sDefaultQuery;
} | [
"public",
"static",
"function",
"GetDefaultQuery",
"(",
"$",
"iLanguageId",
",",
"$",
"sFilterString",
"=",
"false",
")",
"{",
"$",
"sDefaultQuery",
"=",
"'SELECT `pkg_shop_primary_navi`.*\n FROM `pkg_shop_primary_navi`\n WHERE [{sFilterConditions}]\n ORDER BY `pkg_shop_primary_navi`.`position` ASC'",
";",
"$",
"sActivePrimaryNavigationQueryRestriction",
"=",
"''",
";",
"if",
"(",
"!",
"TGlobal",
"::",
"IsCMSMode",
"(",
")",
")",
"{",
"$",
"sActivePrimaryNavigationQueryRestriction",
"=",
"TdbPkgShopPrimaryNaviList",
"::",
"GetActivePrimaryNavigationQueryRestriction",
"(",
")",
";",
"}",
"if",
"(",
"strlen",
"(",
"$",
"sActivePrimaryNavigationQueryRestriction",
")",
">",
"0",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"sFilterString",
")",
"{",
"$",
"sFilterString",
"=",
"\" $sActivePrimaryNavigationQueryRestriction \"",
";",
"}",
"else",
"{",
"$",
"sFilterString",
"=",
"' ( '",
".",
"$",
"sFilterString",
".",
"' ) AND ('",
".",
"$",
"sActivePrimaryNavigationQueryRestriction",
".",
"')'",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"false",
"===",
"$",
"sFilterString",
")",
"{",
"$",
"sFilterString",
"=",
"' 1 = 1 '",
";",
"}",
"}",
"$",
"sDefaultQuery",
"=",
"str_replace",
"(",
"'[{sFilterConditions}]'",
",",
"$",
"sFilterString",
",",
"$",
"sDefaultQuery",
")",
";",
"return",
"$",
"sDefaultQuery",
";",
"}"
] | return default query for the table.
if not in CMS mode return only active navigation trees.
@param int $iLanguageId - language used for query
@param bool|string $sFilterString - any filter conditions to add to the query
@return string | [
"return",
"default",
"query",
"for",
"the",
"table",
".",
"if",
"not",
"in",
"CMS",
"mode",
"return",
"only",
"active",
"navigation",
"trees",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPrimaryNavigationBundle/objects/TPkgShopPrimaryNaviList.class.php#L23-L47 |
32,051 | PGB-LIV/php-ms | src/Utility/Sort/IdentificationSort.php | IdentificationSort.sortByScore | protected function sortByScore(Identification $a, Identification $b)
{
if (is_null($this->scoreKey)) {
throw new \BadMethodCallException('The key to sort on must be defined using SetScoreKey() prior to sorting.');
}
if ($a->getScore($this->scoreKey) == $b->getScore($this->scoreKey)) {
return 0;
}
return $a->getScore($this->scoreKey) > $b->getScore($this->scoreKey) ? $this->returnTrue : $this->returnFalse;
} | php | protected function sortByScore(Identification $a, Identification $b)
{
if (is_null($this->scoreKey)) {
throw new \BadMethodCallException('The key to sort on must be defined using SetScoreKey() prior to sorting.');
}
if ($a->getScore($this->scoreKey) == $b->getScore($this->scoreKey)) {
return 0;
}
return $a->getScore($this->scoreKey) > $b->getScore($this->scoreKey) ? $this->returnTrue : $this->returnFalse;
} | [
"protected",
"function",
"sortByScore",
"(",
"Identification",
"$",
"a",
",",
"Identification",
"$",
"b",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"scoreKey",
")",
")",
"{",
"throw",
"new",
"\\",
"BadMethodCallException",
"(",
"'The key to sort on must be defined using SetScoreKey() prior to sorting.'",
")",
";",
"}",
"if",
"(",
"$",
"a",
"->",
"getScore",
"(",
"$",
"this",
"->",
"scoreKey",
")",
"==",
"$",
"b",
"->",
"getScore",
"(",
"$",
"this",
"->",
"scoreKey",
")",
")",
"{",
"return",
"0",
";",
"}",
"return",
"$",
"a",
"->",
"getScore",
"(",
"$",
"this",
"->",
"scoreKey",
")",
">",
"$",
"b",
"->",
"getScore",
"(",
"$",
"this",
"->",
"scoreKey",
")",
"?",
"$",
"this",
"->",
"returnTrue",
":",
"$",
"this",
"->",
"returnFalse",
";",
"}"
] | Sort the identifications by score using the sort order and key provided
@param Identification $a
@param Identification $b
@throws \BadMethodCallException Thrown if the key has not been specified
@return int | [
"Sort",
"the",
"identifications",
"by",
"score",
"using",
"the",
"sort",
"order",
"and",
"key",
"provided"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Utility/Sort/IdentificationSort.php#L57-L68 |
32,052 | PGB-LIV/php-ms | src/Utility/Sort/IdentificationSort.php | IdentificationSort.sortByRank | protected function sortByRank(Identification $a, Identification $b)
{
if ($a->getRank() == $b->getRank()) {
return 0;
}
return $a->getRank() > $b->getRank() ? $this->returnTrue : $this->returnFalse;
} | php | protected function sortByRank(Identification $a, Identification $b)
{
if ($a->getRank() == $b->getRank()) {
return 0;
}
return $a->getRank() > $b->getRank() ? $this->returnTrue : $this->returnFalse;
} | [
"protected",
"function",
"sortByRank",
"(",
"Identification",
"$",
"a",
",",
"Identification",
"$",
"b",
")",
"{",
"if",
"(",
"$",
"a",
"->",
"getRank",
"(",
")",
"==",
"$",
"b",
"->",
"getRank",
"(",
")",
")",
"{",
"return",
"0",
";",
"}",
"return",
"$",
"a",
"->",
"getRank",
"(",
")",
">",
"$",
"b",
"->",
"getRank",
"(",
")",
"?",
"$",
"this",
"->",
"returnTrue",
":",
"$",
"this",
"->",
"returnFalse",
";",
"}"
] | Sort the identifications by rank using the sort order provided
@param Identification $a
@param Identification $b
@return int | [
"Sort",
"the",
"identifications",
"by",
"rank",
"using",
"the",
"sort",
"order",
"provided"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Utility/Sort/IdentificationSort.php#L77-L84 |
32,053 | CHH/sirel | lib/Sirel/Selections.php | Selections.where | function where($expr)
{
foreach (func_get_args() as $expr) {
$this->getNodes()->restrictions[] = $expr;
}
return $this;
} | php | function where($expr)
{
foreach (func_get_args() as $expr) {
$this->getNodes()->restrictions[] = $expr;
}
return $this;
} | [
"function",
"where",
"(",
"$",
"expr",
")",
"{",
"foreach",
"(",
"func_get_args",
"(",
")",
"as",
"$",
"expr",
")",
"{",
"$",
"this",
"->",
"getNodes",
"(",
")",
"->",
"restrictions",
"[",
"]",
"=",
"$",
"expr",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Add a node to the criteria
@param Node $expr,...
@return SelectManager | [
"Add",
"a",
"node",
"to",
"the",
"criteria"
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Selections.php#L20-L27 |
32,054 | CHH/sirel | lib/Sirel/Selections.php | Selections.reorder | function reorder($expr, $direction = null)
{
$this->order(null);
$this->order($expr, $direction);
return $this;
} | php | function reorder($expr, $direction = null)
{
$this->order(null);
$this->order($expr, $direction);
return $this;
} | [
"function",
"reorder",
"(",
"$",
"expr",
",",
"$",
"direction",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"order",
"(",
"null",
")",
";",
"$",
"this",
"->",
"order",
"(",
"$",
"expr",
",",
"$",
"direction",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Override all previous order clauses with a new one.
@see order()
@param mixed $expr
@param int $direction | [
"Override",
"all",
"previous",
"order",
"clauses",
"with",
"a",
"new",
"one",
"."
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Selections.php#L36-L42 |
32,055 | CHH/sirel | lib/Sirel/Selections.php | Selections.reverseOrder | function reverseOrder(array $attributes = null)
{
if ($attributes !== null) {
$attributes = array_map('strval', $attributes);
$orders = array_filter($this->getNodes()->orders, function($o) use ($attributes) {
$expr = $o->getExpression();
$name = (string) $expr;
return in_array($name, $attributes);
});
} else {
$orders = $this->getNodes()->orders;
}
foreach ($orders as $order) {
$order->reverse();
}
return $this;
} | php | function reverseOrder(array $attributes = null)
{
if ($attributes !== null) {
$attributes = array_map('strval', $attributes);
$orders = array_filter($this->getNodes()->orders, function($o) use ($attributes) {
$expr = $o->getExpression();
$name = (string) $expr;
return in_array($name, $attributes);
});
} else {
$orders = $this->getNodes()->orders;
}
foreach ($orders as $order) {
$order->reverse();
}
return $this;
} | [
"function",
"reverseOrder",
"(",
"array",
"$",
"attributes",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"attributes",
"!==",
"null",
")",
"{",
"$",
"attributes",
"=",
"array_map",
"(",
"'strval'",
",",
"$",
"attributes",
")",
";",
"$",
"orders",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"getNodes",
"(",
")",
"->",
"orders",
",",
"function",
"(",
"$",
"o",
")",
"use",
"(",
"$",
"attributes",
")",
"{",
"$",
"expr",
"=",
"$",
"o",
"->",
"getExpression",
"(",
")",
";",
"$",
"name",
"=",
"(",
"string",
")",
"$",
"expr",
";",
"return",
"in_array",
"(",
"$",
"name",
",",
"$",
"attributes",
")",
";",
"}",
")",
";",
"}",
"else",
"{",
"$",
"orders",
"=",
"$",
"this",
"->",
"getNodes",
"(",
")",
"->",
"orders",
";",
"}",
"foreach",
"(",
"$",
"orders",
"as",
"$",
"order",
")",
"{",
"$",
"order",
"->",
"reverse",
"(",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Reverses the order of all order clauses
@param array $attributes Optional list of attributes which should
be reversed
@return SelectManager | [
"Reverses",
"the",
"order",
"of",
"all",
"order",
"clauses"
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Selections.php#L66-L86 |
32,056 | CHH/sirel | lib/Sirel/Selections.php | Selections.take | function take($numRows)
{
$this->getNodes()->limit = $numRows !== null ? new Limit($numRows) : null;
return $this;
} | php | function take($numRows)
{
$this->getNodes()->limit = $numRows !== null ? new Limit($numRows) : null;
return $this;
} | [
"function",
"take",
"(",
"$",
"numRows",
")",
"{",
"$",
"this",
"->",
"getNodes",
"(",
")",
"->",
"limit",
"=",
"$",
"numRows",
"!==",
"null",
"?",
"new",
"Limit",
"(",
"$",
"numRows",
")",
":",
"null",
";",
"return",
"$",
"this",
";",
"}"
] | Adds a Limit Expression
@param int $numRows
@return SelectManager | [
"Adds",
"a",
"Limit",
"Expression"
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Selections.php#L94-L98 |
32,057 | CHH/sirel | lib/Sirel/Selections.php | Selections.skip | function skip($numRows)
{
$this->getNodes()->offset = $numRows !== null ? new Offset($numRows) : null;
return $this;
} | php | function skip($numRows)
{
$this->getNodes()->offset = $numRows !== null ? new Offset($numRows) : null;
return $this;
} | [
"function",
"skip",
"(",
"$",
"numRows",
")",
"{",
"$",
"this",
"->",
"getNodes",
"(",
")",
"->",
"offset",
"=",
"$",
"numRows",
"!==",
"null",
"?",
"new",
"Offset",
"(",
"$",
"numRows",
")",
":",
"null",
";",
"return",
"$",
"this",
";",
"}"
] | Adds an Offset Expression
@param int $numRows
@return SelectManager | [
"Adds",
"an",
"Offset",
"Expression"
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Selections.php#L106-L110 |
32,058 | CHH/sirel | lib/Sirel/Visitor/ToSql.php | ToSql.visitSirelNodeSelectStatement | protected function visitSirelNodeSelectStatement(Node\SelectStatement $select)
{
return join(" ", array_filter(array(
"SELECT",
($select->distinct ? "DISTINCT" : null),
($select->projections
? join(", ", $this->visitEach($select->projections))
: '*'),
// FROM
$this->visit($select->source),
// WHERE
($select->restrictions
? "WHERE " . join(" AND ", $this->visitEach($select->restrictions))
: null
),
// ORDER BY
($select->orders
? "ORDER BY " . join(", ", $this->visitEach($select->orders))
: null),
// GROUP BY
($select->groups
? "GROUP BY " . join(', ', $this->visitEach($select->groups))
: null),
// LIMIT
($select->limit ? $this->visit($select->limit) : null),
// OFFSET
($select->offset ? $this->visit($select->offset) : null)
))) . ';';
} | php | protected function visitSirelNodeSelectStatement(Node\SelectStatement $select)
{
return join(" ", array_filter(array(
"SELECT",
($select->distinct ? "DISTINCT" : null),
($select->projections
? join(", ", $this->visitEach($select->projections))
: '*'),
// FROM
$this->visit($select->source),
// WHERE
($select->restrictions
? "WHERE " . join(" AND ", $this->visitEach($select->restrictions))
: null
),
// ORDER BY
($select->orders
? "ORDER BY " . join(", ", $this->visitEach($select->orders))
: null),
// GROUP BY
($select->groups
? "GROUP BY " . join(', ', $this->visitEach($select->groups))
: null),
// LIMIT
($select->limit ? $this->visit($select->limit) : null),
// OFFSET
($select->offset ? $this->visit($select->offset) : null)
))) . ';';
} | [
"protected",
"function",
"visitSirelNodeSelectStatement",
"(",
"Node",
"\\",
"SelectStatement",
"$",
"select",
")",
"{",
"return",
"join",
"(",
"\" \"",
",",
"array_filter",
"(",
"array",
"(",
"\"SELECT\"",
",",
"(",
"$",
"select",
"->",
"distinct",
"?",
"\"DISTINCT\"",
":",
"null",
")",
",",
"(",
"$",
"select",
"->",
"projections",
"?",
"join",
"(",
"\", \"",
",",
"$",
"this",
"->",
"visitEach",
"(",
"$",
"select",
"->",
"projections",
")",
")",
":",
"'*'",
")",
",",
"// FROM",
"$",
"this",
"->",
"visit",
"(",
"$",
"select",
"->",
"source",
")",
",",
"// WHERE",
"(",
"$",
"select",
"->",
"restrictions",
"?",
"\"WHERE \"",
".",
"join",
"(",
"\" AND \"",
",",
"$",
"this",
"->",
"visitEach",
"(",
"$",
"select",
"->",
"restrictions",
")",
")",
":",
"null",
")",
",",
"// ORDER BY",
"(",
"$",
"select",
"->",
"orders",
"?",
"\"ORDER BY \"",
".",
"join",
"(",
"\", \"",
",",
"$",
"this",
"->",
"visitEach",
"(",
"$",
"select",
"->",
"orders",
")",
")",
":",
"null",
")",
",",
"// GROUP BY",
"(",
"$",
"select",
"->",
"groups",
"?",
"\"GROUP BY \"",
".",
"join",
"(",
"', '",
",",
"$",
"this",
"->",
"visitEach",
"(",
"$",
"select",
"->",
"groups",
")",
")",
":",
"null",
")",
",",
"// LIMIT",
"(",
"$",
"select",
"->",
"limit",
"?",
"$",
"this",
"->",
"visit",
"(",
"$",
"select",
"->",
"limit",
")",
":",
"null",
")",
",",
"// OFFSET ",
"(",
"$",
"select",
"->",
"offset",
"?",
"$",
"this",
"->",
"visit",
"(",
"$",
"select",
"->",
"offset",
")",
":",
"null",
")",
")",
")",
")",
".",
"';'",
";",
"}"
] | Get a SELECT Query
@param Node\SelectStatement $select
@return string | [
"Get",
"a",
"SELECT",
"Query"
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Visitor/ToSql.php#L44-L80 |
32,059 | CHH/sirel | lib/Sirel/Visitor/ToSql.php | ToSql.visitSirelNodeInsertStatement | protected function visitSirelNodeInsertStatement(Node\InsertStatement $insert)
{
return
"INSERT INTO " . $this->visit($insert->relation)
. ' (' . join(', ', $this->visitEach($insert->columns)) . ')'
. ' VALUES (' . join(', ', $this->visitEach($insert->values)) . ');';
} | php | protected function visitSirelNodeInsertStatement(Node\InsertStatement $insert)
{
return
"INSERT INTO " . $this->visit($insert->relation)
. ' (' . join(', ', $this->visitEach($insert->columns)) . ')'
. ' VALUES (' . join(', ', $this->visitEach($insert->values)) . ');';
} | [
"protected",
"function",
"visitSirelNodeInsertStatement",
"(",
"Node",
"\\",
"InsertStatement",
"$",
"insert",
")",
"{",
"return",
"\"INSERT INTO \"",
".",
"$",
"this",
"->",
"visit",
"(",
"$",
"insert",
"->",
"relation",
")",
".",
"' ('",
".",
"join",
"(",
"', '",
",",
"$",
"this",
"->",
"visitEach",
"(",
"$",
"insert",
"->",
"columns",
")",
")",
".",
"')'",
".",
"' VALUES ('",
".",
"join",
"(",
"', '",
",",
"$",
"this",
"->",
"visitEach",
"(",
"$",
"insert",
"->",
"values",
")",
")",
".",
"');'",
";",
"}"
] | Creates an INSERT Statement
@param Node\InsertStatement $insert
@return string | [
"Creates",
"an",
"INSERT",
"Statement"
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Visitor/ToSql.php#L88-L94 |
32,060 | CHH/sirel | lib/Sirel/Visitor/ToSql.php | ToSql.visitSirelNodeOrder | protected function visitSirelNodeOrder(Node\Order $order)
{
return $this->visit($order->getExpression()) . " "
. ($order->isAscending() ? "ASC" : "DESC");
} | php | protected function visitSirelNodeOrder(Node\Order $order)
{
return $this->visit($order->getExpression()) . " "
. ($order->isAscending() ? "ASC" : "DESC");
} | [
"protected",
"function",
"visitSirelNodeOrder",
"(",
"Node",
"\\",
"Order",
"$",
"order",
")",
"{",
"return",
"$",
"this",
"->",
"visit",
"(",
"$",
"order",
"->",
"getExpression",
"(",
")",
")",
".",
"\" \"",
".",
"(",
"$",
"order",
"->",
"isAscending",
"(",
")",
"?",
"\"ASC\"",
":",
"\"DESC\"",
")",
";",
"}"
] | Create an ORDER Expression
@param Node\Order $order
@return string | [
"Create",
"an",
"ORDER",
"Expression"
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Visitor/ToSql.php#L240-L244 |
32,061 | CHH/sirel | lib/Sirel/Visitor/ToSql.php | ToSql.visitSirelNodeAssignment | protected function visitSirelNodeAssignment(Node\Assignment $assign)
{
return $this->visit($assign->getLeft())
. " = " . $this->visit($assign->getRight());
} | php | protected function visitSirelNodeAssignment(Node\Assignment $assign)
{
return $this->visit($assign->getLeft())
. " = " . $this->visit($assign->getRight());
} | [
"protected",
"function",
"visitSirelNodeAssignment",
"(",
"Node",
"\\",
"Assignment",
"$",
"assign",
")",
"{",
"return",
"$",
"this",
"->",
"visit",
"(",
"$",
"assign",
"->",
"getLeft",
"(",
")",
")",
".",
"\" = \"",
".",
"$",
"this",
"->",
"visit",
"(",
"$",
"assign",
"->",
"getRight",
"(",
")",
")",
";",
"}"
] | Handle an Assignment, join with "="
@param Node\Assignment $assign
@return string | [
"Handle",
"an",
"Assignment",
"join",
"with",
"="
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Visitor/ToSql.php#L252-L256 |
32,062 | CHH/sirel | lib/Sirel/Visitor/ToSql.php | ToSql.visitSirelNodeEqual | protected function visitSirelNodeEqual(Node\Equal $equal)
{
$left = $this->visit($equal->getLeft());
$right = $equal->getRight();
if ($right === null) {
return $left . ' IS NULL';
} else {
return $left . ' = ' . $this->visit($right);
}
} | php | protected function visitSirelNodeEqual(Node\Equal $equal)
{
$left = $this->visit($equal->getLeft());
$right = $equal->getRight();
if ($right === null) {
return $left . ' IS NULL';
} else {
return $left . ' = ' . $this->visit($right);
}
} | [
"protected",
"function",
"visitSirelNodeEqual",
"(",
"Node",
"\\",
"Equal",
"$",
"equal",
")",
"{",
"$",
"left",
"=",
"$",
"this",
"->",
"visit",
"(",
"$",
"equal",
"->",
"getLeft",
"(",
")",
")",
";",
"$",
"right",
"=",
"$",
"equal",
"->",
"getRight",
"(",
")",
";",
"if",
"(",
"$",
"right",
"===",
"null",
")",
"{",
"return",
"$",
"left",
".",
"' IS NULL'",
";",
"}",
"else",
"{",
"return",
"$",
"left",
".",
"' = '",
".",
"$",
"this",
"->",
"visit",
"(",
"$",
"right",
")",
";",
"}",
"}"
] | Transform to SQL Equality, if the right operand is NULL,
then an "IS NULL" comparison is generated.
@param Node\Equal $equal
@return string | [
"Transform",
"to",
"SQL",
"Equality",
"if",
"the",
"right",
"operand",
"is",
"NULL",
"then",
"an",
"IS",
"NULL",
"comparison",
"is",
"generated",
"."
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Visitor/ToSql.php#L265-L275 |
32,063 | CHH/sirel | lib/Sirel/Visitor/ToSql.php | ToSql.visitSirelNodeJoinSource | protected function visitSirelNodeJoinSource(Node\JoinSource $joinSource)
{
$right = $joinSource->getRight();
return
"FROM "
. $this->visit($joinSource->getLeft())
. ($right ? ' ' . join(' ', $this->visitEach($right)) : null);
} | php | protected function visitSirelNodeJoinSource(Node\JoinSource $joinSource)
{
$right = $joinSource->getRight();
return
"FROM "
. $this->visit($joinSource->getLeft())
. ($right ? ' ' . join(' ', $this->visitEach($right)) : null);
} | [
"protected",
"function",
"visitSirelNodeJoinSource",
"(",
"Node",
"\\",
"JoinSource",
"$",
"joinSource",
")",
"{",
"$",
"right",
"=",
"$",
"joinSource",
"->",
"getRight",
"(",
")",
";",
"return",
"\"FROM \"",
".",
"$",
"this",
"->",
"visit",
"(",
"$",
"joinSource",
"->",
"getLeft",
"(",
")",
")",
".",
"(",
"$",
"right",
"?",
"' '",
".",
"join",
"(",
"' '",
",",
"$",
"this",
"->",
"visitEach",
"(",
"$",
"right",
")",
")",
":",
"null",
")",
";",
"}"
] | Returns the FROM part and visits the JOINs
@param Node\JoinSource $joinSource
@return string | [
"Returns",
"the",
"FROM",
"part",
"and",
"visits",
"the",
"JOINs"
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Visitor/ToSql.php#L406-L414 |
32,064 | CHH/sirel | lib/Sirel/Visitor/ToSql.php | ToSql.visitSirelNodeJoin | protected function visitSirelNodeJoin(Node\Join $join)
{
switch ($join->mode) {
case Node\Join::INNER:
$mode = "INNER";
break;
case Node\Join::LEFT:
$mode = "LEFT";
break;
case Node\Join::LEFT_OUTER:
$mode = "LEFT OUTER";
break;
case Node\Join::RIGHT:
$mode = "RIGHT";
break;
case Node\Join::OUTER;
$mode = "OUTER";
break;
default:
$mode = '';
break;
}
return ($join->natural ? 'NATURAL ' : '')
. ($mode ? $mode . ' ' : '')
. "JOIN "
. $this->visit($join->left)
. ($join->right ? ' ' . $this->visit($join->right) : '');
} | php | protected function visitSirelNodeJoin(Node\Join $join)
{
switch ($join->mode) {
case Node\Join::INNER:
$mode = "INNER";
break;
case Node\Join::LEFT:
$mode = "LEFT";
break;
case Node\Join::LEFT_OUTER:
$mode = "LEFT OUTER";
break;
case Node\Join::RIGHT:
$mode = "RIGHT";
break;
case Node\Join::OUTER;
$mode = "OUTER";
break;
default:
$mode = '';
break;
}
return ($join->natural ? 'NATURAL ' : '')
. ($mode ? $mode . ' ' : '')
. "JOIN "
. $this->visit($join->left)
. ($join->right ? ' ' . $this->visit($join->right) : '');
} | [
"protected",
"function",
"visitSirelNodeJoin",
"(",
"Node",
"\\",
"Join",
"$",
"join",
")",
"{",
"switch",
"(",
"$",
"join",
"->",
"mode",
")",
"{",
"case",
"Node",
"\\",
"Join",
"::",
"INNER",
":",
"$",
"mode",
"=",
"\"INNER\"",
";",
"break",
";",
"case",
"Node",
"\\",
"Join",
"::",
"LEFT",
":",
"$",
"mode",
"=",
"\"LEFT\"",
";",
"break",
";",
"case",
"Node",
"\\",
"Join",
"::",
"LEFT_OUTER",
":",
"$",
"mode",
"=",
"\"LEFT OUTER\"",
";",
"break",
";",
"case",
"Node",
"\\",
"Join",
"::",
"RIGHT",
":",
"$",
"mode",
"=",
"\"RIGHT\"",
";",
"break",
";",
"case",
"Node",
"\\",
"Join",
"::",
"OUTER",
";",
"$",
"mode",
"=",
"\"OUTER\"",
";",
"break",
";",
"default",
":",
"$",
"mode",
"=",
"''",
";",
"break",
";",
"}",
"return",
"(",
"$",
"join",
"->",
"natural",
"?",
"'NATURAL '",
":",
"''",
")",
".",
"(",
"$",
"mode",
"?",
"$",
"mode",
".",
"' '",
":",
"''",
")",
".",
"\"JOIN \"",
".",
"$",
"this",
"->",
"visit",
"(",
"$",
"join",
"->",
"left",
")",
".",
"(",
"$",
"join",
"->",
"right",
"?",
"' '",
".",
"$",
"this",
"->",
"visit",
"(",
"$",
"join",
"->",
"right",
")",
":",
"''",
")",
";",
"}"
] | Creates a JOIN
@param Node\Join $join
@return string | [
"Creates",
"a",
"JOIN"
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Visitor/ToSql.php#L422-L450 |
32,065 | chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/TPkgShopRatingService_TrustedShops.class.php | TPkgShopRatingService_TrustedShops.TrustedShopsImage_CacheCheck | public function TrustedShopsImage_CacheCheck($filename_cache, $timeout = 10800)
{
$bRet = false;
if (file_exists($filename_cache)) {
$timestamp = filemtime($filename_cache);
// Seconds
if (mktime() - $timestamp < $timeout) {
$bRet = true;
} else {
$bRet = false;
}
} else {
$bRet = false;
}
return $bRet;
} | php | public function TrustedShopsImage_CacheCheck($filename_cache, $timeout = 10800)
{
$bRet = false;
if (file_exists($filename_cache)) {
$timestamp = filemtime($filename_cache);
// Seconds
if (mktime() - $timestamp < $timeout) {
$bRet = true;
} else {
$bRet = false;
}
} else {
$bRet = false;
}
return $bRet;
} | [
"public",
"function",
"TrustedShopsImage_CacheCheck",
"(",
"$",
"filename_cache",
",",
"$",
"timeout",
"=",
"10800",
")",
"{",
"$",
"bRet",
"=",
"false",
";",
"if",
"(",
"file_exists",
"(",
"$",
"filename_cache",
")",
")",
"{",
"$",
"timestamp",
"=",
"filemtime",
"(",
"$",
"filename_cache",
")",
";",
"// Seconds",
"if",
"(",
"mktime",
"(",
")",
"-",
"$",
"timestamp",
"<",
"$",
"timeout",
")",
"{",
"$",
"bRet",
"=",
"true",
";",
"}",
"else",
"{",
"$",
"bRet",
"=",
"false",
";",
"}",
"}",
"else",
"{",
"$",
"bRet",
"=",
"false",
";",
"}",
"return",
"$",
"bRet",
";",
"}"
] | Return FALSE if cache no more valid!
@param string $filename_cache
@param int $timeout
@return bool | [
"Return",
"FALSE",
"if",
"cache",
"no",
"more",
"valid!"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/TPkgShopRatingService_TrustedShops.class.php#L195-L211 |
32,066 | sylingd/Yesf | src/Http/Dispatcher.php | Dispatcher.handleRequest | public function handleRequest(Request $request, Response $response) {
if ($this->static_enable) {
$request->uri = $request->server['request_uri'];
$uri = $request->server['request_uri'];
if (strpos($uri, $this->static_prefix) === 0) {
$uri = substr($uri, strlen($this->static_prefix));
}
$path = realpath($this->static_dir . $uri);
if ($path !== false && strpos($path, $this->static_dir) === 0) {
if ($this->executeInterceptor('before', $request, $response) !== null) {
$request->end();
$response->end();
unset($request, $response);
return;
}
$response->mimeType(pathinfo($path, PATHINFO_EXTENSION));
$response->sendfile($path);
$this->executeInterceptor('after', $request, $response);
$request->end();
$response->end();
unset($request, $response);
return;
}
}
$this->router->parse($request);
if ($this->executeInterceptor('before', $request, $response) !== null) {
$request->end();
$response->end();
unset($request, $response);
return;
}
$this->dispatch($request, $response);
} | php | public function handleRequest(Request $request, Response $response) {
if ($this->static_enable) {
$request->uri = $request->server['request_uri'];
$uri = $request->server['request_uri'];
if (strpos($uri, $this->static_prefix) === 0) {
$uri = substr($uri, strlen($this->static_prefix));
}
$path = realpath($this->static_dir . $uri);
if ($path !== false && strpos($path, $this->static_dir) === 0) {
if ($this->executeInterceptor('before', $request, $response) !== null) {
$request->end();
$response->end();
unset($request, $response);
return;
}
$response->mimeType(pathinfo($path, PATHINFO_EXTENSION));
$response->sendfile($path);
$this->executeInterceptor('after', $request, $response);
$request->end();
$response->end();
unset($request, $response);
return;
}
}
$this->router->parse($request);
if ($this->executeInterceptor('before', $request, $response) !== null) {
$request->end();
$response->end();
unset($request, $response);
return;
}
$this->dispatch($request, $response);
} | [
"public",
"function",
"handleRequest",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"static_enable",
")",
"{",
"$",
"request",
"->",
"uri",
"=",
"$",
"request",
"->",
"server",
"[",
"'request_uri'",
"]",
";",
"$",
"uri",
"=",
"$",
"request",
"->",
"server",
"[",
"'request_uri'",
"]",
";",
"if",
"(",
"strpos",
"(",
"$",
"uri",
",",
"$",
"this",
"->",
"static_prefix",
")",
"===",
"0",
")",
"{",
"$",
"uri",
"=",
"substr",
"(",
"$",
"uri",
",",
"strlen",
"(",
"$",
"this",
"->",
"static_prefix",
")",
")",
";",
"}",
"$",
"path",
"=",
"realpath",
"(",
"$",
"this",
"->",
"static_dir",
".",
"$",
"uri",
")",
";",
"if",
"(",
"$",
"path",
"!==",
"false",
"&&",
"strpos",
"(",
"$",
"path",
",",
"$",
"this",
"->",
"static_dir",
")",
"===",
"0",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"executeInterceptor",
"(",
"'before'",
",",
"$",
"request",
",",
"$",
"response",
")",
"!==",
"null",
")",
"{",
"$",
"request",
"->",
"end",
"(",
")",
";",
"$",
"response",
"->",
"end",
"(",
")",
";",
"unset",
"(",
"$",
"request",
",",
"$",
"response",
")",
";",
"return",
";",
"}",
"$",
"response",
"->",
"mimeType",
"(",
"pathinfo",
"(",
"$",
"path",
",",
"PATHINFO_EXTENSION",
")",
")",
";",
"$",
"response",
"->",
"sendfile",
"(",
"$",
"path",
")",
";",
"$",
"this",
"->",
"executeInterceptor",
"(",
"'after'",
",",
"$",
"request",
",",
"$",
"response",
")",
";",
"$",
"request",
"->",
"end",
"(",
")",
";",
"$",
"response",
"->",
"end",
"(",
")",
";",
"unset",
"(",
"$",
"request",
",",
"$",
"response",
")",
";",
"return",
";",
"}",
"}",
"$",
"this",
"->",
"router",
"->",
"parse",
"(",
"$",
"request",
")",
";",
"if",
"(",
"$",
"this",
"->",
"executeInterceptor",
"(",
"'before'",
",",
"$",
"request",
",",
"$",
"response",
")",
"!==",
"null",
")",
"{",
"$",
"request",
"->",
"end",
"(",
")",
";",
"$",
"response",
"->",
"end",
"(",
")",
";",
"unset",
"(",
"$",
"request",
",",
"$",
"response",
")",
";",
"return",
";",
"}",
"$",
"this",
"->",
"dispatch",
"(",
"$",
"request",
",",
"$",
"response",
")",
";",
"}"
] | Handle http request
@access public
@param Request $req Request
@param Response $res Response | [
"Handle",
"http",
"request"
] | 0fc2b42903bb3519c54c596270c890c826aeb1df | https://github.com/sylingd/Yesf/blob/0fc2b42903bb3519c54c596270c890c826aeb1df/src/Http/Dispatcher.php#L193-L225 |
32,067 | PGB-LIV/php-ms | src/Core/AminoAcidComposition.php | AminoAcidComposition.getFormula | public static function getFormula($acid)
{
$formula = @constant('pgb_liv\php_ms\Core\AminoAcidComposition::' . $acid);
if (! is_null($formula)) {
return $formula;
}
if (strlen($acid) > 1) {
throw new \InvalidArgumentException('Value must be a single amino acid. Input was ' . $acid);
}
throw new \InvalidArgumentException('Value must be a valid amino acid. Input was ' . $acid);
} | php | public static function getFormula($acid)
{
$formula = @constant('pgb_liv\php_ms\Core\AminoAcidComposition::' . $acid);
if (! is_null($formula)) {
return $formula;
}
if (strlen($acid) > 1) {
throw new \InvalidArgumentException('Value must be a single amino acid. Input was ' . $acid);
}
throw new \InvalidArgumentException('Value must be a valid amino acid. Input was ' . $acid);
} | [
"public",
"static",
"function",
"getFormula",
"(",
"$",
"acid",
")",
"{",
"$",
"formula",
"=",
"@",
"constant",
"(",
"'pgb_liv\\php_ms\\Core\\AminoAcidComposition::'",
".",
"$",
"acid",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"formula",
")",
")",
"{",
"return",
"$",
"formula",
";",
"}",
"if",
"(",
"strlen",
"(",
"$",
"acid",
")",
">",
"1",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Value must be a single amino acid. Input was '",
".",
"$",
"acid",
")",
";",
"}",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Value must be a valid amino acid. Input was '",
".",
"$",
"acid",
")",
";",
"}"
] | Gets the molecular formula for the provided amino acid.
@param string $acid
Amino acid
@throws \InvalidArgumentException If acid is not a single character or valid amino acid
@return string Molecular formula | [
"Gets",
"the",
"molecular",
"formula",
"for",
"the",
"provided",
"amino",
"acid",
"."
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/AminoAcidComposition.php#L77-L90 |
32,068 | edmondscommerce/doctrine-static-meta | src/Entity/Fields/Traits/String/UrlFieldTrait.php | UrlFieldTrait.validatorMetaForPropertyUrl | protected static function validatorMetaForPropertyUrl(ValidatorClassMetaData $metadata): void
{
$metadata->addPropertyConstraint(
UrlFieldInterface::PROP_URL,
new Url([
'relativeProtocol' => true,
'protocols' => ['http', 'https'],
])
);
} | php | protected static function validatorMetaForPropertyUrl(ValidatorClassMetaData $metadata): void
{
$metadata->addPropertyConstraint(
UrlFieldInterface::PROP_URL,
new Url([
'relativeProtocol' => true,
'protocols' => ['http', 'https'],
])
);
} | [
"protected",
"static",
"function",
"validatorMetaForPropertyUrl",
"(",
"ValidatorClassMetaData",
"$",
"metadata",
")",
":",
"void",
"{",
"$",
"metadata",
"->",
"addPropertyConstraint",
"(",
"UrlFieldInterface",
"::",
"PROP_URL",
",",
"new",
"Url",
"(",
"[",
"'relativeProtocol'",
"=>",
"true",
",",
"'protocols'",
"=>",
"[",
"'http'",
",",
"'https'",
"]",
",",
"]",
")",
")",
";",
"}"
] | This method validates that the url is valid
It allows the protocol to be ommitted, eg //www.edmondscommerce.co.uk
You can extend the list of allowed protocols as you see fit | [
"This",
"method",
"validates",
"that",
"the",
"url",
"is",
"valid"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Fields/Traits/String/UrlFieldTrait.php#L43-L52 |
32,069 | comporu/compo-core | src/Compo/FeedbackBundle/Controller/Api/FeedbackController.php | FeedbackController.postAction | public function postAction(Request $request)
{
//if (!$request->isXmlHttpRequest()) {
//throw new \HttpRequestMethodException('Not isXmlHttpRequest');
//}
$request_params = $this->getJsonParams($request);
$feedback = new Feedback();
$feedbackManager = $this->get('compo_feedback.manager.feedback');
$feedbackType = $feedbackManager->getType($request_params['data']['type']);
$form = $this->createForm($feedbackType['form'], $feedback);
$form->submit($request_params['data']);
$csrf = $this->get('security.csrf.token_manager');
if (!$form->isValid()) {
$csrf->refreshToken('feedback_protection');
return View::create(['success' => false, 'error' => 'form_not_valid'], 400);
}
try {
$em = $this->getDoctrine()->getManager();
$em->persist($feedback);
$em->flush();
$csrf->refreshToken('feedback_protection');
$this->get('compo_notification.manager.notification')->send($feedback->getType(), ['feedback' => $feedback]);
return View::create(['success' => true, 'message' => 'contacts_sent'], 200);
} catch (\Exception $e) {
return View::create(['success' => false, 'error' => $e->getMessage()], 400);
}
} | php | public function postAction(Request $request)
{
//if (!$request->isXmlHttpRequest()) {
//throw new \HttpRequestMethodException('Not isXmlHttpRequest');
//}
$request_params = $this->getJsonParams($request);
$feedback = new Feedback();
$feedbackManager = $this->get('compo_feedback.manager.feedback');
$feedbackType = $feedbackManager->getType($request_params['data']['type']);
$form = $this->createForm($feedbackType['form'], $feedback);
$form->submit($request_params['data']);
$csrf = $this->get('security.csrf.token_manager');
if (!$form->isValid()) {
$csrf->refreshToken('feedback_protection');
return View::create(['success' => false, 'error' => 'form_not_valid'], 400);
}
try {
$em = $this->getDoctrine()->getManager();
$em->persist($feedback);
$em->flush();
$csrf->refreshToken('feedback_protection');
$this->get('compo_notification.manager.notification')->send($feedback->getType(), ['feedback' => $feedback]);
return View::create(['success' => true, 'message' => 'contacts_sent'], 200);
} catch (\Exception $e) {
return View::create(['success' => false, 'error' => $e->getMessage()], 400);
}
} | [
"public",
"function",
"postAction",
"(",
"Request",
"$",
"request",
")",
"{",
"//if (!$request->isXmlHttpRequest()) {",
"//throw new \\HttpRequestMethodException('Not isXmlHttpRequest');",
"//}",
"$",
"request_params",
"=",
"$",
"this",
"->",
"getJsonParams",
"(",
"$",
"request",
")",
";",
"$",
"feedback",
"=",
"new",
"Feedback",
"(",
")",
";",
"$",
"feedbackManager",
"=",
"$",
"this",
"->",
"get",
"(",
"'compo_feedback.manager.feedback'",
")",
";",
"$",
"feedbackType",
"=",
"$",
"feedbackManager",
"->",
"getType",
"(",
"$",
"request_params",
"[",
"'data'",
"]",
"[",
"'type'",
"]",
")",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"$",
"feedbackType",
"[",
"'form'",
"]",
",",
"$",
"feedback",
")",
";",
"$",
"form",
"->",
"submit",
"(",
"$",
"request_params",
"[",
"'data'",
"]",
")",
";",
"$",
"csrf",
"=",
"$",
"this",
"->",
"get",
"(",
"'security.csrf.token_manager'",
")",
";",
"if",
"(",
"!",
"$",
"form",
"->",
"isValid",
"(",
")",
")",
"{",
"$",
"csrf",
"->",
"refreshToken",
"(",
"'feedback_protection'",
")",
";",
"return",
"View",
"::",
"create",
"(",
"[",
"'success'",
"=>",
"false",
",",
"'error'",
"=>",
"'form_not_valid'",
"]",
",",
"400",
")",
";",
"}",
"try",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"$",
"em",
"->",
"persist",
"(",
"$",
"feedback",
")",
";",
"$",
"em",
"->",
"flush",
"(",
")",
";",
"$",
"csrf",
"->",
"refreshToken",
"(",
"'feedback_protection'",
")",
";",
"$",
"this",
"->",
"get",
"(",
"'compo_notification.manager.notification'",
")",
"->",
"send",
"(",
"$",
"feedback",
"->",
"getType",
"(",
")",
",",
"[",
"'feedback'",
"=>",
"$",
"feedback",
"]",
")",
";",
"return",
"View",
"::",
"create",
"(",
"[",
"'success'",
"=>",
"true",
",",
"'message'",
"=>",
"'contacts_sent'",
"]",
",",
"200",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"return",
"View",
"::",
"create",
"(",
"[",
"'success'",
"=>",
"false",
",",
"'error'",
"=>",
"$",
"e",
"->",
"getMessage",
"(",
")",
"]",
",",
"400",
")",
";",
"}",
"}"
] | Works with contact form data.
Validates contact form,
Saves contact entity,
Sends notification message to user and site administration
@REST\Route(requirements={"_format"="json|xml"})
@ApiDoc(
requirements={
{"name"="$request", "dataType"="Request", "requirement"="Request", "description"="Request represents an HTTP request."}
},
statusCodes={
200="Returned when contacts is successfully saved and notification sent",
400="Returned when an error has occurred while contact form validated or when something went wrong",
}
)
@param Request $request request represents an HTTP request
@throws \Throwable
@return View | [
"Works",
"with",
"contact",
"form",
"data",
"."
] | ebaa9fe8a4b831506c78fdf637da6b4deadec1e2 | https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/FeedbackBundle/Controller/Api/FeedbackController.php#L51-L90 |
32,070 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderExportLog.class.php | TShopOrderExportLog.WriteLog | public static function WriteLog($iOrderId, $sData)
{
/** @var $oItem TdbShopOrderExportLog */
$oItem = TdbShopOrderExportLog::GetNewInstance();
/** @var Request $request */
$request = \ChameleonSystem\CoreBundle\ServiceLocator::get('request_stack')->getCurrentRequest();
$ip = $request->getClientIp();
$aData = array('shop_order_id' => $iOrderId, 'datecreated' => date('Y-m-d H:i:s'), 'ip' => $ip, 'data' => $sData, 'user_session_id' => session_id());
$oItem->LoadFromRow($aData);
$oItem->AllowEditByAll(true);
$oItem->Save();
} | php | public static function WriteLog($iOrderId, $sData)
{
/** @var $oItem TdbShopOrderExportLog */
$oItem = TdbShopOrderExportLog::GetNewInstance();
/** @var Request $request */
$request = \ChameleonSystem\CoreBundle\ServiceLocator::get('request_stack')->getCurrentRequest();
$ip = $request->getClientIp();
$aData = array('shop_order_id' => $iOrderId, 'datecreated' => date('Y-m-d H:i:s'), 'ip' => $ip, 'data' => $sData, 'user_session_id' => session_id());
$oItem->LoadFromRow($aData);
$oItem->AllowEditByAll(true);
$oItem->Save();
} | [
"public",
"static",
"function",
"WriteLog",
"(",
"$",
"iOrderId",
",",
"$",
"sData",
")",
"{",
"/** @var $oItem TdbShopOrderExportLog */",
"$",
"oItem",
"=",
"TdbShopOrderExportLog",
"::",
"GetNewInstance",
"(",
")",
";",
"/** @var Request $request */",
"$",
"request",
"=",
"\\",
"ChameleonSystem",
"\\",
"CoreBundle",
"\\",
"ServiceLocator",
"::",
"get",
"(",
"'request_stack'",
")",
"->",
"getCurrentRequest",
"(",
")",
";",
"$",
"ip",
"=",
"$",
"request",
"->",
"getClientIp",
"(",
")",
";",
"$",
"aData",
"=",
"array",
"(",
"'shop_order_id'",
"=>",
"$",
"iOrderId",
",",
"'datecreated'",
"=>",
"date",
"(",
"'Y-m-d H:i:s'",
")",
",",
"'ip'",
"=>",
"$",
"ip",
",",
"'data'",
"=>",
"$",
"sData",
",",
"'user_session_id'",
"=>",
"session_id",
"(",
")",
")",
";",
"$",
"oItem",
"->",
"LoadFromRow",
"(",
"$",
"aData",
")",
";",
"$",
"oItem",
"->",
"AllowEditByAll",
"(",
"true",
")",
";",
"$",
"oItem",
"->",
"Save",
"(",
")",
";",
"}"
] | write a Log Entry.
@param int $iOrderId
@param string $sData | [
"write",
"a",
"Log",
"Entry",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderExportLog.class.php#L22-L33 |
32,071 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopManufacturer.class.php | TShopManufacturer.GetLinkProducts | public function GetLinkProducts($bUseAbsoluteURL = false)
{
$oShop = TdbShop::GetInstance();
$sLink = $oShop->GetLinkToSystemPage('manufacturer');
if ('.html' == substr($sLink, -5)) {
$sLink = substr($sLink, 0, -5).'/';
}
$sLink = $sLink.$this->getUrlNormalizationUtil()->normalizeUrl($this->fieldName).'/id/'.urlencode($this->id);
return $sLink;
} | php | public function GetLinkProducts($bUseAbsoluteURL = false)
{
$oShop = TdbShop::GetInstance();
$sLink = $oShop->GetLinkToSystemPage('manufacturer');
if ('.html' == substr($sLink, -5)) {
$sLink = substr($sLink, 0, -5).'/';
}
$sLink = $sLink.$this->getUrlNormalizationUtil()->normalizeUrl($this->fieldName).'/id/'.urlencode($this->id);
return $sLink;
} | [
"public",
"function",
"GetLinkProducts",
"(",
"$",
"bUseAbsoluteURL",
"=",
"false",
")",
"{",
"$",
"oShop",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
")",
";",
"$",
"sLink",
"=",
"$",
"oShop",
"->",
"GetLinkToSystemPage",
"(",
"'manufacturer'",
")",
";",
"if",
"(",
"'.html'",
"==",
"substr",
"(",
"$",
"sLink",
",",
"-",
"5",
")",
")",
"{",
"$",
"sLink",
"=",
"substr",
"(",
"$",
"sLink",
",",
"0",
",",
"-",
"5",
")",
".",
"'/'",
";",
"}",
"$",
"sLink",
"=",
"$",
"sLink",
".",
"$",
"this",
"->",
"getUrlNormalizationUtil",
"(",
")",
"->",
"normalizeUrl",
"(",
"$",
"this",
"->",
"fieldName",
")",
".",
"'/id/'",
".",
"urlencode",
"(",
"$",
"this",
"->",
"id",
")",
";",
"return",
"$",
"sLink",
";",
"}"
] | return link to the product pages for the manufacturer.
@param bool $bUseAbsoluteURL
@return string | [
"return",
"link",
"to",
"the",
"product",
"pages",
"for",
"the",
"manufacturer",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopManufacturer.class.php#L26-L36 |
32,072 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopManufacturer.class.php | TShopManufacturer.GetNumberOfHitsForSearchCacheId | public function GetNumberOfHitsForSearchCacheId($iShopSearchCacheId, $bApplyActiveFilter = false)
{
$iNumHits = 0;
if ($bApplyActiveFilter) {
$query = "SELECT COUNT(DISTINCT `shop_search_cache_item`.`id`) AS hits
FROM `shop_search_cache_item`
INNER JOIN `shop_article` ON `shop_search_cache_item`.`shop_article_id` = `shop_article`.`id`
LEFT JOIN `shop_article_shop_category_mlt` ON `shop_article`.`id` = `shop_article_shop_category_mlt`.`source_id`
WHERE `shop_search_cache_item`.`shop_search_cache_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iShopSearchCacheId)."'
AND `shop_article`.`shop_manufacturer_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
";
$sFilter = TdbShop::GetActiveFilterString(TdbShopManufacturer::FILTER_KEY_NAME);
if (!empty($sFilter)) {
$query .= " AND {$sFilter}";
}
$query .= ' GROUP BY `shop_article`.`shop_manufacturer_id`';
// echo "<pre>".$query."</pre><br>";
} else {
$query = "SELECT COUNT(DISTINCT `shop_search_cache_item`.`id`) AS hits
FROM `shop_search_cache_item`
INNER JOIN `shop_article` ON `shop_search_cache_item`.`shop_article_id` = `shop_article`.`id`
WHERE `shop_search_cache_item`.`shop_search_cache_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iShopSearchCacheId)."'
AND `shop_article`.`shop_manufacturer_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
GROUP BY `shop_article`.`shop_manufacturer_id`
";
}
if ($row = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
$iNumHits = $row['hits'];
}
return $iNumHits;
} | php | public function GetNumberOfHitsForSearchCacheId($iShopSearchCacheId, $bApplyActiveFilter = false)
{
$iNumHits = 0;
if ($bApplyActiveFilter) {
$query = "SELECT COUNT(DISTINCT `shop_search_cache_item`.`id`) AS hits
FROM `shop_search_cache_item`
INNER JOIN `shop_article` ON `shop_search_cache_item`.`shop_article_id` = `shop_article`.`id`
LEFT JOIN `shop_article_shop_category_mlt` ON `shop_article`.`id` = `shop_article_shop_category_mlt`.`source_id`
WHERE `shop_search_cache_item`.`shop_search_cache_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iShopSearchCacheId)."'
AND `shop_article`.`shop_manufacturer_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
";
$sFilter = TdbShop::GetActiveFilterString(TdbShopManufacturer::FILTER_KEY_NAME);
if (!empty($sFilter)) {
$query .= " AND {$sFilter}";
}
$query .= ' GROUP BY `shop_article`.`shop_manufacturer_id`';
// echo "<pre>".$query."</pre><br>";
} else {
$query = "SELECT COUNT(DISTINCT `shop_search_cache_item`.`id`) AS hits
FROM `shop_search_cache_item`
INNER JOIN `shop_article` ON `shop_search_cache_item`.`shop_article_id` = `shop_article`.`id`
WHERE `shop_search_cache_item`.`shop_search_cache_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iShopSearchCacheId)."'
AND `shop_article`.`shop_manufacturer_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
GROUP BY `shop_article`.`shop_manufacturer_id`
";
}
if ($row = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
$iNumHits = $row['hits'];
}
return $iNumHits;
} | [
"public",
"function",
"GetNumberOfHitsForSearchCacheId",
"(",
"$",
"iShopSearchCacheId",
",",
"$",
"bApplyActiveFilter",
"=",
"false",
")",
"{",
"$",
"iNumHits",
"=",
"0",
";",
"if",
"(",
"$",
"bApplyActiveFilter",
")",
"{",
"$",
"query",
"=",
"\"SELECT COUNT(DISTINCT `shop_search_cache_item`.`id`) AS hits\n FROM `shop_search_cache_item`\n INNER JOIN `shop_article` ON `shop_search_cache_item`.`shop_article_id` = `shop_article`.`id`\n LEFT JOIN `shop_article_shop_category_mlt` ON `shop_article`.`id` = `shop_article_shop_category_mlt`.`source_id`\n WHERE `shop_search_cache_item`.`shop_search_cache_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"iShopSearchCacheId",
")",
".",
"\"'\n AND `shop_article`.`shop_manufacturer_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"id",
")",
".",
"\"'\n \"",
";",
"$",
"sFilter",
"=",
"TdbShop",
"::",
"GetActiveFilterString",
"(",
"TdbShopManufacturer",
"::",
"FILTER_KEY_NAME",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"sFilter",
")",
")",
"{",
"$",
"query",
".=",
"\" AND {$sFilter}\"",
";",
"}",
"$",
"query",
".=",
"' GROUP BY `shop_article`.`shop_manufacturer_id`'",
";",
"// echo \"<pre>\".$query.\"</pre><br>\";",
"}",
"else",
"{",
"$",
"query",
"=",
"\"SELECT COUNT(DISTINCT `shop_search_cache_item`.`id`) AS hits\n FROM `shop_search_cache_item`\n INNER JOIN `shop_article` ON `shop_search_cache_item`.`shop_article_id` = `shop_article`.`id`\n WHERE `shop_search_cache_item`.`shop_search_cache_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"iShopSearchCacheId",
")",
".",
"\"'\n AND `shop_article`.`shop_manufacturer_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"id",
")",
".",
"\"'\n GROUP BY `shop_article`.`shop_manufacturer_id`\n \"",
";",
"}",
"if",
"(",
"$",
"row",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"fetch_assoc",
"(",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"query",
")",
")",
")",
"{",
"$",
"iNumHits",
"=",
"$",
"row",
"[",
"'hits'",
"]",
";",
"}",
"return",
"$",
"iNumHits",
";",
"}"
] | returns the number of search hits for a manufacturer.
@param int $iShopSearchCacheId
@param bool $bApplyActiveFilter - set to true if you want to count only hits that match the current filter
@return int | [
"returns",
"the",
"number",
"of",
"search",
"hits",
"for",
"a",
"manufacturer",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopManufacturer.class.php#L118-L151 |
32,073 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopManufacturer.class.php | TShopManufacturer.GetIcon | public function GetIcon($bReturnDefaultImageIfNoneSet = false)
{
$oIcon = $this->GetFromInternalCache('oIcon');
if (is_null($oIcon)) {
$oIcon = $this->GetImage(0, 'cms_media_id', $bReturnDefaultImageIfNoneSet);
if (is_null($oIcon)) {
$oIcon = false;
}
$this->SetInternalCache('oIcon', $oIcon);
}
return $oIcon;
} | php | public function GetIcon($bReturnDefaultImageIfNoneSet = false)
{
$oIcon = $this->GetFromInternalCache('oIcon');
if (is_null($oIcon)) {
$oIcon = $this->GetImage(0, 'cms_media_id', $bReturnDefaultImageIfNoneSet);
if (is_null($oIcon)) {
$oIcon = false;
}
$this->SetInternalCache('oIcon', $oIcon);
}
return $oIcon;
} | [
"public",
"function",
"GetIcon",
"(",
"$",
"bReturnDefaultImageIfNoneSet",
"=",
"false",
")",
"{",
"$",
"oIcon",
"=",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'oIcon'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"oIcon",
")",
")",
"{",
"$",
"oIcon",
"=",
"$",
"this",
"->",
"GetImage",
"(",
"0",
",",
"'cms_media_id'",
",",
"$",
"bReturnDefaultImageIfNoneSet",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"oIcon",
")",
")",
"{",
"$",
"oIcon",
"=",
"false",
";",
"}",
"$",
"this",
"->",
"SetInternalCache",
"(",
"'oIcon'",
",",
"$",
"oIcon",
")",
";",
"}",
"return",
"$",
"oIcon",
";",
"}"
] | return the icon for the manufacturer. returns false if none found.
@return TCMSImage | [
"return",
"the",
"icon",
"for",
"the",
"manufacturer",
".",
"returns",
"false",
"if",
"none",
"found",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopManufacturer.class.php#L158-L170 |
32,074 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopManufacturer.class.php | TShopManufacturer.GetLogo | public function GetLogo($bReturnDefaultImageIfNoneSet = false)
{
$oLogo = $this->GetFromInternalCache('oLogo');
if (is_null($oLogo)) {
$oLogo = $this->GetImage(1, 'cms_media_id', $bReturnDefaultImageIfNoneSet);
if (is_null($oLogo)) {
$oLogo = $this->GetIcon($bReturnDefaultImageIfNoneSet);
}
if (is_null($oLogo)) {
$oLogo = false;
}
$this->SetInternalCache('oLogo', $oLogo);
}
return $oLogo;
} | php | public function GetLogo($bReturnDefaultImageIfNoneSet = false)
{
$oLogo = $this->GetFromInternalCache('oLogo');
if (is_null($oLogo)) {
$oLogo = $this->GetImage(1, 'cms_media_id', $bReturnDefaultImageIfNoneSet);
if (is_null($oLogo)) {
$oLogo = $this->GetIcon($bReturnDefaultImageIfNoneSet);
}
if (is_null($oLogo)) {
$oLogo = false;
}
$this->SetInternalCache('oLogo', $oLogo);
}
return $oLogo;
} | [
"public",
"function",
"GetLogo",
"(",
"$",
"bReturnDefaultImageIfNoneSet",
"=",
"false",
")",
"{",
"$",
"oLogo",
"=",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'oLogo'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"oLogo",
")",
")",
"{",
"$",
"oLogo",
"=",
"$",
"this",
"->",
"GetImage",
"(",
"1",
",",
"'cms_media_id'",
",",
"$",
"bReturnDefaultImageIfNoneSet",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"oLogo",
")",
")",
"{",
"$",
"oLogo",
"=",
"$",
"this",
"->",
"GetIcon",
"(",
"$",
"bReturnDefaultImageIfNoneSet",
")",
";",
"}",
"if",
"(",
"is_null",
"(",
"$",
"oLogo",
")",
")",
"{",
"$",
"oLogo",
"=",
"false",
";",
"}",
"$",
"this",
"->",
"SetInternalCache",
"(",
"'oLogo'",
",",
"$",
"oLogo",
")",
";",
"}",
"return",
"$",
"oLogo",
";",
"}"
] | return the logo for the manufacturer. if none has been set, it will return the icon instead
if there is no icon either, it will return false.
@return TCMSImage | [
"return",
"the",
"logo",
"for",
"the",
"manufacturer",
".",
"if",
"none",
"has",
"been",
"set",
"it",
"will",
"return",
"the",
"icon",
"instead",
"if",
"there",
"is",
"no",
"icon",
"either",
"it",
"will",
"return",
"false",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopManufacturer.class.php#L178-L193 |
32,075 | chameleon-system/chameleon-shop | src/SearchBundle/objects/db/TShopSearchKeywordArticleList.class.php | TShopSearchKeywordArticleList.& | public static function &GetListForShopKeywords($iShopId, $aKeywordList, $iLanguageId = null)
{
if (null === $iLanguageId) {
$iLanguageId = self::getMyLanguageService()->getActiveLanguageId();
}
$aKeywordList = TTools::MysqlRealEscapeArray($aKeywordList);
$query = self::GetDefaultQuery($iLanguageId, "`shop_search_keyword_article`.`shop_id`= '".MySqlLegacySupport::getInstance()->real_escape_string($iShopId)."' AND `shop_search_keyword_article`.`name` IN ('".implode("','", $aKeywordList)."') AND (`shop_search_keyword_article`.`cms_language_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iLanguageId)."' OR `shop_search_keyword_article`.`cms_language_id` = '') ");
return TdbShopSearchKeywordArticleList::GetList($query, $iLanguageId);
} | php | public static function &GetListForShopKeywords($iShopId, $aKeywordList, $iLanguageId = null)
{
if (null === $iLanguageId) {
$iLanguageId = self::getMyLanguageService()->getActiveLanguageId();
}
$aKeywordList = TTools::MysqlRealEscapeArray($aKeywordList);
$query = self::GetDefaultQuery($iLanguageId, "`shop_search_keyword_article`.`shop_id`= '".MySqlLegacySupport::getInstance()->real_escape_string($iShopId)."' AND `shop_search_keyword_article`.`name` IN ('".implode("','", $aKeywordList)."') AND (`shop_search_keyword_article`.`cms_language_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iLanguageId)."' OR `shop_search_keyword_article`.`cms_language_id` = '') ");
return TdbShopSearchKeywordArticleList::GetList($query, $iLanguageId);
} | [
"public",
"static",
"function",
"&",
"GetListForShopKeywords",
"(",
"$",
"iShopId",
",",
"$",
"aKeywordList",
",",
"$",
"iLanguageId",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"iLanguageId",
")",
"{",
"$",
"iLanguageId",
"=",
"self",
"::",
"getMyLanguageService",
"(",
")",
"->",
"getActiveLanguageId",
"(",
")",
";",
"}",
"$",
"aKeywordList",
"=",
"TTools",
"::",
"MysqlRealEscapeArray",
"(",
"$",
"aKeywordList",
")",
";",
"$",
"query",
"=",
"self",
"::",
"GetDefaultQuery",
"(",
"$",
"iLanguageId",
",",
"\"`shop_search_keyword_article`.`shop_id`= '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"iShopId",
")",
".",
"\"' AND `shop_search_keyword_article`.`name` IN ('\"",
".",
"implode",
"(",
"\"','\"",
",",
"$",
"aKeywordList",
")",
".",
"\"') AND (`shop_search_keyword_article`.`cms_language_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"iLanguageId",
")",
".",
"\"' OR `shop_search_keyword_article`.`cms_language_id` = '') \"",
")",
";",
"return",
"TdbShopSearchKeywordArticleList",
"::",
"GetList",
"(",
"$",
"query",
",",
"$",
"iLanguageId",
")",
";",
"}"
] | return list for a set of keywords.
@param int $iShopId
@param array $aKeywordList
@param int $iLanguageId
@return TdbShopSearchKeywordArticleList | [
"return",
"list",
"for",
"a",
"set",
"of",
"keywords",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchKeywordArticleList.class.php#L23-L32 |
32,076 | chameleon-system/chameleon-shop | src/ShopDhlPackstationBundle/pkgExtranet/objects/db/TPkgShopDhlPackstation_DataExtranetUser.class.php | TPkgShopDhlPackstation_DataExtranetUser.SetAddressAsBillingAddress | public function SetAddressAsBillingAddress($sAddressId)
{
$oNewBillingAdr = null;
if (0 != strcmp($this->fieldDefaultBillingAddressId, $sAddressId)) {
$oAdr = TdbDataExtranetUserAddress::GetNewInstance();
if ($oAdr->LoadFromFields(
array('id' => $sAddressId, 'data_extranet_user_id' => $this->id, 'is_dhl_packstation' => '0')
)
) {
$this->SaveFieldsFast(array('default_billing_address_id' => $sAddressId));
$oNewBillingAdr = $this->GetBillingAddress(true);
}
} else {
$oNewBillingAdr = $this->GetBillingAddress();
}
return $oNewBillingAdr;
} | php | public function SetAddressAsBillingAddress($sAddressId)
{
$oNewBillingAdr = null;
if (0 != strcmp($this->fieldDefaultBillingAddressId, $sAddressId)) {
$oAdr = TdbDataExtranetUserAddress::GetNewInstance();
if ($oAdr->LoadFromFields(
array('id' => $sAddressId, 'data_extranet_user_id' => $this->id, 'is_dhl_packstation' => '0')
)
) {
$this->SaveFieldsFast(array('default_billing_address_id' => $sAddressId));
$oNewBillingAdr = $this->GetBillingAddress(true);
}
} else {
$oNewBillingAdr = $this->GetBillingAddress();
}
return $oNewBillingAdr;
} | [
"public",
"function",
"SetAddressAsBillingAddress",
"(",
"$",
"sAddressId",
")",
"{",
"$",
"oNewBillingAdr",
"=",
"null",
";",
"if",
"(",
"0",
"!=",
"strcmp",
"(",
"$",
"this",
"->",
"fieldDefaultBillingAddressId",
",",
"$",
"sAddressId",
")",
")",
"{",
"$",
"oAdr",
"=",
"TdbDataExtranetUserAddress",
"::",
"GetNewInstance",
"(",
")",
";",
"if",
"(",
"$",
"oAdr",
"->",
"LoadFromFields",
"(",
"array",
"(",
"'id'",
"=>",
"$",
"sAddressId",
",",
"'data_extranet_user_id'",
"=>",
"$",
"this",
"->",
"id",
",",
"'is_dhl_packstation'",
"=>",
"'0'",
")",
")",
")",
"{",
"$",
"this",
"->",
"SaveFieldsFast",
"(",
"array",
"(",
"'default_billing_address_id'",
"=>",
"$",
"sAddressId",
")",
")",
";",
"$",
"oNewBillingAdr",
"=",
"$",
"this",
"->",
"GetBillingAddress",
"(",
"true",
")",
";",
"}",
"}",
"else",
"{",
"$",
"oNewBillingAdr",
"=",
"$",
"this",
"->",
"GetBillingAddress",
"(",
")",
";",
"}",
"return",
"$",
"oNewBillingAdr",
";",
"}"
] | set address as new billing address... will check if the address belongs to the user.
@param $sAddressId
@return TdbDataExtranetUserAddress | [
"set",
"address",
"as",
"new",
"billing",
"address",
"...",
"will",
"check",
"if",
"the",
"address",
"belongs",
"to",
"the",
"user",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopDhlPackstationBundle/pkgExtranet/objects/db/TPkgShopDhlPackstation_DataExtranetUser.class.php#L21-L38 |
32,077 | chameleon-system/chameleon-shop | src/ShopDhlPackstationBundle/pkgExtranet/objects/db/TPkgShopDhlPackstation_DataExtranetUser.class.php | TPkgShopDhlPackstation_DataExtranetUser.UpdateShippingAddress | public function UpdateShippingAddress($aAddressData)
{
$aAddressData = $this->fillPackStationFieldValue($aAddressData);
$bChangeDHLPackStation = $this->DHLPackStationStatusChanged($aAddressData);
$bIsDHLPackStation = ('0' == $aAddressData['is_dhl_packstation']) ? false : true;
$bUpdated = parent::UpdateShippingAddress($aAddressData);
if (true === $bUpdated && true === $bChangeDHLPackStation) {
$oShippingAddress = $this->GetShippingAddress();
if (false === is_null($oShippingAddress)) {
$oShippingAddress->SetIsDhlPackstation($bIsDHLPackStation, false);
}
}
return $bUpdated;
} | php | public function UpdateShippingAddress($aAddressData)
{
$aAddressData = $this->fillPackStationFieldValue($aAddressData);
$bChangeDHLPackStation = $this->DHLPackStationStatusChanged($aAddressData);
$bIsDHLPackStation = ('0' == $aAddressData['is_dhl_packstation']) ? false : true;
$bUpdated = parent::UpdateShippingAddress($aAddressData);
if (true === $bUpdated && true === $bChangeDHLPackStation) {
$oShippingAddress = $this->GetShippingAddress();
if (false === is_null($oShippingAddress)) {
$oShippingAddress->SetIsDhlPackstation($bIsDHLPackStation, false);
}
}
return $bUpdated;
} | [
"public",
"function",
"UpdateShippingAddress",
"(",
"$",
"aAddressData",
")",
"{",
"$",
"aAddressData",
"=",
"$",
"this",
"->",
"fillPackStationFieldValue",
"(",
"$",
"aAddressData",
")",
";",
"$",
"bChangeDHLPackStation",
"=",
"$",
"this",
"->",
"DHLPackStationStatusChanged",
"(",
"$",
"aAddressData",
")",
";",
"$",
"bIsDHLPackStation",
"=",
"(",
"'0'",
"==",
"$",
"aAddressData",
"[",
"'is_dhl_packstation'",
"]",
")",
"?",
"false",
":",
"true",
";",
"$",
"bUpdated",
"=",
"parent",
"::",
"UpdateShippingAddress",
"(",
"$",
"aAddressData",
")",
";",
"if",
"(",
"true",
"===",
"$",
"bUpdated",
"&&",
"true",
"===",
"$",
"bChangeDHLPackStation",
")",
"{",
"$",
"oShippingAddress",
"=",
"$",
"this",
"->",
"GetShippingAddress",
"(",
")",
";",
"if",
"(",
"false",
"===",
"is_null",
"(",
"$",
"oShippingAddress",
")",
")",
"{",
"$",
"oShippingAddress",
"->",
"SetIsDhlPackstation",
"(",
"$",
"bIsDHLPackStation",
",",
"false",
")",
";",
"}",
"}",
"return",
"$",
"bUpdated",
";",
"}"
] | clear field for type change after updating address.
@param array $aAddressData
@return bool | [
"clear",
"field",
"for",
"type",
"change",
"after",
"updating",
"address",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopDhlPackstationBundle/pkgExtranet/objects/db/TPkgShopDhlPackstation_DataExtranetUser.class.php#L47-L61 |
32,078 | chameleon-system/chameleon-shop | src/ShopDhlPackstationBundle/pkgExtranet/objects/db/TPkgShopDhlPackstation_DataExtranetUser.class.php | TPkgShopDhlPackstation_DataExtranetUser.DHLPackStationStatusChanged | public function DHLPackStationStatusChanged($aAddressData)
{
$bChangeDHLPackStation = false;
$aAddressData = $this->fillPackStationFieldValue($aAddressData);
$bIsDHLPackStation = ('0' == $aAddressData['is_dhl_packstation']) ? false : true;
$oOldAddress = clone $this->GetShippingAddress();
if ($bIsDHLPackStation != $oOldAddress->fieldIsDhlPackstation) {
$bChangeDHLPackStation = true;
}
return $bChangeDHLPackStation;
} | php | public function DHLPackStationStatusChanged($aAddressData)
{
$bChangeDHLPackStation = false;
$aAddressData = $this->fillPackStationFieldValue($aAddressData);
$bIsDHLPackStation = ('0' == $aAddressData['is_dhl_packstation']) ? false : true;
$oOldAddress = clone $this->GetShippingAddress();
if ($bIsDHLPackStation != $oOldAddress->fieldIsDhlPackstation) {
$bChangeDHLPackStation = true;
}
return $bChangeDHLPackStation;
} | [
"public",
"function",
"DHLPackStationStatusChanged",
"(",
"$",
"aAddressData",
")",
"{",
"$",
"bChangeDHLPackStation",
"=",
"false",
";",
"$",
"aAddressData",
"=",
"$",
"this",
"->",
"fillPackStationFieldValue",
"(",
"$",
"aAddressData",
")",
";",
"$",
"bIsDHLPackStation",
"=",
"(",
"'0'",
"==",
"$",
"aAddressData",
"[",
"'is_dhl_packstation'",
"]",
")",
"?",
"false",
":",
"true",
";",
"$",
"oOldAddress",
"=",
"clone",
"$",
"this",
"->",
"GetShippingAddress",
"(",
")",
";",
"if",
"(",
"$",
"bIsDHLPackStation",
"!=",
"$",
"oOldAddress",
"->",
"fieldIsDhlPackstation",
")",
"{",
"$",
"bChangeDHLPackStation",
"=",
"true",
";",
"}",
"return",
"$",
"bChangeDHLPackStation",
";",
"}"
] | check if address type status changed.
@param array $aAddressData
@return bool | [
"check",
"if",
"address",
"type",
"status",
"changed",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopDhlPackstationBundle/pkgExtranet/objects/db/TPkgShopDhlPackstation_DataExtranetUser.class.php#L86-L97 |
32,079 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShop.class.php | TShop.GetAffilateCode | public function GetAffilateCode()
{
$sCode = false;
if (array_key_exists(TdbShop::SESSION_AFFILIATE_CODE, $_SESSION)) {
$sCode = $_SESSION[TdbShop::SESSION_AFFILIATE_CODE];
}
return $sCode;
} | php | public function GetAffilateCode()
{
$sCode = false;
if (array_key_exists(TdbShop::SESSION_AFFILIATE_CODE, $_SESSION)) {
$sCode = $_SESSION[TdbShop::SESSION_AFFILIATE_CODE];
}
return $sCode;
} | [
"public",
"function",
"GetAffilateCode",
"(",
")",
"{",
"$",
"sCode",
"=",
"false",
";",
"if",
"(",
"array_key_exists",
"(",
"TdbShop",
"::",
"SESSION_AFFILIATE_CODE",
",",
"$",
"_SESSION",
")",
")",
"{",
"$",
"sCode",
"=",
"$",
"_SESSION",
"[",
"TdbShop",
"::",
"SESSION_AFFILIATE_CODE",
"]",
";",
"}",
"return",
"$",
"sCode",
";",
"}"
] | return the affiliate partner code for the current session.
@return string | [
"return",
"the",
"affiliate",
"partner",
"code",
"for",
"the",
"current",
"session",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L52-L60 |
32,080 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShop.class.php | TShop.SetActiveSearchCacheObject | public function SetActiveSearchCacheObject(TdbShopSearchCache $oActiveSearchCache)
{
$this->oActiveSearchCache = &$oActiveSearchCache;
if (!is_null($oActiveSearchCache)) {
$_SESSION[self::SESSION_ACTIVE_SEARCH_CACHE_ID] = base64_encode(serialize($oActiveSearchCache));
} else {
unset($_SESSION[self::SESSION_ACTIVE_SEARCH_CACHE_ID]);
}
} | php | public function SetActiveSearchCacheObject(TdbShopSearchCache $oActiveSearchCache)
{
$this->oActiveSearchCache = &$oActiveSearchCache;
if (!is_null($oActiveSearchCache)) {
$_SESSION[self::SESSION_ACTIVE_SEARCH_CACHE_ID] = base64_encode(serialize($oActiveSearchCache));
} else {
unset($_SESSION[self::SESSION_ACTIVE_SEARCH_CACHE_ID]);
}
} | [
"public",
"function",
"SetActiveSearchCacheObject",
"(",
"TdbShopSearchCache",
"$",
"oActiveSearchCache",
")",
"{",
"$",
"this",
"->",
"oActiveSearchCache",
"=",
"&",
"$",
"oActiveSearchCache",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"oActiveSearchCache",
")",
")",
"{",
"$",
"_SESSION",
"[",
"self",
"::",
"SESSION_ACTIVE_SEARCH_CACHE_ID",
"]",
"=",
"base64_encode",
"(",
"serialize",
"(",
"$",
"oActiveSearchCache",
")",
")",
";",
"}",
"else",
"{",
"unset",
"(",
"$",
"_SESSION",
"[",
"self",
"::",
"SESSION_ACTIVE_SEARCH_CACHE_ID",
"]",
")",
";",
"}",
"}"
] | store a copy of the active search object.
@param TdbShopSearchCache $oActiveSearchCache | [
"store",
"a",
"copy",
"of",
"the",
"active",
"search",
"object",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L105-L113 |
32,081 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShop.class.php | TShop.& | public function &GetActiveSearchObject()
{
if (is_null($this->oActiveSearchCache) && array_key_exists(self::SESSION_ACTIVE_SEARCH_CACHE_ID, $_SESSION)) {
$this->oActiveSearchCache = unserialize(base64_decode($_SESSION[self::SESSION_ACTIVE_SEARCH_CACHE_ID]));
// $this->oActiveSearchCache = TdbShopSearchCache::GetNewInstance();
// if (!$this->oActiveSearchCache->Load($_SESSION[self::SESSION_ACTIVE_SEARCH_CACHE_ID])) $this->oActiveSearchCache = null;
}
return $this->oActiveSearchCache;
} | php | public function &GetActiveSearchObject()
{
if (is_null($this->oActiveSearchCache) && array_key_exists(self::SESSION_ACTIVE_SEARCH_CACHE_ID, $_SESSION)) {
$this->oActiveSearchCache = unserialize(base64_decode($_SESSION[self::SESSION_ACTIVE_SEARCH_CACHE_ID]));
// $this->oActiveSearchCache = TdbShopSearchCache::GetNewInstance();
// if (!$this->oActiveSearchCache->Load($_SESSION[self::SESSION_ACTIVE_SEARCH_CACHE_ID])) $this->oActiveSearchCache = null;
}
return $this->oActiveSearchCache;
} | [
"public",
"function",
"&",
"GetActiveSearchObject",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"oActiveSearchCache",
")",
"&&",
"array_key_exists",
"(",
"self",
"::",
"SESSION_ACTIVE_SEARCH_CACHE_ID",
",",
"$",
"_SESSION",
")",
")",
"{",
"$",
"this",
"->",
"oActiveSearchCache",
"=",
"unserialize",
"(",
"base64_decode",
"(",
"$",
"_SESSION",
"[",
"self",
"::",
"SESSION_ACTIVE_SEARCH_CACHE_ID",
"]",
")",
")",
";",
"// $this->oActiveSearchCache = TdbShopSearchCache::GetNewInstance();",
"// if (!$this->oActiveSearchCache->Load($_SESSION[self::SESSION_ACTIVE_SEARCH_CACHE_ID])) $this->oActiveSearchCache = null;",
"}",
"return",
"$",
"this",
"->",
"oActiveSearchCache",
";",
"}"
] | return pointer to the search cache object.
@return TdbShopSearchCache | [
"return",
"pointer",
"to",
"the",
"search",
"cache",
"object",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L120-L129 |
32,082 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShop.class.php | TShop.GetActiveManufacturer | public static function GetActiveManufacturer()
{
static $oActiveManufacturer = 'x';
if ('x' === $oActiveManufacturer) {
$oActiveManufacturer = null;
$oGlobal = TGlobal::instance();
$iManufacturerId = $oGlobal->GetUserData(MTShopManufacturerArticleCatalogCore::URL_MANUFACTURER_ID);
if (empty($iManufacturerId)) {
$oItem = self::getShopService()->getActiveProduct();
if (null !== $oItem) {
$oActiveManufacturer = $oItem->GetFieldShopManufacturer();
}
} else {
$oActiveManufacturer = TdbShopManufacturer::GetNewInstance();
if (!$oActiveManufacturer->Load($iManufacturerId)) {
$oActiveManufacturer = null;
}
}
}
return $oActiveManufacturer;
} | php | public static function GetActiveManufacturer()
{
static $oActiveManufacturer = 'x';
if ('x' === $oActiveManufacturer) {
$oActiveManufacturer = null;
$oGlobal = TGlobal::instance();
$iManufacturerId = $oGlobal->GetUserData(MTShopManufacturerArticleCatalogCore::URL_MANUFACTURER_ID);
if (empty($iManufacturerId)) {
$oItem = self::getShopService()->getActiveProduct();
if (null !== $oItem) {
$oActiveManufacturer = $oItem->GetFieldShopManufacturer();
}
} else {
$oActiveManufacturer = TdbShopManufacturer::GetNewInstance();
if (!$oActiveManufacturer->Load($iManufacturerId)) {
$oActiveManufacturer = null;
}
}
}
return $oActiveManufacturer;
} | [
"public",
"static",
"function",
"GetActiveManufacturer",
"(",
")",
"{",
"static",
"$",
"oActiveManufacturer",
"=",
"'x'",
";",
"if",
"(",
"'x'",
"===",
"$",
"oActiveManufacturer",
")",
"{",
"$",
"oActiveManufacturer",
"=",
"null",
";",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"iManufacturerId",
"=",
"$",
"oGlobal",
"->",
"GetUserData",
"(",
"MTShopManufacturerArticleCatalogCore",
"::",
"URL_MANUFACTURER_ID",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"iManufacturerId",
")",
")",
"{",
"$",
"oItem",
"=",
"self",
"::",
"getShopService",
"(",
")",
"->",
"getActiveProduct",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"oItem",
")",
"{",
"$",
"oActiveManufacturer",
"=",
"$",
"oItem",
"->",
"GetFieldShopManufacturer",
"(",
")",
";",
"}",
"}",
"else",
"{",
"$",
"oActiveManufacturer",
"=",
"TdbShopManufacturer",
"::",
"GetNewInstance",
"(",
")",
";",
"if",
"(",
"!",
"$",
"oActiveManufacturer",
"->",
"Load",
"(",
"$",
"iManufacturerId",
")",
")",
"{",
"$",
"oActiveManufacturer",
"=",
"null",
";",
"}",
"}",
"}",
"return",
"$",
"oActiveManufacturer",
";",
"}"
] | Returns the active manufacturer.
@return TdbShopManufacturer|null | [
"Returns",
"the",
"active",
"manufacturer",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L160-L181 |
32,083 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShop.class.php | TShop.GetActiveRootCategory | public static function GetActiveRootCategory()
{
static $oActiveRootCategory = 'x';
if ('x' === $oActiveRootCategory) {
$oActiveRootCategory = null;
$oActiveCategory = self::getShopService()->GetActiveCategory();
if (null !== $oActiveCategory) {
$oActiveRootCategory = $oActiveCategory->GetRootCategory();
}
}
return $oActiveRootCategory;
} | php | public static function GetActiveRootCategory()
{
static $oActiveRootCategory = 'x';
if ('x' === $oActiveRootCategory) {
$oActiveRootCategory = null;
$oActiveCategory = self::getShopService()->GetActiveCategory();
if (null !== $oActiveCategory) {
$oActiveRootCategory = $oActiveCategory->GetRootCategory();
}
}
return $oActiveRootCategory;
} | [
"public",
"static",
"function",
"GetActiveRootCategory",
"(",
")",
"{",
"static",
"$",
"oActiveRootCategory",
"=",
"'x'",
";",
"if",
"(",
"'x'",
"===",
"$",
"oActiveRootCategory",
")",
"{",
"$",
"oActiveRootCategory",
"=",
"null",
";",
"$",
"oActiveCategory",
"=",
"self",
"::",
"getShopService",
"(",
")",
"->",
"GetActiveCategory",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"oActiveCategory",
")",
"{",
"$",
"oActiveRootCategory",
"=",
"$",
"oActiveCategory",
"->",
"GetRootCategory",
"(",
")",
";",
"}",
"}",
"return",
"$",
"oActiveRootCategory",
";",
"}"
] | return the active root category.
@return TdbShopCategory | [
"return",
"the",
"active",
"root",
"category",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L200-L212 |
32,084 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShop.class.php | TShop.GetActiveFilter | public static function GetActiveFilter()
{
static $aFilter = 'x';
if ('x' === $aFilter) {
$oGlobal = TGlobal::instance();
$aFilter = $oGlobal->GetUserData(MTShopArticleCatalogCore::URL_FILTER);
if (!is_array($aFilter)) {
$aFilter = array();
}
// now reduce filter list to valid filter fields
$aValidFilterFields = TdbShop::GetValidFilterFields();
$aValidFilter = array();
foreach ($aValidFilterFields as $sField) {
if (array_key_exists($sField, $aFilter)) {
$aValidFilter[$sField] = $aFilter[$sField];
}
}
$aFilter = $aValidFilter;
}
return $aFilter;
} | php | public static function GetActiveFilter()
{
static $aFilter = 'x';
if ('x' === $aFilter) {
$oGlobal = TGlobal::instance();
$aFilter = $oGlobal->GetUserData(MTShopArticleCatalogCore::URL_FILTER);
if (!is_array($aFilter)) {
$aFilter = array();
}
// now reduce filter list to valid filter fields
$aValidFilterFields = TdbShop::GetValidFilterFields();
$aValidFilter = array();
foreach ($aValidFilterFields as $sField) {
if (array_key_exists($sField, $aFilter)) {
$aValidFilter[$sField] = $aFilter[$sField];
}
}
$aFilter = $aValidFilter;
}
return $aFilter;
} | [
"public",
"static",
"function",
"GetActiveFilter",
"(",
")",
"{",
"static",
"$",
"aFilter",
"=",
"'x'",
";",
"if",
"(",
"'x'",
"===",
"$",
"aFilter",
")",
"{",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"aFilter",
"=",
"$",
"oGlobal",
"->",
"GetUserData",
"(",
"MTShopArticleCatalogCore",
"::",
"URL_FILTER",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"aFilter",
")",
")",
"{",
"$",
"aFilter",
"=",
"array",
"(",
")",
";",
"}",
"// now reduce filter list to valid filter fields",
"$",
"aValidFilterFields",
"=",
"TdbShop",
"::",
"GetValidFilterFields",
"(",
")",
";",
"$",
"aValidFilter",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"aValidFilterFields",
"as",
"$",
"sField",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"sField",
",",
"$",
"aFilter",
")",
")",
"{",
"$",
"aValidFilter",
"[",
"$",
"sField",
"]",
"=",
"$",
"aFilter",
"[",
"$",
"sField",
"]",
";",
"}",
"}",
"$",
"aFilter",
"=",
"$",
"aValidFilter",
";",
"}",
"return",
"$",
"aFilter",
";",
"}"
] | return current active filter conditions.
@return array | [
"return",
"current",
"active",
"filter",
"conditions",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L219-L240 |
32,085 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShop.class.php | TShop.GetActiveFilterString | public static function GetActiveFilterString($sExcludeKey = '')
{
$aFilter = TdbShop::GetActiveFilter();
$aTmp = array();
foreach ($aFilter as $filterKey => $filterVal) {
if ($filterKey != $sExcludeKey) {
$aTmp[] = TdbShop::GetFilterSQLString($filterKey, $filterVal);
}
}
return implode(' AND ', $aTmp);
} | php | public static function GetActiveFilterString($sExcludeKey = '')
{
$aFilter = TdbShop::GetActiveFilter();
$aTmp = array();
foreach ($aFilter as $filterKey => $filterVal) {
if ($filterKey != $sExcludeKey) {
$aTmp[] = TdbShop::GetFilterSQLString($filterKey, $filterVal);
}
}
return implode(' AND ', $aTmp);
} | [
"public",
"static",
"function",
"GetActiveFilterString",
"(",
"$",
"sExcludeKey",
"=",
"''",
")",
"{",
"$",
"aFilter",
"=",
"TdbShop",
"::",
"GetActiveFilter",
"(",
")",
";",
"$",
"aTmp",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"aFilter",
"as",
"$",
"filterKey",
"=>",
"$",
"filterVal",
")",
"{",
"if",
"(",
"$",
"filterKey",
"!=",
"$",
"sExcludeKey",
")",
"{",
"$",
"aTmp",
"[",
"]",
"=",
"TdbShop",
"::",
"GetFilterSQLString",
"(",
"$",
"filterKey",
",",
"$",
"filterVal",
")",
";",
"}",
"}",
"return",
"implode",
"(",
"' AND '",
",",
"$",
"aTmp",
")",
";",
"}"
] | return an sql string for the current filter.
@return string | [
"return",
"an",
"sql",
"string",
"for",
"the",
"current",
"filter",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L247-L258 |
32,086 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShop.class.php | TShop.GetActiveItemVariant | public static function GetActiveItemVariant($oArticle)
{
$aVariantTypeSelection = TdbShopVariantDisplayHandler::GetActiveVariantTypeSelection(true);
if (is_array($aVariantTypeSelection)) {
$oSet = &$oArticle->GetFieldShopVariantSet();
if (null === $oSet) {
return $oArticle;
}
$oTypes = &$oSet->GetFieldShopVariantTypeList();
if (count($aVariantTypeSelection) == $oTypes->Length()) {
if (!$oArticle->IsVariant()) {
$oVariants = &$oArticle->GetFieldShopArticleVariantsList($aVariantTypeSelection);
} else {
$oParentArticle = $oArticle->GetFieldVariantParent();
$oVariants = &$oParentArticle->GetFieldShopArticleVariantsList($aVariantTypeSelection);
}
if (1 == $oVariants->Length()) {
$oArticle = $oVariants->Current();
}
}
} elseif (!$oArticle->IsVariant()) {
$oVariants = &$oArticle->GetFieldShopArticleVariantsList();
if (1 == $oVariants->Length()) {
$oArticle = $oVariants->Current();
}
}
return $oArticle;
} | php | public static function GetActiveItemVariant($oArticle)
{
$aVariantTypeSelection = TdbShopVariantDisplayHandler::GetActiveVariantTypeSelection(true);
if (is_array($aVariantTypeSelection)) {
$oSet = &$oArticle->GetFieldShopVariantSet();
if (null === $oSet) {
return $oArticle;
}
$oTypes = &$oSet->GetFieldShopVariantTypeList();
if (count($aVariantTypeSelection) == $oTypes->Length()) {
if (!$oArticle->IsVariant()) {
$oVariants = &$oArticle->GetFieldShopArticleVariantsList($aVariantTypeSelection);
} else {
$oParentArticle = $oArticle->GetFieldVariantParent();
$oVariants = &$oParentArticle->GetFieldShopArticleVariantsList($aVariantTypeSelection);
}
if (1 == $oVariants->Length()) {
$oArticle = $oVariants->Current();
}
}
} elseif (!$oArticle->IsVariant()) {
$oVariants = &$oArticle->GetFieldShopArticleVariantsList();
if (1 == $oVariants->Length()) {
$oArticle = $oVariants->Current();
}
}
return $oArticle;
} | [
"public",
"static",
"function",
"GetActiveItemVariant",
"(",
"$",
"oArticle",
")",
"{",
"$",
"aVariantTypeSelection",
"=",
"TdbShopVariantDisplayHandler",
"::",
"GetActiveVariantTypeSelection",
"(",
"true",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"aVariantTypeSelection",
")",
")",
"{",
"$",
"oSet",
"=",
"&",
"$",
"oArticle",
"->",
"GetFieldShopVariantSet",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",
"oSet",
")",
"{",
"return",
"$",
"oArticle",
";",
"}",
"$",
"oTypes",
"=",
"&",
"$",
"oSet",
"->",
"GetFieldShopVariantTypeList",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"aVariantTypeSelection",
")",
"==",
"$",
"oTypes",
"->",
"Length",
"(",
")",
")",
"{",
"if",
"(",
"!",
"$",
"oArticle",
"->",
"IsVariant",
"(",
")",
")",
"{",
"$",
"oVariants",
"=",
"&",
"$",
"oArticle",
"->",
"GetFieldShopArticleVariantsList",
"(",
"$",
"aVariantTypeSelection",
")",
";",
"}",
"else",
"{",
"$",
"oParentArticle",
"=",
"$",
"oArticle",
"->",
"GetFieldVariantParent",
"(",
")",
";",
"$",
"oVariants",
"=",
"&",
"$",
"oParentArticle",
"->",
"GetFieldShopArticleVariantsList",
"(",
"$",
"aVariantTypeSelection",
")",
";",
"}",
"if",
"(",
"1",
"==",
"$",
"oVariants",
"->",
"Length",
"(",
")",
")",
"{",
"$",
"oArticle",
"=",
"$",
"oVariants",
"->",
"Current",
"(",
")",
";",
"}",
"}",
"}",
"elseif",
"(",
"!",
"$",
"oArticle",
"->",
"IsVariant",
"(",
")",
")",
"{",
"$",
"oVariants",
"=",
"&",
"$",
"oArticle",
"->",
"GetFieldShopArticleVariantsList",
"(",
")",
";",
"if",
"(",
"1",
"==",
"$",
"oVariants",
"->",
"Length",
"(",
")",
")",
"{",
"$",
"oArticle",
"=",
"$",
"oVariants",
"->",
"Current",
"(",
")",
";",
"}",
"}",
"return",
"$",
"oArticle",
";",
"}"
] | Returns the active variant for given article.
If no Variant is active return given article.
@param TdbShopArticle $oArticle
@return TdbShopArticle | [
"Returns",
"the",
"active",
"variant",
"for",
"given",
"article",
".",
"If",
"no",
"Variant",
"is",
"active",
"return",
"given",
"article",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L317-L346 |
32,087 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShop.class.php | TShop.GetSystemPageNames | public function GetSystemPageNames()
{
$aSystemPages = array();
$oPortal = self::getPortalDomainService()->getActivePortal();
if ($oPortal) {
$aSystemPages = $oPortal->GetSystemPageNames();
}
return $aSystemPages;
} | php | public function GetSystemPageNames()
{
$aSystemPages = array();
$oPortal = self::getPortalDomainService()->getActivePortal();
if ($oPortal) {
$aSystemPages = $oPortal->GetSystemPageNames();
}
return $aSystemPages;
} | [
"public",
"function",
"GetSystemPageNames",
"(",
")",
"{",
"$",
"aSystemPages",
"=",
"array",
"(",
")",
";",
"$",
"oPortal",
"=",
"self",
"::",
"getPortalDomainService",
"(",
")",
"->",
"getActivePortal",
"(",
")",
";",
"if",
"(",
"$",
"oPortal",
")",
"{",
"$",
"aSystemPages",
"=",
"$",
"oPortal",
"->",
"GetSystemPageNames",
"(",
")",
";",
"}",
"return",
"$",
"aSystemPages",
";",
"}"
] | return list of system page names.
@return array | [
"return",
"list",
"of",
"system",
"page",
"names",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L519-L528 |
32,088 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShop.class.php | TShop.GetSystemPageNodeId | public function GetSystemPageNodeId($sSystemPageName)
{
$systemPage = $this->getSystemPageService()->getSystemPage($sSystemPageName);
if (null === $systemPage) {
return null;
}
return $systemPage->fieldCmsTreeId;
} | php | public function GetSystemPageNodeId($sSystemPageName)
{
$systemPage = $this->getSystemPageService()->getSystemPage($sSystemPageName);
if (null === $systemPage) {
return null;
}
return $systemPage->fieldCmsTreeId;
} | [
"public",
"function",
"GetSystemPageNodeId",
"(",
"$",
"sSystemPageName",
")",
"{",
"$",
"systemPage",
"=",
"$",
"this",
"->",
"getSystemPageService",
"(",
")",
"->",
"getSystemPage",
"(",
"$",
"sSystemPageName",
")",
";",
"if",
"(",
"null",
"===",
"$",
"systemPage",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"systemPage",
"->",
"fieldCmsTreeId",
";",
"}"
] | return the node for the system page with the name sSystemPageName. see GetLinkToSystemPage for details.
@deprecated since 6.1.0 - use system_page_service::getSystemPage()->fieldCmsTreeId instead
@param string $sSystemPageName
@return string|null | [
"return",
"the",
"node",
"for",
"the",
"system",
"page",
"with",
"the",
"name",
"sSystemPageName",
".",
"see",
"GetLinkToSystemPage",
"for",
"details",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L568-L576 |
32,089 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShop.class.php | TShop.GetShopInfo | public function GetShopInfo($sShopInfoName)
{
$oInfo = TdbShopSystemInfo::GetNewInstance();
if (!$oInfo->LoadFromFields(array('shop_id' => $this->id, 'name_internal' => $sShopInfoName))) {
$oInfo = null;
}
return $oInfo;
} | php | public function GetShopInfo($sShopInfoName)
{
$oInfo = TdbShopSystemInfo::GetNewInstance();
if (!$oInfo->LoadFromFields(array('shop_id' => $this->id, 'name_internal' => $sShopInfoName))) {
$oInfo = null;
}
return $oInfo;
} | [
"public",
"function",
"GetShopInfo",
"(",
"$",
"sShopInfoName",
")",
"{",
"$",
"oInfo",
"=",
"TdbShopSystemInfo",
"::",
"GetNewInstance",
"(",
")",
";",
"if",
"(",
"!",
"$",
"oInfo",
"->",
"LoadFromFields",
"(",
"array",
"(",
"'shop_id'",
"=>",
"$",
"this",
"->",
"id",
",",
"'name_internal'",
"=>",
"$",
"sShopInfoName",
")",
")",
")",
"{",
"$",
"oInfo",
"=",
"null",
";",
"}",
"return",
"$",
"oInfo",
";",
"}"
] | return the system info with the given name.
@param string $sShopInfoName - internal name of the info record
@return TdbShopSystemInfo | [
"return",
"the",
"system",
"info",
"with",
"the",
"given",
"name",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L585-L593 |
32,090 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShop.class.php | TShop.RenderShippingInfo | public function RenderShippingInfo($sViewName, $sViewType, $aCallTimeVars = array())
{
$oView = new TViewParser();
$oView->AddVar('oShop', $this);
$oShippingIntroText = $this->GetShopInfo('shipping-intro');
$oShippingEndText = $this->GetShopInfo('shipping-end');
$oView->AddVar('oShippingIntroText', $oShippingIntroText);
$oView->AddVar('oShippingEndText', $oShippingEndText);
// get the shipping list for users not sigend in
$oPublicShippingGroups = &TdbShopShippingGroupList::GetPublicShippingGroups();
$oView->AddVar('oPublicShippingGroups', $oPublicShippingGroups);
$oView->AddVar('aCallTimeVars', $aCallTimeVars);
$aOtherParameters = $this->GetAdditionalViewVariables($sViewName, $sViewType);
$oView->AddVarArray($aOtherParameters);
return $oView->RenderObjectPackageView($sViewName, self::VIEW_PATH, $sViewType);
} | php | public function RenderShippingInfo($sViewName, $sViewType, $aCallTimeVars = array())
{
$oView = new TViewParser();
$oView->AddVar('oShop', $this);
$oShippingIntroText = $this->GetShopInfo('shipping-intro');
$oShippingEndText = $this->GetShopInfo('shipping-end');
$oView->AddVar('oShippingIntroText', $oShippingIntroText);
$oView->AddVar('oShippingEndText', $oShippingEndText);
// get the shipping list for users not sigend in
$oPublicShippingGroups = &TdbShopShippingGroupList::GetPublicShippingGroups();
$oView->AddVar('oPublicShippingGroups', $oPublicShippingGroups);
$oView->AddVar('aCallTimeVars', $aCallTimeVars);
$aOtherParameters = $this->GetAdditionalViewVariables($sViewName, $sViewType);
$oView->AddVarArray($aOtherParameters);
return $oView->RenderObjectPackageView($sViewName, self::VIEW_PATH, $sViewType);
} | [
"public",
"function",
"RenderShippingInfo",
"(",
"$",
"sViewName",
",",
"$",
"sViewType",
",",
"$",
"aCallTimeVars",
"=",
"array",
"(",
")",
")",
"{",
"$",
"oView",
"=",
"new",
"TViewParser",
"(",
")",
";",
"$",
"oView",
"->",
"AddVar",
"(",
"'oShop'",
",",
"$",
"this",
")",
";",
"$",
"oShippingIntroText",
"=",
"$",
"this",
"->",
"GetShopInfo",
"(",
"'shipping-intro'",
")",
";",
"$",
"oShippingEndText",
"=",
"$",
"this",
"->",
"GetShopInfo",
"(",
"'shipping-end'",
")",
";",
"$",
"oView",
"->",
"AddVar",
"(",
"'oShippingIntroText'",
",",
"$",
"oShippingIntroText",
")",
";",
"$",
"oView",
"->",
"AddVar",
"(",
"'oShippingEndText'",
",",
"$",
"oShippingEndText",
")",
";",
"// get the shipping list for users not sigend in",
"$",
"oPublicShippingGroups",
"=",
"&",
"TdbShopShippingGroupList",
"::",
"GetPublicShippingGroups",
"(",
")",
";",
"$",
"oView",
"->",
"AddVar",
"(",
"'oPublicShippingGroups'",
",",
"$",
"oPublicShippingGroups",
")",
";",
"$",
"oView",
"->",
"AddVar",
"(",
"'aCallTimeVars'",
",",
"$",
"aCallTimeVars",
")",
";",
"$",
"aOtherParameters",
"=",
"$",
"this",
"->",
"GetAdditionalViewVariables",
"(",
"$",
"sViewName",
",",
"$",
"sViewType",
")",
";",
"$",
"oView",
"->",
"AddVarArray",
"(",
"$",
"aOtherParameters",
")",
";",
"return",
"$",
"oView",
"->",
"RenderObjectPackageView",
"(",
"$",
"sViewName",
",",
"self",
"::",
"VIEW_PATH",
",",
"$",
"sViewType",
")",
";",
"}"
] | render the shipping infos.
@return string | [
"render",
"the",
"shipping",
"infos",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L602-L620 |
32,091 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShop.class.php | TShop.GetCentralShopHandlerAjaxURL | public function GetCentralShopHandlerAjaxURL($sMethod, $aParameter = array())
{
$oGlobal = TGlobal::instance();
$aParameter[MTShopCentralHandler::URL_CALLING_SPOT_NAME] = $oGlobal->GetExecutingModulePointer()->sModuleSpotName;
$aRealParams = array('module_fnc' => array($this->fieldShopCentralHandlerSpotName => 'ExecuteAjaxCall'), '_fnc' => $sMethod, MTShopCentralHandler::URL_DATA => $aParameter);
$oActivePage = self::getActivePageService()->getActivePage();
return $oActivePage->GetRealURLPlain($aRealParams);
} | php | public function GetCentralShopHandlerAjaxURL($sMethod, $aParameter = array())
{
$oGlobal = TGlobal::instance();
$aParameter[MTShopCentralHandler::URL_CALLING_SPOT_NAME] = $oGlobal->GetExecutingModulePointer()->sModuleSpotName;
$aRealParams = array('module_fnc' => array($this->fieldShopCentralHandlerSpotName => 'ExecuteAjaxCall'), '_fnc' => $sMethod, MTShopCentralHandler::URL_DATA => $aParameter);
$oActivePage = self::getActivePageService()->getActivePage();
return $oActivePage->GetRealURLPlain($aRealParams);
} | [
"public",
"function",
"GetCentralShopHandlerAjaxURL",
"(",
"$",
"sMethod",
",",
"$",
"aParameter",
"=",
"array",
"(",
")",
")",
"{",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"aParameter",
"[",
"MTShopCentralHandler",
"::",
"URL_CALLING_SPOT_NAME",
"]",
"=",
"$",
"oGlobal",
"->",
"GetExecutingModulePointer",
"(",
")",
"->",
"sModuleSpotName",
";",
"$",
"aRealParams",
"=",
"array",
"(",
"'module_fnc'",
"=>",
"array",
"(",
"$",
"this",
"->",
"fieldShopCentralHandlerSpotName",
"=>",
"'ExecuteAjaxCall'",
")",
",",
"'_fnc'",
"=>",
"$",
"sMethod",
",",
"MTShopCentralHandler",
"::",
"URL_DATA",
"=>",
"$",
"aParameter",
")",
";",
"$",
"oActivePage",
"=",
"self",
"::",
"getActivePageService",
"(",
")",
"->",
"getActivePage",
"(",
")",
";",
"return",
"$",
"oActivePage",
"->",
"GetRealURLPlain",
"(",
"$",
"aRealParams",
")",
";",
"}"
] | return ajax url to a function in the central shop handler.
@param string $sMethod
@param array $aParameter
@return string | [
"return",
"ajax",
"url",
"to",
"a",
"function",
"in",
"the",
"central",
"shop",
"handler",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L643-L652 |
32,092 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShop.class.php | TShop.RegisterActiveVariantForSpot | public static function RegisterActiveVariantForSpot($sSpotName, $sParentId, $sShopVariantArticleId)
{
if (!array_key_exists(TdbShop::SESSION_ACTIVE_VARIANT_ARRAY, $_SESSION)) {
$_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY] = array();
}
if (!array_key_exists($sSpotName, $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY])) {
$_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY][$sSpotName] = array();
}
$_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY][$sSpotName][$sParentId] = $sShopVariantArticleId;
} | php | public static function RegisterActiveVariantForSpot($sSpotName, $sParentId, $sShopVariantArticleId)
{
if (!array_key_exists(TdbShop::SESSION_ACTIVE_VARIANT_ARRAY, $_SESSION)) {
$_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY] = array();
}
if (!array_key_exists($sSpotName, $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY])) {
$_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY][$sSpotName] = array();
}
$_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY][$sSpotName][$sParentId] = $sShopVariantArticleId;
} | [
"public",
"static",
"function",
"RegisterActiveVariantForSpot",
"(",
"$",
"sSpotName",
",",
"$",
"sParentId",
",",
"$",
"sShopVariantArticleId",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"TdbShop",
"::",
"SESSION_ACTIVE_VARIANT_ARRAY",
",",
"$",
"_SESSION",
")",
")",
"{",
"$",
"_SESSION",
"[",
"TdbShop",
"::",
"SESSION_ACTIVE_VARIANT_ARRAY",
"]",
"=",
"array",
"(",
")",
";",
"}",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"sSpotName",
",",
"$",
"_SESSION",
"[",
"TdbShop",
"::",
"SESSION_ACTIVE_VARIANT_ARRAY",
"]",
")",
")",
"{",
"$",
"_SESSION",
"[",
"TdbShop",
"::",
"SESSION_ACTIVE_VARIANT_ARRAY",
"]",
"[",
"$",
"sSpotName",
"]",
"=",
"array",
"(",
")",
";",
"}",
"$",
"_SESSION",
"[",
"TdbShop",
"::",
"SESSION_ACTIVE_VARIANT_ARRAY",
"]",
"[",
"$",
"sSpotName",
"]",
"[",
"$",
"sParentId",
"]",
"=",
"$",
"sShopVariantArticleId",
";",
"}"
] | register the active variant for an article with a spot - this allow us to later refresh all
data for that spot without loosing the currentl selected variant info.
@param string $sSpotName
@param string $sParentId
@param string $sShopVariantArticleId | [
"register",
"the",
"active",
"variant",
"for",
"an",
"article",
"with",
"a",
"spot",
"-",
"this",
"allow",
"us",
"to",
"later",
"refresh",
"all",
"data",
"for",
"that",
"spot",
"without",
"loosing",
"the",
"currentl",
"selected",
"variant",
"info",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L679-L688 |
32,093 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShop.class.php | TShop.GetRegisteredActiveVariantForCurrentSpot | public static function GetRegisteredActiveVariantForCurrentSpot($sParentId)
{
$sShopVariantArticleId = false;
if (array_key_exists(TdbShop::SESSION_ACTIVE_VARIANT_ARRAY, $_SESSION)) {
$oGlobal = TGlobal::instance();
$oExecutingModuleSpot = $oGlobal->GetExecutingModulePointer();
if ($oExecutingModuleSpot) {
$sSpotName = $oExecutingModuleSpot->sModuleSpotName;
if (array_key_exists($sSpotName, $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY]) && array_key_exists($sParentId, $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY][$sSpotName])) {
$sShopVariantArticleId = $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY][$sSpotName][$sParentId];
}
}
}
return $sShopVariantArticleId;
} | php | public static function GetRegisteredActiveVariantForCurrentSpot($sParentId)
{
$sShopVariantArticleId = false;
if (array_key_exists(TdbShop::SESSION_ACTIVE_VARIANT_ARRAY, $_SESSION)) {
$oGlobal = TGlobal::instance();
$oExecutingModuleSpot = $oGlobal->GetExecutingModulePointer();
if ($oExecutingModuleSpot) {
$sSpotName = $oExecutingModuleSpot->sModuleSpotName;
if (array_key_exists($sSpotName, $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY]) && array_key_exists($sParentId, $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY][$sSpotName])) {
$sShopVariantArticleId = $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY][$sSpotName][$sParentId];
}
}
}
return $sShopVariantArticleId;
} | [
"public",
"static",
"function",
"GetRegisteredActiveVariantForCurrentSpot",
"(",
"$",
"sParentId",
")",
"{",
"$",
"sShopVariantArticleId",
"=",
"false",
";",
"if",
"(",
"array_key_exists",
"(",
"TdbShop",
"::",
"SESSION_ACTIVE_VARIANT_ARRAY",
",",
"$",
"_SESSION",
")",
")",
"{",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"oExecutingModuleSpot",
"=",
"$",
"oGlobal",
"->",
"GetExecutingModulePointer",
"(",
")",
";",
"if",
"(",
"$",
"oExecutingModuleSpot",
")",
"{",
"$",
"sSpotName",
"=",
"$",
"oExecutingModuleSpot",
"->",
"sModuleSpotName",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"sSpotName",
",",
"$",
"_SESSION",
"[",
"TdbShop",
"::",
"SESSION_ACTIVE_VARIANT_ARRAY",
"]",
")",
"&&",
"array_key_exists",
"(",
"$",
"sParentId",
",",
"$",
"_SESSION",
"[",
"TdbShop",
"::",
"SESSION_ACTIVE_VARIANT_ARRAY",
"]",
"[",
"$",
"sSpotName",
"]",
")",
")",
"{",
"$",
"sShopVariantArticleId",
"=",
"$",
"_SESSION",
"[",
"TdbShop",
"::",
"SESSION_ACTIVE_VARIANT_ARRAY",
"]",
"[",
"$",
"sSpotName",
"]",
"[",
"$",
"sParentId",
"]",
";",
"}",
"}",
"}",
"return",
"$",
"sShopVariantArticleId",
";",
"}"
] | return the active variant for a parent article and a given spot. returns false if no
variant has been selected for that parent in the spot yet.
@param string $sParentId
@return string | [
"return",
"the",
"active",
"variant",
"for",
"a",
"parent",
"article",
"and",
"a",
"given",
"spot",
".",
"returns",
"false",
"if",
"no",
"variant",
"has",
"been",
"selected",
"for",
"that",
"parent",
"in",
"the",
"spot",
"yet",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L698-L713 |
32,094 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShop.class.php | TShop.GetURLPageStateParameters | public static function GetURLPageStateParameters()
{
// ------------------------------------------------------------------------
$oURLData = &TCMSSmartURLData::GetActive();
$aSeoParam = $oURLData->getSeoURLParameters();
$aSeoParam[] = MTShopBasketCoreEndpoint::URL_REQUEST_PARAMETER;
$aSeoParam[] = 'module_fnc';
$aSeoParam[] = 'pagedef';
return array_keys(TGlobal::instance()->GetRawUserData(null, $aSeoParam));
} | php | public static function GetURLPageStateParameters()
{
// ------------------------------------------------------------------------
$oURLData = &TCMSSmartURLData::GetActive();
$aSeoParam = $oURLData->getSeoURLParameters();
$aSeoParam[] = MTShopBasketCoreEndpoint::URL_REQUEST_PARAMETER;
$aSeoParam[] = 'module_fnc';
$aSeoParam[] = 'pagedef';
return array_keys(TGlobal::instance()->GetRawUserData(null, $aSeoParam));
} | [
"public",
"static",
"function",
"GetURLPageStateParameters",
"(",
")",
"{",
"// ------------------------------------------------------------------------",
"$",
"oURLData",
"=",
"&",
"TCMSSmartURLData",
"::",
"GetActive",
"(",
")",
";",
"$",
"aSeoParam",
"=",
"$",
"oURLData",
"->",
"getSeoURLParameters",
"(",
")",
";",
"$",
"aSeoParam",
"[",
"]",
"=",
"MTShopBasketCoreEndpoint",
"::",
"URL_REQUEST_PARAMETER",
";",
"$",
"aSeoParam",
"[",
"]",
"=",
"'module_fnc'",
";",
"$",
"aSeoParam",
"[",
"]",
"=",
"'pagedef'",
";",
"return",
"array_keys",
"(",
"TGlobal",
"::",
"instance",
"(",
")",
"->",
"GetRawUserData",
"(",
"null",
",",
"$",
"aSeoParam",
")",
")",
";",
"}"
] | return an array of all parameters that define a state of a page and therefore must be
included in links that want to call an action on a page.
@return array | [
"return",
"an",
"array",
"of",
"all",
"parameters",
"that",
"define",
"a",
"state",
"of",
"a",
"page",
"and",
"therefore",
"must",
"be",
"included",
"in",
"links",
"that",
"want",
"to",
"call",
"an",
"action",
"on",
"a",
"page",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L731-L741 |
32,095 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShop.class.php | TShop.CacheGetKey | protected static function CacheGetKey($iPortalId = null)
{
if (is_null($iPortalId)) {
$portal = self::getPortalDomainService()->getActivePortal();
if (null !== $portal) {
$iPortalId = $portal->id;
}
}
$aKey = array('class' => 'TdbShop', 'ident' => 'objectInstance', 'portalid' => $iPortalId);
return TCacheManager::GetKey($aKey);
} | php | protected static function CacheGetKey($iPortalId = null)
{
if (is_null($iPortalId)) {
$portal = self::getPortalDomainService()->getActivePortal();
if (null !== $portal) {
$iPortalId = $portal->id;
}
}
$aKey = array('class' => 'TdbShop', 'ident' => 'objectInstance', 'portalid' => $iPortalId);
return TCacheManager::GetKey($aKey);
} | [
"protected",
"static",
"function",
"CacheGetKey",
"(",
"$",
"iPortalId",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"iPortalId",
")",
")",
"{",
"$",
"portal",
"=",
"self",
"::",
"getPortalDomainService",
"(",
")",
"->",
"getActivePortal",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"portal",
")",
"{",
"$",
"iPortalId",
"=",
"$",
"portal",
"->",
"id",
";",
"}",
"}",
"$",
"aKey",
"=",
"array",
"(",
"'class'",
"=>",
"'TdbShop'",
",",
"'ident'",
"=>",
"'objectInstance'",
",",
"'portalid'",
"=>",
"$",
"iPortalId",
")",
";",
"return",
"TCacheManager",
"::",
"GetKey",
"(",
"$",
"aKey",
")",
";",
"}"
] | get the cache key used to id the object in cache.
@param string|int|null $iPortalId
@return string | [
"get",
"the",
"cache",
"key",
"used",
"to",
"id",
"the",
"object",
"in",
"cache",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L768-L779 |
32,096 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneBase.class.php | TShopPaymentHandlerOgoneBase.GetPaymentURL | protected function GetPaymentURL()
{
if (IPkgShopOrderPaymentConfig::ENVIRONMENT_PRODUCTION === $this->getEnvironment()) {
$sPaymentURL = $this->GetConfigParameter('sOgonePaymentURLLive');
} else {
$sPaymentURL = $this->GetConfigParameter('sOgonePaymentURLTest');
}
return $sPaymentURL;
} | php | protected function GetPaymentURL()
{
if (IPkgShopOrderPaymentConfig::ENVIRONMENT_PRODUCTION === $this->getEnvironment()) {
$sPaymentURL = $this->GetConfigParameter('sOgonePaymentURLLive');
} else {
$sPaymentURL = $this->GetConfigParameter('sOgonePaymentURLTest');
}
return $sPaymentURL;
} | [
"protected",
"function",
"GetPaymentURL",
"(",
")",
"{",
"if",
"(",
"IPkgShopOrderPaymentConfig",
"::",
"ENVIRONMENT_PRODUCTION",
"===",
"$",
"this",
"->",
"getEnvironment",
"(",
")",
")",
"{",
"$",
"sPaymentURL",
"=",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'sOgonePaymentURLLive'",
")",
";",
"}",
"else",
"{",
"$",
"sPaymentURL",
"=",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'sOgonePaymentURLTest'",
")",
";",
"}",
"return",
"$",
"sPaymentURL",
";",
"}"
] | Get the payment service URL to redirect or send post request.
@return string | [
"Get",
"the",
"payment",
"service",
"URL",
"to",
"redirect",
"or",
"send",
"post",
"request",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneBase.class.php#L59-L68 |
32,097 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneBase.class.php | TShopPaymentHandlerOgoneBase.CheckIncomingHash | protected function CheckIncomingHash($aURLParameter)
{
$bIsValid = false;
$oGlobal = TGlobal::instance();
$sSharedSecret = $this->GetConfigParameter('sSharedSecretIn');
$sIncomingHash = $oGlobal->GetUserData('SHASIGN');
$aHashParameter = $this->GetIncomingPaymentParameter();
$sHash = '';
$aURLParameter = array_change_key_case($aURLParameter, CASE_UPPER);
if ('' != $sIncomingHash) {
foreach ($aHashParameter as $sHashParameter) {
if (array_key_exists($sHashParameter, $aURLParameter) && '' != $aURLParameter[$sHashParameter]) {
$sHash .= $sHashParameter.'='.$aURLParameter[$sHashParameter].$sSharedSecret;
}
}
$sHash = strtoupper(hash('sha256', $sHash));
if ($sHash == $sIncomingHash) {
$bIsValid = true;
}
} else {
$bIsValid = true;
}
return $bIsValid;
} | php | protected function CheckIncomingHash($aURLParameter)
{
$bIsValid = false;
$oGlobal = TGlobal::instance();
$sSharedSecret = $this->GetConfigParameter('sSharedSecretIn');
$sIncomingHash = $oGlobal->GetUserData('SHASIGN');
$aHashParameter = $this->GetIncomingPaymentParameter();
$sHash = '';
$aURLParameter = array_change_key_case($aURLParameter, CASE_UPPER);
if ('' != $sIncomingHash) {
foreach ($aHashParameter as $sHashParameter) {
if (array_key_exists($sHashParameter, $aURLParameter) && '' != $aURLParameter[$sHashParameter]) {
$sHash .= $sHashParameter.'='.$aURLParameter[$sHashParameter].$sSharedSecret;
}
}
$sHash = strtoupper(hash('sha256', $sHash));
if ($sHash == $sIncomingHash) {
$bIsValid = true;
}
} else {
$bIsValid = true;
}
return $bIsValid;
} | [
"protected",
"function",
"CheckIncomingHash",
"(",
"$",
"aURLParameter",
")",
"{",
"$",
"bIsValid",
"=",
"false",
";",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"sSharedSecret",
"=",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'sSharedSecretIn'",
")",
";",
"$",
"sIncomingHash",
"=",
"$",
"oGlobal",
"->",
"GetUserData",
"(",
"'SHASIGN'",
")",
";",
"$",
"aHashParameter",
"=",
"$",
"this",
"->",
"GetIncomingPaymentParameter",
"(",
")",
";",
"$",
"sHash",
"=",
"''",
";",
"$",
"aURLParameter",
"=",
"array_change_key_case",
"(",
"$",
"aURLParameter",
",",
"CASE_UPPER",
")",
";",
"if",
"(",
"''",
"!=",
"$",
"sIncomingHash",
")",
"{",
"foreach",
"(",
"$",
"aHashParameter",
"as",
"$",
"sHashParameter",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"sHashParameter",
",",
"$",
"aURLParameter",
")",
"&&",
"''",
"!=",
"$",
"aURLParameter",
"[",
"$",
"sHashParameter",
"]",
")",
"{",
"$",
"sHash",
".=",
"$",
"sHashParameter",
".",
"'='",
".",
"$",
"aURLParameter",
"[",
"$",
"sHashParameter",
"]",
".",
"$",
"sSharedSecret",
";",
"}",
"}",
"$",
"sHash",
"=",
"strtoupper",
"(",
"hash",
"(",
"'sha256'",
",",
"$",
"sHash",
")",
")",
";",
"if",
"(",
"$",
"sHash",
"==",
"$",
"sIncomingHash",
")",
"{",
"$",
"bIsValid",
"=",
"true",
";",
"}",
"}",
"else",
"{",
"$",
"bIsValid",
"=",
"true",
";",
"}",
"return",
"$",
"bIsValid",
";",
"}"
] | Generate hash with transfer parameter and saved shared secret and compare it with transfer hash.
HEADS UP! the OUT key in the shop config has to match the IN Key in the Ogone backend
and vice versa
@param string $aURLParameter
@return bool | [
"Generate",
"hash",
"with",
"transfer",
"parameter",
"and",
"saved",
"shared",
"secret",
"and",
"compare",
"it",
"with",
"transfer",
"hash",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneBase.class.php#L107-L131 |
32,098 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneBase.class.php | TShopPaymentHandlerOgoneBase.HandleNotifyMessageForPaymentState | protected function HandleNotifyMessageForPaymentState($sPaymentState, $aParameter, $oOrder)
{
if (!$oOrder->fieldOrderIsPaid) {
if ('9' === $sPaymentState) {
$oOrder->SetStatusPaid(true);
$oOrder->SetStatusCanceled(false);
$this->HandleNotifyOrderOnChange($oOrder, true, true, true);
TTools::WriteLogEntry('OGONE: handle notify message order ('.$aParameter['ORDERID'].') was activated and paid by notify (Status 9 paid)', 1, __FILE__, __LINE__);
} elseif ('5' === $sPaymentState) {
if ($oOrder->fieldCanceled || !$oOrder->fieldSystemOrderSaveCompleted) {
$oOrder->SetStatusCanceled(false);
$oOrder->SetStatusPaid(false);
TTools::WriteLogEntry('OGONE: handle notify message order ('.$aParameter['ORDERID'].') was activated by notify and set to not paid (Status 5 reservation)', 1, __FILE__, __LINE__);
$this->HandleNotifyOrderOnChange($oOrder, false, !$oOrder->fieldSystemOrderSaveCompleted, true);
}
} else {
if ('6' === $sPaymentState || '1' === $sPaymentState || '2' === $sPaymentState || '0' === $sPaymentState) {
$oOrder->SetStatusCanceled(true);
$oOrder->SetStatusPaid(false);
$this->HandleNotifyOrderOnChange($oOrder, false, false, true);
TTools::WriteLogEntry('OGONE: handle notify message order ('.$aParameter['ORDERID'].') was canceled and set to not paid by notify (Status 0,1,2,6)', 1, __FILE__, __LINE__);
}
}
} else {
TTools::WriteLogEntry('OGONE: handle notify message order ('.$aParameter['ORDERID'].') was already paid nothing to do)', 1, __FILE__, __LINE__);
}
} | php | protected function HandleNotifyMessageForPaymentState($sPaymentState, $aParameter, $oOrder)
{
if (!$oOrder->fieldOrderIsPaid) {
if ('9' === $sPaymentState) {
$oOrder->SetStatusPaid(true);
$oOrder->SetStatusCanceled(false);
$this->HandleNotifyOrderOnChange($oOrder, true, true, true);
TTools::WriteLogEntry('OGONE: handle notify message order ('.$aParameter['ORDERID'].') was activated and paid by notify (Status 9 paid)', 1, __FILE__, __LINE__);
} elseif ('5' === $sPaymentState) {
if ($oOrder->fieldCanceled || !$oOrder->fieldSystemOrderSaveCompleted) {
$oOrder->SetStatusCanceled(false);
$oOrder->SetStatusPaid(false);
TTools::WriteLogEntry('OGONE: handle notify message order ('.$aParameter['ORDERID'].') was activated by notify and set to not paid (Status 5 reservation)', 1, __FILE__, __LINE__);
$this->HandleNotifyOrderOnChange($oOrder, false, !$oOrder->fieldSystemOrderSaveCompleted, true);
}
} else {
if ('6' === $sPaymentState || '1' === $sPaymentState || '2' === $sPaymentState || '0' === $sPaymentState) {
$oOrder->SetStatusCanceled(true);
$oOrder->SetStatusPaid(false);
$this->HandleNotifyOrderOnChange($oOrder, false, false, true);
TTools::WriteLogEntry('OGONE: handle notify message order ('.$aParameter['ORDERID'].') was canceled and set to not paid by notify (Status 0,1,2,6)', 1, __FILE__, __LINE__);
}
}
} else {
TTools::WriteLogEntry('OGONE: handle notify message order ('.$aParameter['ORDERID'].') was already paid nothing to do)', 1, __FILE__, __LINE__);
}
} | [
"protected",
"function",
"HandleNotifyMessageForPaymentState",
"(",
"$",
"sPaymentState",
",",
"$",
"aParameter",
",",
"$",
"oOrder",
")",
"{",
"if",
"(",
"!",
"$",
"oOrder",
"->",
"fieldOrderIsPaid",
")",
"{",
"if",
"(",
"'9'",
"===",
"$",
"sPaymentState",
")",
"{",
"$",
"oOrder",
"->",
"SetStatusPaid",
"(",
"true",
")",
";",
"$",
"oOrder",
"->",
"SetStatusCanceled",
"(",
"false",
")",
";",
"$",
"this",
"->",
"HandleNotifyOrderOnChange",
"(",
"$",
"oOrder",
",",
"true",
",",
"true",
",",
"true",
")",
";",
"TTools",
"::",
"WriteLogEntry",
"(",
"'OGONE: handle notify message order ('",
".",
"$",
"aParameter",
"[",
"'ORDERID'",
"]",
".",
"') was activated and paid by notify (Status 9 paid)'",
",",
"1",
",",
"__FILE__",
",",
"__LINE__",
")",
";",
"}",
"elseif",
"(",
"'5'",
"===",
"$",
"sPaymentState",
")",
"{",
"if",
"(",
"$",
"oOrder",
"->",
"fieldCanceled",
"||",
"!",
"$",
"oOrder",
"->",
"fieldSystemOrderSaveCompleted",
")",
"{",
"$",
"oOrder",
"->",
"SetStatusCanceled",
"(",
"false",
")",
";",
"$",
"oOrder",
"->",
"SetStatusPaid",
"(",
"false",
")",
";",
"TTools",
"::",
"WriteLogEntry",
"(",
"'OGONE: handle notify message order ('",
".",
"$",
"aParameter",
"[",
"'ORDERID'",
"]",
".",
"') was activated by notify and set to not paid (Status 5 reservation)'",
",",
"1",
",",
"__FILE__",
",",
"__LINE__",
")",
";",
"$",
"this",
"->",
"HandleNotifyOrderOnChange",
"(",
"$",
"oOrder",
",",
"false",
",",
"!",
"$",
"oOrder",
"->",
"fieldSystemOrderSaveCompleted",
",",
"true",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"'6'",
"===",
"$",
"sPaymentState",
"||",
"'1'",
"===",
"$",
"sPaymentState",
"||",
"'2'",
"===",
"$",
"sPaymentState",
"||",
"'0'",
"===",
"$",
"sPaymentState",
")",
"{",
"$",
"oOrder",
"->",
"SetStatusCanceled",
"(",
"true",
")",
";",
"$",
"oOrder",
"->",
"SetStatusPaid",
"(",
"false",
")",
";",
"$",
"this",
"->",
"HandleNotifyOrderOnChange",
"(",
"$",
"oOrder",
",",
"false",
",",
"false",
",",
"true",
")",
";",
"TTools",
"::",
"WriteLogEntry",
"(",
"'OGONE: handle notify message order ('",
".",
"$",
"aParameter",
"[",
"'ORDERID'",
"]",
".",
"') was canceled and set to not paid by notify (Status 0,1,2,6)'",
",",
"1",
",",
"__FILE__",
",",
"__LINE__",
")",
";",
"}",
"}",
"}",
"else",
"{",
"TTools",
"::",
"WriteLogEntry",
"(",
"'OGONE: handle notify message order ('",
".",
"$",
"aParameter",
"[",
"'ORDERID'",
"]",
".",
"') was already paid nothing to do)'",
",",
"1",
",",
"__FILE__",
",",
"__LINE__",
")",
";",
"}",
"}"
] | Handles Ogone notify and update order state depending on notify state.
@param string $sPaymentState state of the notified transaction
@param array $aParameter
@param TdbShopOrder $oOrder | [
"Handles",
"Ogone",
"notify",
"and",
"update",
"order",
"state",
"depending",
"on",
"notify",
"state",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneBase.class.php#L178-L204 |
32,099 | CHH/sirel | lib/Sirel/Visitor/AbstractVisitor.php | AbstractVisitor.visit | function visit($node)
{
$method = "visit";
if (is_object($node)) {
$method .= join('', explode("\\", get_class($node)));
} else {
$method .= ucfirst(gettype($node));
}
if (!is_callable(array($this, $method))) {
throw new UnexpectedValueException(sprintf(
"No Visitor Method for Node of Type %s available",
is_object($node) ? get_class($node) : gettype($node)
));
}
return $this->$method($node);
} | php | function visit($node)
{
$method = "visit";
if (is_object($node)) {
$method .= join('', explode("\\", get_class($node)));
} else {
$method .= ucfirst(gettype($node));
}
if (!is_callable(array($this, $method))) {
throw new UnexpectedValueException(sprintf(
"No Visitor Method for Node of Type %s available",
is_object($node) ? get_class($node) : gettype($node)
));
}
return $this->$method($node);
} | [
"function",
"visit",
"(",
"$",
"node",
")",
"{",
"$",
"method",
"=",
"\"visit\"",
";",
"if",
"(",
"is_object",
"(",
"$",
"node",
")",
")",
"{",
"$",
"method",
".=",
"join",
"(",
"''",
",",
"explode",
"(",
"\"\\\\\"",
",",
"get_class",
"(",
"$",
"node",
")",
")",
")",
";",
"}",
"else",
"{",
"$",
"method",
".=",
"ucfirst",
"(",
"gettype",
"(",
"$",
"node",
")",
")",
";",
"}",
"if",
"(",
"!",
"is_callable",
"(",
"array",
"(",
"$",
"this",
",",
"$",
"method",
")",
")",
")",
"{",
"throw",
"new",
"UnexpectedValueException",
"(",
"sprintf",
"(",
"\"No Visitor Method for Node of Type %s available\"",
",",
"is_object",
"(",
"$",
"node",
")",
"?",
"get_class",
"(",
"$",
"node",
")",
":",
"gettype",
"(",
"$",
"node",
")",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"$",
"method",
"(",
"$",
"node",
")",
";",
"}"
] | Inspects the Type of the Node and calls the appropiate
type-specific Visitor if possible.
For example:
- If the Node is of Class "Sirel\\Node\\Equal", then the
concrete visitor method "visitSirelNodeEqual" gets called
- If the Node is of Type Integer, then the visitor method
"visitInt" gets called (the return value of `gettype()`, with the
first char uppercased)
The visitor method always receives the node, unchanged, as first argument.
You may enforce more strict typing in the more specific visitor methods.
@throws UnexpectedValueException If no visitor for the Class/Type is found
@param mixed $node The Node, can be everything
@return mixed The return value of the concrete visitor | [
"Inspects",
"the",
"Type",
"of",
"the",
"Node",
"and",
"calls",
"the",
"appropiate",
"type",
"-",
"specific",
"Visitor",
"if",
"possible",
"."
] | 7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8 | https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Visitor/AbstractVisitor.php#L48-L66 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.