200 || $aClean['iTopNumber'] < 0)
$aClean['iTopNumber'] = 25;
if(empty($aClean['iCategoryId']))
$aClean['iCategoryId'] = 0;
apidb_header("Vote Stats - Top ".$aClean['iTopNumber']." Applications");
/* display the selection for the top number of apps to view */
echo "
';
echo '
';
echo '
';
/***************************************************/
/* build a list of the apps in the chosen category */
if(empty($aClean['iCategoryId']))
{
/* leave out the appFamily.catId = '$aClean['iCategoryId']' */
$hResult = query_parameters("SELECT appVotes.appId, appName, count(userId) as count ".
"FROM appVotes, appFamily ".
"WHERE appVotes.appId = appFamily.appId ".
"GROUP BY appId ORDER BY count DESC LIMIT ?", $aClean['iTopNumber']);
} else
{
/* Display all application for a given category (including sub categories)
SELECT f.appId, f.appName
FROM appFamily AS f, appCategory AS c
WHERE f.catId = c.catId
AND (
c.catId =29
OR c.catParent =29)*/
$hResult = query_parameters("SELECT v.appId, f.appName, count( v.appId ) AS count
FROM appFamily AS f, appCategory AS c, appVotes AS v
WHERE v.appId = f.appId
AND f.catId = c.catId
AND (
c.catId = '?'
OR c.catParent = '?'
)
GROUP BY appId
ORDER BY count DESC LIMIT ?", $aClean['iCategoryId'], $aClean['iCategoryId'], $aClean['iTopNumber']);
}
if($hResult)
{
echo html_frame_start("", "90%", '', 0);
echo html_table_begin("width='100%' align=center");
echo "| Application Name | \n";
echo "Votes |
\n";
$c = 1;
while($row = mysql_fetch_object($hResult))
{
$bgcolor = ($c % 2) ? "color0" : "color1";
$link = "$row->appName";
echo "| $c. $link | $row->count |
\n";
$c++;
}
echo html_table_end();
echo html_frame_end();
/* Make sure we tell the user here are no apps, otherwise they might */
/* think that something went wrong with the server */
if($c == 1)
{
echo 'No apps found in this category, please vote for your favorite apps!
';
}
echo 'What does this screen mean?
';
}
apidb_footer();
?>