<?php include_once 'utils.php'; $id = $_GET['c']; $chart = getChartInfo($id); if ($chart["type"] == "line") { include_once dirname(__FILE__) . '/../charts/line.js.php'; } else { if ($chart["type"] == "percentage_line") { include_once dirname(__FILE__) . '/../charts/percentage_line.js.php'; } else { if ($chart["type"] == "heatmap") { include_once dirname(__FILE__) . '/../charts/heatmap.js.php'; } else { if ($chart["type"] == "boxplot") { include_once dirname(__FILE__) . '/../charts/boxplot.js.php'; } else { if ($chart["type"] == "scatter") { include_once dirname(__FILE__) . '/../charts/scatter.js.php'; } else { if ($chart["type"] == "stacked") { include_once dirname(__FILE__) . '/../charts/stacked.js.php'; } else { if ($chart["type"] == "bar.scatter") { include_once dirname(__FILE__) . '/../charts/bar.scatter.js.php'; } else { if ($chart["type"] == "scatterset") { include_once dirname(__FILE__) . '/../charts/scatterset.js.php'; } } }
public function actionFilter() { if (!YII_DEBUG && !Yii::app()->request->isAjaxRequest) { throw new CHttpException('403', 'Forbidden access.'); } $result = array(); $url = $_POST["url"]; $pos = strrpos($url, "?"); $chartId = substr($url, $pos + 3); // echo $chartId; $chart = getChartInfo($chartId); $result["msg"] = "successful"; $result["chart"] = $chart; $q = $chart["query"]; if (isset($_POST["start_date"]) && strlen($_POST["start_date"]) > 0) { $q = Jobs::filter($q, "start_time", $_POST["start_date"], ">"); } if (isset($_POST["end_date"]) && strlen($_POST["end_date"]) > 0) { $q = Jobs::filter($q, "end_time", $_POST["end_date"], "<"); } if (isset($_POST["application"]) && strlen($_POST["application"]) > 0) { $q = Jobs::filter($q, "appname", $_POST["application"]); } if (isset($_POST["numapp"]) && strlen($_POST["numapp"]) > 0) { $q = Jobs::Limit($q, $_POST["numapp"]); } if (!isset($q["order"])) { $orderby = "start_time"; } else { $orderby = $q["order"]; } if (isset($_POST["sort_level1"]) && strlen($_POST["sort_level1"]) > 0) { $orderby = $_POST["sort_level1"]; } $mode1 = "desc"; if (isset($_POST["mode_level1"])) { $mode1 = $_POST["mode_level1"]; } $q = Jobs::OrderBy($q, $orderby, $mode1); $q = Jobs::Limit($q, 15000); if (isset($_POST["sort_level2"]) && strlen($_POST["sort_level2"]) > 0) { $sortlevel2 = $_POST["sort_level2"]; $mode2 = "desc"; if (isset($_POST["mode_level2"])) { $mode1 = $_POST["mode_level2"]; } $q = Jobs::addSortingLevel($q, $sortlevel2, $mode2); } if (isset($_POST["sort_level3"]) && strlen($_POST["sort_level3"]) > 0) { $sortlevel3 = $_POST["sort_level3"]; $mode3 = "desc"; if (isset($_POST["mode_level3"])) { $mode1 = $_POST["mode_level3"]; } $q = Jobs::addSortingLevel($q, $sortlevel3, $mode3); } if (isset($_POST["user"]) && strlen($_POST["user"]) > 0) { $q = Jobs::filter($q, "uid", $_POST["user"]); } //var_dump($q) ; $data = Jobs::execSQLQuery($q); //print_r($data); $preprocess = $chart["preprocess"]; $queryResult = $preprocess($chart, $data); $result["queryresult"] = $queryResult; $result["query"] = $q; // $result = array_merge($result, $result2); //echo $series_str; // print_r($_GET); // if (empty($_GET['data'])) { // throw new CHttpException('404', 'Missing "data" GET parameter.'); // } // $term = $_GET['term']; // $filters = empty($_GET['exclude']) ? null : (int) $_GET['exclude']); // echo json_encode(User::completeTerm($term, $exclude)); header('Content-Type: application/json; charset="UTF-8"'); echo json_encode($result); Yii::app()->end(); }