/*
 * Handle the input criteria and generate the query result
 * Form for displaying query results
 */
if (isset($_POST['zoom_submit']) && $_POST['criteriaColumnNames'][0] != 'pma_null' && $_POST['criteriaColumnNames'][1] != 'pma_null' && $_POST['criteriaColumnNames'][0] != $_POST['criteriaColumnNames'][1]) {
    //Query generation part
    $sql_query = $table_search->buildSqlQuery();
    $sql_query .= ' LIMIT ' . $_POST['maxPlotLimit'];
    //Query execution part
    $result = $GLOBALS['dbi']->query($sql_query . ";", null, PMA_DatabaseInterface::QUERY_STORE);
    $fields_meta = $GLOBALS['dbi']->getFieldsMeta($result);
    $data = array();
    while ($row = $GLOBALS['dbi']->fetchAssoc($result)) {
        //Need a row with indexes as 0,1,2 for the getUniqueCondition
        // hence using a temporary array
        $tmpRow = array();
        foreach ($row as $val) {
            $tmpRow[] = $val;
        }
        //Get unique condition on each row (will be needed for row update)
        $uniqueCondition = PMA_Util::getUniqueCondition($result, count($table_search->getColumnNames()), $fields_meta, $tmpRow, true);
        //Append it to row array as where_clause
        $row['where_clause'] = $uniqueCondition[0];
        $tmpData = array($_POST['criteriaColumnNames'][0] => $row[$_POST['criteriaColumnNames'][0]], $_POST['criteriaColumnNames'][1] => $row[$_POST['criteriaColumnNames'][1]], 'where_clause' => $uniqueCondition[0]);
        $tmpData[$dataLabel] = $dataLabel ? $row[$dataLabel] : '';
        $data[] = $tmpData;
    }
    unset($tmpData);
    //Displays form for point data and scatter plot
    $response->addHTML($table_search->getZoomResultsForm($goto, $data));
}
Ejemplo n.º 2
0
 /**
  * Test for getZoomResultsForm
  *
  * @return void
  */
 public function testGetZoomResultsForm()
 {
     $tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "zoom");
     $goto = "http://phpmyadmin.net";
     $data = array("PMAA" => "abc");
     $html = $tableSearch->getZoomResultsForm($goto, $data);
     $this->assertContains('<legend>' . __('Browse/Edit the points') . '</legend>', $html);
     $this->assertContains(json_encode($data), $html);
 }