| version 1.65, 2003/03/30 21:57:30 |
version 1.66, 2003/03/31 18:44:20 |
|
|
| * http://www.platon.sk/projects/phpMyEdit/ |
* http://www.platon.sk/projects/phpMyEdit/ |
| */ |
*/ |
| |
|
| /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.64 2003/03/30 01:12:30 nepto Exp $ */ |
/* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.65 2003/03/30 21:57:30 nepto Exp $ */ |
| |
|
| /* This is a generic table editing program. The table and fields to be |
/* This is a generic table editing program. The table and fields to be |
| edited are defined in the calling program. |
edited are defined in the calling program. |
| Line 753 function phpMyEdit_form_control(theForm) |
|
| Line 753 function phpMyEdit_form_control(theForm) |
|
| echo '<td class="',$this->getCSSclass('key', '', true),'">',$this->fdd[$k]['name'],'</td>',"\n"; |
echo '<td class="',$this->getCSSclass('key', '', true),'">',$this->fdd[$k]['name'],'</td>',"\n"; |
| echo '<td class="',$this->getCSSclass('value', '', true),'">'."\n"; |
echo '<td class="',$this->getCSSclass('value', '', true),'">'."\n"; |
| $css_class_name = $this->getCSSclass('input', '', true); |
$css_class_name = $this->getCSSclass('input', '', true); |
| if ($this->col_has_values($k) && !$this->readonly($k)) { |
if ($this->col_has_values($k)) { |
| $vals = $this->set_values($k); |
$vals = $this->set_values($k); |
| $selected = @$this->fdd[$k]['default']; |
$selected = @$this->fdd[$k]['default']; |
| $multiple = $this->fdd[$k]['select'] == 'M' && ! $this->fdd[$k]['values']['table']; |
$multiple = $this->fdd[$k]['select'] == 'M' && ! $this->fdd[$k]['values']['table']; |
| echo $this->htmlSelect($this->fds[$k], $css_class_name, $vals, $selected, $multiple); |
$readonly = $this->readonly($k); |
| } elseif (isset ($this->fdd[$k]['textarea']) && !$this->readonly($k)) { |
echo $this->htmlSelect($this->fds[$k], $css_class_name, $vals, $selected, $multiple,$readonly); |
| echo '<textarea class="',$css_class_name,'" '; |
} elseif (isset ($this->fdd[$k]['textarea'])) { |
| if (isset ($this->fdd[$k]['textarea']['rows'])) { |
echo '<textarea class="',$css_class_name,'" name="'.$this->fds[$k].'"'; |
| echo 'rows="',$this->fdd[$k]['textarea']['rows'],'" '; |
echo ($this->readonly($k) ? ' disabled' : ''); |
| } |
if (intval($this->fdd[$k]['textarea']['rows']) > 0) { |
| if (isset ($this->fdd[$k]['textarea']['cols'])) { |
echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"'; |
| echo 'cols="',$this->fdd[$k]['textarea']['cols'],'" '; |
} |
| } |
if (intval($this->fdd[$k]['textarea']['cols']) > 0) { |
| echo 'name="',$this->fds[$k],'" wrap="virtual">'; |
echo ' cols="',$this->fdd[$k]['textarea']['cols'],'"'; |
| echo htmlspecialchars($this->fdd[$k]['default']); |
} |
| echo '</textarea>',"\n"; |
if (isset($this->fdd[$k]['textarea']['wrap'])) { |
| |
echo ' wrap="',$this->fdd[$k]['textarea']['wrap'],'"'; |
| |
} else { |
| |
echo ' wrap="virtual"'; |
| |
} |
| |
echo '>',htmlspecialchars($this->fdd[$k]['default']),'</textarea>',"\n"; |
| } else { |
} else { |
| // Simple edit box required |
// Simple edit box required |
| $size_ml_props = ''; |
$size_ml_props = ''; |
| Line 864 function phpMyEdit_form_control(theForm) |
|
| Line 869 function phpMyEdit_form_control(theForm) |
|
| { |
{ |
| echo '<td class="',$this->getCSSclass('value', '', true),'">',"\n"; |
echo '<td class="',$this->getCSSclass('value', '', true),'">',"\n"; |
| $css_class_name = $this->getCSSclass('input', '', true); |
$css_class_name = $this->getCSSclass('input', '', true); |
| if ($this->col_has_values($k) && !$this->readonly($k)) { |
if ($this->col_has_values($k)) { |
| $vals = $this->set_values($k); |
$vals = $this->set_values($k); |
| $multiple = $this->fdd[$k]['select'] == 'M' && ! $this->fdd[$k]['values']['table']; |
$multiple = $this->fdd[$k]['select'] == 'M' && ! $this->fdd[$k]['values']['table']; |
| echo $this->htmlSelect($this->fds[$k], $css_class_name, $vals, $row["qf$k"], $multiple); |
$readonly = $this->readonly($k); |
| } elseif (isset($this->fdd[$k]['textarea']) && !$this->readonly($k)) { |
echo $this->htmlSelect($this->fds[$k], $css_class_name, $vals, $row["qf$k"], $multiple, $readonly); |
| |
} elseif (isset($this->fdd[$k]['textarea'])) { |
| echo '<textarea class="',$css_class_name,'" name="'.$this->fds[$k].'"'; |
echo '<textarea class="',$css_class_name,'" name="'.$this->fds[$k].'"'; |
| |
echo ($this->readonly($k) ? ' disabled' : ''); |
| if (intval($this->fdd[$k]['textarea']['rows']) > 0) { |
if (intval($this->fdd[$k]['textarea']['rows']) > 0) { |
| echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"'; |
echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"'; |
| } |
} |
| Line 1058 function phpMyEdit_form_control(theForm) |
|
| Line 1065 function phpMyEdit_form_control(theForm) |
|
| * @param kv_array key => value array |
* @param kv_array key => value array |
| * @param selected selected key (it can be single string, array of |
* @param selected selected key (it can be single string, array of |
| * keys or multiple values separated by comma |
* keys or multiple values separated by comma |
| * @param multiple bool for mulptiple selection |
* @param multiple bool for multiple selection |
| * @param nat_sort bool for natural sorting |
* @param readonly bool for readonly/disabled selection |
| */ |
*/ |
| function htmlSelect($name, $css, $kv_array, $selected = null, $multiple = false, $nat_sort = false) /* {{{ */ |
function htmlSelect($name, $css, $kv_array, $selected = null, $multiple = false, $readonly = false) /* {{{ */ |
| { |
{ |
| $ret = '<select class="'.htmlspecialchars($css).'" name="'.htmlspecialchars($name); |
$ret = '<select class="'.htmlspecialchars($css).'" name="'.htmlspecialchars($name); |
| if ($multiple) { |
if ($multiple) { |
| Line 1070 function phpMyEdit_form_control(theForm) |
|
| Line 1077 function phpMyEdit_form_control(theForm) |
|
| $selected = explode(',', $selected); |
$selected = explode(',', $selected); |
| } |
} |
| } |
} |
| $ret .= '">'."\n"; |
$ret .= '"'.($readonly ? ' disabled' : '').'>'."\n"; |
| if ($nat_sort) { |
|
| uasort($kv_array,'strnatcasecmp'); |
|
| } |
|
| if (! is_array($selected)) { |
if (! is_array($selected)) { |
| $selected = $selected === null ? array() : array($selected); |
$selected = $selected === null ? array() : array($selected); |
| } |
} |