Changeset View
Changeset View
Standalone View
Standalone View
core/units/category_items/category_items_event_handler.php
Show All 22 Lines | |||||
* @return void | * @return void | ||||
* @access protected | * @access protected | ||||
* @see kDBEventHandler::OnListBuild() | * @see kDBEventHandler::OnListBuild() | ||||
*/ | */ | ||||
protected function SetCustomQuery(kEvent $event) | protected function SetCustomQuery(kEvent $event) | ||||
{ | { | ||||
parent::SetCustomQuery($event); | parent::SetCustomQuery($event); | ||||
/** @var kDBList $object */ | |||||
$object = $event->getObject(); | $object = $event->getObject(); | ||||
/* @var $object kDBList */ | |||||
/** @var kMultiLanguage $ml_formatter */ | |||||
$ml_formatter = $this->Application->recallObject('kMultiLanguage'); | $ml_formatter = $this->Application->recallObject('kMultiLanguage'); | ||||
/* @var $ml_formatter kMultiLanguage */ | |||||
$object->addCalculatedField('CategoryName', 'c.' . $ml_formatter->LangFieldName('CachedNavbar')); | $object->addCalculatedField('CategoryName', 'c.' . $ml_formatter->LangFieldName('CachedNavbar')); | ||||
} | } | ||||
/** | /** | ||||
* Set's new category as primary for product | * Set's new category as primary for product | ||||
* | * | ||||
* @param kEvent $event | * @param kEvent $event | ||||
*/ | */ | ||||
function OnSetPrimary($event) | function OnSetPrimary($event) | ||||
{ | { | ||||
/** @var kDBItem $object */ | |||||
$object = $event->getObject(Array ('skip_autoload' => true)); | $object = $event->getObject(Array ('skip_autoload' => true)); | ||||
Lint: Generic.PHP.LowerCaseKeyword.Found: PHP keywords must be lowercase; expected "array" but found "Array" | |||||
There must be no space between the Array keyword and the opening parenthesis Lint: CodingStandard.Array.Array.SpaceAfterKeyword: There must be no space between the Array keyword and the opening parenthesis | |||||
/* @var $object kDBItem */ | |||||
$ids = $this->StoreSelectedIDs($event); | $ids = $this->StoreSelectedIDs($event); | ||||
if ( $ids ) { | if ( $ids ) { | ||||
$id = array_shift($ids); | $id = array_shift($ids); | ||||
$table_info = $object->getLinkedInfo(); | $table_info = $object->getLinkedInfo(); | ||||
$this->Conn->Query('UPDATE ' . $object->TableName . ' SET PrimaryCat = 0 WHERE ' . $table_info['ForeignKey'] . ' = ' . $table_info['ParentId']); | $this->Conn->Query('UPDATE ' . $object->TableName . ' SET PrimaryCat = 0 WHERE ' . $table_info['ForeignKey'] . ' = ' . $table_info['ParentId']); | ||||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Line(s) | |||||
{ | { | ||||
$category_ids = $event->getEventParam('category_ids'); | $category_ids = $event->getEventParam('category_ids'); | ||||
if ( !$category_ids ) { | if ( !$category_ids ) { | ||||
return ; | return ; | ||||
} | } | ||||
$item_prefix = $event->getEventParam('item_prefix'); | $item_prefix = $event->getEventParam('item_prefix'); | ||||
/** @var kCatDBItem $item */ | |||||
$item = $this->Application->recallObject($item_prefix . '.-item', null, Array ('skip_autoload' => true)); | $item = $this->Application->recallObject($item_prefix . '.-item', null, Array ('skip_autoload' => true)); | ||||
There must be no space between the Array keyword and the opening parenthesis Lint: CodingStandard.Array.Array.SpaceAfterKeyword: There must be no space between the Array keyword and the opening parenthesis | |||||
PHP keywords must be lowercase; expected "array" but found "Array" Lint: Generic.PHP.LowerCaseKeyword.Found: PHP keywords must be lowercase; expected "array" but found "Array" | |||||
/* @var $item kCatDBItem */ | |||||
$ci_table = $this->Application->getUnitOption($event->Prefix, 'TableName'); | $ci_table = $this->Application->getUnitOption($event->Prefix, 'TableName'); | ||||
$item_table = $this->Application->getUnitOption($item_prefix, 'TableName'); | $item_table = $this->Application->getUnitOption($item_prefix, 'TableName'); | ||||
$sql = 'SELECT ItemResourceId, CategoryId | $sql = 'SELECT ItemResourceId, CategoryId | ||||
FROM %1$s | FROM %1$s | ||||
INNER JOIN %2$s ON (%1$s.ResourceId = %2$s.ItemResourceId) | INNER JOIN %2$s ON (%1$s.ResourceId = %2$s.ItemResourceId) | ||||
WHERE CategoryId IN (%3$s)'; | WHERE CategoryId IN (%3$s)'; | ||||
Show All 19 Lines | |||||
* @see CategoryItems_DBItem::GetKeyClause() | * @see CategoryItems_DBItem::GetKeyClause() | ||||
*/ | */ | ||||
protected function OnAfterCopyToLive(kEvent $event) | protected function OnAfterCopyToLive(kEvent $event) | ||||
{ | { | ||||
// don't call parent, because it's unclear how from here we can get parent item's ID here | // don't call parent, because it's unclear how from here we can get parent item's ID here | ||||
} | } | ||||
} | } | ||||
No newline at end of file | No newline at end of file |
PHP keywords must be lowercase; expected "array" but found "Array"