Changeset View
Changeset View
Standalone View
Standalone View
branches/5.3.x/core/kernel/db/cat_event_handler.php
Show First 20 Lines • Show All 2199 Lines • ▼ Show 20 Line(s) | |||||
* @param string $cached_field | * @param string $cached_field | ||||
*/ | */ | ||||
function cacheItemOwner($event, $id_field, $cached_field) | function cacheItemOwner($event, $id_field, $cached_field) | ||||
{ | { | ||||
$object = $event->getObject(); | $object = $event->getObject(); | ||||
/* @var $object kDBItem */ | /* @var $object kDBItem */ | ||||
$object->SetDBField($cached_field, $object->GetField($id_field)); | $object->SetDBField($cached_field, $object->GetField($id_field)); | ||||
$options = $object->GetFieldOptions($id_field); | |||||
if ( isset($options['options'][$user_id]) ) { | |||||
$object->SetDBField($cached_field, $options['options'][$user_id]); | |||||
} | |||||
else { | |||||
$user_config = $this->Application->getUnitConfig('u'); | |||||
$id_field = $user_config->getIDField(); | |||||
$table_name = $user_config->getTableName(); | |||||
$sql = 'SELECT Username | |||||
FROM ' . $table_name . ' | |||||
WHERE ' . $id_field . ' = ' . $user_id; | |||||
$object->SetDBField($cached_field, $this->Conn->GetOne($sql)); | |||||
} | |||||
} | } | ||||
/** | /** | ||||
* Saves edited item into temp table | * Saves edited item into temp table | ||||
* If there is no id, new item is created in temp table | * If there is no id, new item is created in temp table | ||||
* | * | ||||
* @param kEvent $event | * @param kEvent $event | ||||
* @return void | * @return void | ||||
▲ Show 20 Lines • Show All 875 Lines • Show Last 20 Lines |