/** * (Output) Recursive processor for each search group * * @param $row * @return string */ protected function searchAdvancedGroup($row) { static $base = array('groupOp' => 'AND', 'rules' => array(), 'groups' => array()); static $basic_ops = array('eq' => '=', 'ne' => '!=', 'lt' => '<', 'le' => '<=', 'gt' => '>', 'ge' => '>='); static $like_ops = array('bw' => "LIKE '{data}%'", 'bn' => "NOT LIKE '{data}%'", 'ew' => "LIKE '%{data}'", 'en' => "NOT LIKE '%{data}'", 'cn' => "LIKE '%{data}%'", 'nc' => "NOT LIKE '%{data}%'"); $row = array_merge($base, $row); $row['groupOp'] = in_array($row['groupOp'], array('AND', 'OR')) ? $row['groupOp'] : 'AND'; $wh = array(); //------------ // Process rules //------------ foreach ($row['rules'] as $r) { if (!array_key_exists($r['field'], $this->cols)) { continue; } $op = $r['op']; $c = $this->cols[$r['field']]; $data = $this->searchCleanVal($r['data']); //------------- // Empty data? Skip this rule! //------------- if (empty($data) and !in_array($op, array('nu', 'nn'))) { continue; } //------------- // Customer search op //------------- if ($c['search_op'] and $c['search_op'] != 'auto') { $callback = array($this, jqGrid_Utils::uscore2camel('searchOp', $c['search_op'])); if (!is_callable($callback)) { throw new jqGrid_Exception('Search operation ' . $c['search_op'] . ' is not defined'); } $wh[] = call_user_func($callback, $c, $data); continue; } //------------- // Common search op's //------------- if (array_key_exists($op, $basic_ops)) { $wh[] = $c['db'] . ' ' . $basic_ops[$op] . " '{$data}'"; } elseif (array_key_exists($op, $like_ops)) { $wh[] = $c['db'] . ' ' . str_replace('{data}', addcslashes($data, '%_'), $like_ops[$op]); } else { switch ($op) { case 'nu': $wh[] = $c['db'] . ' IS NULL'; break; case 'nn': $wh[] = $c['db'] . ' IS NOT NULL'; break; case 'in': $wh[] = $c['db'] . " IN ('" . implode("','", array_map('trim', explode(',', $data))) . "')"; break; case 'ni': $wh[] = $c['db'] . " NOT IN ('" . implode("','", array_map('trim', explode(',', $data))) . "')"; break; } } } //------------ // Process sub-groups recursively //------------ foreach ($row['groups'] as $g) { $wh[] = $this->searchAdvancedGroup($g); } //------------ // Implode rules //------------ $wh = array_filter($wh); return $wh ? '(' . implode(' ' . $row['groupOp'] . ' ', $wh) . ')' : $this->where_empty; }
echo $s['name'][$lang]; ?> </a></h3> <div> <ul> <?php foreach ($s['items'] as $item_id => $item_name) { ?> <li<?php if (jqGrid_Utils::uscore2camel('jq', $item_id) == $grid) { ?> class="active"<?php } ?> ><a href="?render=<?php echo jqGrid_Utils::uscore2camel('jq', $item_id); ?> "><?php echo $item_name[$lang]; ?> </a></li> <?php } ?> </ul> </div> <?php } ?> </div>