";
echo "Number of top apps to display:";
echo "";
/* list sub categories */
if($categoryId == "any")
$catId = 0;
else
$catId = $categoryId;
/******************************************************************/
/* build an array of categories from the current category back up */
/* the tree to the main category */
$cat_array = Array();
$cat_name_array = Array();
if($catId != 0)
{
$currentCatId = $catId;
do
{
$catQuery = "SELECT appCategory.catName, appCategory.catParent ".
"FROM appCategory WHERE appCategory.catId = '$currentCatId';";
$result = mysql_query($catQuery);
if($result)
{
$row = mysql_fetch_object($result);
$catParent = $row->catParent;
array_push($cat_array, "$currentCatId");
array_push($cat_name_array, "$row->catName");
}
$currentCatId = $catParent;
} while($currentCatId != 0);
}
/*******************************************************************/
/* add options for all of the categories that we are recursed into */
echo "Section:";
echo "";
echo "";
echo "";
echo "
";
echo "
";
/***************************************************/
/* build a list of the apps in the chosen category */
if(strcasecmp($categoryId, "any") == 0)
{
/* leave out the appFamily.catId = '$categoryId' */
$voteQuery = "SELECT appVotes.appId, appName, count(userId) as count ".
"FROM appVotes, appFamily ".
"WHERE appVotes.appId = appFamily.appId ".
"GROUP BY appId ORDER BY count DESC LIMIT $topNumber";
} else
{
$voteQuery = "SELECT appVotes.appId, appName, count(userId) as count ".
"FROM appVotes, appFamily, appCategory ".
"WHERE appVotes.appId = appFamily.appId AND ".
"(appFamily.catId = '$categoryId' OR ".
"(appFamily.catId = appCategory.catId AND appCategory.catParent = '$categoryId')) ".
"GROUP BY appId ORDER BY count DESC LIMIT $topNumber";
}
$result = mysql_query($voteQuery);
if($result)
{
echo html_frame_start("", "90%", '', 0);
echo html_table_begin("width='100%' align=center");
echo "