update
This commit is contained in:
111
application/models/FxForm_model.php
Normal file
111
application/models/FxForm_model.php
Normal file
@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Utilisateur
|
||||
* Date: 2019-04-23
|
||||
* Time: 10:21g
|
||||
*/
|
||||
class fxForm_model extends CI_Model {
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
public function fxValidation($rule,$message)
|
||||
{
|
||||
$mem_rules='rules : {';
|
||||
foreach($rule as $key=>$value){
|
||||
$mem_rules=$mem_rules.$value.',';
|
||||
|
||||
|
||||
}
|
||||
$mem_rules=rtrim($mem_rules,", ");
|
||||
$mem_rules=$mem_rules.' },';
|
||||
$mem_messages='messages : {';
|
||||
foreach($message as $key=>$value){
|
||||
$mem_messages=$mem_messages.$value.',';
|
||||
|
||||
|
||||
}
|
||||
$mem_messages=rtrim($mem_messages,", ");
|
||||
$mem_messages=$mem_messages.' },';
|
||||
|
||||
$mem_return['rules']=$mem_rules;
|
||||
$mem_return['messages']=$mem_messages;
|
||||
return $mem_return ;
|
||||
}
|
||||
public function fxinputtxt($mem_champ,$mem_value,$mem_label,$mem_icon='',$mem_placeholder='',$mem_class='',$mem_size='',$readonly=false){
|
||||
|
||||
global $mem_data;
|
||||
$mem_data['input'][$mem_champ] = array(
|
||||
'type' => 'text',
|
||||
'name' => $mem_champ,
|
||||
'id' => $mem_champ,
|
||||
'placeholder' => $mem_placeholder,
|
||||
'value' => $mem_value,
|
||||
'class' =>$mem_class,
|
||||
'size' =>$mem_size
|
||||
);
|
||||
if ($readonly)
|
||||
$mem_data['input'][$mem_champ]['readonly']='readonly';
|
||||
|
||||
|
||||
|
||||
$mem_data['label'][$mem_champ] = $mem_label;
|
||||
$mem_data['icon'][$mem_champ] = $mem_icon;
|
||||
return;
|
||||
}
|
||||
public function fxcheckbox($mem_champ,$mem_value,$mem_label,$mem_icon='',$mem_placeholder='',$mem_class='',$mem_size='',$readonly=false){
|
||||
|
||||
global $mem_data;
|
||||
$mem_data['input'][$mem_champ] = array(
|
||||
'type' => 'checkbox',
|
||||
'name' => $mem_champ,
|
||||
'id' => $mem_champ,
|
||||
|
||||
'placeholder' => $mem_placeholder,
|
||||
'value' => $mem_value,
|
||||
'class' =>$mem_class,
|
||||
'size' =>$mem_size
|
||||
);
|
||||
if ($readonly)
|
||||
$mem_data['input'][$mem_champ]['readonly']='readonly';
|
||||
if ($mem_value==1)
|
||||
$mem_data['input'][$mem_champ]['checked']='TRUE';
|
||||
|
||||
|
||||
|
||||
$mem_data['label'][$mem_champ] = $mem_label;
|
||||
$mem_data['icon'][$mem_champ] = $mem_icon;
|
||||
return;
|
||||
}
|
||||
public function fxvaliderequired($mem_champ,$rule='',$message='' ){
|
||||
|
||||
global $validation;
|
||||
if ($rule==""){
|
||||
$rule="
|
||||
".$mem_champ." : {
|
||||
required : true
|
||||
}";
|
||||
|
||||
}
|
||||
if ($message==""){
|
||||
$message="
|
||||
".$mem_champ." : {
|
||||
required : 'Champ obligatoire'
|
||||
}";
|
||||
|
||||
}
|
||||
|
||||
$validation['rule'][]=$rule ;
|
||||
$validation['message'][]=$message;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user