// // ------------------------------------------------------------------------- // // Original Author: James Knickelbein // Author Website : http://www.journeymilwaukee.com // Licence Type : GPL // ------------------------------------------------------------------------- // include_once("header.php"); include_once(XOOPS_ROOT_PATH."/header.php"); $mytree = new XoopsTree($db->prefix("adresses_cat"), "cid", "pid"); //generates top 10 charts by rating and hits for each main category OpenTable(); echo ""._MI_MYADRESSES_NAME.""; if ($rate) { $sort = _RATING; $sortDB = "rating"; } else { $sort = _HITS; $sortDB = "hits"; } $arr = array(); $result = $db->query("SELECT cid, title FROM ".$db->prefix("adresses_cat")." WHERE pid=0"); while (list($cid, $ctitle) = $db->fetchRow($result)) { $boxtitle = ""; $boxtitle .= sprintf(_TOP10, $ctitle); $boxtitle .= " (".$sort.")"; $thing = ""; $query = "SELECT lid, cid, title, hits, rating, votes FROM ".$db->prefix("adresses_adresses")." WHERE status>0 AND (cid=$cid"; // get all child cat ids for a given cat id $arr = $mytree->getAllChildId($cid); $size = count($arr); for ($i=0; $i<$size; $i++) { $query .= " OR cid=".$arr[$i].""; } $query .= ") ORDER BY ".$sortDB." DESC"; $result2 = $db->query($query, 10, 0); $rank = 1; while (list($did, $dcid, $dtitle, $hits, $rating, $votes) = $db->fetchRow($result2)) { $rating = number_format($rating, 2); if ($hit) { $hits = "$hits"; } elseif ($rate) { $rating = "$rating"; } $catpath = $mytree->getNicePathFromId($dcid, "title", "viewcat.php?"); $catpath = substr($catpath, 0, -2); $catpath = str_replace(":", "»", $catpath); $thing .= ""; $thing .= ""; $thing .= ""; $thing .= ""; $thing .= ""; $rank++; } $thing .= "
"._RANK.""._TITLE.""._CATEGORY.""._HITS.""._RATING.""._VOTE."
$rank$dtitle$catpath$hits$rating$votes
"; themecenterposts($boxtitle, $thing); echo "
"; } CloseTable(); include_once("footer.php"); ?>