Added update property for things how ImageField

This commit is contained in:
Antonio de la Rosa 2015-08-29 04:48:26 +02:00
parent 22becfad23
commit 4f3641ad5b
2 changed files with 18 additions and 0 deletions

View file

@ -114,6 +114,11 @@ class PhangoField {
public $default_value='';
/**
* A property for know if updated or insert this field
*/
public $update=0;
/**

View file

@ -294,6 +294,12 @@ class Webmodel {
static public $form_type_checked=array();
/**
* A simple switch for know if updated or insert this model
*/
public $update=0;
//Construct the model
/**
@ -630,6 +636,8 @@ class Webmodel {
}
*/
$this->update=0;
$arr_fields=array();
if( $fields=$this->check_all($post, $safe_query) )
@ -706,6 +714,10 @@ class Webmodel {
$post=$this->unset_no_required($post);
//With this property your fields can save if insert or update
$this->update=1;
//Checking and sanitizing data from $post array for use in the query
if( $fields=$this->check_all($post, $safe_query) )
@ -1464,6 +1476,7 @@ class Webmodel {
if(isset($post[$key]) && ($field->protected==0 || $safe_query==1))
{
$this->components[$key]->update=$this->update;
//Check if the value is valid..