Build top-X lists from a function call that will use the highest
voted apps for the list and fill the rest of the list in with applications that have screenshots. Don't mention a blank top application if there are no votes recorded and no top application.CVS: ----------------------------------------------------------------------
This commit is contained in:
@@ -253,4 +253,52 @@ function lookupVendorName($vendorId)
|
||||
return $vendor->vendorName;
|
||||
}
|
||||
|
||||
?>
|
||||
/* Output the rows for the Top-X tables on the main page */
|
||||
function outputTopXRowAppsFromRating($rating, $num_apps)
|
||||
{
|
||||
$sQuery = "SELECT appVotes.appId AS appId, COUNT( appVotes.appId ) AS c
|
||||
FROM appVotes, appVersion
|
||||
WHERE appVersion.maintainer_rating = '$rating'
|
||||
AND appVersion.appId = appVotes.appId
|
||||
GROUP BY appVotes.appId
|
||||
ORDER BY c DESC
|
||||
LIMIT $num_apps";
|
||||
$hResult = query_appdb($sQuery);
|
||||
$num_apps-=mysql_num_rows($hResult); /* take away the rows we are outputting here */
|
||||
while($oRow = mysql_fetch_object($hResult))
|
||||
{
|
||||
$oApp = new Application($oRow->appId);
|
||||
// image
|
||||
$img = get_screenshot_img($oRow->appId);
|
||||
echo '
|
||||
<tr class="white">
|
||||
<td><a href="appview.php?appId='.$oRow->appId.'">'.$oApp->sName.'</a></td>
|
||||
<td>'.trim_description($oApp->sDescription).'</td>
|
||||
<td>'.$img.'</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
/* if we have any empty spots in the list, get these from applications with images */
|
||||
$sQuery = "SELECT DISTINCT appVersion.appId as appId
|
||||
FROM appVersion, appData
|
||||
WHERE appVersion.maintainer_rating = '$rating'
|
||||
AND appVersion.versionId = appData.versionId
|
||||
AND appData.type = 'image'
|
||||
AND appData.queued = 'false'
|
||||
LIMIT $num_apps";
|
||||
$hResult = query_appdb($sQuery);
|
||||
while($oRow = mysql_fetch_object($hResult))
|
||||
{
|
||||
$oApp = new Application($oRow->appId);
|
||||
// image
|
||||
$img = get_screenshot_img($oRow->appId);
|
||||
echo '
|
||||
<tr class="white">
|
||||
<td><a href="appview.php?appId='.$oRow->appId.'">'.$oApp->sName.'</a></td>
|
||||
<td>'.trim_description($oApp->sDescription).'</td>
|
||||
<td>'.$img.'</td>
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user