Browse apps: Include sub-categories when filtering by category

This commit is contained in:
Alexander Nicolaysen Sørnes
2009-04-05 16:01:11 +02:00
parent 460af69ae5
commit 7cbc67f1f5
4 changed files with 88 additions and 16 deletions

View File

@@ -18,6 +18,7 @@ define('FILTER_LESS_THAN', 7);
define('FILTER_NOT_EQUALS', 8);
define('FILTER_NOT_LIKE', 9);
define('FILTER_OPTION_BOOL', 10);
define('FILTER_OPTION_ENUM', 11);
/* A filter as part of an SQL query, such as something = 'somevalue' */
class Filter
@@ -82,7 +83,7 @@ class Filter
public function getExpression()
{
/* We let callers handle options themselves, so don't include them in the WHERE clause */
if($this->iType == FILTER_OPTION_BOOL)
if($this->isOption())
return '';
$sData = $this->sData;
@@ -105,6 +106,19 @@ class Filter
return "{$this->sColumn} $sOp '$sData'";
}
public function IsOption()
{
switch($this->iType)
{
case FILTER_OPTION_BOOL:
case FILTER_OPTION_ENUM:
return true;
default:
return false;
}
}
}
/* Class handling tables where the user can filter contents */