Index: branches/RC/core/units/categories/categories_tag_processor.php =================================================================== diff -u -r9132 -r9279 --- branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 9132) +++ branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 9279) @@ -125,6 +125,23 @@ return $category_helper->NavigationBar($params); } + /** + * Allows to show category path of selected module + * + * @param Array $params + * @return string + */ + function FieldCategoryPath($params) + { + $object =& $this->getObject(); + /* @var $object kDBItem */ + + $field = $this->SelectParam($params, 'name,field'); + $params['cat_id'] = $object->GetDBField($field); + + return $this->CategoryPath($params); + } + function CurrentCategoryName($params) { $cat_object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix.'_List'); @@ -140,26 +157,45 @@ return $ml_formatter->LangFieldName('Name'); } - function CategoryLink($params) + function getCategorySymLink($category_id) { - $params = array_merge(Array('pass' => 'm'), $params); - $cat_id = getArrayValue($params, 'cat_id'); - if ($cat_id === false) { - $cat_id = $this->Application->GetVar($this->getPrefixSpecial().'_id'); + static $cache = null; + + if (!isset($cache)) { + $id_field = $this->Application->getUnitOption($this->Prefix, 'IDField'); + $table_name = $this->Application->getUnitOption($this->Prefix, 'TableName'); + + $sql = 'SELECT SymLinkCategoryId, '.$id_field.' + FROM '.$table_name.' + WHERE SymLinkCategoryId IS NOT NULL'; + $cache = $this->Conn->GetCol($sql, $id_field); } - if ("$cat_id" == 'Root') { - $params['m_cat_id'] = $this->Application->findModule('Name', $params['module'], 'RootCat'); - unset($params['module']); - } - else { - $params['m_cat_id'] = $cat_id; - } - unset($params['cat_id']); - $params['pass_category'] = 1; + return isset($cache[$category_id]) ? $cache[$category_id] : $category_id; + } - $main_processor =& $this->Application->recallObject('m_TagProcessor'); - return $main_processor->T($params); + function CategoryLink($params) + { + $category_id = getArrayValue($params, 'cat_id'); + if ($category_id === false) { + $category_id = $this->Application->GetVar($this->getPrefixSpecial().'_id'); + } + + if ("$category_id" == 'Root') { + $category_id = $this->Application->findModule('Name', $params['module'], 'RootCat'); + } + elseif ("$category_id" == 'current') { + $category_id = $this->Application->GetVar('m_cat_id'); + } + + unset($params['cat_id'], $params['module']); + + $category_id = $this->getCategorySymLink($category_id); + + $new_params = Array ('pass' => 'm', 'm_cat_id' => $category_id, 'pass_category' => 1); + $params = array_merge_recursive2($params, $new_params); + + return $this->Application->ProcessParsedTag('m', 't', $params); } function CategoryList($params)