var $dec;
//
//
- function simple_crud($name, $fields = null)
+ function __construct($name, $fields = null)
{
$this->name = $name;
$this->pre_handlers = array(
if (isset($_POST[$this->name.$m])) {
unset($_POST['_focus']); // focus on first form entry
$Ajax->activate($this->name.'_div');
- $val = @key($_POST[$this->name.$m]);
+ $val = is_array($_POST[$this->name.$m]) ? key($_POST[$this->name.$m]) : null;
$this->selected_id = $val!==null ? @quoted_printable_decode($val) : $this->_none;
return $m;
}
$name = $fmt;
$fmt = array();
}
+ if (is_string($fmt)) {
+ $fmt = array('fmt' => $fmt);
+ }
$post = isset($fmt['post']) ? $fmt['post'] : $name;
$fld = isset($fmt['fld']) ? $fmt['fld'] : $name;
- $value = $this->selected_id == $this->_none ? @$fmt['dflt'] :
+ $value = $this->selected_id == $this->_none ? (isset($fmt['dflt']) ? $fmt['dflt'] : null) :
(is_array($this->data) ? $this->data[$fld]: $this->data->$fld);
- $_POST[$post] = $this->_format_output($value, @$fmt['fmt']);
+ $_POST[$post] = $this->_format_output($value, isset($fmt['fmt']) ? $fmt['fmt'] : null);
}
}
//--------------------------
$name = $fmt;
$fmt = array();
}
+ if (is_string($fmt)) {
+ $fmt = array('fmt' => $fmt);
+ }
$post = isset($fmt['post']) ? $fmt['post'] : $name;
$fld = isset($fmt['fld']) ? $fmt['fld'] : $name;