Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/units/categories/categories_tag_processor.php
Show First 20 Lines • Show All 355 Lines • ▼ Show 20 Line(s) | |||||
$meta_type = $params['name']; | $meta_type = $params['name']; | ||||
if ($object->isLoaded()) { | if ($object->isLoaded()) { | ||||
// 1. get module prefix by current category | // 1. get module prefix by current category | ||||
$category_helper = $this->Application->recallObject('CategoryHelper'); | $category_helper = $this->Application->recallObject('CategoryHelper'); | ||||
/* @var $category_helper CategoryHelper */ | /* @var $category_helper CategoryHelper */ | ||||
$category_path = explode('|', substr($object->GetDBField('ParentPath'), 1, -1)); | $category_path = explode('|', substr($object->GetDBField('ParentPath'), 1, -1)); | ||||
$module_info = $category_helper->getCategoryModule($params, $category_path); | $module_info = $category_helper->getCategoryModule($params, $category_path); | ||||
// In-Edit & Proj-CMS module prefixes doesn't have custom field with item template | if ( $module_info ) { | ||||
if ($module_info && $module_info['Var'] != 'adm' && $module_info['Var'] != 'st') { | |||||
// 2. get item template by current category & module prefix | // 2. get item template by current category & module prefix | ||||
$rewrite_processor = $this->Application->recallObject('kRewriteUrlProcessor'); | $rewrite_processor = $this->Application->recallObject('kRewriteUrlProcessor'); | ||||
/* @var $rewrite_processor kRewriteUrlProcessor */ | /* @var $rewrite_processor kRewriteUrlProcessor */ | ||||
$category_params = Array ( | $category_params = Array ( | ||||
'CategoryId' => $object->GetID(), | 'CategoryId' => $object->GetID(), | ||||
'ParentPath' => $object->GetDBField('ParentPath'), | 'ParentPath' => $object->GetDBField('ParentPath'), | ||||
); | ); | ||||
▲ Show 20 Lines • Show All 535 Lines • ▼ Show 20 Line(s) | |||||
$sql = 'SELECT '.$id_field.' | $sql = 'SELECT '.$id_field.' | ||||
FROM '.$table_name.' | FROM '.$table_name.' | ||||
WHERE '.$id_field.' = '.$sym_category_id; | WHERE '.$id_field.' = '.$sym_category_id; | ||||
return $this->Conn->GetOne($sql)? true : false; | return $this->Conn->GetOne($sql)? true : false; | ||||
} | } | ||||
/** | /** | ||||
* Builds link to a category in the Admin Tree. | |||||
* | |||||
* @param array $params Tag params. | |||||
* | |||||
* @return string | |||||
*/ | |||||
protected function AdminTreeLink(array $params) | |||||
{ | |||||
$params['direct_link'] = 1; | |||||
$params['pass'] = 'm'; | |||||
$params['m_opener'] = 'r'; | |||||
if ( $this->Application->ConfigValue('Catalog_PreselectModuleTab') ) { | |||||
$module_prefix = $this->GetModulePrefix($params); | |||||
if ( $module_prefix ) { | |||||
$params['anchor'] = 'tab-' . $module_prefix; | |||||
} | |||||
} | |||||
return $this->CategoryLink($params); | |||||
} | |||||
/** | |||||
* Returns module prefix based on root category for given | * Returns module prefix based on root category for given | ||||
* | * | ||||
* @param Array $params | * @param Array $params | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
function GetModulePrefix($params) | function GetModulePrefix($params) | ||||
{ | { | ||||
$object = $this->getObject($params); | $object = $this->getObject($params); | ||||
/* @var $object kDBItem */ | /* @var $object kDBItem */ | ||||
$parent_path = explode('|', substr($object->GetDBField('ParentPath'), 1, -1)); | $parent_path = explode('|', substr($object->GetDBField('ParentPath'), 1, -1)); | ||||
$category_helper = $this->Application->recallObject('CategoryHelper'); | $category_helper = $this->Application->recallObject('CategoryHelper'); | ||||
/* @var $category_helper CategoryHelper */ | /* @var $category_helper CategoryHelper */ | ||||
$module_info = $category_helper->getCategoryModule($params, $parent_path); | $module_info = $category_helper->getCategoryModule($params, $parent_path); | ||||
return $module_info['Var']; | |||||
return $module_info ? $module_info['Var'] : 'c'; | |||||
} | } | ||||
function ImageSrc($params) | function ImageSrc($params) | ||||
{ | { | ||||
list ($ret, $tag_processed) = $this->processAggregatedTag('ImageSrc', $params, $this->getPrefixSpecial()); | list ($ret, $tag_processed) = $this->processAggregatedTag('ImageSrc', $params, $this->getPrefixSpecial()); | ||||
return $tag_processed ? $ret : false; | return $tag_processed ? $ret : false; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1315 Lines • Show Last 20 Lines |