From 65182984f85ca03063aa30bc2acd04b3f46f24fe Mon Sep 17 00:00:00 2001 From: "mike.morgan%oregonstate.edu" Date: Thu, 26 Jan 2006 00:52:44 +0000 Subject: [PATCH] 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? --- webtools/addons/public/htdocs/extensions.php | 35 +++++--------------- webtools/addons/public/htdocs/search.php | 7 ++-- webtools/addons/public/htdocs/themes.php | 35 +++++--------------- 3 files changed, 18 insertions(+), 59 deletions(-) diff --git a/webtools/addons/public/htdocs/extensions.php b/webtools/addons/public/htdocs/extensions.php index 32b9419bdbc4..c9bfdaaf96f9 100644 --- a/webtools/addons/public/htdocs/extensions.php +++ b/webtools/addons/public/htdocs/extensions.php @@ -8,7 +8,7 @@ $currentTab = 'extensions'; -startProcessing('extensions.tpl', null, $compileId, 'nonav'); +startProcessing('extensions.tpl', null, $compileId); require_once('includes.php'); // 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. $sql['app'] = $clean['app']; -// Get most popular extensions based on application. -$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; - +$amo = new AMO_Object(); // Assign template variables. $tpl->assign( - array( 'popularExtensions' => $popularExtensions, + array( 'newestExtensions' => $amo->getNewestAddons($sql['app'],'E',10), + 'popularExtensions' => $amo->getPopularAddons($sql['app'],'E',10), 'title' => $clean['app'].' Addons', - 'currentTab' => $currentTab) + 'currentTab' => $currentTab, + 'content' => 'extensions.tpl', + 'sidebar' => 'inc/category-sidebar.tpl', + 'cats' => $amo->getCats('E')) ); ?> diff --git a/webtools/addons/public/htdocs/search.php b/webtools/addons/public/htdocs/search.php index b8910a1b8e16..0de59a7daabd 100644 --- a/webtools/addons/public/htdocs/search.php +++ b/webtools/addons/public/htdocs/search.php @@ -92,9 +92,6 @@ foreach ($clean as $key=>$val) { // Instantiate AMO_Object so we can get our categories and platforms. $amo = new AMO_Object(); -$amo->getCats(); -$amo->getPlatforms(); - $dates = array( 'day' => 'Today', 'week' => 'This Week', @@ -270,8 +267,8 @@ $tpl->assign( 'page' => $page, 'results' => $results, 'clean' => $clean, - 'cats' => $amo->Cats, - 'platforms' => $amo->Platforms, + 'cats' => $amo->getCats(), + 'platforms' => $amo->getPlatforms(), 'apps' => $apps, 'dates' => $dates, 'sort' => $sort, diff --git a/webtools/addons/public/htdocs/themes.php b/webtools/addons/public/htdocs/themes.php index 8d528e93c962..81bd17a17697 100644 --- a/webtools/addons/public/htdocs/themes.php +++ b/webtools/addons/public/htdocs/themes.php @@ -8,7 +8,7 @@ $currentTab = 'themes'; -startProcessing('themes.tpl', null, $compileId, 'nonav'); +startProcessing('themes.tpl', null, $compileId); require_once('includes.php'); // 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. $sql['app'] = $clean['app']; -// Get most popular extensions based on application. -$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; - +$amo = new AMO_Object(); // Assign template variables. $tpl->assign( - array( 'popularExtensions' => $popularExtensions, + array( 'newestThemes' => $amo->getNewestAddons($sql['app'],'T',10), + 'popularThemes' => $amo->getPopularAddons($sql['app'],'T',10), 'title' => $clean['app'].' Addons', - 'currentTab' => $currentTab) + 'currentTab' => $currentTab, + 'content' => 'themes.tpl', + 'sidebar' => 'inc/category-sidebar.tpl', + 'cats' => $amo->getCats('T')) ); ?>