From 7a138bd2c2ad80cb75f7b2cb2bb0d8514e08fbb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Nicolaysen=20S=C3=B8rnes?= Date: Fri, 13 Jun 2008 23:18:07 +0200 Subject: [PATCH] filter_ui: Improve display of filters with only one operator --- include/db_filter_ui.php | 49 +++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/include/db_filter_ui.php b/include/db_filter_ui.php index d928b84..ed2f270 100644 --- a/include/db_filter_ui.php +++ b/include/db_filter_ui.php @@ -165,32 +165,45 @@ class FilterInterface $oColumn = $this->aFilterInfo[$oFilter->getColumn()]; $sId = ($iId == -1) ? '' : $iId; - $shEditor = $oColumn->getDisplayName(); + $shEditor = $oColumn->getDisplayName().' '; - $shEditor .= " "; + + /* Printing 'equal to' sounds weird if it is the only choice */ + if($aTypes[0] != FILTER_EQUALS) + $shEditor .= $oColumn->getOpName($aTypes[0]); } else { - $sSel = ''; - $sText = 'remove'; - } + $shEditor .= " '; + $shEditor .= ""; + + foreach($aTypes as $iType) + { + if($oFilter->getOperatorId() == $iType) + $sSel = " selected='selected'"; + else + $sSel = ''; + $shEditor .= "
'; + } + $shEditor .= ' '; + } switch($oColumn->getValueType()) { @@ -344,7 +357,7 @@ class FilterInterface $sData = $aClean["s{$sColumn}Data"]; $iOp = $aClean["i{$sColumn}Op"]; - if($iOp) + if($iOp && $sData) { $oFilter = new Filter($oOption->getColumn(), $iOp, $sData); $aReturn[] = $oFilter;