Ejemplo n.º 1
0
	$b_includes.='
	$(document).ready(function(){
		$("#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'];	
Ejemplo n.º 2
0
function update_report_totals()
{
    $root =& $_SESSION["webreports"];
    //	ensure all fields in reports are listed in the tables
    $tables = getReportTablesList();
    if (is_wr_custom()) {
        $fields = WRGetFieldsList('');
    }
    $arr_unset = array();
    foreach ($root["totals"] as $idx => $fld) {
        if (array_search($fld["table"], $tables) !== false || is_null($fld["table"]) && is_wr_custom()) {
            if (!is_wr_custom()) {
                $fields = WRGetFieldsList($fld["table"]);
            }
            if (array_search($fld["name"], $fields) !== false) {
                continue;
            }
        }
        //	remove $total if found
        $arr_unset[] = $idx;
    }
    foreach ($arr_unset as $idx => $fld) {
        unset($root["totals"][$fld]);
    }
    //	ensure all fields appear in the totals
    $all_fields = array();
    foreach ($tables as $t) {
        $fields = WRGetFieldsList($t);
        foreach ($fields as $f) {
            if (is_wr_db()) {
                $all_fields[] = $t . "." . $f;
            } else {
                $all_fields[] = $f;
            }
        }
    }
    //	ensure all series  fields appear in the totals
    foreach ($all_fields as $fieldItem) {
        $f = $fieldItem;
        $table = "";
        $fld = "";
        if (is_wr_db()) {
            WRSplitFieldName($f, $table, $fld);
        } else {
            $table = $tables[0];
            $fld = $f;
            $f = $table . "_" . $f;
        }
        if (array_key_exists(GoodFieldName($f), $root["totals"])) {
            continue;
        }
        $pSet = new ProjectSettings($table, PAGE_LIST);
        $root['totals'][GoodFieldName($f)] = array();
        $root['totals'][GoodFieldName($f)]["name"] = $fld;
        $root['totals'][GoodFieldName($f)]["table"] = $table;
        $root['totals'][GoodFieldName($f)]["label"] = $pSet->label($fld);
        $root['totals'][GoodFieldName($f)]["show"] = "true";
        $root['totals'][GoodFieldName($f)]["min"] = "false";
        $root['totals'][GoodFieldName($f)]["max"] = "false";
        $root['totals'][GoodFieldName($f)]["sum"] = "false";
        $root['totals'][GoodFieldName($f)]["avg"] = "false";
        $root['totals'][GoodFieldName($f)]["curr"] = "false";
        $root['totals'][GoodFieldName($f)]["search"] = "";
        $root['totals'][GoodFieldName($f)]["view_format"] = GetGenericViewFormat($table, $fld);
        $root['totals'][GoodFieldName($f)]["edit_format"] = GetGenericEditFormat($table, $fld);
        $root['totals'][GoodFieldName($f)]["display_field"] = $pSet->getDisplayField($fld);
        $root['totals'][GoodFieldName($f)]["linkfield"] = $pSet->getLinkField($fld);
        $root['totals'][GoodFieldName($f)]["show_thumbnail"] = $pSet->showThumbnail($fld);
        $root['totals'][GoodFieldName($f)]["need_encode"] = $pSet->NeedEncode($fld);
        $root['totals'][GoodFieldName($f)]["thumbnail"] = $pSet->getStrThumbnail($fld);
        $root['totals'][GoodFieldName($f)]["listformatobj_imgwidth"] = $pSet->getImageWidth($fld);
        $root['totals'][GoodFieldName($f)]["listformatobj_imgheight"] = $pSet->getImageHeight($fld);
        $root['totals'][GoodFieldName($f)]["hlprefix"] = $pSet->getLinkPrefix($fld);
        $root['totals'][GoodFieldName($f)]["listformatobj_filename"] = $pSet->getFilenameField($fld);
        $root['totals'][GoodFieldName($f)]["lookupobj_lookuptype"] = $pSet->getLookupType($fld);
        $root['totals'][GoodFieldName($f)]["editformatobj_lookupobj_customdispaly"] = $pSet->getDisplayField($fld);
        $root['totals'][GoodFieldName($f)]["editformatobj_lookupobj_table"] = $pSet->getLookupTable($fld);
        $root['totals'][GoodFieldName($f)]["editformatobj_lookupobj_where"] = GetLWWhere($fld, PAGE_REPORT);
    }
    $_SESSION["webreports"] = $root;
}
Ejemplo n.º 3
0
function update_report_sort_fields()
{
    //	ensure all group fields are listed in the tables
    $root =& $_SESSION["webreports"];
    if (!$root["sort_fields"]) {
        return;
    }
    //	ensure all fields in reports are listed in the tables
    $tables = getReportTablesList();
    $changed = false;
    $arr_unset = array();
    foreach ($root["sort_fields"] as $idx => $fld) {
        $table = "";
        $field = "";
        if (is_wr_db()) {
            WRSplitFieldName($fld["name"], $table, $field);
        } else {
            $field = $fld["name"];
            $table = $root['tables'][0];
        }
        if (array_search($table, $tables) !== false) {
            $fields = WRGetFieldsList($table);
            if (array_search($field, $fields) !== false) {
                continue;
            }
        }
        //	remove $total if found
        $arr_unset[] = $idx;
    }
    foreach ($arr_unset as $idx => $fld) {
        unset($root["sort_fields"][$fld]);
    }
    //	make new array
    $newarr = array();
    //	add group fields
    foreach ($root["group_fields"] as $fld) {
        if ($fld["name"] == "Summary") {
            continue;
        }
        $newarr[] = array("name" => $fld["name"], "desc" => "false");
    }
    //	add the rest of fields
    $keys = array_keys($root["sort_fields"]);
    $j = count($newarr);
    foreach ($keys as $idx) {
        $found = false;
        foreach ($newarr as $nfld) {
            if ($nfld["name"] == $root["sort_fields"][$idx]["name"]) {
                $found = true;
                break;
            }
        }
        if ($found) {
            continue;
        }
        $newarr[$j] = $root["sort_fields"][$idx];
        $j++;
    }
    $root["sort_fields"] = $newarr;
}