Show multiple cats properly

This commit is contained in:
Miles Lott 2001-05-23 20:45:51 +00:00
parent 63b55fb831
commit 03e3895d6d

View File

@ -197,15 +197,31 @@
// Following cleans up view_row, since we were only using it to fill {cols} // Following cleans up view_row, since we were only using it to fill {cols}
$t->set_var('view_row',''); $t->set_var('view_row','');
$cat = CreateObject('phpgwapi.categories'); $fields['cat_id'] = is_array($cat_id) ? implode(',',$cat_id) : $cat_id;
$catinfo = $cat->return_single($fields[0]['cat_id']);
$catname = $catinfo[0]['name'];
if ($fields[0]['cat_id']) { $cat_id = $fields[0]['cat_id']; }
$cat->app_name = 'phpgw'; $cat = CreateObject('phpgwapi.categories');
$catinfo = $cat->return_single($fields[0]['cat_id']); $cats = explode(',',$fields[0]['cat_id']);
$catname .= $catinfo[0]['name']; if ($cats[1])
if ($fields[0]['cat_id']) { $cat_id = $fields[0]['cat_id']; } {
while (list($key,$thiscat) = each($cats))
{
$catinfo = $cat->return_single($thiscat);
$catname .= $catinfo[0]['name'] . '; ';
}
if (!$cat_id)
{
$cat_id = $cats[0];
}
}
else
{
$catinfo = $cat->return_single($fields[0]['cat_id']);
$catname = $catinfo[0]['name'];
if (!$cat_id)
{
$cat_id = $fields[0]['cat_id'];
}
}
if (!$catname) { $catname = lang('none'); } if (!$catname) { $catname = lang('none'); }