Changeset View
Changeset View
Standalone View
Standalone View
core/kernel/db/cat_event_handler.php
Show First 20 Lines • Show All 195 Lines • ▼ Show 20 Line(s) | |||||
$perm_helper = $this->Application->recallObject('PermissionsHelper'); | $perm_helper = $this->Application->recallObject('PermissionsHelper'); | ||||
// when saving data from temp table to live table check by data from temp table | // when saving data from temp table to live table check by data from temp table | ||||
$item_ids = $this->_getPermissionCheckIDs($event); | $item_ids = $this->_getPermissionCheckIDs($event); | ||||
$items = $perm_helper->GetCategoryItemData($event->Prefix, $item_ids, $event->Name == 'OnSave'); | $items = $perm_helper->GetCategoryItemData($event->Prefix, $item_ids, $event->Name == 'OnSave'); | ||||
if (!$items) { | if (!$items) { | ||||
// when item not present in temp table, then permission is not checked, because there are no data in db to check | // when item not present in temp table, then permission is not checked, because there are no data in db to check | ||||
$items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); | $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); | ||||
Lint: PSR2.Methods.FunctionCallSignature.SpaceAfterOpenBracket: Space after opening parenthesis of function call prohibited | |||||
Expected 0 spaces before closing bracket; 1 found Lint: PSR2.Methods.FunctionCallSignature.SpaceBeforeCloseBracket: Expected 0 spaces before closing bracket; 1 found | |||||
list ($id, $fields_hash) = each($items_info); | $id = key($items_info); | ||||
$fields_hash = $items_info[$id]; | |||||
if (array_key_exists('CategoryId', $fields_hash)) { | if (array_key_exists('CategoryId', $fields_hash)) { | ||||
$item_category = $fields_hash['CategoryId']; | $item_category = $fields_hash['CategoryId']; | ||||
} | } | ||||
else { | else { | ||||
$item_category = $this->Application->GetVar('m_cat_id'); | $item_category = $this->Application->GetVar('m_cat_id'); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1960 Lines • ▼ Show 20 Line(s) | |||||
* @param kEvent $event | * @param kEvent $event | ||||
*/ | */ | ||||
function OnSaveSettings($event) | function OnSaveSettings($event) | ||||
{ | { | ||||
$event->redirect = false; | $event->redirect = false; | ||||
$items_info = $this->Application->GetVar($event->getPrefixSpecial(true)); | $items_info = $this->Application->GetVar($event->getPrefixSpecial(true)); | ||||
if ( $items_info ) { | if ( $items_info ) { | ||||
list($id, $field_values) = each($items_info); | $id = key($items_info); | ||||
$field_values = $items_info[$id]; | |||||
/** @var kDBItem $object */ | /** @var kDBItem $object */ | ||||
$object = $event->getObject(Array ('skip_autoload' => true)); | $object = $event->getObject(Array ('skip_autoload' => true)); | ||||
$object->setID($id); | $object->setID($id); | ||||
$object->SetFieldsFromHash($field_values); | $object->SetFieldsFromHash($field_values); | ||||
$event->setEventParam('form_data', $field_values); | $event->setEventParam('form_data', $field_values); | ||||
▲ Show 20 Lines • Show All 927 Lines • Show Last 20 Lines |
Space after opening parenthesis of function call prohibited