diff --git a/src/CoreFields/I18nField.php b/src/CoreFields/I18nField.php index 7c03594..74ee7f7 100644 --- a/src/CoreFields/I18nField.php +++ b/src/CoreFields/I18nField.php @@ -13,6 +13,7 @@ namespace PhangoApp\PhaModels\CoreFields; use PhangoApp\PhaI18n\I18n; use PhangoApp\PhaModels\Forms\MultiLangForm; +use PhangoApp\PhaModels\Forms\TextForm; use PhangoApp\PhaModels\CoreFields\SlugifyField; /** @@ -39,6 +40,7 @@ class I18nField extends PhangoField { { $this->type_field=&$type_field; + $this->parameters=[]; } diff --git a/src/CoreFields/ImageField.php b/src/CoreFields/ImageField.php index 50ff50b..55ff518 100644 --- a/src/CoreFields/ImageField.php +++ b/src/CoreFields/ImageField.php @@ -63,20 +63,22 @@ class ImageField extends PhangoField { //Check the image for delete. //This field is used only for a row + //echo $this->model_instance->conditions; die; $old_reset=Webmodel::$model[$this->name_model]->reset_conditions; Webmodel::$model[$this->name_model]->reset_conditions=0; $old_image=Webmodel::$model[$this->name_model]->select_a_row_where(array($this->name_component), 1)[$this->name_component]; Webmodel::$model[$this->name_model]->reset_conditions=$old_reset; + + } if(isset($_FILES[$file_name]['tmp_name'])) { - + if(trim($_FILES[$file_name]['tmp_name'])!=='') { - $name_image=$_FILES[$file_name]['name']; if($this->prefix_id) diff --git a/src/CoreFields/SlugifyField.php b/src/CoreFields/SlugifyField.php index 66615b8..0a9bcc6 100644 --- a/src/CoreFields/SlugifyField.php +++ b/src/CoreFields/SlugifyField.php @@ -1,6 +1,8 @@ components[$field.'_'.$lang_field]=new SlugifyField(); + Webmodel::$model[$model_name]->components[$field.'_'.$lang_field]=new SlugifyField(); } diff --git a/src/CoreFields/TextField.php b/src/CoreFields/TextField.php index 507b26e..ba2d1c1 100644 --- a/src/CoreFields/TextField.php +++ b/src/CoreFields/TextField.php @@ -12,7 +12,6 @@ class TextField extends PhangoField { public $value=""; public $label=""; public $required=0; - public $form="TextAreaForm"; public $quot_open='\''; public $quot_close='\''; public $std_error=''; @@ -22,7 +21,7 @@ class TextField extends PhangoField { function __construct($multilang=0) { - $this->form='PhangoApp\PhaModels\Forms\BaseForm'; + $this->form='PhangoApp\PhaModels\Forms\TextAreaForm'; $this->multilang=$multilang; } diff --git a/src/CoreFields/TextHTMLField.php b/src/CoreFields/TextHTMLField.php index b414feb..5ce95b5 100644 --- a/src/CoreFields/TextHTMLField.php +++ b/src/CoreFields/TextHTMLField.php @@ -12,7 +12,6 @@ class TextHTMLField extends PhangoField { public $value=""; public $label=""; public $required=0; - public $form="TextAreaForm"; public $quot_open='\''; public $quot_close='\''; public $std_error=''; @@ -25,7 +24,7 @@ class TextHTMLField extends PhangoField { function __construct($multilang=0) { - $this->form='PhangoApp\PhaModels\Forms\BaseForm'; + $this->form='PhangoApp\PhaModels\Forms\TextAreaEditor'; $this->set_safe_html_tags(); diff --git a/src/Forms/MultiLangForm.php b/src/Forms/MultiLangForm.php index 0cbd600..888962f 100644 --- a/src/Forms/MultiLangForm.php +++ b/src/Forms/MultiLangForm.php @@ -11,12 +11,19 @@ class MultiLangForm extends BaseForm{ public $type_form; - public function __construct($name, $value, $type_form='PhangoApp\PhaModels\Forms\BaseForm') + public function __construct($name, $value, $form_class='') { - - $this->type_form=new $type_form($name, $value); - + parent::__construct($name, $value); + + if($form_class=='') + { + + $form_class=new BaseForm($name, $value); + + } + + $this->type_form=&$form_class; } diff --git a/src/Forms/TextAreaForm.php b/src/Forms/TextAreaForm.php new file mode 100644 index 0000000..c964081 --- /dev/null +++ b/src/Forms/TextAreaForm.php @@ -0,0 +1,23 @@ + +
+ \ No newline at end of file diff --git a/src/Webmodel.php b/src/Webmodel.php index 09fa042..323dc13 100644 --- a/src/Webmodel.php +++ b/src/Webmodel.php @@ -950,13 +950,6 @@ class Webmodel { $conditions=trim($this->conditions.' '.$this->order_by.' '.$this->limit); - if($this->reset_conditions==1) - { - - $this->reset_conditions(); - - } - //Make conversion from post //Check if minimal fields are fill and if fields exists in components. @@ -1032,6 +1025,13 @@ class Webmodel { } } + + if($this->reset_conditions==1) + { + + $this->reset_conditions(); + + } //Create the query.. @@ -2046,9 +2046,11 @@ class Webmodel { //$this->forms[$component_name]=new $form_class($component_name, $component->value, $component->parameters); $rc=new \ReflectionClass($form_class); - array_unshift($component->parameters, $component_name, $component->value); + $parameters=$component->parameters; - $this->forms[$component_name]=$rc->newInstanceArgs($component->parameters); + array_unshift($parameters, $component_name, $component->value); + + $this->forms[$component_name]=$rc->newInstanceArgs($parameters); $type_class=get_class($this->forms[$component_name]);