update function id2name to return also main,app,owner

This commit is contained in:
bettina 2001-07-02 02:25:26 +00:00
parent c3d72d5af5
commit e93eb90d38

View File

@ -423,15 +423,32 @@
return $this->db->f('cat_id'); return $this->db->f('cat_id');
} }
function id2name($cat_id) function id2name($cat_id, $item = 'name')
{ {
$this->db->query("select cat_name from phpgw_categories where cat_id='" if ($item == 'main')
{
$value = 'cat_main';
}
elseif ($item == 'owner')
{
$value = 'cat_owner';
}
elseif ($item == 'app')
{
$value = 'cat_appname';
}
else
{
$value = 'cat_name';
}
$this->db->query("select $value from phpgw_categories where cat_id='"
. "$cat_id'",__LINE__,__FILE__); . "$cat_id'",__LINE__,__FILE__);
$this->db->next_record(); $this->db->next_record();
if ($this->db->f('cat_name')) if ($this->db->f($value))
{ {
return $this->db->f('cat_name'); return $this->db->f($value);
} }
else else
{ {
@ -490,16 +507,5 @@
return False; return False;
} }
} }
function return_main($cat_id = '')
{
$this->db->query("select cat_main from phpgw_categories where cat_id='$cat_id'",__LINE__,__FILE__);
$this->db->next_record();
$cat_main = $this->db->f('cat_main');
return $cat_main;
}
} }
?> ?>