Пример #1
0
/**
 * Function to get html for each insert/edit row
 *
 * @param array  $url_params            url parameters
 * @param array  $table_columns         table columns
 * @param array  $comments_map          comments map
 * @param bool   $timestamp_seen        whether timestamp seen
 * @param array  $current_result        current result
 * @param string $chg_evt_handler       javascript change event handler
 * @param string $jsvkey                javascript validation key
 * @param string $vkey                  validation key
 * @param bool   $insert_mode           whether insert mode
 * @param array  $current_row           current row
 * @param int    &$o_rows               row offset
 * @param int    &$tabindex             tab index
 * @param int    $columns_cnt           columns count
 * @param bool   $is_upload             whether upload
 * @param int    $tabindex_for_function tab index offset for function
 * @param array  $foreigners            foreigners
 * @param int    $tabindex_for_null     tab index offset for null
 * @param int    $tabindex_for_value    tab index offset for value
 * @param string $table                 table
 * @param string $db                    database
 * @param int    $row_id                row id
 * @param array  $titles                titles
 * @param int    $biggest_max_file_size biggest max file size
 * @param string $text_dir              text direction
 * @param array  $repopulate            the data to be repopulated
 * @param array  $where_clause_array    the array of where clauses
 *
 * @return string
 */
function PMA_getHtmlForInsertEditRow($url_params, $table_columns, $comments_map, $timestamp_seen, $current_result, $chg_evt_handler, $jsvkey, $vkey, $insert_mode, $current_row, &$o_rows, &$tabindex, $columns_cnt, $is_upload, $tabindex_for_function, $foreigners, $tabindex_for_null, $tabindex_for_value, $table, $db, $row_id, $titles, $biggest_max_file_size, $text_dir, $repopulate, $where_clause_array)
{
    $html_output = PMA_getHeadAndFootOfInsertRowTable($url_params) . '<tbody>';
    //store the default value for CharEditing
    $default_char_editing = $GLOBALS['cfg']['CharEditing'];
    $mime_map = PMA_getMIME($db, $table);
    $odd_row = true;
    $where_clause = '';
    if (isset($where_clause_array[$row_id])) {
        $where_clause = $where_clause_array[$row_id];
    }
    for ($column_number = 0; $column_number < $columns_cnt; $column_number++) {
        $table_column = $table_columns[$column_number];
        // skip this column if user does not have necessary column privilges
        if (!PMA_userHasColumnPrivileges($table_column, $insert_mode)) {
            continue;
        }
        $column_mime = array();
        if (isset($mime_map[$table_column['Field']])) {
            $column_mime = $mime_map[$table_column['Field']];
        }
        $html_output .= PMA_getHtmlForInsertEditFormColumn($table_columns, $column_number, $comments_map, $timestamp_seen, $current_result, $chg_evt_handler, $jsvkey, $vkey, $insert_mode, $current_row, $odd_row, $o_rows, $tabindex, $columns_cnt, $is_upload, $tabindex_for_function, $foreigners, $tabindex_for_null, $tabindex_for_value, $table, $db, $row_id, $titles, $biggest_max_file_size, $default_char_editing, $text_dir, $repopulate, $column_mime, $where_clause);
        $odd_row = !$odd_row;
    }
    // end for
    $o_rows++;
    $html_output .= '  </tbody>' . '</table><br />' . '<div class="clearfloat"></div>';
    return $html_output;
}
Пример #2
0
/**
 * Function to get html for each insert/edit row
 *
 * @param array  $url_params            url parameters
 * @param array  $table_columns         table columns
 * @param array  $column                column
 * @param array  $comments_map          comments map
 * @param bool   $timestamp_seen        whether timestamp seen
 * @param array  $current_result        current result
 * @param string $chg_evt_handler       javascript change event handler
 * @param string $jsvkey                javascript validation key
 * @param string $vkey                  validation key
 * @param bool   $insert_mode           whether insert mode
 * @param array  $current_row           current row
 * @param int    &$o_rows               row offset
 * @param int    &$tabindex             tab index
 * @param int    $columns_cnt           columns count
 * @param bool   $is_upload             whether upload
 * @param int    $tabindex_for_function tab index offset for function
 * @param array  $foreigners            foreigners
 * @param int    $tabindex_for_null     tab index offset for null
 * @param int    $tabindex_for_value    tab index offset for value
 * @param string $table                 table
 * @param string $db                    database
 * @param int    $row_id                row id
 * @param array  $titles                titles
 * @param int    $biggest_max_file_size biggest max file size
 * @param string $text_dir              text direction
 *
 * @return string
 */
function PMA_getHtmlForInsertEditRow($url_params, $table_columns, $column, $comments_map, $timestamp_seen, $current_result, $chg_evt_handler, $jsvkey, $vkey, $insert_mode, $current_row, &$o_rows, &$tabindex, $columns_cnt, $is_upload, $tabindex_for_function, $foreigners, $tabindex_for_null, $tabindex_for_value, $table, $db, $row_id, $titles, $biggest_max_file_size, $text_dir)
{
    $html_output = PMA_getHeadAndFootOfInsertRowTable($url_params) . '<tbody>';
    //store the default value for CharEditing
    $default_char_editing = $GLOBALS['cfg']['CharEditing'];
    $odd_row = true;
    for ($i = 0; $i < $columns_cnt; $i++) {
        $html_output .= PMA_getHtmlForInsertEditFormColumn($table_columns, $i, $column, $comments_map, $timestamp_seen, $current_result, $chg_evt_handler, $jsvkey, $vkey, $insert_mode, $current_row, $odd_row, $o_rows, $tabindex, $columns_cnt, $is_upload, $tabindex_for_function, $foreigners, $tabindex_for_null, $tabindex_for_value, $table, $db, $row_id, $titles, $biggest_max_file_size, $default_char_editing, $text_dir);
        $odd_row = !$odd_row;
    }
    // end for
    $o_rows++;
    $html_output .= '  </tbody>' . '</table><br />';
    return $html_output;
}
 /**
  * Test for PMA_getHeadAndFootOfInsertRowTable
  *
  * @return void
  */
 public function testGetHeadAndFootOfInsertRowTable()
 {
     $GLOBALS['cfg']['ShowFieldTypesInDataEditView'] = true;
     $GLOBALS['cfg']['ShowFunctionFields'] = true;
     $GLOBALS['cfg']['ServerDefault'] = 1;
     $url_params = array('ShowFunctionFields' => 2);
     $result = PMA_getHeadAndFootOfInsertRowTable($url_params);
     $this->assertContains('tbl_change.php?ShowFunctionFields=1&amp;ShowFieldTypesInDataEditView=0', $result);
     $this->assertContains('tbl_change.php?ShowFunctionFields=0&amp;ShowFieldTypesInDataEditView=1', $result);
 }
Пример #4
0
    $rownumber_param = '&amp;rownumber=' . $row_id;
    $vkey = '[multi_edit][' . $jsvkey . ']';

    $current_result = (isset($result) && is_array($result) && isset($result[$row_id])
        ? $result[$row_id]
        : $result);
    if ($insert_mode && $row_id > 0) {
        $html_output .= '<input type="checkbox" checked="checked"'
            . ' name="insert_ignore_' . $row_id . '"'
            . ' id="insert_ignore_' . $row_id . '" />'
            .'<label for="insert_ignore_' . $row_id . '">'
            . __('Ignore')
            . '</label><br />' . "\n";
    }

    $html_output .= PMA_getHeadAndFootOfInsertRowTable($url_params)
        . '<tbody>';

    // Sets a multiplier used for input-field counts
    // (as zero cannot be used, advance the counter plus one)
    $m_rows = $o_rows + 1;
    //store the default value for CharEditing
    $default_char_editing  = $cfg['CharEditing'];

    $odd_row = true;
    for ($i = 0; $i < $columns_cnt; $i++) {
        if (! isset($table_fields[$i]['processed'])) {
            $column = $table_fields[$i];
            $column = PMA_analyzeTableColumnsArray(
                $column, $comments_map, $timestamp_seen
            );