This commit is contained in:
ceb 2003-06-24 13:32:25 +00:00
parent 5503443533
commit 782fdf7c2d
2 changed files with 29 additions and 5 deletions

View File

@ -345,7 +345,7 @@
'lang_no_cat' => lang('no category'),
'lang_cat_statustext' => lang('Select the parent category. If this is a main category select NO CATEGORY'),
'select_name' => 'values[parent]',
'cat_list' => $this->bo->cats->formatted_xslt_list(array('format' => 'select','selected' => $parent,'globals' => $global_cats))
'cat_list' => $this->bo->cats->formatted_xslt_list(array('format' => 'select', 'selected' => $parent,'self' => $this->cat_id,'globals' => $global_cats))
);
$link_data['menuaction'] = 'admin.uicategories.edit';

View File

@ -398,17 +398,18 @@
@result $s array - populated with categories
*/
function formatted_list($format,$type = 'all',$selected = '',$globals = False,$site_link = 'site')
function formatted_list($format,$type = 'all',$selected = '',$globals = True,$site_link = 'site',$self = '')
{
if(is_array($format))
{
$temp_format = $format['format'];
$type = (isset($format['type'])?$format['type']:'all');
$selected = (isset($format['selected'])?$format['selected']:'');
$globals = (isset($format['globals'])?$format['globals']:False);
$self = (isset($format['self'])?$format['self']:'');
$globals = (isset($format['globals'])?$format['globals']:True);
$site_link = (isset($format['site_link'])?$format['site_link']:'site');
settype($format,'string');
$format = $temp_format;
$format = ($temp_format?$temp_format:'select');
unset($temp_format);
}
@ -426,6 +427,17 @@
$cats = $this->return_sorted_array($start,False,$query,$sort,$order,$globals);
}
if($self)
{
for ($i=0;$i<count($cats);$i++)
{
if ($cats[$i]['cat_id'] == $self)
{
unset($cats[$i]);
}
}
}
if ($format == 'select')
{
for ($i=0;$i<count($cats);$i++)
@ -499,7 +511,8 @@
$format = (isset($data['format'])?$data['format']:'filter');
$type = (isset($data['type'])?$data['type']:'all');
$selected = (isset($data['selected'])?$data['selected']:'');
$globals = (isset($data['globals'])?$data['globals']:False);
$self = (isset($data['self'])?$data['self']:'');
$globals = (isset($data['globals'])?$data['globals']:True);
}
if (!is_array($selected))
@ -526,6 +539,17 @@
break;
}
if($self)
{
for ($i=0;$i<count($cats);$i++)
{
if ($cats[$i]['cat_id'] == $self)
{
unset($cats[$i]);
}
}
}
while (is_array($cats) && list(,$cat) = each($cats))
{
$sel_cat = '';