|
OpenSencillo
2015.002
|
Public Member Functions | |
| create ($type, $params) | |
| getById ($id, $action="/", $method="post") | |
| groupToLines ($id, $tag=null, $params=null) | |
Protected Attributes | |
| $form = array() | |
Definition at line 2 of file form.tool.framework.php.
| create | ( | $ | type, |
| $ | params | ||
| ) |
Create input
| string | $type | (HTML5 types) |
| string | $id | (unique identification) |
| string | $name | (unique name) |
| string | $value | (sending value) |
| string | $class | (classes) |
| string | $param | (other parameters) |
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
| array | $id | (identification in the system) |
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)
| string | $id | |
| string | $tag,=null |
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;
}
$form = array() [protected] |
Definition at line 4 of file form.tool.framework.php.