Finished extensions / themes and mofidied the search to work with the updated amo.class.php, which doesn't set class vars but instead was updated so the gets actually just return data instead of setting things. Makes sense, no?

This commit is contained in:
mike.morgan%oregonstate.edu 2006-01-26 00:52:44 +00:00
Родитель e531090e22
Коммит 65182984f8
3 изменённых файлов: 18 добавлений и 59 удалений

Просмотреть файл

@ -8,7 +8,7 @@
$currentTab = 'extensions'; $currentTab = 'extensions';
startProcessing('extensions.tpl', null, $compileId, 'nonav'); startProcessing('extensions.tpl', null, $compileId);
require_once('includes.php'); require_once('includes.php');
// If app is not set or empty, set it to null for our switch. // If app is not set or empty, set it to null for our switch.
@ -32,35 +32,16 @@ switch( $_GET['app'] ) {
// We have to ucfirst() it because the DB has caps. // We have to ucfirst() it because the DB has caps.
$sql['app'] = $clean['app']; $sql['app'] = $clean['app'];
// Get most popular extensions based on application. $amo = new AMO_Object();
$db->query("
SELECT DISTINCT
TM.ID ID,
TM.Name name,
TM.downloadcount dc
FROM
main TM
INNER JOIN version TV ON TM.ID = TV.ID
INNER JOIN applications TA ON TV.AppID = TA.AppID
INNER JOIN os TOS ON TV.OSID = TOS.OSID
WHERE
AppName = '{$sql['app']}' AND
downloadcount > '0' AND
approved = 'YES' AND
Type = 'E'
ORDER BY
downloadcount DESC
LIMIT
5
", SQL_ALL, SQL_ASSOC);
$popularExtensions = $db->record;
// Assign template variables. // Assign template variables.
$tpl->assign( $tpl->assign(
array( 'popularExtensions' => $popularExtensions, array( 'newestExtensions' => $amo->getNewestAddons($sql['app'],'E',10),
'popularExtensions' => $amo->getPopularAddons($sql['app'],'E',10),
'title' => $clean['app'].' Addons', 'title' => $clean['app'].' Addons',
'currentTab' => $currentTab) 'currentTab' => $currentTab,
'content' => 'extensions.tpl',
'sidebar' => 'inc/category-sidebar.tpl',
'cats' => $amo->getCats('E'))
); );
?> ?>

Просмотреть файл

@ -92,9 +92,6 @@ foreach ($clean as $key=>$val) {
// Instantiate AMO_Object so we can get our categories and platforms. // Instantiate AMO_Object so we can get our categories and platforms.
$amo = new AMO_Object(); $amo = new AMO_Object();
$amo->getCats();
$amo->getPlatforms();
$dates = array( $dates = array(
'day' => 'Today', 'day' => 'Today',
'week' => 'This Week', 'week' => 'This Week',
@ -270,8 +267,8 @@ $tpl->assign(
'page' => $page, 'page' => $page,
'results' => $results, 'results' => $results,
'clean' => $clean, 'clean' => $clean,
'cats' => $amo->Cats, 'cats' => $amo->getCats(),
'platforms' => $amo->Platforms, 'platforms' => $amo->getPlatforms(),
'apps' => $apps, 'apps' => $apps,
'dates' => $dates, 'dates' => $dates,
'sort' => $sort, 'sort' => $sort,

Просмотреть файл

@ -8,7 +8,7 @@
$currentTab = 'themes'; $currentTab = 'themes';
startProcessing('themes.tpl', null, $compileId, 'nonav'); startProcessing('themes.tpl', null, $compileId);
require_once('includes.php'); require_once('includes.php');
// If app is not set or empty, set it to null for our switch. // If app is not set or empty, set it to null for our switch.
@ -32,35 +32,16 @@ switch( $_GET['app'] ) {
// We have to ucfirst() it because the DB has caps. // We have to ucfirst() it because the DB has caps.
$sql['app'] = $clean['app']; $sql['app'] = $clean['app'];
// Get most popular extensions based on application. $amo = new AMO_Object();
$db->query("
SELECT DISTINCT
TM.ID ID,
TM.Name name,
TM.downloadcount dc
FROM
main TM
INNER JOIN version TV ON TM.ID = TV.ID
INNER JOIN applications TA ON TV.AppID = TA.AppID
INNER JOIN os TOS ON TV.OSID = TOS.OSID
WHERE
AppName = '{$sql['app']}' AND
downloadcount > '0' AND
approved = 'YES' AND
Type = 'E'
ORDER BY
downloadcount DESC
LIMIT
5
", SQL_ALL, SQL_ASSOC);
$popularExtensions = $db->record;
// Assign template variables. // Assign template variables.
$tpl->assign( $tpl->assign(
array( 'popularExtensions' => $popularExtensions, array( 'newestThemes' => $amo->getNewestAddons($sql['app'],'T',10),
'popularThemes' => $amo->getPopularAddons($sql['app'],'T',10),
'title' => $clean['app'].' Addons', 'title' => $clean['app'].' Addons',
'currentTab' => $currentTab) 'currentTab' => $currentTab,
'content' => 'themes.tpl',
'sidebar' => 'inc/category-sidebar.tpl',
'cats' => $amo->getCats('T'))
); );
?> ?>