browse apps: Add support for filtering by license

This commit is contained in:
Alexander Nicolaysen Sørnes
2008-06-13 21:28:08 +02:00
committed by Chris Morgan
parent 132431e9a2
commit 0a305197fd
2 changed files with 12 additions and 3 deletions

View File

@@ -1020,8 +1020,11 @@ class Application {
$aCatIds[] = $oCategory->objectGetId(); $aCatIds[] = $oCategory->objectGetId();
} }
$aLicenses = version::getLicenses();
$oFilter->AddFilterInfo('appVersion.rating', 'Rating', array(FILTER_EQUALS, FILTER_LESS_THAN, FILTER_GREATER_THAN), FILTER_VALUES_ENUM, array('Platinum', 'Gold', 'Silver', 'Bronze', 'Garbage')); $oFilter->AddFilterInfo('appVersion.rating', 'Rating', array(FILTER_EQUALS, FILTER_LESS_THAN, FILTER_GREATER_THAN), FILTER_VALUES_ENUM, array('Platinum', 'Gold', 'Silver', 'Bronze', 'Garbage'));
$oFilter->AddFilterInfo('appFamily.catId', 'Category', array(FILTER_EQUALS), FILTER_VALUES_ENUM, $aCatIds, $aCatNames); $oFilter->AddFilterInfo('appFamily.catId', 'Category', array(FILTER_EQUALS), FILTER_VALUES_ENUM, $aCatIds, $aCatNames);
$oFilter->AddFilterInfo('appVersion.license', 'License', array(FILTER_EQUALS), FILTER_VALUES_ENUM, $aLicenses);
return $oFilter; return $oFilter;
} }

View File

@@ -1368,6 +1368,13 @@ class version {
return $oTable->GetString(); return $oTable->GetString();
} }
/* Returns an array containg the different software licences */
public function getLicenses()
{
return array(LICENSE_RETAIL, LICENSE_OPENSOURCE, LICENSE_FREETOUSE,
LICENSE_FREETOSHARE, LICENSE_DEMO, LICENSE_SHAREWARE);
}
// returns a string containing the html for a selection list // returns a string containing the html for a selection list
public function makeLicenseList($sLicense = NULL) public function makeLicenseList($sLicense = NULL)
{ {
@@ -1376,8 +1383,7 @@ class version {
$sReturn = "<select name=\"sLicense\">\n"; $sReturn = "<select name=\"sLicense\">\n";
$sReturn .= "<option value=\"\">Choose . . .</option>\n"; $sReturn .= "<option value=\"\">Choose . . .</option>\n";
$aLicense = array(LICENSE_RETAIL, LICENSE_OPENSOURCE, LICENSE_FREETOUSE, $aLicense = version::getLicences();
LICENSE_FREETOSHARE, LICENSE_DEMO, LICENSE_SHAREWARE);
$iMax = count($aLicense); $iMax = count($aLicense);
for($i = 0; $i < $iMax; $i++) for($i = 0; $i < $iMax; $i++)