Slight debug of selects
parent
4527ed6593
commit
894fcbd37a
33
olap.php
33
olap.php
|
@ -10,6 +10,21 @@ require_once 'lib/templating.php';
|
|||
|
||||
require_once 'olap_config.php';
|
||||
|
||||
foreach ($_REQUEST as $k => $v)
|
||||
{
|
||||
if ($v === "")
|
||||
{
|
||||
unset($_GET[$k]);
|
||||
unset($_POST[$k]);
|
||||
$modified = true;
|
||||
}
|
||||
}
|
||||
if ($modified)
|
||||
{
|
||||
header("Location: ?".http_build_query($_GET+$_POST));
|
||||
exit;
|
||||
}
|
||||
|
||||
OLAP::execute($_REQUEST);
|
||||
exit;
|
||||
|
||||
|
@ -110,11 +125,11 @@ class OLAP
|
|||
if (substr($k, 0, 6) == 'where-')
|
||||
{
|
||||
list($t, $f) = explode('-', substr($k, 6), 2);
|
||||
$fd = self::$current_src['fielddescs'][$f];
|
||||
$fd = &self::$current_src['fielddescs'][$f];
|
||||
if (!$fd)
|
||||
{
|
||||
$f = str_replace('_', ' ', $f);
|
||||
$fd = self::$current_src['fielddescs'][$f];
|
||||
$fd = &self::$current_src['fielddescs'][$f];
|
||||
}
|
||||
if (!$fd || !strlen($v))
|
||||
continue;
|
||||
|
@ -124,13 +139,19 @@ class OLAP
|
|||
$dn = $fd['sql'];
|
||||
if (!$dn)
|
||||
$dn = $f;
|
||||
$v = mysql_ecranize($v);
|
||||
$ve = mysql_ecranize($v);
|
||||
if ($t == 'eq')
|
||||
$where[] = "$dn = $v";
|
||||
{
|
||||
$where[] = "$dn = $ve";
|
||||
if ($fd['options'])
|
||||
foreach ($fd['options'] as &$o)
|
||||
if ("$o[id]" === $v)
|
||||
$o['selected'] = true;
|
||||
}
|
||||
elseif ($t == 'ge' && $fd['le_ge'])
|
||||
$where[] = "$dn >= $v";
|
||||
$where[] = "$dn >= $ve";
|
||||
elseif ($t == 'le' && $fd['le_ge'])
|
||||
$where[] = "$dn <= $v";
|
||||
$where[] = "$dn <= $ve";
|
||||
else
|
||||
unset($wh[$k]);
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
<select style="width: 100px" name="where-eq-{f.id}">
|
||||
<option value="">любой</option>
|
||||
<!-- FOR o = f.options -->
|
||||
<option value="{s o.id}"<!-- IF eq(o.id,get(wh,concat('where-eq-',f.id))) --> selected<!-- END -->>{s o.name}</option>
|
||||
<option value="{s o.id}"<!-- IF o.selected --> selected<!-- END -->>{s o.name}</option>
|
||||
<!-- END -->
|
||||
</select>
|
||||
<!-- ELSE -->
|
||||
|
|
Loading…
Reference in New Issue