From: SourceForge.net <no...@so...> - 2003-09-15 21:31:56
|
Patches item #806815, was opened at 2003-09-15 17:31 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=506848&aid=806815&group_id=64258 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Serge Aluker (theserge_com) Assigned to: Nobody/Anonymous (nobody) Summary: show all subsites for tracker Initial Comment: I have never submitted a patch for anything, so I hope not to embarrass myself too much... When a category is viewed in the tracker, there is a number next to any subcategory which shows how many sites there are in that subcategory. For complex category structures this number is misleading (as subcategories can have more subcategories with more sites). I wrote a function to get ALL of the subcategories' sites: for class: DirLib in file: lib/directory/dirlib.php input: category id output: number of ALL sites within that category (recursive) function get_cats_subcat_sites($catid) { //get all direct child id's of this category $query_childids = "select categId from tiki_directory_categories where par ent=" . $catid; $result_childids = $this->query($query_childids); $childret = Array(); $subsites = 0; while($childret = $result_childids->fetchRow(DB_FETCHMODE_ASSOC)){ $subsites += $this->db->getOne("select count(*) from tiki_category_sites where categId=".$childret["categId"]); //recursive call to all subcats $subsites += $this->get_cats_subcat_sites($childret["categId"]); } return $subsites; } to tack the result onto the number that is displayed, just add on this line to the while loop in the function "dir_list_categories" in the same class and file: $res["sites"]+=$this->get_cats_subcat_sites($res["categId"]); I hope this helps somehow! Serge ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=506848&aid=806815&group_id=64258 |