20 define(
'XOBJ_DTYPE_TXTBOX', 1);
21 define(
'XOBJ_DTYPE_TXTAREA', 2);
22 define(
'XOBJ_DTYPE_INT', 3);
23 define(
'XOBJ_DTYPE_URL', 4);
24 define(
'XOBJ_DTYPE_EMAIL', 5);
25 define(
'XOBJ_DTYPE_ARRAY', 6);
26 define(
'XOBJ_DTYPE_OTHER', 7);
27 define(
'XOBJ_DTYPE_SOURCE', 8);
28 define(
'XOBJ_DTYPE_STIME', 9);
29 define(
'XOBJ_DTYPE_MTIME', 10);
30 define(
'XOBJ_DTYPE_LTIME', 11);
31 define(
'XOBJ_DTYPE_FLOAT', 13);
32 define(
'XOBJ_DTYPE_DECIMAL', 14);
33 define(
'XOBJ_DTYPE_ENUM', 15);
103 $this->_isNew =
true;
113 $this->_isNew =
false;
136 $this->_isDirty =
true;
146 $this->_isDirty =
false;
172 public function initVar($key, $data_type, $value = null, $required =
false, $maxlength = null,
$options =
'')
174 $this->vars[$key] = array(
176 'required' => $required,
177 'data_type' => $data_type,
178 'maxlength' => $maxlength,
194 if (isset($key) && isset($this->vars[$key])) {
195 $this->vars[$key][
'value'] = $value;
208 if(is_array($var_arr))
foreach ($var_arr as $key => $value) {
222 public function setVar($key, $value, $not_gpc =
false)
224 if (!empty($key) && isset($value) && isset($this->vars[$key])) {
225 $this->vars[$key][
'value'] = $value;
226 $this->vars[$key][
'not_gpc'] = $not_gpc;
227 $this->vars[$key][
'changed'] =
true;
240 public function setVars($var_arr, $not_gpc =
false)
242 if(is_array($var_arr))
foreach ($var_arr as $key => $value) {
243 $this->
setVar($key, $value, $not_gpc);
260 foreach (
$var as $key) {
261 if (!isset($this->vars[$key])) {
264 $this->vars[$key][
'changed'] = null;
282 public function setFormVars($var_arr = null, $pref =
'xo_', $not_gpc =
false)
284 $len = strlen($pref);
285 if(is_array($var_arr))
foreach ($var_arr as $key => $value) {
286 if ($pref == substr($key, 0, $len)) {
287 $this->
setVar(substr($key, $len), $value, $not_gpc);
315 $keys = array_keys($this->vars);
319 if (isset($this->vars[$key])) {
320 if (is_object($this->vars[$key]) && is_a($this->vars[$key],
'Xoops\Core\Kernel\XoopsObject')) {
323 $obj = $this->vars[$key];
324 $vars[$key] = $obj->getValues(null, $format, $maxDepth - 1);
342 public function getVar($key, $format =
's')
345 if (!isset($this->vars[$key])) {
365 $this->_errors = array();
366 foreach ($this->vars as $k => $v) {
367 if (!$v[
'changed']) {
372 if (count($this->_errors) > 0) {
373 $this->_errors = array_merge($existing_errors, $this->_errors);
390 $this->_filters[] = $filtername;
401 if (isset($loaded)) {
409 if(is_array($this->_filters))
foreach ($this->_filters as $f) {
434 $class = get_class($this);
440 $function = $dirname .
'_' . $class .
'_' . $method;
441 if (function_exists($function)) {
442 call_user_func_array($function, array(&$this));
457 $class = get_class($this);
459 $clone =
new $class();
460 foreach ($this->vars as $k => $v) {
461 $clone->assignVar($k, $v[
'value']);
477 if (is_array($err_str)) {
478 $this->_errors = array_merge($this->_errors, $err_str);
480 $this->_errors[] = trim($err_str);
504 $ret =
'<h4>Errors</h4>';
505 if (!empty($this->_errors)) {
506 foreach ($this->_errors as
$error) {
507 $ret .= $error .
'<br />';
510 $ret .=
'None<br />';
if(empty($settings['ROOT_PATH'])) elseif(empty($settings['DB_PARAMETERS'])) $error
static getVar(XoopsObject $obj, $key, $format)
static cleanVar(XoopsObject $obj, $key, $quote=true)
if(!isset($xoops->paths[$path_type])) if($path_type== 'var') $file
getVar($key, $format= 's')
setFormVars($var_arr=null, $pref= 'xo_', $not_gpc=false)
getValues($keys=null, $format= 's', $maxDepth=1)
setVars($var_arr, $not_gpc=false)
registerFilter($filtername)
setVar($key, $value, $not_gpc=false)
initVar($key, $data_type, $value=null, $required=false, $maxlength=null, $options= '')