Example #1
0
function get_chart_series_fields(&$arr_data_series, &$arr_label_series)
{
    if (is_groupby_chart()) {
        return get_chart_groupbyseries_fields($arr_data_series, $arr_label_series);
    }
    $root =& $_SESSION['webcharts'];
    $arr_data_series = array();
    $arr_label_series = array();
    $arr_join_tables = getChartTablesList();
    for ($i = 0; $i < count($arr_join_tables); $i++) {
        $t = $arr_join_tables[$i];
        $arr_fields = GetNumberFieldsList($t);
        for ($j = 0; $j < count($arr_fields); $j++) {
            if (!is_wr_custom()) {
                $arr_data_series[] = array("field" => $t . "." . $arr_fields[$j], "label" => WRChartLabel($t . "." . $arr_fields[$j]));
            } else {
                $arr_data_series[] = array("field" => $arr_fields[$j], "label" => WRChartLabel($arr_fields[$j]));
            }
        }
        $arr_fields = WRGetNBFieldsList($t);
        for ($j = 0; $j < count($arr_fields); $j++) {
            if (!is_wr_custom()) {
                $arr_label_series[] = array("field" => $t . "." . $arr_fields[$j], "label" => WRChartLabel($t . "." . $arr_fields[$j]));
            } else {
                $arr_label_series[] = array("field" => $arr_fields[$j], "label" => WRChartLabel($arr_fields[$j]));
            }
        }
    }
    if (!count($arr_data_series)) {
        $arr_data_series = $arr_label_series;
    }
}
		$("#sql_button").hide();
		';
		$b_includes.='
		$("#sql_name").hide();
		$("#check_button").hide();
		$("#sql_textarea").attr("readonly","readonly");
	});
	';
	$b_includes.="</script>";
	$xt->assign("b_includes", $b_includes);
	if(is_wr_project()) 
	{
		if($type=="webreports")
			$arr_tables = getReportTablesList();
		else
			$arr_tables = getChartTablesList();
		foreach ($arr_tables as $tbl) 
			include("include/" . GetTableURL($tbl) . "_variables.php");
		$gSettings = new ProjectSettings($arr_tables[0], PAGE_REPORT);
	}
	else 
	{
		global $strTableName;
		$gSettings = new ProjectSettings($strTableName, PAGE_REPORT);
	}

	if(!is_wr_project())
	{
		$sql_query_display = $_SESSION[$type]['sql'].$_SESSION[$type]['where'].$_SESSION[$type]['group_by'].$_SESSION[$type]['order_by'];	
		if(strlen($_SESSION[$type]['sql_preview']))
			$sql_query = $_SESSION[$type]['sql_preview'];
ini_set("display_startup_errors","1");
include("include/dbcommon.php");
header("Expires: Thu, 01 Jan 1970 00:00:01 GMT");


include("include/reportfunctions.php");

	if(!@$_SESSION["UserID"])
	{
		$_SESSION["MyURL"]=$_SERVER["SCRIPT_NAME"]."?".$_SERVER["QUERY_STRING"];
		header("Location: ".GetTableLink("login", "", "message=expired"));
		return;
	}
//$conn=db_connect();
Reload_Chart(postvalue("cname"));
$arr_join_tables = getChartTablesList();

include('include/xtempl.php');
$xt = new Xtempl();

if (@$_SESSION['webcharts']['settings']['title'] != "") {
	$title=@$_SESSION['webcharts']['settings']['title'];
	if(strlen($title)>25)
		$title=substr($title,0,25)."...";
	$xt->assign("chart_title",", "."Title".": ".$title);
} else {
	$xt->assign("chart_title","");
}
if (@$_SESSION['webcharts']['tables'][0] != "") {
	$stable=@$_SESSION['webcharts']['tables'][0];
	if(strlen($stable)>25)
Example #4
0
function set_default_chart_parameter($idx, $labelMode, $addLabel)
{
    $root =& $_SESSION["webcharts"];
    $arr_join_tables = getChartTablesList();
    if (is_groupby_chart()) {
        for ($i = 0; $i < count($root["group_by_condition"]) - 1; $i++) {
            if (!$root["group_by_condition"][$i]["group_by_value"]) {
                continue;
            }
            $type = WRGetFieldType($root["group_by_condition"][$i]["field_opt"]);
            $grvalue = $root["group_by_condition"][$i]["group_by_value"];
            if (!$labelMode && (IsNumberType($type) || $grvalue != "GROUP BY") || $labelMode) {
                $table = "";
                $field = "";
                WRSplitFieldName($root["group_by_condition"][$i]["field_opt"], $table, $field);
                $root["parameters"][$idx]["name"] = $field;
                $root["parameters"][$idx]["table"] = $table;
                if ($grvalue != "GROUP BY") {
                    $root["parameters"][$idx]["agr_func"] = $grvalue;
                }
                if ($addLabel) {
                    $root["parameters"][$idx]["label"] = $field;
                }
                break;
            }
        }
    } else {
        foreach ($arr_join_tables as $tbl) {
            if (!$labelMode) {
                $fields = GetNumberFieldsList($tbl);
            } else {
                $fields = WRGetNBFieldsList($tbl);
            }
            if (count($fields)) {
                $root["parameters"][$idx]["name"] = $fields[0];
                $root["parameters"][$idx]["table"] = $tbl;
                $root["parameters"][$idx]["agr_func"] = "";
                if ($addLabel) {
                    $root["parameters"][$idx]["label"] = WRChartLabel($tbl . "." . $fields[0]);
                }
                break;
            }
        }
    }
}