[imc-sf-coders] CVS update of sf-active/sf-active/shared/classes
(category_class.inc)
Bart M
pseudopunk at codecoop.org
Thu Dec 29 07:08:55 PST 2005
Date: Thursday, December 29, 2005 @ 16:08:55
Author: pseudopunk
Path: /cvsroot/sf-active/sf-active/sf-active/shared/classes
Modified: category_class.inc
closes bug 360 &368 : set correct link in category box and use display name as link text
Index: sf-active/sf-active/shared/classes/category_class.inc
diff -u sf-active/sf-active/shared/classes/category_class.inc:1.110 sf-active/sf-active/shared/classes/category_class.inc:1.111
--- sf-active/sf-active/shared/classes/category_class.inc:1.110 Wed Dec 28 09:13:35 2005
+++ sf-active/sf-active/shared/classes/category_class.inc Thu Dec 29 16:08:54 2005
@@ -82,28 +82,17 @@
// function adde to display the list of category names an artile belogns to -- blicero
/**
- * sets an array containing the shortnames of the categories an article belongs to, and a string to display them in an article
- * TODO: refactor this code
+ * Returns an array with as key the category shortnames and as item the category names an article belongs to.
+ *
+ * This is used to set the box of categories on the article page.
+ * @param int $id
+ * @return array
*/
function get_article_catname_array($id)
{
$db_obj = new DB();
- $this->cat_name_match = array();
- $query = "SELECT catlink.catid as catid, category.shortname as shortname FROM catlink LEFT JOIN category ON catlink.catid = category.category_id WHERE id = $id GROUP BY catlink.catid";
- $resultset = $db_obj->query($query);
- $results = $resultset;
- $this->cat_name_match_printable='$GLOBALS["page_categories"]=array(';
- if (is_array($resultset)) {
- while ($row = array_pop($resultset))
- {
- $this->cat_name_match[] = $row['shortname'];
- $this->cat_name_match_printable .= 'array('.$row[catid].",'".$row['shortname']."'),";
- }
- $this->cat_name_match_printable .= ');';
- $this->cat_name_match_printable = str_replace(',);',');',$this->cat_name_match_printable);
- }
-
-
+ $query = "SELECT category.shortname as shortname, category.name as name FROM catlink LEFT JOIN category ON catlink.catid = category.category_id WHERE id = $id GROUP BY catlink.catid";
+ $results = $db_obj->query_retrieve_keyed_list($query);
return $results;
}
More information about the imc-sf-coders
mailing list