Created
July 22, 2013 20:03
-
-
Save evilnapsis/6057155 to your computer and use it in GitHub Desktop.
Obtiene un array bien construido y dibuja un formulario
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class FormBuilder { | |
private $forminstace; | |
public $method; | |
public $action; | |
public $smtext; | |
public function FormBuilder($form){ | |
$this->forminstance = $form; | |
} | |
public function renderAddForm(){ | |
$form = $this->forminstance->fields['form']; | |
if($this->action!="" && $this->method!="" && $this->smtext!=""){ | |
print "<form method=\"".$this->method."\" action=\"".$this->action."\" class='form-horizontal'>"; | |
foreach( $form as $k=>$v){ | |
if($v["action"]["add"]==true){ | |
print '<div class="control-group">'; | |
print '<label class="control-label" for="inputEmail">'.$v['label'].'</label>'; | |
print '<div class="controls">'; | |
print "<input type=\"".$v['type']."\" name=\"".$k."\" style='border-radius : 0px ; padding : 8px; height : 30px ;'>"; | |
print '</div>'; | |
print "</div>"; | |
} | |
} | |
print '<div class="controls">'; | |
print "<input class='btn btn-inverse' type='submit' value=\"".$this->smtext."\" >"; | |
print "</div>"; | |
print "</form>"; | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment