Esempio n. 1
0
if(is_wr_project())
{
	foreach ($arr_join_tables as $tbl) 
	{
		include_once("include/" . GetTableURL($tbl) . "_settings.php");	
	}
}

if (postvalue("rname")) {
	$inspect_fields = $xml_array["totals"];
} elseif (postvalue("cname")) {
	//$inspect_fields = $xml_array["parameters"];
	$inspect_fields = array();
	for ($i=0; $i < count($arr_join_tables); $i++ ) {
		$t = $arr_join_tables[$i];
		$arr_fields = WRGetNBFieldsList($t);
		for ($j=0; $j < count($arr_fields); $j++) {
			$slabel=$arr_fields[$j];
			for ($k=0; $k < count($xml_array["parameters"])-1; $k++) 
				if($xml_array["parameters"][$k]["name"]==$slabel)
				{
					$slabel=$xml_array["parameters"][$k]["label"];
					break;
				}
			$inspect_fields[] = array("table" => $t, "name" => $arr_fields[$j], "show" => "true", "label" => $slabel);
		}
	}
}

//}
$pageName = GetTableLink("dsearch");
Esempio n. 2
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;
    }
}
Esempio n. 3
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;
            }
        }
    }
}
}

$aGroupFields = array();
//$aGroupFields = $sGroupFields;
$aTypes = array();
$aChecked = array();
$aColor1 = array();
$aColor2 = array();
$aGrTypes=array();

$arr = $_SESSION['webreports']['group_fields'];
if(count($arr)==1)
{
	$arr[]=$arr[0];
	$table=@$_SESSION['webreports']['tables'][0];
    $arr_fields = WRGetNBFieldsList($table);

	$gfield=$arr_fields[0];
	if(is_wr_db())
		$gfield=$table.".".$arr_fields[0];
	$arr[0] = array(

        array(
			"name" => $gfield,
            "int_type" => "0",
            "ss" => "true",
            "group_order" => "1",
            "color1" => "FF0000",
            "color2" => "CC0000"
        )
    );		
		$stable=substr($stable,25)."...";

	$xt->assign("report_table",", "."Table".": ".$stable);
} else {
	$xt->assign("report_table","");
}

$xt->assign("b_is_report_save",($_SESSION['webreports']['tmp_active'] != "x"));	
$xt->assign("b_is_report_name",($_SESSION['webreports']['settings']['name'] != ""));
$xt->assign("report_name",$_SESSION['webreports']['settings']['name']);

$arr_tables = getReportTablesList();
$sort_fields=array();
foreach($arr_tables as $t)
{
	$tfields=WRGetNBFieldsList($t);
	foreach($tfields as $f)
	{
		if(is_wr_db())
			$sort_fields[]=$t.".".$f;
		else
			$sort_fields[]=$f;
	}
}
$aSelSortFields=array();

$arr = $_SESSION['webreports']['group_fields'];
if ( !empty( $arr ) ){

	for ( $i=0; $i < count($arr)-1; $i++ ) {
		$aSelSortFields[$i]["name"] = $arr[$i]["name"];