OpenSencillo  2015.002
formCreator Class Reference

Public Member Functions

 create ($type, $params)
 getById ($id, $action="/", $method="post")
 groupToLines ($id, $tag=null, $params=null)

Protected Attributes

 $form = array()

Detailed Description

Definition at line 2 of file form.tool.framework.php.


Member Function Documentation

create ( type,
params 
)

Create input

Parameters:
string$type(HTML5 types)
string$id(unique identification)
string$name(unique name)
string$value(sending value)
string$class(classes)
string$param(other parameters)
Returns:
false (if notype)
string (if generating process is ok)

Definition at line 19 of file form.tool.framework.php.

    {
        if($type==null)
        {
                return false;
        }
        else 
        {
            $params=array();
            $updateParams=array();
            if($params['value']!=null)
            {
                $updateParams['value']=" value='".$params['value']."'";
            }
            if($params['id']!=null)
            {
                $updateParams['id']=" id='".$params['id']."'";
            }
            if($params['name']!=null)
            {
                $updateParams['name']=" name='".$params['name']."'";
            }
            if($params['class']!=null)
            {
                $updateParams['class']=" class='".$params['class']."'";
            }
            if($params['param']!=null)
            {
                $updateParams['param']=" param='".$params['param']."'";
            }
            if($params['label']!=null)
            {
                $updateParams['label']="<label id='".$params['id']."_label' for='".$params['id']."'>".$params['label']."</label>";
            }
            $this->form['label'][$params['id']]=$updateParams['label'];
            $this->form['input'][$params['id']]="<input type='$type'".$params['value'].$params['id'].$params['name'].$params['class'].$params['param'].">";
                return array($this->form['label'][$params['id']],$this->form['input'][$params['id']]);
        }
    }
getById ( id,
action = "/",
method = "post" 
)

Create form

Parameters:
array$id(identification in the system)
Returns:
string (if exist $id retruning html input tag)

Definition at line 66 of file form.tool.framework.php.

    {
        $out='';
        
        foreach($id as &$value)
        {
                $out.=$value;
        }
        return '<form action="'.$action.'" method="'.$method.'">'.$out.'</form>';
    }
groupToLines ( id,
tag = null,
params = null 
)

Create a new form line (no save)

Parameters:
string$id
string$tag,=null
Returns:
string

Definition at line 85 of file form.tool.framework.php.

    {
        $out='';
        $i=0;
        foreach($id as &$id_value)
        {
            $j=0;
            $tag=str_ireplace(array('<','>'),'',$tag);
            if($tag!=null)
            {
                $out.="<".$tag." ".$params[$i][$j++].">".$this->form['label'][$id_value]."</".$tag."><".$tag." ".$params[$i][$j++].">".$this->form['input'][$id_value]."</".$tag.">";
            }
            else 
            {
                $tag="div";
                $out.="<".$tag." ".$params[$i][$j++].">".$this->form['label'][$id_value].$this->form['input'][$id_value]."</".$tag.">";
            }
            $i++;
        }
        return $out;
    }

Field Documentation

$form = array() [protected]

Definition at line 4 of file form.tool.framework.php.


The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables