Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/units/categories/categories_event_handler.php
Show First 20 Lines • Show All 196 Lines • ▼ Show 20 Line(s) | |||||
$sql = 'SELECT ' . $id_field . ', CreatedById, ParentId | $sql = 'SELECT ' . $id_field . ', CreatedById, ParentId | ||||
FROM ' . $table_name . ' | FROM ' . $table_name . ' | ||||
WHERE ' . $id_field . ' IN (' . $this->_getPermissionCheckIDs($event) . ')'; | WHERE ' . $id_field . ' IN (' . $this->_getPermissionCheckIDs($event) . ')'; | ||||
$items = $this->Conn->Query($sql, $id_field); | $items = $this->Conn->Query($sql, $id_field); | ||||
if (!$items) { | if (!$items) { | ||||
// when creating new category, then no IDs are stored in session | // when creating new category, then no IDs are stored in session | ||||
$items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); | $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); | ||||
list ($id, $fields_hash) = each($items_info); | $id = key($items_info); | ||||
$fields_hash = $items_info[$id]; | |||||
if (array_key_exists('ParentId', $fields_hash)) { | if (array_key_exists('ParentId', $fields_hash)) { | ||||
$item_category = $fields_hash['ParentId']; | $item_category = $fields_hash['ParentId']; | ||||
} | } | ||||
else { | else { | ||||
$item_category = $this->Application->RecallVar('m_cat_id'); // saved in c:OnPreCreate event permission checking | $item_category = $this->Application->RecallVar('m_cat_id'); // saved in c:OnPreCreate event permission checking | ||||
} | } | ||||
▲ Show 20 Lines • Show All 3020 Lines • Show Last 20 Lines |