Esempio n. 1
0
/**
 * Get table head and table foot for insert row table
 *
 * @param array $url_params url parameters
 *
 * @return string           an html snippet
 */
function PMA_getHeadAndFootOfInsertRowTable($url_params)
{
    $html_output = '<table class="insertRowTable">' . '<thead>' . '<tr>' . '<th>' . __('Column') . '</th>';
    if ($GLOBALS['cfg']['ShowFieldTypesInDataEditView']) {
        $html_output .= PMA_showColumnTypesInDataEditView($url_params, true);
    }
    if ($GLOBALS['cfg']['ShowFunctionFields']) {
        $html_output .= PMA_showFunctionFieldsInEditMode($url_params, true);
    }
    $html_output .= '<th>' . __('Null') . '</th>' . '<th>' . __('Value') . '</th>' . '</tr>' . '</thead>' . ' <tfoot>' . '<tr>' . '<th colspan="5" class="tblFooters right">' . '<input type="submit" value="' . __('Go') . '" />' . '</th>' . '</tr>' . '</tfoot>';
    return $html_output;
}
 /**
  * Test for PMA_showColumnTypesInDataEditView
  *
  * @return void
  */
 public function testShowColumnTypesInDataEditView()
 {
     $GLOBALS['cfg']['ShowFieldTypesInDataEditView'] = true;
     $GLOBALS['cfg']['ShowFunctionFields'] = true;
     $GLOBALS['cfg']['ServerDefault'] = 1;
     $url_params = array('ShowFunctionFields' => 2);
     $result = PMA_showColumnTypesInDataEditView($url_params, false);
     $this->assertEquals(' : <a href="tbl_change.php?ShowFunctionFields=1&amp;ShowFieldTypesIn' . 'DataEditView=1&amp;goto=sql.php&amp;lang=en&amp;token=token">' . 'Type</a>' . "\n", $result);
     // case 2
     $result = PMA_showColumnTypesInDataEditView($url_params, true);
     $this->assertEquals('<th><a href="tbl_change.php?ShowFunctionFields=1&amp;ShowFieldTypesIn' . 'DataEditView=0&amp;goto=sql.php&amp;lang=en&amp;token=token" title=' . '"Hide">Type</a></th>' . "\n", $result);
 }
}
//Insert/Edit form
//If table has blob fields we have to disable ajax.
$html_output .= PMA_getHtmlForInsertEditFormHeader($has_blob_field, $is_upload);
$html_output .= PMA_URL_getHiddenInputs($_form_params);
$titles['Browse'] = PMA_Util::getIcon('b_browse.png', __('Browse foreign values'));
// user can toggle the display of Function column and column types
// (currently does not work for multi-edits)
if (!$cfg['ShowFunctionFields'] || !$cfg['ShowFieldTypesInDataEditView']) {
    $html_output .= __('Show');
}
if (!$cfg['ShowFunctionFields']) {
    $html_output .= PMA_showFunctionFieldsInEditMode($url_params, false);
}
if (!$cfg['ShowFieldTypesInDataEditView']) {
    $html_output .= PMA_showColumnTypesInDataEditView($url_params, false);
}
$GLOBALS['plugin_scripts'] = array();
foreach ($rows as $row_id => $current_row) {
    if (empty($current_row)) {
        $current_row = array();
    }
    $jsvkey = $row_id;
    $vkey = '[multi_edit][' . $jsvkey . ']';
    $current_result = isset($result) && is_array($result) && isset($result[$row_id]) ? $result[$row_id] : $result;
    $repopulate = array();
    $checked = true;
    if (isset($unsaved_values[$row_id])) {
        $repopulate = $unsaved_values[$row_id];
        $checked = false;
    }