Index: branches/RC/core/units/categories/categories_tag_processor.php =================================================================== diff -u -r9375 -r9524 --- branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 9375) +++ branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 9524) @@ -175,20 +175,20 @@ WHERE SymLinkCategoryId IS NOT NULL'; $cache = $this->Conn->GetCol($sql, $id_field); } - + if (isset($cache[$category_id])) { - - //check if sym. link category is valid + + //check if sym. link category is valid $id_field = $this->Application->getUnitOption($this->Prefix, 'IDField'); $table_name = $this->Application->getUnitOption($this->Prefix, 'TableName'); - + $sql = 'SELECT '.$id_field.' FROM '.$table_name.' WHERE '.$id_field.' = '.$cache[$category_id]; - + $category_id = $this->Conn->GetOne($sql)? $cache[$category_id] : $category_id; - } - + } + return $category_id; } @@ -205,11 +205,11 @@ elseif ("$category_id" == 'current') { $category_id = $this->Application->GetVar('m_cat_id'); } - + $category_id = $this->getCategorySymLink($category_id); unset($params['cat_id'], $params['module']); - + $new_params = Array ('pass' => 'm', 'm_cat_id' => $category_id, 'pass_category' => 1); $params = array_merge_recursive2($params, $new_params); @@ -655,34 +655,54 @@ { return $this->Prefix.'_'.$params['type']; } - + /** * Checks if current category is valid symbolic link to another category * * @param Array $params * @return string */ function IsCategorySymLink($params) - { + { $object =& $this->getObject($params); /* @var $object kDBList */ - $sym_category_id = $object->GetDBField('SymLinkCategoryId'); - + $sym_category_id = $object->GetDBField('SymLinkCategoryId'); + if (is_null($sym_category_id)) { return false; } - + $id_field = $this->Application->getUnitOption($this->Prefix, 'IDField'); $table_name = $this->Application->getUnitOption($this->Prefix, 'TableName'); - + $sql = 'SELECT '.$id_field.' - FROM '.$table_name.' - WHERE '.$id_field.' = '.$sym_category_id; - + FROM '.$table_name.' + WHERE '.$id_field.' = '.$sym_category_id; + return $this->Conn->GetOne($sql)? true : false; - } + } + + /** + * Returns module prefix based on root category for given + * + * @param Array $params + * @return string + */ + function GetModulePrefix($params) + { + $object =& $this->getObject($params); + /* @var $object kDBItem */ + + $parent_path = explode('|', substr($object->GetDBField('ParentPath'), 1, -1)); + + $category_helper =& $this->Application->recallObject('CategoryHelper'); + /* @var $category_helper CategoryHelper */ + + $module_info = $category_helper->getCategoryModule($params, $parent_path); + return $module_info['Var']; + } } ?> \ No newline at end of file