Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/kernel/db/cat_event_handler.php
Show First 20 Lines • Show All 416 Lines • ▼ Show 20 Line(s) | |||||
if ($displayed) { | if ($displayed) { | ||||
$id_field = $this->Application->getUnitOption($event->Prefix, 'IDField'); | $id_field = $this->Application->getUnitOption($event->Prefix, 'IDField'); | ||||
$type_clauses['displayed']['except'] = '%1$s.'.$id_field.' NOT IN ('.$displayed.')'; | $type_clauses['displayed']['except'] = '%1$s.'.$id_field.' NOT IN ('.$displayed.')'; | ||||
} | } | ||||
else { | else { | ||||
$type_clauses['displayed']['except'] = ''; | $type_clauses['displayed']['except'] = ''; | ||||
} | } | ||||
$type_clauses['displayed']['having_filter'] = false; | $type_clauses['displayed']['having_filter'] = false; | ||||
$item_type = (int)$this->Application->getUnitOption($event->Prefix, 'ItemType'); | |||||
if (in_array('search', $types) || in_array('search', $except_types)) { | if (in_array('search', $types) || in_array('search', $except_types)) { | ||||
$event_mapping = Array ( | $event_mapping = Array ( | ||||
'simple' => 'OnSimpleSearch', | 'simple' => 'OnSimpleSearch', | ||||
'subsearch' => 'OnSubSearch', | 'subsearch' => 'OnSubSearch', | ||||
'advanced' => 'OnAdvancedSearch' | 'advanced' => 'OnAdvancedSearch' | ||||
); | ); | ||||
Show All 11 Lines | |||||
/** @var kDBList $object */ | /** @var kDBList $object */ | ||||
$object = $event->getObject(); | $object = $event->getObject(); | ||||
/** @var kSearchHelper $search_helper */ | /** @var kSearchHelper $search_helper */ | ||||
$search_helper = $this->Application->recallObject('SearchHelper'); | $search_helper = $this->Application->recallObject('SearchHelper'); | ||||
$search_sql = ' FROM ' . $search_helper->getSearchTable() . ' search_result | $search_sql = ' FROM ' . $search_helper->getSearchTable() . ' search_result | ||||
JOIN %1$s ON %1$s.ResourceId = search_result.ResourceId'; | JOIN %1$s | ||||
ON %1$s.ResourceId = search_result.ResourceId | |||||
AND search_result.ItemType = ' . $item_type; | |||||
$sql = str_replace('FROM %1$s', $search_sql, $object->GetPlainSelectSQL()); | $sql = str_replace('FROM %1$s', $search_sql, $object->GetPlainSelectSQL()); | ||||
$object->SetSelectSQL($sql); | $object->SetSelectSQL($sql); | ||||
$object->addCalculatedField('Relevance', 'search_result.Relevance'); | $object->addCalculatedField('Relevance', 'search_result.Relevance'); | ||||
$type_clauses['search']['include'] = 'PrimaryCat = 1 AND ('.TABLE_PREFIX.'Categories.Status = '.STATUS_ACTIVE.')'; | $type_clauses['search']['include'] = 'PrimaryCat = 1 AND ('.TABLE_PREFIX.'Categories.Status = '.STATUS_ACTIVE.')'; | ||||
$type_clauses['search']['except'] = 'PrimaryCat = 1 AND ('.TABLE_PREFIX.'Categories.Status = '.STATUS_ACTIVE.')'; | $type_clauses['search']['except'] = 'PrimaryCat = 1 AND ('.TABLE_PREFIX.'Categories.Status = '.STATUS_ACTIVE.')'; | ||||
Show All 9 Lines | |||||
else { | else { | ||||
$sql = 'SELECT Prefix | $sql = 'SELECT Prefix | ||||
FROM '.TABLE_PREFIX.'ItemTypes | FROM '.TABLE_PREFIX.'ItemTypes | ||||
WHERE ItemName = '.$this->Conn->qstr($related_to); | WHERE ItemName = '.$this->Conn->qstr($related_to); | ||||
$related_prefix = $this->Conn->GetOne($sql); | $related_prefix = $this->Conn->GetOne($sql); | ||||
} | } | ||||
$rel_table = $this->Application->getUnitOption('rel', 'TableName'); | $rel_table = $this->Application->getUnitOption('rel', 'TableName'); | ||||
$item_type = (int)$this->Application->getUnitOption($event->Prefix, 'ItemType'); | |||||
if ($item_type == 0) { | if ($item_type == 0) { | ||||
trigger_error('<strong>ItemType</strong> not defined for prefix <strong>' . $event->Prefix . '</strong>', E_USER_WARNING); | trigger_error('<strong>ItemType</strong> not defined for prefix <strong>' . $event->Prefix . '</strong>', E_USER_WARNING); | ||||
} | } | ||||
// process case, then this list is called inside another list | // process case, then this list is called inside another list | ||||
$prefix_special = $event->getEventParam('PrefixSpecial'); | $prefix_special = $event->getEventParam('PrefixSpecial'); | ||||
if (!$prefix_special) { | if (!$prefix_special) { | ||||
▲ Show 20 Lines • Show All 2629 Lines • Show Last 20 Lines |