Index: trunk/core/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r8506 -r8718 --- trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 8506) +++ trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 8718) @@ -107,108 +107,12 @@ function CategoryPath($params) { - $module_name = getArrayValue($params, 'module') ? $params['module'] : 'In-Commerce'; - $module_category_id = $this->Application->findModule('Name', $module_name, 'RootCat'); - $module_item_id = $this->Application->GetVar($this->Application->findModule('Name', $module_name, 'Var').'_id'); + $category_helper =& $this->Application->recallObject('CategoryHelper'); + /* @var $category_helper CategoryHelper */ - $block_params['separator'] = $params['separator']; - - if (!isset($params['cat_id'])) { - $params['cat_id'] = getArrayValue($params, 'cat_id') ? $params['cat_id'] : $this->Application->GetVar('m_cat_id'); - } - - if ($params['cat_id'] == 0) { - $block_params['current'] = 1; - $block_params['cat_id'] = 0; - $block_params['cat_name'] = $this->Application->ProcessParsedTag('m', 'RootCategoryName', $params); - $block_params['name'] = $this->SelectParam($params, 'root_cat_render_as,block_root_cat,rootcatblock,render_as'); - return $this->Application->ParseBlock($block_params); - } - else { - $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); - $navbar_field = $ml_formatter->LangFieldName('CachedNavBar'); - - $id_field = $this->Application->getUnitOption($this->Prefix, 'IDField'); - $table_name = $this->Application->getUnitOption($this->Prefix, 'TableName'); - $sql = 'SELECT '.$navbar_field.', ParentPath - FROM '.$table_name.' - WHERE '.$id_field.' = '.$params['cat_id']; - $category_data = $this->Conn->GetRow($sql); - $ret = ''; - if ($category_data) { - $category_names = explode('&|&', $category_data[$navbar_field]); - $category_ids = explode('|', substr($category_data['ParentPath'], 1, -1)); - - // add "Home" category at beginning of path - array_unshift($category_names, $this->Application->ProcessParsedTag('m', 'RootCategoryName', $params)); - array_unshift($category_ids, 0); - - foreach ($category_ids as $category_pos => $category_id) { - $block_params['cat_id'] = $category_id; - $block_params['cat_name'] = $category_names[$category_pos]; - $block_params['current'] = ($params['cat_id'] == $category_id) && !$module_item_id ? 1 : 0; - $block_params['is_module_root'] = $category_id == $module_category_id ? 1 : 0; - $block_params['name'] = $this->SelectParam($params, 'render_as,block'); - - // which block to parse as current ? - if ($category_id == 0) { - $block_params['name'] = $this->SelectParam($params, 'root_cat_render_as,block_root_cat,rootcatblock,render_as,block'); - } - - if ($block_params['is_module_root'] == 1) { // module root - $block_params['name'] = $this->SelectParam($params, 'module_root_render_as,block_module_root,rootmoduleblock,render_as,block'); - } - - if ($block_params['current'] == 1) { // current cat (label) - $block_params['name'] = $this->SelectParam($params, 'current_render_as,block_current,currentblock,render_as,block'); - } - - $this->Application->SetVar($this->Prefix.'_id', $category_id); - $ret .= $this->Application->ParseBlock($block_params, 1); - } - } - - return $ret; - } + return $category_helper->NavigationBar($params); } - function NavigationBar($params) - { - $titles = explode(',', $params['titles']); - $templates = explode(',', $params['templates']); - - array_unshift($titles, $this->Application->ProcessParsedTag('m', 'RootCategoryName', $params)); - array_unshift($templates, ''); - - $block_params = $this->prepareTagParams($params); - $current_template = $this->Application->GetVar('t'); - - $ret = ''; - foreach ($templates as $template_index => $template) { - $block_params['current'] = ($template == $current_template); - $block_params['title'] = $titles[$template_index]; - $block_params['template'] = $template; - - switch ($template) { - case '': - $block_params['name'] = $params['root_cat_render_as']; - break; - - case $current_template: - $block_params['name'] = $params['current_render_as']; - break; - - default: - $block_params['name'] = $params['render_as']; - break; - } - - $ret .= $this->Application->ParseBlock($block_params); - } - - return $ret; - } - function CurrentCategoryName($params) { $cat_object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix.'_List');