コード例 #1
0
 /**
  * Tests for PMA_getHtmlForTableChartDisplay() method.
  *
  * @return void
  * @test
  */
 public function testPMAGetHtmlForTableChartDisplay()
 {
     $_SESSION[' PMA_token '] = "PMA_token";
     $_SESSION['tmpval']['pos'] = "pos";
     $_SESSION['tmpval']['max_rows'] = "all";
     $GLOBALS['cfg']['MaxRows'] = 10;
     $url_query = "url_query";
     $url_params = array("url" => "url_params");
     $keys = array("x1" => "value1", "x2" => "value2");
     $fields_meta = array("x1" => new Mock_Meta("type1"), "x2" => new Mock_Meta("type3"));
     $numeric_types = array("type1", "type2");
     $numeric_column_count = 2;
     $sql_query = "sql_query";
     $yaxis = null;
     $html = PMA_getHtmlForTableChartDisplay($url_query, $url_params, $keys, $fields_meta, $numeric_types, $numeric_column_count, $sql_query);
     //case 1: PMA_getHtmlForPmaTokenAndUrlQuery
     $this->assertContains(PMA_getHtmlForPmaTokenAndUrlQuery($url_query), $html);
     //case 2: PMA_getHtmlForPmaTokenAndUrlQuery
     $this->assertContains(PMA_URL_getHiddenInputs($url_params), $html);
     //case 3: options
     $this->assertContains(PMA_getHtmlForChartTypeOptions(), $html);
     $this->assertContains(PMA_getHtmlForStackedOption(), $html);
     //case 4: options
     $this->assertContains(__('Chart title'), $html);
     //case 5: options
     $this->assertContains(PMA_getHtmlForChartXAxisOptions($keys, $yaxis), $html);
     $this->assertContains(PMA_getHtmlForChartSeriesOptions($keys, $fields_meta, $numeric_types, $yaxis, $numeric_column_count), $html);
     //case 6: PMA_getHtmlForDateTimeCols
     $this->assertContains(PMA_getHtmlForDateTimeCols($keys, $fields_meta), $html);
     $this->assertContains(PMA_getHtmlForTableAxisLabelOptions($yaxis, $keys), $html);
     $this->assertContains(PMA_Util::getStartAndNumberOfRowsPanel($sql_query), $html);
     $this->assertContains(PMA_getHtmlForChartAreaDiv(), $html);
 }
コード例 #2
0
ファイル: tbl_chart.lib.php プロジェクト: minggLu/openemr
/**
 * Function to get html for displaying table chart
 *
 * @param string $url_query            url query
 * @param array  $url_params           url parameters
 * @param array  $keys                 keys
 * @param array  $fields_meta          fields meta
 * @param array  $numeric_types        numeric types
 * @param int    $numeric_column_count numeric column count
 * @param string $sql_query            sql query
 *
 * @return string
 */
function PMA_getHtmlForTableChartDisplay($url_query, $url_params, $keys, $fields_meta, $numeric_types, $numeric_column_count, $sql_query)
{
    // pma_token/url_query needed for chart export
    $htmlString = PMA_getHtmlForPmaTokenAndUrlQuery($url_query);
    $htmlString .= '<!-- Display Chart options -->' . '<div id="div_view_options">' . '<form method="post" id="tblchartform" action="tbl_chart.php" ' . 'class="ajax">' . PMA_URL_getHiddenInputs($url_params) . '<fieldset>' . '<legend>' . __('Display chart') . '</legend>' . '<div style="float:left; width:420px;">';
    $htmlString .= PMA_getHtmlForChartTypeOptions();
    $htmlString .= PMA_getHtmlForStackedOption();
    $htmlString .= '<input type="text" name="chartTitle" value="' . __('Chart title') . '">' . '</div>';
    $yaxis = null;
    $htmlString .= PMA_getHtmlForChartXAxisOptions($keys, $yaxis);
    $htmlString .= PMA_getHtmlForChartSeriesOptions($keys, $fields_meta, $numeric_types, $yaxis, $numeric_column_count);
    $htmlString .= PMA_getHtmlForDateTimeCols($keys, $fields_meta);
    $htmlString .= PMA_getHtmlForNumericCols($keys, $fields_meta, $numeric_types);
    $htmlString .= '</div>';
    $htmlString .= PMA_getHtmlForTableAxisLabelOptions($yaxis, $keys);
    $htmlString .= PMA_getHtmlForStartAndNumberOfRowsOptions($sql_query);
    $htmlString .= PMA_getHtmlForChartAreaDiv();
    $htmlString .= '</fieldset>' . '</form>' . '</div>';
    return $htmlString;
}