application: Add support for filtering by app category
This commit is contained in:
committed by
Chris Morgan
parent
f453c5d7a0
commit
7d0469978c
@@ -1010,8 +1010,18 @@ class Application {
|
||||
public static function objectGetFilterInfo()
|
||||
{
|
||||
$oFilter = new FilterInterface();
|
||||
$aCategories = category::getOrderedList();
|
||||
$aCatNames = array();
|
||||
$aCatIds = array();
|
||||
|
||||
foreach($aCategories as $oCategory)
|
||||
{
|
||||
$aCatNames[] = $oCategory->sName;
|
||||
$aCatIds[] = $oCategory->objectGetId();
|
||||
}
|
||||
|
||||
$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);
|
||||
return $oFilter;
|
||||
}
|
||||
|
||||
@@ -1138,7 +1148,7 @@ class Application {
|
||||
{
|
||||
$sExtraTables = ',appVersion';
|
||||
$sWhereFilter = " AND appVersion.appId = appFamily.appId AND $sWhereFilter";
|
||||
}
|
||||
}
|
||||
|
||||
if($sState != 'accepted' && !application::canEdit())
|
||||
{
|
||||
|
||||
@@ -135,6 +135,38 @@ class Category {
|
||||
return array();
|
||||
}
|
||||
|
||||
/* Get a category's subcategory objects. Names are indented according
|
||||
to subcategory level */
|
||||
function getSubCatList($iLevel)
|
||||
{
|
||||
$aOut = array();
|
||||
$iId = $this->iCatId ? $this->iCatId : 0;
|
||||
|
||||
$sIndent = '';
|
||||
for($i = 0; $i < $iLevel; $i++)
|
||||
$sIndent .= ' ';
|
||||
|
||||
$hResult = query_parameters("SELECT * FROM appCategory WHERE catParent = '?'
|
||||
ORDER BY catName", $iId);
|
||||
|
||||
while($oRow = mysql_fetch_object($hResult))
|
||||
{
|
||||
$oCat = new category($oRow->catId);
|
||||
$oCat->sName = $sIndent.$oCat->sName;
|
||||
$aOut[] = $oCat;
|
||||
$aOut = array_merge($aOut, $oCat->getSubCatList($iLevel + 1));
|
||||
}
|
||||
return $aOut;
|
||||
}
|
||||
|
||||
/* Get all category objects, ordered and with category names indented
|
||||
according to subcategory level */
|
||||
static function getOrderedList()
|
||||
{
|
||||
$oCat = new category();
|
||||
return $oCat->getSubCatList(0);
|
||||
}
|
||||
|
||||
function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
|
||||
{
|
||||
/* We don't send notification mails */
|
||||
|
||||
Reference in New Issue
Block a user