$id_first_part = json_decode($_POST["id_first_part"]); // Create connection $conn = new mysqli($server, $user_ro, $pass_ro, $db); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "select c.child_name_id, c.html_class \n" . "from data_chart.param_input_child c \n" . "where c.option_value = '" . $name_id . "' \n" . "order by c.order_num \n"; if (!$conn->query($sql)) { $error_arr[] = $conn->error; } $result = $conn->query($sql); while ($row = $result->fetch_assoc()) { $child_name_id = $row["child_name_id"]; $html_class = $row["html_class"]; $html .= formElemCreate($child_name_id, $html_class); } $id_second_part = idFromFirstOptions($html); $id = idWrapAdd("{$id_first_part} {$id_second_part}"); $def = definitionCreate($id); $filter_type = $def->info->filter_type; if (count($error_arr) === 0) { $conn->commit(); $status = "success"; } else { $conn->rollback(); $status = "failure"; } $output = new stdClass(); $output->html = $html; $output->status = $status;
$param_array = json_decode($_POST["param_array"]); $area = json_decode($_POST["area"]); $id = paramToId($param_array); $def = definitionCreate($id); $filter_type = $def->info->filter_type; switch ($area) { case 'axis': switch ($filter_type) { case 'none': $html = ''; break; default: $html = "<div class=\"min-wrap col-xs-6 noPad-xs\"> \n" . formElemCreate("axis_min", "min") . "</div> \n" . "<div class=\"max-wrap col-xs-6 noPad-xs\"> \n" . formElemCreate("axis_max", "max") . "</div>"; break; } break; case 'filters': switch ($filter_type) { case 'none': $html = ''; break; default: $html = formElemCreate("filter_operator", "operator"); break; } break; default: $html = $area; break; } echo json_encode($html);
function categoryHTML($area) { require_once SERVER_ROOT . '/php/dist/extension.php'; require_once SERVER_ROOT . '/module/definition/module.php'; require_once SERVER_ROOT . '/module/form_elem/module.php'; require_once SERVER_ROOT . '/module/category/dist/id_from_first_options.php'; $html_class = "m-category"; switch ($area) { case 'y-axis': $html_class .= " areatype-axis"; break; case 'x-axis': $html_class .= " areatype-axis"; break; case 'filters': $html_class .= " areatype-filters"; break; default: break; } $category_html = formElemCreate("category", null, $area); $id = idFromFirstOptions($category_html); $id = idWrapAdd($id); $def = definitionCreate($id); $filter_type = $def->info->filter_type; $filter_wrap_html_class = 'filter-wrap row'; if ($filter_type === 'none') { $filter_wrap_html_class .= ' hidden'; } ob_start(); //Function continues... ?> <div class="<?php echo $html_class; ?> "> <div class="category-wrap"> <?php echo $category_html; ?> </div> <div class="<?php echo $filter_wrap_html_class; ?> "> <div class="operator-wrap col-xs-4 halfPad-xs"> <?php echo formElemCreate("filter_operator", "operator"); ?> </div> <div class="col-xs-8 noPad-xs"> <div class="equal-wrap col-xs-6 halfPad-xs hidden"> <?php echo formElemCreate("filter_min", "equal"); ?> </div> <div class="min-wrap col-xs-6 halfPad-xs hidden"> <?php echo formElemCreate("filter_min", "min"); ?> </div> <div class="max-wrap col-xs-6 halfPad-xs hidden"> <?php echo formElemCreate("filter_max", "max"); ?> </div> </div> </div> </div> <?php //...function continues. $html = ob_get_clean(); return $html; }
function axesCreate() { require_once SERVER_ROOT . '/module/category/module.php'; //Function continues... ?> <link rel="stylesheet" media="screen" href="<?php echo WEB_ROOT . "/module/axes/dist/style.min.css"; ?> "> <div class="m-axes"> <form> <h4>Y-Axis</h4> <div class="y-axis category-wrap form-group"> <?php echo categoryCreate("y-axis"); ?> </div> <h4>X-Axis</h4> <div class="x-axis form-group"> <?php echo categoryCreate("x-axis"); ?> <div class="round-wrap row"> <div class="round-factor-wrap col-xs-6 noPad-xs"> <?php echo formElemCreate("axis_round_factor", "round-factor"); ?> </div> <div class="round-count-wrap col-xs-6 noPad-xs"> <?php echo formElemCreate("axis_round_count", "round-count"); ?> </div> </div> </div> <h4>Main Filters</h4> <div class="filter-main form-group"> <div class="row"> <div class="dateMin-wrap col-xs-6 noPad-xs"> <?php echo formElemCreate("date_min", "date-min"); ?> </div> <div class="dateMax-wrap col-xs-6 noPad-xs"> <?php echo formElemCreate("date_max", "date-max"); ?> </div> </div> <div class="row"> <div class="col-xs-3"></div> <div class="tapGrade-wrap col-xs-6 noPad-xs"> <?php echo formElemCreate("tap_grade", "tap-grade"); ?> </div> <div class="col-xs-3"></div> </div> </div> <!-- <button type="button" class="submitBtn btn btn-xlarge btn-success">Generate Chart</button> --> </form> </div> <script src="<?php echo WEB_ROOT . "/module/axes/dist/script.min.js"; ?> "></script> <?php }