<?php

require_once "Form.php";
$f = new Form();
switch ($_SERVER['REQUEST_METHOD']) {
    case "GET":
        //$f->getAll();
        //foreach section en doom CADA ARRAY SON ELEMENTS EN EL DOM
        $items2[] = new ElementSwitchoption("1", "titulo elemento otro", "value 1 sa", "value 2 asd", "yes", 1, "sdasda", "sdads", 2);
        $elements2[] = new Element("0", "sortable", 2, "sdasd21", "yes", $items2);
        $subsection2[] = new Susbsection("1", $elements2);
        $section2[] = new Section("segunda seccion", "descripcion segunda seccion", "1", $subsection2, true, true, 7, 9);
        $items[] = new MixMaxElement("0", "titulo min_max", "name", "value1", "value 2", "yes");
        $items[] = new ElementSwitchoption("0", "titulo 2", "nombre de swich", "valor 1", "valor 2", "yes", "1", "false", "ssda");
        $items[] = new ElementSelectoption("0", "titulo elemento", "nombre elemento", "10", "primera opcion", "no", "false");
        $elements[] = new Element("0", "option select", 2, "unics", "yes", $items);
        $elements[] = new ElementSelectoption("0", "titulo elemento", "nombre elemento", "10", "primera opcion", "no", "false");
        $subsection[] = new Susbsection("0", $elements);
        $section[] = new Section("prinera seccion", "descripcion de seccion", "0", $subsection, false, false, 4, 10);
        $section[] = new Section("prinera seccion", "descripcion de seccion", "0", $subsection, false, false, 1, 2);
        $s = Form::set_values("description", "prueva", $section);
        echo json_encode($s);
        break;
    case "POST":
        $f->insert();
        break;
}


// function Scaping_weir_char(string $string)
// {
//     // stripslashes($string);
//     $ss = str_replace("\\\\", "", $string);
//     $ss2 = str_replace("\_", "", $ss);
//     return $ss2;
// }


// obteniendo data y validando

// var_dump(new ElementWithoutConditional("0","dropdown","w","saas","yes",["dropdown","select","boton"]));
// var_dump($pp);
// var_dump(new ElementWithConditional("0","dropdown",["dropdown","select","boton"],2,"saas","yes",2));
// var_dump($ss);
// var_dump(new ElementSelectoption("0","titulo 1","nombre_elemento","value1","value222","yes",true))




?>
<!-- <p><?php //getOne(45); 
        ?></p> -->
<p><?php //getAll(); 
    ?></p>