Exemplo n.º 1
0
    $selected_query = $_POST[$wpbi_settings['parameter']['qy_id']];
    $old_query = new vo_query($selected_query, NULL, NULL, NULL);
    $new_query = new vo_query($selected_query, $_POST[$wpbi_settings['parameter']['qy_db']], $_POST[$wpbi_settings['parameter']['qy_name']], $_POST[$wpbi_settings['parameter']['qy_statement']]);
    $dao_query = new dao_query($wpdb, $wpbi_sql['tname']['queries']);
    $dao_query->edit($old_query, $new_query);
}
?>

<?php 
/***********************/
/***     DEFAULT     ***/
/***********************/
/**** Build form to create new query and display the created query ***/
if ($_GET[$wpbi_settings['parameter']['action']] != $wpbi_settings['value']['test'] && $_GET[$wpbi_settings['parameter']['action']] != $wpbi_settings['value']['edit'] && $_POST[$wpbi_settings['parameter']['action']] != $wpbi_settings['value']['edit-test']) {
    //Database select options
    $dao_database = new dao_database($wpdb, $wpbi_sql['tname']['databases']);
    $vo_database = $dao_database->select(NULL);
    if (sizeof($vo_database) == 0) {
        echo '
	<p>' . $wpbi_dialog['msg']['warning']['no-connections'] . '</p>
	';
    } else {
        $select_options = '';
        for ($index = 0; $index < sizeof($vo_database); $index++) {
            $selected = '';
            if ((int) $_POST[$wpbi_settings['parameter']['qy_db']] == $vo_database[$index]->id) {
                $selected = 'selected';
            }
            $select_options = $select_options . '			
		<option ' . $selected . ' value="' . $vo_database[$index]->id . '">' . $vo_database[$index]->name . ' (' . $vo_database[$index]->user . '@' . $vo_database[$index]->host . ')</option>
		';
Exemplo n.º 2
0
			<option ' . $selected . ' value="' . $vo_query[$index]->id . '">' . $vo_query[$index]->name . '</option>
			';
        }
    }
    $template_site->assign_vars(array('PG_TITLE' => $wpbi_dialog['page']['tables']['title'], 'PG_DESCRIPTION' => $wpbi_dialog['page']['tables']['description'], 'VW_NEW_QUERY' => $wpbi_dialog['field']['tables']['query'], 'VW_NEW_QY_OPTIONS' => $select_options, 'VW_NEW_FORM_ACTION' => substr(substr(strrchr($_SERVER['REQUEST_URI'], '/'), 1), 0, strpos(substr(strrchr($_SERVER['REQUEST_URI'], '/'), 1), '&')), 'P_VW_ACTION' => $wpbi_settings['parameter']['action'], 'V_SET_ACTION' => $wpbi_settings['value']['set'], 'P_VW_QY' => $wpbi_settings['parameter']['qy_id'], 'LBL_BTN_SET' => $wpbi_dialog['button']['label']['set']));
    /***********************/
    /***   SET ACTION    ***/
    /***********************/
    if (($_POST[$wpbi_settings['parameter']['action']] == $wpbi_settings['value']['set'] || $_POST[$wpbi_settings['parameter']['action']] == $wpbi_settings['value']['test']) && isset($_POST[$wpbi_settings['parameter']['qy_id']])) {
        //Get selected query
        $dao_query = new dao_query($wpdb, $wpbi_sql['tname']['queries']);
        $tgt_query = new vo_query($_POST[$wpbi_settings['parameter']['qy_id']], NULL, NULL, NULL, NULL);
        $vo_query = $dao_query->select($tgt_query);
        $vo_query = $vo_query[0];
        //Select associated db
        $dao_database = new dao_database($wpdb, $wpbi_sql['tname']['databases']);
        $tgt_database = new vo_database($vo_query->db_id, NULL, NULL, NULL, NULL);
        $vo_database = $dao_database->select($tgt_database);
        $vo_database = $vo_database[0];
        //Create wpdb object and execute the query
        $my_test_db = new wpdb($vo_database->user, $vo_database->pass, $vo_database->name, $vo_database->host);
        $query = new query($vo_query->statement, $wpdb, $wpbi_sql['tname']['vars']);
        //Execute query limiting the resultset
        $my_test_rows = $my_test_db->get_results($query->limit_qy_to(0, 1), 'ARRAY_N');
        $my_test_cols = $my_test_db->get_col_info('name');
        //build html for columns
        $col_idx = 0;
        $columns_html = '';
        $checked = '';
        foreach ($my_test_cols as $my_test_col) {
            if (!isset($_POST[$wpbi_settings['parameter']['tb-cb-column-tf']]) || in_array($col_idx, $_POST[$wpbi_settings['parameter']['tb-cb-column-tf']])) {
Exemplo n.º 3
0
function get_html_4_chart($id)
{
    global $wpdb, $qy_table_databases, $qy_table_queries, $wpbi_sql, $wpbi_settings, $wpbi_url, $wpbi_dialog, $lng, $language, $template_site;
    $template_site->set_filenames(array('chart' => $wpbi_url['tpl']['root-path'] . $wpbi_url['tpl']['nvd3chart']));
    $chart_id = $id;
    //id or key
    $search_by_key = false;
    if (!is_numeric($chart_id)) {
        if (strlen($chart_id) == 32 && strpos($chart_id, ' ') === false) {
            $search_by_key = true;
        } else {
            return '<p>Could not create table. Wrong ID provided.</p>';
        }
    }
    $test_output = '';
    //Store the test output
    //Get chart metadata
    $selected_charts = $chart_id;
    $vo_chart = new vo_chart(NULL);
    $vo_chart->set_chart_id($selected_charts);
    $vo_chart->set_chart_key($selected_charts);
    $dao_chart = new dao_chart($wpdb, $wpbi_sql['tname']['charts']);
    $vo_chart = $search_by_key ? $dao_chart->select_by_key($vo_chart) : $dao_chart->select($vo_chart);
    $vo_chart = $vo_chart[0];
    //Get cols metadata
    $vo_ch_cols = new vo_ch_cols();
    $vo_ch_cols->set_ch_id($vo_chart->chart_id);
    $dao_ch_cols = new dao_ch_cols($wpdb, $wpbi_sql['tname']['chart-cols']);
    $vo_ch_cols = $dao_ch_cols->select($vo_ch_cols);
    //Get selected query
    $dao_query = new dao_query($wpdb, $wpbi_sql['tname']['queries']);
    $tgt_query = new vo_query($vo_chart->query_id, NULL, NULL, NULL, NULL);
    $vo_query = $dao_query->select($tgt_query);
    $vo_query = $vo_query[0];
    //Select associated db
    $dao_database = new dao_database($wpdb, $wpbi_sql['tname']['databases']);
    $tgt_database = new vo_database($vo_query->db_id, NULL, NULL, NULL, NULL);
    $vo_database = $dao_database->select($tgt_database);
    $vo_database = $vo_database[0];
    //Create wpdb object and execute the query
    $my_test_db = new wpdb($vo_database->user, $vo_database->pass, $vo_database->name, $vo_database->host);
    $query = new query($vo_query->statement, $wpdb, $wpbi_sql['tname']['vars']);
    $total_rows = $my_test_db->get_results($query->count_qy_results(), 'ARRAY_N');
    if (count($total_rows) == 0) {
        return "<div style='padding:40px;'><h1 style='color: red;'>The query returned no data</h1>" . "<p>Please check the DB connectivity or your SQL query syntax</p></div>";
    }
    $total_rows = intval($total_rows[0][0]);
    //get query resultset
    $my_test_rows = $my_test_db->get_results($query->stmt, 'ARRAY_N');
    //get columns
    $x_label_cols = array();
    $color_cols = array();
    $tx_label_cols = array();
    $values_cols = array();
    $istime_cols = array();
    $stacked_label_cols = array();
    $stacked_label_cols_color = array();
    $col_idx = 0;
    foreach ($vo_ch_cols as $vo_ch_col) {
        array_push($tx_label_cols, $vo_ch_col->col_label);
        array_push($color_cols, $vo_ch_col->col_color);
        if ($vo_ch_col->is_label) {
            array_push($x_label_cols, $col_idx);
        }
        if ($vo_ch_col->is_value) {
            array_push($values_cols, $col_idx);
            array_push($stacked_label_cols, $vo_ch_col->col_label);
            array_push($stacked_label_cols_color, $vo_ch_col->col_color);
        }
        if ($vo_ch_col->is_time) {
            array_push($istime_cols, $col_idx);
        }
        $col_idx++;
    }
    //Create chart
    $wpbi_chart = new chart($my_test_rows);
    $wpbi_chart->set_name($vo_chart->chart_name);
    $wpbi_chart->set_tooltip($vo_chart->chart_tooltip);
    $wpbi_chart->set_width($vo_chart->chart_width . ($vo_chart->chart_width_percent ? '%' : ''));
    $wpbi_chart->set_height($vo_chart->chart_height . ($vo_chart->chart_height_percent ? '%' : ''));
    $wpbi_chart->set_bg_colour($vo_chart->chart_bg_color);
    $wpbi_chart->set_title($vo_chart->chart_title);
    $wpbi_chart->set_title_color($vo_chart->chart_title_color);
    $wpbi_chart->set_title_size($vo_chart->chart_title_size);
    $wpbi_chart->set_type($vo_chart->chart_type);
    $wpbi_chart->set_x_axis_step_percent($vo_chart->chart_x_grid_lines);
    $wpbi_chart->set_y_axis_step_percent($vo_chart->chart_y_grid_lines);
    $wpbi_chart->set_time_format($vo_chart->chart_time_format);
    //Get values, labels, colors
    $label_color = array();
    $stacked_label_color = array();
    $row_idx = 0;
    $label_tmp_x = "";
    foreach ($my_test_rows as $my_test_row) {
        for ($col_idx = 0; $col_idx < sizeof($my_test_row); $col_idx++) {
            //Colors
            $label_color[$tx_label_cols[$col_idx]] = $color_cols[$col_idx];
            if (in_array($col_idx, $values_cols)) {
                $stacked_label_color[$tx_label_cols[$col_idx]] = $color_cols[$col_idx];
            }
            if (in_array($col_idx, $values_cols)) {
                //create different array of values for each selected column
                $current_value = is_string($my_test_row[$col_idx]) ? $my_test_row[$col_idx] : floatval($my_test_row[$col_idx]);
                if (isset($data[$tx_label_cols[$col_idx]])) {
                    array_push($data[$tx_label_cols[$col_idx]], $current_value);
                } else {
                    $data[$tx_label_cols[$col_idx]] = array();
                    array_push($data[$tx_label_cols[$col_idx]], $current_value);
                }
            }
            if (in_array($col_idx, $values_cols)) {
                //create different array of values for each selected column (for stacked bar chart)
                $current_value = floatval($my_test_row[$col_idx]);
                if (isset($data_stacked[$row_idx])) {
                    array_push($data_stacked[$row_idx], $current_value);
                } else {
                    $data_stacked[$row_idx] = array();
                    array_push($data_stacked[$row_idx], $current_value);
                }
            }
            if (in_array($col_idx, $x_label_cols)) {
                //Concatenate selected columns
                $label_tmp_x = $label_tmp_x == '' ? $my_test_row[$col_idx] : $label_tmp_x . $wpbi_dialog['charts']['x-label']['concat-string'] . $my_test_row[$col_idx];
            }
        }
        if ($label_tmp_x != NULL) {
            $label_x[] = $label_tmp_x;
            $label_tmp_x = '';
        }
        $row_idx++;
    }
    //Assign values and labels
    switch ($wpbi_chart->type) {
        case chart::DONUT:
        case chart::PIE:
            if (sizeof($label_x) > 0) {
                $wpbi_chart->set_x_axis_labels($label_x, $vo_chart->chart_x_labels_size, $vo_chart->chart_x_labels_color);
            }
            foreach ($data as $key => $value) {
                //Overwrite data value for pie chart in order to show labels (via pie_value object)
                if (sizeof($label_x) > 0) {
                    for ($idx = 0; $idx < sizeof($value); $idx++) {
                        $value[$idx] = new pie_value($value[$idx], $label_x[$idx]);
                    }
                }
                $wpbi_chart->set_tooltip($wpbi_dialog['charts']['pie']['tooltip']);
                $wpbi_chart->create_element($key, $value);
                $wpbi_chart->elements[$key]->set_colours($wpbi_settings['pie-chart']['color-set']);
            }
            break;
        case chart::BAR_STACKED:
            if (sizeof($label_x) > 0) {
                $wpbi_chart->set_x_axis_labels($label_x, $_POST[$wpbi_settings['parameter']['ch-x-label-size']], $_POST[$wpbi_settings['parameter']['ch-x-label-color']]);
                $wpbi_chart->x_axis_istime = sizeof($istime_cols) > 0;
                if ($wpbi_chart->x_axis_istime) {
                    $wpbi_chart->x_axis_labels->labels = $wpbi_chart->convert_to_time($wpbi_chart->x_axis_labels->labels);
                }
            }
            $wpbi_chart->set_y_axis_labels_color($_POST[$wpbi_settings['parameter']['ch-y-label-color']]);
            $wpbi_chart->set_y_axis_labels_size($_POST[$wpbi_settings['parameter']['ch-y-label-size']]);
            foreach ($data_stacked as $key => $value) {
                $wpbi_chart->create_element('BAR_STACKED', $value);
                $wpbi_chart->elements['BAR_STACKED']->set_colours($stacked_label_color);
            }
            break;
        case chart::STACKED_AREA:
        case chart::LINE_AREA:
            if (sizeof($label_x) > 0) {
                $wpbi_chart->set_x_axis_labels($label_x, $vo_chart->chart_x_labels_size, $vo_chart->chart_x_labels_color);
            }
            $wpbi_chart->set_y_axis_labels_color($vo_chart->chart_y_labels_color);
            $wpbi_chart->set_y_axis_labels_size($vo_chart->chart_y_labels_size);
            foreach ($data as $key => $value) {
                $wpbi_chart->create_element($key, $value);
                $wpbi_chart->elements[$key]->set_colour($label_color[$key]);
                $wpbi_chart->elements[$key]->set_fill_colour($label_color[$key]);
                $wpbi_chart->elements[$key]->set_fill_alpha(0.5);
            }
            break;
        case chart::RADAR:
            if (sizeof($label_x) > 0) {
                $wpbi_chart->set_y_axis_labels($label_x, $vo_chart->chart_y_labels_size, $vo_chart->chart_y_labels_color);
            }
            foreach ($data as $key => $value) {
                $wpbi_chart->create_element($key, $value);
                $wpbi_chart->elements[$key]->set_colour($label_color[$key]);
            }
            break;
        case chart::BAR_HORIZONTAL:
            if (sizeof($label_x) > 0) {
                $wpbi_chart->set_y_axis_labels($label_x, $vo_chart->chart_y_labels_size, $vo_chart->chart_y_labels_color);
            }
            $wpbi_chart->set_x_axis_labels_color($vo_chart->chart_x_labels_color);
            $wpbi_chart->set_x_axis_labels_size($vo_chart->chart_x_labels_size);
            foreach ($data as $key => $value) {
                $wpbi_chart->create_element($key, $value);
                $wpbi_chart->elements[$key]->set_colour($label_color[$key]);
            }
            break;
        default:
            if (sizeof($label_x) > 0) {
                $wpbi_chart->set_x_axis_labels($label_x, $vo_chart->chart_x_labels_size, $vo_chart->chart_x_labels_color, sizeof($istime_cols) > 0);
                $wpbi_chart->x_axis_istime = sizeof($istime_cols) > 0;
            } else {
                $wpbi_chart->set_x_axis_labels_color($vo_chart->chart_x_labels_color);
                $wpbi_chart->set_x_axis_labels_size($vo_chart->chart_x_labels_size);
            }
            $wpbi_chart->set_y_axis_labels_color($vo_chart->chart_y_labels_color);
            $wpbi_chart->set_y_axis_labels_size($vo_chart->chart_y_labels_size);
            foreach ($data as $key => $value) {
                $wpbi_chart->create_element($key, $value);
                $wpbi_chart->elements[$key]->set_colour($label_color[$key]);
            }
            break;
    }
    //Set legends
    $wpbi_chart->set_y_legend($vo_chart->chart_y_legend, $vo_chart->chart_y_legend_size, $vo_chart->chart_y_legend_color);
    $wpbi_chart->set_x_legend($vo_chart->chart_x_legend, $vo_chart->chart_x_legend_size, $vo_chart->chart_x_legend_color);
    $wpbi_chart->set_x_label($vo_chart->chart_x_axis_label);
    $wpbi_chart->set_x_axis_labels_rotation($vo_chart->chart_x_labels_rotation);
    $wpbi_chart->set_y_axis_labels_rotation($vo_chart->chart_y_labels_rotation);
    $wpbi_chart->set_y_axis_color($vo_chart->chart_y_color);
    $wpbi_chart->set_y_axis_grid_color($vo_chart->chart_y_grid_color);
    $wpbi_chart->set_y_axis_thickness($vo_chart->chart_y_thickness);
    $wpbi_chart->set_x_axis_color($vo_chart->chart_x_color);
    $wpbi_chart->set_x_axis_grid_color($vo_chart->chart_x_grid_color);
    $wpbi_chart->set_x_axis_thickness($vo_chart->chart_x_thickness);
    $wpbi_chart->set_x_precision($vo_chart->chart_x_axis_precision);
    $wpbi_chart->set_y_precision($vo_chart->chart_y_axis_precision);
    $wpbi_chart->set_y_range($vo_chart->chart_y_axis_range);
    $wpbi_chart->set_y_label($vo_chart->chart_y_axis_label);
    $wpbi_chart->set_y_currency($vo_chart->chart_y_axis_currency);
    $wpbi_chart->set_snapshot($vo_chart->chart_snapshot == 1);
    $wpbi_chart->set_stacked($vo_chart->chart_stacked == 1);
    //Main legend for stacked chart
    if ($wpbi_chart->type == chart::BAR_STACKED) {
        $stacked_keys = array();
        for ($i = 0; $i < sizeof($stacked_label_cols_color); $i++) {
            array_push($stacked_keys, new bar_stack_key($stacked_label_cols_color[$i], $stacked_label_cols[$i], 10));
        }
        $wpbi_chart->elements['BAR_STACKED']->set_keys($stacked_keys);
    }
    $wpbi_chart->build();
    //Import scripts
    echo '
		<link rel="stylesheet" href="' . $wpbi_url['nvd3']['css'] . '" type="text/css" />

		<script type="text/javascript" src="' . $wpbi_url['nvd3']['d3js'] . '"></script>
		<script type="text/javascript" src="' . $wpbi_url['nvd3']['nvd3'] . '"></script>
		';
    //Set template variables
    $template_site->assign_vars(array('CH_NEW_CHART_NAME' => $selected_charts, 'CH_NEW_CHART_WIDTH' => $wpbi_chart->width, 'CH_NEW_CHART_HEIGHT' => $wpbi_chart->height, 'CH_NEW_CHART_RESIZE' => 'chart_resize', 'CH_NEW_CHART_JSON' => $wpbi_chart->get_json_code(), 'CH_NEW_CHART_NVD3_CODE' => $wpbi_chart->get_nvd3_chart_code(), 'CH_NEW_CHART_NVD3_HTML' => $wpbi_chart->get_nvd3_chart_html(), 'CH_NEW_CHART_NVD3_DATA' => $wpbi_chart->get_nvd3_chart_data(), 'CH_NEW_CHART_NVD3_PLACEHOLDER' => $wpbi_chart->get_nvd3_chart_placeholder()));
    ob_start();
    $template_site->pparse('chart');
    $chart_output = ob_get_contents();
    ob_end_clean();
    return $chart_output;
}
Exemplo n.º 4
0
function wpbi_initWPDBconnection()
{
    global $wpdb, $wpbi_settings, $wpbi_sql;
    $wpbi_query = "SELECT * FROM " . $wpbi_sql['tname']['databases'];
    // test if at least one DB connection already exists
    if (!$wpdb->query($wpbi_query)) {
        $wpbi_credentials = wpbi_getWPDBcredentials();
        $vo_database = new vo_database(NULL, $wpbi_credentials[0], $wpbi_credentials[3], $wpbi_credentials[1], $wpbi_credentials[2]);
        $dao_database = new dao_database($wpdb, $wpbi_sql['tname']['databases']);
        $dao_database->add($vo_database);
    }
}
Exemplo n.º 5
0
    $dao_database = new dao_database($wpdb, $wpbi_sql['tname']['databases']);
    $tgt_database = new vo_database($db_id, NULL, NULL, NULL, NULL);
    $vo_database = $dao_database->select($tgt_database);
    $vo_database = $vo_database[0];
    //Prepare output
    $template_site->assign_vars(array('PG_TITLE' => $wpbi_dialog['page']['connections']['title'], 'PG_DESCRIPTION' => $wpbi_dialog['action']['connections']['edit'], 'CONN_EDIT_NAME' => $wpbi_dialog['field']['connections']['name'], 'CONN_EDIT_HOST' => $wpbi_dialog['field']['connections']['host'], 'CONN_EDIT_USER' => $wpbi_dialog['field']['connections']['user'], 'CONN_EDIT_PASS' => $wpbi_dialog['field']['connections']['pass'], 'P_DB_ID' => $wpbi_settings['parameter']['db_id'], 'V_DB_ID' => $vo_database->id, 'P_CONN_NAME' => $wpbi_settings['parameter']['db_name'], 'V_CONN_NAME' => isset($_POST[$wpbi_settings['parameter']['db_name']]) ? $_POST[$wpbi_settings['parameter']['db_name']] : $vo_database->name, 'P_CONN_HOST' => $wpbi_settings['parameter']['db_host'], 'V_CONN_HOST' => isset($_POST[$wpbi_settings['parameter']['db_host']]) ? $_POST[$wpbi_settings['parameter']['db_host']] : $vo_database->host, 'P_CONN_USER' => $wpbi_settings['parameter']['db_user'], 'V_CONN_USER' => isset($_POST[$wpbi_settings['parameter']['db_user']]) ? $_POST[$wpbi_settings['parameter']['db_user']] : $vo_database->user, 'P_CONN_PASS' => $wpbi_settings['parameter']['db_pass'], 'V_CONN_PASS' => isset($_POST[$wpbi_settings['parameter']['db_pass']]) ? $_POST[$wpbi_settings['parameter']['db_pass']] : $vo_database->pass, 'P_CONN_ACTION' => $wpbi_settings['parameter']['action'], 'V_EDIT_ACTION' => $wpbi_settings['value']['edit'], 'V_TEST_ACTION' => $wpbi_settings['value']['edit-test'], 'LBL_BTN_ADD' => $wpbi_dialog['label']['button']['add'], 'LBL_BTN_TEST' => $wpbi_dialog['label']['button']['test'], 'CONN_EDIT_FORM_ACTION' => substr(substr(strrchr($_SERVER['REQUEST_URI'], '/'), 1), 0, strpos(substr(strrchr($_SERVER['REQUEST_URI'], '/'), 1), '&')), 'CONN_TEST_RESULT' => $test_result));
    //output page header and database form
    $template_site->pparse('header');
    $template_site->pparse('connections-edit');
}
/**** Edit database: save modifications ***/
if ($_POST[$wpbi_settings['parameter']['action']] == $wpbi_settings['value']['edit'] && isset($_POST[$wpbi_settings['parameter']['db_id']]) && isset($_POST[$wpbi_settings['parameter']['db_host']]) && isset($_POST[$wpbi_settings['parameter']['db_name']]) && isset($_POST[$wpbi_settings['parameter']['db_user']]) && isset($_POST[$wpbi_settings['parameter']['db_pass']])) {
    $selected_db = $_POST[$wpbi_settings['parameter']['db_id']];
    $old_db = new vo_database($selected_db, NULL, NULL, NULL, NULL);
    $new_db = new vo_database($selected_db, $_POST[$wpbi_settings['parameter']['db_name']], $_POST[$wpbi_settings['parameter']['db_host']], $_POST[$wpbi_settings['parameter']['db_user']], $_POST[$wpbi_settings['parameter']['db_pass']]);
    $dao_database = new dao_database($wpdb, $wpbi_sql['tname']['databases']);
    $dao_database->edit($old_db, $new_db);
}
?>

<?php 
/***********************/
/***     DEFAULT     ***/
/***********************/
if ($_GET[$wpbi_settings['parameter']['action']] != $wpbi_settings['value']['edit'] && $_POST[$wpbi_settings['parameter']['action']] != $wpbi_settings['value']['edit-test']) {
    //Prepare output
    $template_site->assign_vars(array('PG_TITLE' => $wpbi_dialog['page']['connections']['title'], 'PG_DESCRIPTION' => $wpbi_dialog['page']['connections']['description'], 'CONN_NEW_NAME' => $wpbi_dialog['field']['connections']['name'], 'CONN_NEW_HOST' => $wpbi_dialog['field']['connections']['host'], 'CONN_NEW_USER' => $wpbi_dialog['field']['connections']['user'], 'CONN_NEW_PASS' => $wpbi_dialog['field']['connections']['pass'], 'P_CONN_NAME' => $wpbi_settings['parameter']['db_name'], 'V_CONN_NAME' => $_POST[$wpbi_settings['parameter']['db_name']], 'P_CONN_HOST' => $wpbi_settings['parameter']['db_host'], 'V_CONN_HOST' => $_POST[$wpbi_settings['parameter']['db_host']], 'P_CONN_USER' => $wpbi_settings['parameter']['db_user'], 'V_CONN_USER' => $_POST[$wpbi_settings['parameter']['db_user']], 'P_CONN_PASS' => $wpbi_settings['parameter']['db_pass'], 'V_CONN_PASS' => $_POST[$wpbi_settings['parameter']['db_pass']], 'P_CONN_ACTION' => $wpbi_settings['parameter']['action'], 'V_ADD_ACTION' => $wpbi_settings['value']['add'], 'V_TEST_ACTION' => $wpbi_settings['value']['test'], 'LBL_BTN_ADD' => $wpbi_dialog['label']['button']['add'], 'LBL_BTN_TEST' => $wpbi_dialog['label']['button']['test'], 'DB_TEST_DESCRIPTION' => $wpbi_dialog['page']['connections']['test-description'], 'CONN_TEST_RESULT' => $test_result));
    //output page header and query form
    $template_site->pparse('header');
    $template_site->pparse('connections-new');
    //Get saved connections