| version 1.205, 2007/09/22 12:11:50 |
version 1.206, 2007/09/22 13:24:30 |
| Line 2018 function '.$this->js['prefix'].'filter_h |
|
| Line 2018 function '.$this->js['prefix'].'filter_h |
|
| $this->total_recs = $row[0]; |
$this->total_recs = $row[0]; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| |
function filter_heading($sys_cols) /* {{{ */ |
| |
{ |
| |
/* FILTER {{{ |
| |
* |
| |
* Draw the filter and fill it with any data typed in last pass and stored |
| |
* in the array parameter keyword 'filter'. Prepare the SQL WHERE clause. |
| |
*/ |
| |
|
| |
// Filter row retrieval |
| |
/*$fields = false; |
| |
$filter_row = array();//$row; |
| |
if (! is_array($filter_row)) { echo 'tttt'; |
| |
unset($qparts['where']); |
| |
$query = $this->get_SQL_query($qparts); |
| |
$res = $this->myquery($query, __LINE__); |
| |
if ($res == false) { |
| |
$this->error('invalid SQL query', $query); |
| |
return false; |
| |
} |
| |
$filter_row = $this->sql_fetch($res); |
| |
}*/ |
| |
/* TODO - $fields is completely useless (michal) |
| |
Variable $fields is used to get index of particular field in |
| |
result. That index can be passed in example to $this->sql_field_len() |
| |
function. Use field names as indexes to $fields array. */ |
| |
if (is_array($filter_row)) { |
| |
$fields = array_flip(array_keys($filter_row)); |
| |
} |
| |
//if ($fields != false) { |
| |
$css_class_name = $this->getCSSclass('filter'); |
| |
echo '<tr class="',$css_class_name,'">',"\n"; |
| |
echo '<td class="',$css_class_name,'" colspan="',$sys_cols,'">'; |
| |
echo $this->htmlSubmit('filter', 'Query', $this->getCSSclass('query'), false); |
| |
echo '</td>', "\n"; |
| |
for ($k = 0; $k < $this->num_fds; $k++) { |
| |
if (! $this->displayed[$k]) { |
| |
continue; |
| |
} |
| |
$css_postfix = @$this->fdd[$k]['css']['postfix']; |
| |
$css_class_name = $this->getCSSclass('filter', null, null, $css_postfix); |
| |
$this->field_name = $this->fds[$k]; |
| |
$fd = $this->field_name; |
| |
$this->field = $this->fdd[$fd]; |
| |
$l = 'qf'.$k; |
| |
$lc = 'qf'.$k.'_comp'; |
| |
$li = 'qf'.$k.'_id'; |
| |
if ($this->clear_operation()) { |
| |
$m = null; |
| |
$mc = null; |
| |
$mi = null; |
| |
} else { |
| |
$m = $this->get_sys_cgi_var($l); |
| |
$mc = $this->get_sys_cgi_var($lc); |
| |
$mi = $this->get_sys_cgi_var($li); |
| |
} |
| |
echo '<td class="',$css_class_name,'">'; |
| |
if ($this->password($k)) { |
| |
echo ' '; |
| |
} else if ($this->fdd[$fd]['select'] == 'D' || $this->fdd[$fd]['select'] == 'M') { |
| |
// Multiple fields processing |
| |
// Default size is 2 and array required for values. |
| |
$from_table = ! $this->col_has_values($k) || isset($this->fdd[$k]['values']['table']); |
| |
$vals = $this->set_values($k, array('*' => '*'), null, $from_table); |
| |
$selected = $mi; |
| |
$multiple = $this->col_has_multiple_select($k); |
| |
$multiple |= $this->fdd[$fd]['select'] == 'M'; |
| |
$readonly = false; |
| |
$strip_tags = true; |
| |
$escape = true; |
| |
echo $this->htmlSelect($this->cgi['prefix']['sys'].$l.'_id', $css_class_name, |
| |
$vals, $selected, $multiple, $readonly, $strip_tags, $escape); |
| |
} elseif ($this->fdd[$fd]['select'] == 'N' || $this->fdd[$fd]['select'] == 'T') { |
| |
$len_props = ''; |
| |
$maxlen = intval($this->fdd[$k]['maxlen']); |
| |
//$maxlen > 0 || $maxlen = intval($this->sql_field_len($res, $fields["qf$k"])); |
| |
$maxlen > 0 || $maxlen = 500; |
| |
$size = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size'] |
| |
: ($maxlen < 30 ? min($maxlen, 8) : 12); |
| |
$len_props .= ' size="'.$size.'"'; |
| |
$len_props .= ' maxlength="'.$maxlen.'"'; |
| |
if ($this->fdd[$fd]['select'] == 'N') { |
| |
$mc = in_array($mc, $this->comp_ops) ? $mc : '='; |
| |
echo $this->htmlSelect($this->cgi['prefix']['sys'].$l.'_comp', |
| |
$css_class_name, $this->comp_ops, $mc); |
| |
} |
| |
echo '<input class="',$css_class_name,'" value="',htmlspecialchars(@$m); |
| |
echo '" type="text" name="'.$this->cgi['prefix']['sys'].'qf'.$k.'"',$len_props; |
| |
echo ' onkeypress="return '.$this->js['prefix'].'filter_handler(this.form, event);" />'; |
| |
} else { |
| |
echo ' '; |
| |
} |
| |
echo '</td>',"\n"; |
| |
} |
| |
echo '</tr>',"\n"; |
| |
//} |
| |
} /* }}} */ |
| /* |
/* |
| * Table Page Listing |
* Table Page Listing |
| */ |
*/ |
| Line 2189 function '.$this->js['prefix'].'filter_h |
|
| Line 2285 function '.$this->js['prefix'].'filter_h |
|
| } |
} |
| $row = $this->sql_fetch($res); |
$row = $this->sql_fetch($res); |
| |
|
| /* FILTER {{{ |
// filter |
| * |
if ($this->filter_operation()) $this->filter_heading($sys_cols); |
| * Draw the filter and fill it with any data typed in last pass and stored |
|
| * in the array parameter keyword 'filter'. Prepare the SQL WHERE clause. |
|
| */ |
|
| if ($this->filter_operation()) { |
|
| // Filter row retrieval |
|
| $fields = false; |
|
| $filter_row = $row; |
|
| if (! is_array($filter_row)) { |
|
| unset($qparts['where']); |
|
| $query = $this->get_SQL_query($qparts); |
|
| $res = $this->myquery($query, __LINE__); |
|
| if ($res == false) { |
|
| $this->error('invalid SQL query', $query); |
|
| return false; |
|
| } |
|
| $filter_row = $this->sql_fetch($res); |
|
| } |
|
| /* Variable $fields is used to get index of particular field in |
|
| result. That index can be passed in example to $this->sql_field_len() |
|
| function. Use field names as indexes to $fields array. */ |
|
| if (is_array($filter_row)) { |
|
| $fields = array_flip(array_keys($filter_row)); |
|
| } |
|
| if ($fields != false) { |
|
| $css_class_name = $this->getCSSclass('filter'); |
|
| echo '<tr class="',$css_class_name,'">',"\n"; |
|
| echo '<td class="',$css_class_name,'" colspan="',$sys_cols,'">'; |
|
| echo $this->htmlSubmit('filter', 'Query', $this->getCSSclass('query'), false); |
|
| echo '</td>', "\n"; |
|
| for ($k = 0; $k < $this->num_fds; $k++) { |
|
| if (! $this->displayed[$k]) { |
|
| continue; |
|
| } |
|
| $css_postfix = @$this->fdd[$k]['css']['postfix']; |
|
| $css_class_name = $this->getCSSclass('filter', null, null, $css_postfix); |
|
| $this->field_name = $this->fds[$k]; |
|
| $fd = $this->field_name; |
|
| $this->field = $this->fdd[$fd]; |
|
| $l = 'qf'.$k; |
|
| $lc = 'qf'.$k.'_comp'; |
|
| $li = 'qf'.$k.'_id'; |
|
| if ($this->clear_operation()) { |
|
| $m = null; |
|
| $mc = null; |
|
| $mi = null; |
|
| } else { |
|
| $m = $this->get_sys_cgi_var($l); |
|
| $mc = $this->get_sys_cgi_var($lc); |
|
| $mi = $this->get_sys_cgi_var($li); |
|
| } |
|
| echo '<td class="',$css_class_name,'">'; |
|
| if ($this->password($k)) { |
|
| echo ' '; |
|
| } else if ($this->fdd[$fd]['select'] == 'D' || $this->fdd[$fd]['select'] == 'M') { |
|
| // Multiple fields processing |
|
| // Default size is 2 and array required for values. |
|
| $from_table = ! $this->col_has_values($k) || isset($this->fdd[$k]['values']['table']); |
|
| $vals = $this->set_values($k, array('*' => '*'), null, $from_table); |
|
| $selected = $mi; |
|
| $multiple = $this->col_has_multiple_select($k); |
|
| $multiple |= $this->fdd[$fd]['select'] == 'M'; |
|
| $readonly = false; |
|
| $strip_tags = true; |
|
| $escape = true; |
|
| echo $this->htmlSelect($this->cgi['prefix']['sys'].$l.'_id', $css_class_name, |
|
| $vals, $selected, $multiple, $readonly, $strip_tags, $escape); |
|
| } elseif ($this->fdd[$fd]['select'] == 'N' || $this->fdd[$fd]['select'] == 'T') { |
|
| $len_props = ''; |
|
| $maxlen = intval($this->fdd[$k]['maxlen']); |
|
| $maxlen > 0 || $maxlen = intval($this->sql_field_len($res, $fields["qf$k"])); |
|
| $size = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size'] |
|
| : ($maxlen < 30 ? min($maxlen, 8) : 12); |
|
| $len_props .= ' size="'.$size.'"'; |
|
| $len_props .= ' maxlength="'.$maxlen.'"'; |
|
| if ($this->fdd[$fd]['select'] == 'N') { |
|
| $mc = in_array($mc, $this->comp_ops) ? $mc : '='; |
|
| echo $this->htmlSelect($this->cgi['prefix']['sys'].$l.'_comp', |
|
| $css_class_name, $this->comp_ops, $mc); |
|
| } |
|
| echo '<input class="',$css_class_name,'" value="',htmlspecialchars(@$m); |
|
| echo '" type="text" name="'.$this->cgi['prefix']['sys'].'qf'.$k.'"',$len_props; |
|
| echo ' onkeypress="return '.$this->js['prefix'].'filter_handler(this.form, event);" />'; |
|
| } else { |
|
| echo ' '; |
|
| } |
|
| echo '</td>',"\n"; |
|
| } |
|
| echo '</tr>',"\n"; |
|
| } |
|
| } // }}} |
|
| |
|
| /* |
/* |
| * Display sorting sequence |
* Display sorting sequence |
| */ |
*/ |