Example #1
0
                 $conn = null;
                 unset($stmt);
                 return true;
             }
             break;
     }
     break;
 case 'chart':
     //$item = $_POST['item'];
     $test_query = new Query();
     $array1 = $_POST['array1'];
     $test_query->start_date_from = $_POST['date_from'];
     $test_query->start_date_to = $_POST['date_to'];
     $test_query->filters = json_decode($array1);
     //use the TRUE parameter to convert to an array, not a json object, but for now we'll use an object.
     $records = $test_query->getChartData($_POST['parameter']);
     $records1 = $test_query->formatChartData($records, $_POST['parameter']);
     echo json_encode($records1, JSON_NUMERIC_CHECK);
     //JSON_NUMERIC_CHECK ensures that all the chart values are not converted to string. Without this parameter, all numbers are returned as string.
     break;
 case 'StatBlocks':
     $stat_query = new Query();
     $array1 = $_POST['array1'];
     $stat_query->start_date_from = $_POST['date_from'];
     $stat_query->start_date_to = $_POST['date_to'];
     $stat_query->filters = json_decode($array1);
     //use the TRUE parameter to convert to an array, not a json object, but for now we'll use an object.
     $rows = $stat_query->getAggregateData();
     //        $statblock = new StatBlock("Sponsors", "17");
     //        echo $statblock->getHTML();
     echo json_encode($rows);