implemented grouping by itemlevel and slot for items

group by source won't require much additional work besides adding source to
items in the first place

search for multiple itemUpgrades are also yet to come
This commit is contained in:
Sarjuuk
2014-03-20 17:08:59 +01:00
parent 1ced59c113
commit f236d7ae93
10 changed files with 268 additions and 140 deletions

View File

@@ -349,7 +349,6 @@ abstract class BaseType
// additional (str)
case 'g': // group by
case 'h': // having
case 'o': // order by
if (!empty($this->queryOpts[$tbl][$module]))
$this->queryOpts[$tbl][$module] .= $value;
else
@@ -364,9 +363,10 @@ abstract class BaseType
$this->queryOpts[$tbl][$module] = $value;
break;
// replacement
// replacement (str)
case 'l': // limit
case 's': // select
case 'o': // order by
$this->queryOpts[$tbl][$module] = $value;
break;
}
@@ -543,7 +543,7 @@ abstract class Filter
private $cndSet = [];
protected $fiData = ['c' => [], 'v' =>[]];
protected $formData = array( // data to fill form fields
protected $formData = array( // data to fill form fields
'form' => [], // base form - unsanitized
'setCriteria' => [], // dynamic criteria list - index checked
'setWeights' => [], // dynamic weights list - index checked
@@ -581,20 +581,8 @@ abstract class Filter
}
}
// create get-data
$tmp = [];
foreach (array_merge($this->fiData['c'], $this->fiData['v']) as $k => $v)
{
if ($v === '')
continue;
else if (is_array($v))
$tmp[$k] = $k."=".implode(':', $v);
else
$tmp[$k] = $k."=".$v;
}
// do get request
header('Location: '.HOST_URL.'?'.$_SERVER['QUERY_STRING'].'='.implode(';', $tmp));
header('Location: '.HOST_URL.'?'.$_SERVER['QUERY_STRING'].'='.$this->urlize());
}
// sanitize input and build sql
else if (!empty($_GET['filter']))
@@ -674,6 +662,23 @@ abstract class Filter
}
}
public function urlize(array $override = [], array $addCr = [])
{
$_ = [];
foreach (array_merge($this->fiData['c'], $this->fiData['v'], $override) as $k => $v)
{
if (isset($addCr[$k]))
$v = $v ? array_merge((array)$v, (array)$addCr[$k]) : $addCr[$k];
if (is_array($v) && !empty($v))
$_[$k] = $k.'='.implode(':', $v);
else if ($v === '')
$_[$k] = $k.'='.$v;
}
return implode(';', $_);
}
// todo: kill data, that is unexpected or points to wrong indizes
private function evaluateFilter()
{