Exemplo n.º 1
0
}
// end if isset($destination_foreign)
// U p d a t e s   f o r   d i s p l a y   f i e l d
if ($cfgRelation['displaywork'] && isset($_POST['display_field'])) {
    $html_output .= PMA_handleUpdateForDisplayField($disp, $_POST['display_field'], $db, $table, $cfgRelation);
}
// end if
// If we did an update, refresh our data
if (isset($_POST['destination_db']) && $cfgRelation['relwork']) {
    $existrel = PMA_getForeigners($db, $table, '', 'internal');
}
if (isset($_POST['destination_foreign_db']) && PMA_Util::isForeignKeySupported($tbl_storage_engine)) {
    $existrel_foreign = PMA_getForeigners($db, $table, '', 'foreign');
}
if ($cfgRelation['displaywork']) {
    $disp = PMA_getDisplayField($db, $table);
}
/**
 * Dialog
 */
// Now find out the columns of our $table
// need to use PMA_DatabaseInterface::QUERY_STORE with $GLOBALS['dbi']->numRows()
// in mysqli
$columns = $GLOBALS['dbi']->getColumns($db, $table);
// common form
$html_output .= PMA_getHtmlForCommonForm($db, $table, $columns, $cfgRelation, $tbl_storage_engine, isset($existrel) ? $existrel : array(), isset($existrel_foreign) ? $existrel_foreign['foreign_keys_data'] : array(), $options_array);
if (PMA_Util::isForeignKeySupported($tbl_storage_engine)) {
    $html_output .= PMA_getHtmlForDisplayIndexes();
}
// Render HTML output
PMA_Response::getInstance()->addHTML($html_output);
 /**
  * Tests for PMA_getHtmlForCommonForm() method.
  *
  * @return void
  * @test
  */
 public function testPMAGetHtmlForCommonForm()
 {
     $db = "pma_db";
     $table = "pma_table";
     $columns = array(array("Field" => "Field1"));
     $cfgRelation = array('displaywork' => true, 'relwork' => true, 'displaywork' => true);
     $tbl_storage_engine = "InnoDB";
     $existrel = array();
     $existrel_foreign = array();
     $options_array = array();
     $save_row = array();
     foreach ($columns as $row) {
         $save_row[] = $row;
     }
     $html = PMA_getHtmlForCommonForm($db, $table, $columns, $cfgRelation, $tbl_storage_engine, $existrel, $existrel_foreign, $options_array);
     //case 1: PMA_getHtmlForInternalRelationForm
     $this->assertContains(PMA_getHtmlForInternalRelationForm($columns, $tbl_storage_engine, $existrel, $db), $html);
     //case 2: PMA_getHtmlForForeignKeyForm
     $this->assertContains(PMA_getHtmlForForeignKeyForm($columns, $existrel_foreign, $db, $tbl_storage_engine, $options_array), $html);
     $this->assertContains(PMA_URL_getHiddenInputs($db, $table), $html);
     $this->assertContains(__('Relations'), $html);
     $this->assertContains(__('Column'), $html);
     $this->assertContains(__('Internal relation'), $html);
     $this->assertContains(__('Choose column to display:'), $html);
     //case 3: PMA_getHtmlForInternalRelationRow
     $row = PMA_getHtmlForInternalRelationRow($save_row, 0, true, $existrel, $db);
     $this->assertContains($row, $html);
     //case 4: PMA_getHtmlForForeignKeyRow
     $row = PMA_getHtmlForForeignKeyRow(array(), true, $columns, 0, $options_array, $tbl_storage_engine, $db);
     $this->assertContains($row, $html);
     //case 5: PMA_getHtmlForDisplayFieldInfos
     $this->assertContains(PMA_getHtmlForDisplayFieldInfos($db, $table, $save_row), $html);
     //case 6: PMA_getHtmlForCommonFormFooter
     $this->assertContains(PMA_getHtmlForCommonFormFooter(), $html);
 }
Exemplo n.º 3
0
}
// end if isset($destination_foreign)
// U p d a t e s   f o r   d i s p l a y   f i e l d
if ($cfgRelation['displaywork'] && isset($display_field)) {
    PMA_handleUpdateForDisplayField($disp, $display_field, $db, $table, $cfgRelation);
}
// end if
// If we did an update, refresh our data
if (isset($_POST['destination_db']) && $cfgRelation['relwork']) {
    $existrel = PMA_getForeigners($db, $table, '', 'internal');
}
if (isset($destination_foreign_db) && PMA_Util::isForeignKeySupported($tbl_storage_engine)) {
    $existrel_foreign = PMA_getForeigners($db, $table, '', 'foreign');
}
if ($cfgRelation['displaywork']) {
    $disp = PMA_getDisplayField($db, $table);
}
/**
 * Dialog
 */
// Now find out the columns of our $table
// need to use PMA_DatabaseInterface::QUERY_STORE with $GLOBALS['dbi']->numRows()
// in mysqli
$columns = $GLOBALS['dbi']->getColumns($db, $table);
// common form
$html_output .= PMA_getHtmlForCommonForm($db, $table, $columns, $cfgRelation, $tbl_storage_engine, $existrel, $existrel_foreign, $options_array);
if (PMA_Util::isForeignKeySupported($tbl_storage_engine)) {
    $html_output .= PMA_getHtmlForDisplayIndexes();
}
// Render HTML output
PMA_Response::getInstance()->addHTML($html_output);