Fixes on modelform
This commit is contained in:
parent
7b7df55b3b
commit
19cd803a87
5 changed files with 23 additions and 8 deletions
|
|
@ -26,7 +26,7 @@ function select_a_field_method_class($class, $where, $field)
|
||||||
|
|
||||||
$query=$class->select($where, array($field), $raw_query=1);
|
$query=$class->select($where, array($field), $raw_query=1);
|
||||||
|
|
||||||
while(list($field_choose)=webtsys_fetch_row($query))
|
while(list($field_choose)=$class->fetch_row($query))
|
||||||
{
|
{
|
||||||
|
|
||||||
$arr_field[]=$field_choose;
|
$arr_field[]=$field_choose;
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ function select_a_row_method_class($class, $idrow, $arr_select=array(), $raw_que
|
||||||
|
|
||||||
$query=$class->select('where '.$class->name.'.`'.$class->idmodel.'`=\''.$idrow.'\'', $arr_select, $raw_query);
|
$query=$class->select('where '.$class->name.'.`'.$class->idmodel.'`=\''.$idrow.'\'', $arr_select, $raw_query);
|
||||||
|
|
||||||
return webtsys_fetch_array($query, $assoc);
|
return $class->fetch_array($query, $assoc);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ function select_a_row_where_method_class($class, $where, $arr_select=array(), $r
|
||||||
|
|
||||||
$query=$class->select($where, $arr_select, $raw_query);
|
$query=$class->select($where, $arr_select, $raw_query);
|
||||||
|
|
||||||
return webtsys_fetch_array($query, $assoc);
|
return $class->fetch_array($query, $assoc);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ function select_to_array_method_class($class, $where="", $arr_select=array(), $r
|
||||||
|
|
||||||
$query=$class->select($where, $arr_select, $raw_query);
|
$query=$class->select($where, $arr_select, $raw_query);
|
||||||
|
|
||||||
while($arr_row=webtsys_fetch_array($query))
|
while($arr_row=$class->fetch_array($query))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PhangoApp\PhaModels;
|
namespace PhangoApp\PhaModels;
|
||||||
|
use PhangoApp\PhaUtils\Utils;
|
||||||
|
use PhangoApp\PhaModels\CoreFields;
|
||||||
|
use PhangoApp\PhaI18n\I18n;
|
||||||
|
|
||||||
//Class ModelForm is the base class for create forms...
|
//Class ModelForm is the base class for create forms...
|
||||||
|
|
||||||
|
|
@ -92,6 +95,18 @@ class ModelForm {
|
||||||
|
|
||||||
public $error_flag=0;
|
public $error_flag=0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array for save the fields for external checkings.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static public $arr_form_public=array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boolean property that set DEBUG mode
|
||||||
|
*/
|
||||||
|
|
||||||
|
static public $debug=1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for create a new ModelForm. ModelForm are used for create forms easily.
|
* Constructor for create a new ModelForm. ModelForm are used for create forms easily.
|
||||||
*
|
*
|
||||||
|
|
@ -114,17 +129,17 @@ class ModelForm {
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
$this->label = $label;
|
$this->label = $label;
|
||||||
$this->std_error = '';
|
$this->std_error = '';
|
||||||
$this->txt_error = PhangoVar::$l_['common']->lang('error_in_field', 'Error in field');
|
$this->txt_error = I18n::lang('common', 'error_in_field', 'Error in field');
|
||||||
$this->required = $required;
|
$this->required = $required;
|
||||||
|
|
||||||
$this->html_field_name=$name_field;
|
$this->html_field_name=$name_field;
|
||||||
|
|
||||||
switch(DEBUG)
|
switch(ModelForm::$debug)
|
||||||
{
|
{
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
$prefix_uniqid=generate_random_password();
|
$prefix_uniqid=Utils::generate_random_password();
|
||||||
|
|
||||||
if(!isset($_SESSION['fields_check'][$name_field]))
|
if(!isset($_SESSION['fields_check'][$name_field]))
|
||||||
{
|
{
|
||||||
|
|
@ -169,7 +184,7 @@ class ModelForm {
|
||||||
|
|
||||||
//$this->html_field_name=$name_field; slugify($this->label, $respect_upper=0, $replace_space='-', $replace_dot=1, $replace_barr=1);
|
//$this->html_field_name=$name_field; slugify($this->label, $respect_upper=0, $replace_space='-', $replace_dot=1, $replace_barr=1);
|
||||||
|
|
||||||
PhangoVar::$arr_form_public[$this->html_field_name]=$name_field;
|
ModelForm::$arr_form_public[$this->html_field_name]=$name_field;
|
||||||
|
|
||||||
$this->parameters = array($this->html_field_name, $class='', $parameters);
|
$this->parameters = array($this->html_field_name, $class='', $parameters);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue