/**
 * Function to get html for column attributes
 *
 * @param int        $columnNumber                     column number
 * @param array      $columnMeta                       column meta
 * @param string     $type_upper                       type upper
 * @param int        $length_values_input_size         length values input size
 * @param int        $length                           length
 * @param string     $default_current_timestamp        default current time stamp
 * @param array|null $extracted_columnspec             extracted column spec
 * @param string     $submit_attribute                 submit attribute
 * @param array|null $analyzed_sql                     analyzed sql
 * @param string     $submit_default_current_timestamp submit default current
 *                                                     timestamp
 * @param array      $comments_map                     comments map
 * @param array|null $fields_meta                      fields map
 * @param bool       $is_backup                        is backup
 * @param array      $move_columns                     move columns
 * @param array      $cfgRelation                      configuration relation
 * @param array      $available_mime                   available mime
 * @param array      $mime_map                         mime map
 *
 * @return array
 */
function PMA_getHtmlForColumnAttributes($columnNumber, $columnMeta, $type_upper, $length_values_input_size, $length, $default_current_timestamp, $extracted_columnspec, $submit_attribute, $analyzed_sql, $submit_default_current_timestamp, $comments_map, $fields_meta, $is_backup, $move_columns, $cfgRelation, $available_mime, $mime_map)
{
    // Cell index: If certain fields get left out, the counter shouldn't change.
    $ci = 0;
    // Every time a cell shall be left out the STRG-jumping feature, $ci_offset
    // has to be incremented ($ci_offset++)
    $ci_offset = -1;
    $content_cell = array();
    // column name
    $content_cell[$ci] = PMA_getHtmlForColumnName($columnNumber, $ci, $ci_offset, isset($columnMeta) ? $columnMeta : null, $cfgRelation);
    $ci++;
    // column type
    $content_cell[$ci] = PMA_getHtmlForColumnType($columnNumber, $ci, $ci_offset, $type_upper, isset($columnMeta) ? $columnMeta : null);
    $ci++;
    // column length
    $content_cell[$ci] = PMA_getHtmlForColumnLength($columnNumber, $ci, $ci_offset, $length_values_input_size, $length);
    $ci++;
    // column default
    $content_cell[$ci] = PMA_getHtmlForColumnDefault($columnNumber, $ci, $ci_offset, isset($type_upper) ? $type_upper : null, isset($default_current_timestamp) ? $default_current_timestamp : null, isset($columnMeta) ? $columnMeta : null);
    $ci++;
    // column collation
    $content_cell[$ci] = PMA_getHtmlForColumnCollation($columnNumber, $ci, $ci_offset, $columnMeta);
    $ci++;
    // column attribute
    $content_cell[$ci] = PMA_getHtmlForColumnAttribute($columnNumber, $ci, $ci_offset, isset($extracted_columnspec) ? $extracted_columnspec : null, isset($columnMeta) ? $columnMeta : null, isset($submit_attribute) ? $submit_attribute : null, isset($analyzed_sql) ? $analyzed_sql : null, isset($submit_default_current_timestamp) ? $submit_default_current_timestamp : null);
    $ci++;
    // column NULL
    $content_cell[$ci] = PMA_getHtmlForColumnNull($columnNumber, $ci, $ci_offset, isset($columnMeta) ? $columnMeta : null);
    $ci++;
    // column indexes
    // See my other comment about  this 'if'.
    if (!$is_backup) {
        $content_cell[$ci] = PMA_getHtmlForColumnIndexes($columnNumber, $ci, $ci_offset, $columnMeta);
        $ci++;
    }
    // end if ($action ==...)
    // column auto_increment
    $content_cell[$ci] = PMA_getHtmlForColumnAutoIncrement($columnNumber, $ci, $ci_offset, $columnMeta);
    $ci++;
    // column comments
    $content_cell[$ci] = PMA_getHtmlForColumnComment($columnNumber, $ci, $ci_offset, isset($columnMeta) ? $columnMeta : null, $comments_map);
    $ci++;
    // move column
    if (isset($fields_meta)) {
        $content_cell[$ci] = PMA_getHtmlForMoveColumn($columnNumber, $ci, $ci_offset, $move_columns, $columnMeta);
        $ci++;
    }
    if ($cfgRelation['mimework'] && $GLOBALS['cfg']['BrowseMIME'] && $cfgRelation['commwork']) {
        // Column Mime-type
        $content_cell[$ci] = PMA_getHtmlForMimeType($columnNumber, $ci, $ci_offset, $available_mime, $columnMeta, $mime_map);
        $ci++;
        // Column Browser transformation
        $content_cell[$ci] = PMA_getHtmlForTransformation($columnNumber, $ci, $ci_offset, $available_mime, $columnMeta, $mime_map, '');
        $ci++;
        // column Transformation options
        $content_cell[$ci] = PMA_getHtmlForTransformationOption($columnNumber, $ci, $ci_offset, $columnMeta, $mime_map, '');
        $ci++;
        // Column Input transformation
        $content_cell[$ci] = PMA_getHtmlForTransformation($columnNumber, $ci, $ci_offset, $available_mime, $columnMeta, $mime_map, 'input_');
        $ci++;
        // column Input transformation options
        $content_cell[$ci] = PMA_getHtmlForTransformationOption($columnNumber, $ci, $ci_offset, $columnMeta, $mime_map, 'input_');
    }
    return $content_cell;
}
コード例 #2
0
    /**
     * Test for PMA_getHtmlForColumnName
     *
     * @return void
     */
    public function testGetHtmlForColumnName()
    {
        $result = PMA_getHtmlForColumnName(
            2, 4, 4, array('Field' => "fieldname")
        );

        $this->assertTag(
            PMA_getTagArray(
                '<input id="field_2_0" type="text" name="field_name[2]" '
                . 'maxlength="64" class="textfield" title="Column" size="10" '
                . 'value="fieldname" />'
            ),
            $result
        );
    }
 /**
  * Test for PMA_getHtmlForColumnName
  *
  * @return void
  */
 public function testGetHtmlForColumnName()
 {
     $cfgRelation = array('central_columnswork' => true);
     $result = PMA_getHtmlForColumnName(2, 4, 4, array('Field' => "fieldname", 'column_status' => array('isReferenced' => false, 'isForeignKey' => false, 'isEditable' => true)), $cfgRelation);
     $this->assertContains('<input id="field_2_0" type="text" name="field_name[2]" ' . 'maxlength="64" class="textfield" title="Column" size="10" ' . 'value="fieldname" />', $result);
 }
コード例 #4
0
/**
 * build html for adding a new user defined column to central list
 *
 * @param string $db current database
 *
 * @return html of the form to let user add a new user defined column to the list
 */
function PMA_getHTMLforAddNewColumn($db)
{
    $addNewColumn = '<div id="add_col_div"><a href="#">' . '<span>+</span> ' . __('Add new column') . '</a>' . '<form id="add_new" style="min-width:100%;display:none" ' . 'method="post" action="db_central_columns.php">' . PMA_URL_getHiddenInputs($db) . '<input type="hidden" name="add_new_column" value="add_new_column">' . '<table>';
    $addNewColumn .= PMA_getCentralColumnsTableHeader();
    $addNewColumn .= '<tr>' . '<td></td>' . '<td name="col_name" class="nowrap">' . PMA_getHtmlForColumnName(0, 0, 0, array(), array('central_columnswork' => false)) . '</td>' . '<td name = "col_type" class="nowrap">' . PMA_getHtmlForColumnType(0, 1, 0, '', array()) . '</td>' . '<td class="nowrap" name="col_length">' . PMA_getHtmlForColumnLength(0, 2, 0, 8, '') . '</td>' . '<td class="nowrap" name="col_default">' . PMA_getHtmlForColumnDefault(0, 3, 0, '', '', array()) . '</td>' . '<td name="collation" class="nowrap">' . PMA_getHtmlForColumnCollation(0, 4, 0, array()) . '</td>' . '<td class="nowrap" name="col_attribute">' . PMA_getHtmlForColumnAttribute(0, 5, 0, array(), array(), false, null) . '</td>' . '<td class="nowrap" name="col_isNull">' . PMA_getHtmlForColumnNull(0, 6, 0, array()) . '</td>' . '<td class="nowrap" name="col_extra">' . PMA_getHtmlForColumnExtra(0, 7, 0, array()) . '</td>' . ' <td>' . '<input id="add_column_save" type="submit" ' . ' value="Save"/></td>' . '</tr>';
    $addNewColumn .= '</table></form></div>';
    return $addNewColumn;
}