mirror of
https://github.com/e107inc/e107.git
synced 2025-08-20 13:21:54 +02:00
Send field and field-type values to e_parse toDB
This commit is contained in:
@@ -514,6 +514,17 @@ class e_model extends e_object
|
||||
*/
|
||||
protected $_data_fields = array();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Current model field types eg. text, bbarea, dropdown etc.
|
||||
*
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_field_input_types = array();
|
||||
|
||||
|
||||
/**
|
||||
* Current model DB table, used in all db calls
|
||||
*
|
||||
@@ -719,6 +730,21 @@ class e_model extends e_object
|
||||
return $this->_data_fields;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
* @return bool
|
||||
*/
|
||||
public function getFieldInputType($key)
|
||||
{
|
||||
if(isset($this->_field_input_types[$key]))
|
||||
{
|
||||
return $this->_field_input_types[$key];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Predefined data fields in format key => type
|
||||
* @return e_model
|
||||
@@ -729,6 +755,16 @@ class e_model extends e_object
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Predefined data fields in format key => type
|
||||
* @return e_model
|
||||
*/
|
||||
public function setFieldInputTypes($fields)
|
||||
{
|
||||
$this->_field_input_types = $fields;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Predefined data field
|
||||
* @return e_model
|
||||
@@ -2646,6 +2682,7 @@ class e_front_model extends e_model
|
||||
$value = $this->getPostedData($key);
|
||||
}
|
||||
|
||||
|
||||
switch ($type)
|
||||
{
|
||||
case 'int':
|
||||
@@ -2660,7 +2697,8 @@ class e_front_model extends e_model
|
||||
case 'str':
|
||||
case 'string':
|
||||
case 'array':
|
||||
return $tp->toDB($value, false, false, 'model');
|
||||
$type = $this->getFieldInputType($key);
|
||||
return $tp->toDB($value, false, false, 'model', array('type'=>$type, 'field'=>$key));
|
||||
break;
|
||||
|
||||
case 'json':
|
||||
|
Reference in New Issue
Block a user