function getElement($id, $name, $link, $options) { $element = ''; switch ($id) { case 105: return Element::text(array('label' => $name, 'placeholder' => '')); case 106: return Element::button($name); case 107: return Element::buttonLink($name, $link); case 108: return Element::radioButton($name, $options); case 109: return Element::checkBox($name, $options); case 110: return Element::dropdownList($name, $options); } }
<?php /** * Created by IntelliJ IDEA. * User: Roledene * Date: 2/10/2016 * Time: 6:33 PM */ include 'app/Database.php'; include 'app/Element.php'; $db = new \app\Database(); $db->deleteAllElements(); $db->insertElement("textBox", \app\Element::text(array('label' => 'Tex Box', 'placeholder' => 'text', 'help' => 'help', 'require' => false), true, false), 0); $db->insertElement("button", \app\Element::button("Button"), 0); $db->insertElement("link", \app\Element::buttonLink("Button", "add.php"), 0); $db->insertElement("RadioButton", \app\Element::radioButton("Radiobtn", array(0 => 'radio 1')), 0); $db->insertElement("CheckBox", \app\Element::checkBox("Check", array(0 => 'check 1', 1 => 'check 2')), 0); $db->insertElement("Dropdown", \app\Element::dropdownList("Drop", array(0 => 'op 1', 1 => 'op 2', 2 => 'op 3')), 0);
echo Boostrap::openForm("Create a new form", $attribute); echo str_replace('{text}', 'Form Name', Element::text(array('label' => 'Form Name', 'placeholder' => '', 'help' => ''), 'textinput', false)); echo Element::button("New"); echo Boostrap::closeForm(); ////////////////////////////// // open form $attribute = array('class' => $isBoostrap ? 'form-horizontal' : '', 'action' => 'index.php'); echo Boostrap::openForm("Add elements to form", $attribute); // open form // make the form body here ///////////////////////////////////////////////// echo str_replace('{button}', ' ', Element::text(array('label' => "Question Name", 'placeholder' => "Type name tag", 'help' => "Type name tag here"))); $label = array(); $count = ''; $result = $db->getAllElements(); while ($row = $result->fetch_assoc()) { $label[$row['id']] = $row['label']; // array_push($label,$row["id"],$row["label"]); } //die(print_r($label)); echo Element::dropdownList("select elements", $label); echo str_replace('{button}', ' ', Element::text(array('label' => "If you are selecting, RadioButton, CheckBox or Dropdown list please give options as comma seperated list", 'placeholder' => "Type name tag", 'help' => "Type name tag here"), 'list')); echo Element::button("Add element to form"); //////////////////////////////////////// Boostrap::closeForm(); // end form Boostrap::closeDiv(); //column end Boostrap::closeDiv(); // row end include "includes/footer.php";
// // $attribute = array( // 'class' => 'col-xs-9 col-md-9', // 'style' => 'background: blue; height: 20px;' // ); // // // //body // Boostrap::openDiv($attribute); // column open // // open form // $attribute = array( // 'class' => 'form-horizontal', // 'action' => 'test.php' // ); // Boostrap::openForm("Form Builder",$attribute); // // $result = $db->getAllElements(); // while($row = $result->fetch_assoc()) { // echo $row["code"]. "<br>"; // } //// echo Element::button("submit"); //// echo Element::buttonLink("submit","test.html"); // Boostrap::closeForm(); // Boostrap::closeDiv(); //column end // //Boostrap::closeDiv(); // row end // just call it here and see weather it works echo Element::redio_Button(); //if parameters need pass echo Element::text(array('label' => 'my custom text box', 'placeholder' => 'custom holder', 'help' => 'your help goes here')); include "includes/footer.php";