Index: trunk/core/units/categories/categories_tag_processor.php =================================================================== diff -u -r1910 -r2190 --- trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 1910) +++ trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 2190) @@ -240,203 +240,25 @@ } } - - /* function PrintListTest($params) + function Meta($params) { - $stack_cat_id = $this->Application->GetVar('m_cat_id'); + $name = getArrayValue($params, 'name'); + $object =& $this->Application->recallObject($this->Prefix.'.-item'); - $prefix_special = $this->getPrefixSpecial(); - $list =& $this->Application->recallObject( $prefix_special, $this->Prefix.'_List',$params); + $field = $object->GetField('Meta'.$name); + if ($field) return $field; - if ( !($list->OriginalParams == $params) ) { - $this->Application->removeObject($prefix_special); - $list =& $this->Application->recallObject($prefix_special,$this->Prefix.'_List',$params); - } - - $cat_id = $this->Application->GetVar('m_cat_id') ? $this->Application->GetVar('m_cat_id') : 0; - $list->addFilter( 'category_scope_filter', 'ParentId = '.$this->Application->GetVar('m_cat_id') ); - $list->Query(); - - $record_ids_array = array(); - - foreach ($list->Records as $record_id){ - $record_ids_array[] = $record_id['CategoryId']; + switch ($name) { + case 'Description': + $conf = 'Category_MetaDesc'; + break; + case 'Keywords': + $conf = 'Category_MetaKey'; + break; } - $parent_records=$list->Records; - - $records_list = implode(', ', $record_ids_array); - - $or_filter =& $this->Application->makeClass('kMultipleFilter'); - $or_filter->setType(FLT_TYPE_OR); - $or_filter->addFilter('parent_filter', 'ParentId IN ('.$records_list.')'); - $or_filter->addFilter('category_filter', 'CategoryId IN ('.$records_list.')'); - $list->clearFilters(); - $list->addFilter('parent_filter', $or_filter); - - $list->AddOrderField('CachedNavbar', 'ASC'); - $list->Query(); - - $unsorted_cats=$list->Records; - $parent_cats=array(); - $child_cats=array(); - $all_records=array(); - - - for ($i=0; $iRecords=$all_records; - - $o = ''; - $list->GoFirst(); - - $block_params=$this->prepareTagParams($params); - $block_params['name']=$params['block']; - $block_params['pass_params']='true'; - - - while (!$list->EOL()) - { - //if ($list->GetDBField('ParentId') == $cat_id) { - $block_params['cat_id'] = $list->GetDBField('CategoryId'); - $block_params['parent_id']=$list->GetDBField('CategoryId'); - $this->Application->SetVar('m_cat_id', $list->GetDBField('CategoryId') ); - // for edit/delete links using GET - $o.= $this->Application->ParseBlock($block_params, 1); - //}else{ - $list->GoNext(); - //} - } - $this->Application->SetVar('m_cat_id', $stack_cat_id); - - return $o; + return $this->Application->ConfigValue($conf); } - - function ListSubCategories($params) - { - return $this->PrintSubCategories($params); - } - - function PrintSubCategories($params){ - $list =& $this->Application->recallObject( $this->getPrefixSpecial(), $this->Prefix.'_List',$params); - $id_field = $this->Application->getUnitOption($this->Prefix,'IDField'); - $o = ''; - - $block_params=$this->prepareTagParams($params); - $block_params['pass_params']='true'; - - $parent_cat = $list->GetDBField('CategoryId'); - - $is_first=1; - $current_item=1; - $show_more_link=true; - $list->GoNext(); - while (!$list->EOL() && $list->GetDBField('ParentId') == $parent_cat) - { - if ($current_item > $params['max_sub_cats']){ - $is_first=0; - if ($show_more_link && isset($params['block_more'])){ - $more_params=$this->prepareTagParams($params); - $more_params['name']=$params['block_more']; - $this->Application->SetVar( 'm_cat_id', $list->GetDBField('ParentId') ); - $o.= $this->Application->ParseBlock($more_params, 1); - $show_more_link=false; - } - $list->GoNext(); - continue; - } - - $block_params['cat_id'] = $list->GetDBField('CategoryId'); - $block_params['is_first']=$is_first; - $this->Application->SetVar( $this->getPrefixSpecial().'_id', $list->GetDBField('CategoryId') ); - $this->Application->SetVar( 'm_cat_id', $list->GetDBField('CategoryId') ); - $o.= $this->Application->ParseBlock($block_params, 1); - $list->GoNext(); - $is_first=0; - - $current_item++; - } - - $list->GoPrev(); -// $this->Application->SetVar('m_cat_id', $parent_cat); - - return $o; - } - - function PrintList2($params) - { - $list =& $this->Application->recallObject( $this->getPrefixSpecial(), $this->Prefix.'_List',$params); - $id_field = $this->Application->getUnitOption($this->Prefix,'IDField'); - - $list->Query(); - $o = ''; - $list->GoFirst(); - - $direction = (isset($params['direction']) && $params['direction']=="H")?"H":"V"; - $columns = (isset($params['columns']))?$params['columns']:1; - - if ($columns>1 && $direction=="V") { - $list->Records = $this->LinearToVertical($list->Records, $columns, $params['per_page']); - } - - $list->GoFirst(); - if($list->EOL()) - { - $block_params['name'] = 'no_categories'; - return $this->Application->ParseBlock($block_params); - } - - $block_params=$this->prepareTagParams($params); - $block_params['name']=$params['block']; - $block_params['pass_params']='true'; - - $block_start_row_params=$this->prepareTagParams($params); - $block_start_row_params['name']=$params['row_start_block']; - - $block_end_row_params=$this->prepareTagParams($params); - $block_end_row_params['name']=$params['row_end_block']; - - $i=0; - while (!$list->EOL()) - { - $block_params['cat_id'] = $list->GetDBField('CategoryId'); - - $this->Application->SetVar( $this->getPrefixSpecial().'_id', $list->GetDBField($id_field) ); // for edit/delete links using GET - - $list->UpdateFormattersSubFields(); - - if ($i%$params['columns'] == 0) $o.= $this->Application->ParseBlock($block_start_row_params, 1); - $this->Application->SetVar( $this->getPrefixSpecial().'_id', $list->GetDBField($id_field) ); - $o.= $this->Application->ParseBlock($block_params, 1); - if (($i+1)%$params['columns'] == 0) $o.= $this->Application->ParseBlock($block_end_row_params, 1); - - $list->GoNext(); - - $i++; - } - - $this->Application->SetVar( $this->getPrefixSpecial().'_id', ''); - return $o; - } - - */ - }