Index: branches/5.1.x/core/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r12127 -r12657 --- branches/5.1.x/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 12127) +++ branches/5.1.x/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 12657) @@ -1,6 +1,6 @@ Prefix != 'c') { - return parent::ItemIcon($params); + $grids = $this->Application->getUnitOption($this->Prefix, 'Grids'); + $grid = $grids[ $params['grid'] ]; + + if (!array_key_exists('Icons', $grid)) { + return ''; } + $icons = $grid['Icons']; + + if (array_key_exists('name', $params)) { + $icon_name = $params['name']; + return array_key_exists($icon_name, $icons) ? $icons[$icon_name] : ''; + } + $object =& $this->getObject($params); - if ($object->GetDBField('IsMenu')) { - $status = $object->GetDBField('Status'); - if ($status == 1) { - $ret = $object->GetDBField('IsNew') ? 'icon16_cat_new.gif' : 'icon16_folder.gif'; - } - else { - $ret = $status ? 'icon16_cat_pending.gif' : 'icon16_cat_disabled.gif'; - } + /* @var $object kDBList */ + + if ($object->GetDBField('CreatedBySystem')) { + return 'icon16_section_system.png'; } - else { - $ret = 'icon16_folder-red.gif'; + + $status = $object->GetDBField('Status'); + + if ($status == STATUS_DISABLED) { + return 'icon16_section_disabled.png'; } - return $ret; + if (!$object->GetDBField('IsMenu')) { + return 'icon16_section_menuhidden.png'; + } + + if ($status == STATUS_PENDING) { + return 'icon16_section_pending.png'; + } + + if ($object->GetDBField('IsNew')) { + return 'icon16_section_new.png'; + } + + return 'icon16_section.png'; } function ItemCount($params) @@ -182,7 +202,7 @@ $cat_object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix.'_List'); $sql = 'SELECT '.$this->getTitleField().' FROM '.$cat_object->TableName.' - WHERE CategoryId = '.$this->Application->GetVar('m_cat_id'); + WHERE CategoryId = '.(int)$this->Application->GetVar('m_cat_id'); return $this->Conn->GetOne($sql); } @@ -601,10 +621,13 @@ function CatalogItemCount($params) { + $params['skip_quering'] = true; $object =& $this->GetList($params); + if (!$object->Counted) { $object->CountRecs(); } + return $object->NoFilterCount != $object->RecordsCount ? $object->RecordsCount.' / '.$object->NoFilterCount : $object->RecordsCount; } @@ -673,7 +696,7 @@ if (!isset($current_path)) { $sql = 'SELECT ParentPath FROM ' . TABLE_PREFIX . 'Category - WHERE CategoryId = ' . $this->Application->GetVar('m_cat_id'); + WHERE CategoryId = ' . (int)$this->Application->GetVar('m_cat_id'); $current_path = $this->Conn->GetOne($sql); } @@ -1033,7 +1056,12 @@ } else { // no relation with current category object -> query from db - $sql = 'SELECT l' . $this->Application->GetVar('m_lang') . '_CachedNavbar + $language_id = (int)$this->Application->GetVar('m_lang'); + if (!$language_id) { + $language_id = 1; + } + + $sql = 'SELECT l' . $language_id . '_CachedNavbar FROM ' . $object->TableName . ' WHERE ' . $object->IDField . ' = ' . $category_id; $cached_navbar = $this->Conn->GetOne($sql); @@ -1135,7 +1163,7 @@ $edit_code_before = $edit_code_after = ''; - if (EDITING_MODE == EDITING_MODE_CMS) { + if (EDITING_MODE == EDITING_MODE_CONTENT) { $bg_color = isset($params['bgcolor']) ? $params['bgcolor'] : '#ffffff'; $url_params = Array ( 'pass' => 'm,c,content', @@ -1162,11 +1190,11 @@ $edit_url = $this->Application->HREF('categories/edit_content', ADMIN_DIRECTORY, $url_params, 'index.php'); $edit_code_before = '