Added name2id() and id2name() functions

This commit is contained in:
jengo 2001-04-25 18:12:10 +00:00
parent 371b4bd374
commit 665e72f75a

View File

@ -303,13 +303,17 @@
. "$cat_data', cat_parent='$cat_parent', cat_access='$cat_access' where cat_appname='" . "$cat_data', cat_parent='$cat_parent', cat_access='$cat_access' where cat_appname='"
. $this->app_name . "' and cat_id='$cat_id'",__LINE__,__FILE__); . $this->app_name . "' and cat_id='$cat_id'",__LINE__,__FILE__);
} }
/*!
@function return_name function name2id($cat_name)
@abstract return category name given $cat_id {
@param $cat_id $this->db->query("select cat_id from phpgw_categories where cat_name='"
@result cat_name category name . "$cat_name'",__LINE__,__FILE__);
*/ $this->db->next_record();
function return_name($cat_id)
return $this->db->f('cat_id');
}
function id2name($cat_id)
{ {
$this->db->query("select cat_name from phpgw_categories where cat_id='" $this->db->query("select cat_name from phpgw_categories where cat_id='"
. "$cat_id'",__LINE__,__FILE__); . "$cat_id'",__LINE__,__FILE__);
@ -322,8 +326,21 @@
else else
{ {
return '--'; return '--';
} }
} }
/*!
@function return_name
@abstract return category name given $cat_id
@param $cat_id
@result cat_name category name
*/
// NOTE: This is only a temp wrapper, use id2name() to keep things matching across the board. (jengo)
function return_name($cat_id)
{
return $this->id2name($cat_id);
}
/*! /*!
@function exists @function exists
@abstract used for checking if a category name exists @abstract used for checking if a category name exists