/**
  * Test for PMA_getHTMLinput
  *
  * @return void
  */
 public function testGetHTMLinput()
 {
     $column = array();
     $column['pma_type'] = 'date';
     $column['True_Type'] = 'date';
     $result = PMA_getHTMLinput($column, 'a', 'b', 30, 'c', 23, 2, 0);
     $this->assertEquals('<input type="text" name="fieldsa" value="b" size="30" class=' . '"textfield datefield" c tabindex="25" id="field_0_3" />', $result);
     // case 2 datetime
     $column['pma_type'] = 'datetime';
     $column['True_Type'] = 'datetime';
     $result = PMA_getHTMLinput($column, 'a', 'b', 30, 'c', 23, 2, 0);
     $this->assertEquals('<input type="text" name="fieldsa" value="b" size="30" class=' . '"textfield datetimefield" c tabindex="25" id="field_0_3" />', $result);
     // case 3 timestamp
     $column['pma_type'] = 'timestamp';
     $column['True_Type'] = 'timestamp';
     $result = PMA_getHTMLinput($column, 'a', 'b', 30, 'c', 23, 2, 0);
     $this->assertEquals('<input type="text" name="fieldsa" value="b" size="30" class=' . '"textfield datetimefield" c tabindex="25" id="field_0_3" />', $result);
 }
/**
 * Get HTML for the Value column of other datatypes
 * (here, "column" is used in the sense of HTML column in HTML table)
 *
 * @param array   $column                description of column in given table
 * @param string  $default_char_editing  default char editing mode which is stored
 *                                       in the config.inc.php script
 * @param string  $backup_field          hidden input field
 * @param string  $column_name_appendix  the name attribute
 * @param string  $onChangeClause        onchange clause for fields
 * @param integer $tabindex              tab index
 * @param string  $special_chars         special characters
 * @param integer $tabindex_for_value    offset for the values tabindex
 * @param integer $idindex               id index
 * @param string  $text_dir              text direction
 * @param string  $special_chars_encoded replaced char if the string starts
 *                                       with a \r\n pair (0x0d0a) add an extra \n
 * @param string  $data                  data to edit
 * @param array   $extracted_columnspec  associative array containing type,
 *                                       spec_in_brackets and possibly
 *                                       enum_set_values (another array)
 *
 * @return string an html snippet
 */
function PMA_getValueColumnForOtherDatatypes($column, $default_char_editing, $backup_field, $column_name_appendix, $onChangeClause, $tabindex, $special_chars, $tabindex_for_value, $idindex, $text_dir, $special_chars_encoded, $data, $extracted_columnspec)
{
    // HTML5 data-* attribute data-type
    $data_type = $GLOBALS['PMA_Types']->getTypeClass($column['True_Type']);
    $fieldsize = PMA_getColumnSize($column, $extracted_columnspec);
    $html_output = $backup_field . "\n";
    if ($column['is_char'] && ($GLOBALS['cfg']['CharEditing'] == 'textarea' || mb_strpos($data, "\n") !== false)) {
        $html_output .= "\n";
        $GLOBALS['cfg']['CharEditing'] = $default_char_editing;
        $html_output .= PMA_getTextarea($column, $backup_field, $column_name_appendix, $onChangeClause, $tabindex, $tabindex_for_value, $idindex, $text_dir, $special_chars_encoded, $data_type);
    } else {
        $html_output .= PMA_getHTMLinput($column, $column_name_appendix, $special_chars, $fieldsize, $onChangeClause, $tabindex, $tabindex_for_value, $idindex, $data_type);
        if ($column['Extra'] == 'auto_increment') {
            $html_output .= '<input type="hidden" name="auto_increment' . $column_name_appendix . '" value="1" />';
        }
        if (substr($column['pma_type'], 0, 9) == 'timestamp') {
            $html_output .= '<input type="hidden" name="fields_type' . $column_name_appendix . '" value="timestamp" />';
        }
        if (substr($column['pma_type'], 0, 8) == 'datetime') {
            $html_output .= '<input type="hidden" name="fields_type' . $column_name_appendix . '" value="datetime" />';
        }
        if ($column['True_Type'] == 'bit') {
            $html_output .= '<input type="hidden" name="fields_type' . $column_name_appendix . '" value="bit" />';
        }
        if ($column['pma_type'] == 'date' || $column['pma_type'] == 'datetime' || substr($column['pma_type'], 0, 9) == 'timestamp') {
            // the _3 suffix points to the date field
            // the _2 suffix points to the corresponding NULL checkbox
            // in dateFormat, 'yy' means the year with 4 digits
        }
    }
    return $html_output;
}
 /**
  * Test for PMA_getHTMLinput
  *
  * @return void
  */
 public function testGetHTMLinput()
 {
     $GLOBALS['cfg']['ShowFunctionFields'] = true;
     $column = array();
     $column['pma_type'] = 'date';
     $column['True_Type'] = 'date';
     $result = PMA_getHTMLinput($column, 'a', 'b', 30, 'c', 23, 2, 0, 'DATE', false);
     $this->assertEquals('<input type="text" name="fieldsa" value="b" size="30" data-type="DATE"' . ' class="textfield datefield" c tabindex="25" id="field_0_3" />', $result);
     // case 2 datetime
     $column['pma_type'] = 'datetime';
     $column['True_Type'] = 'datetime';
     $result = PMA_getHTMLinput($column, 'a', 'b', 30, 'c', 23, 2, 0, 'DATE', false);
     $this->assertEquals('<input type="text" name="fieldsa" value="b" size="30" data-type="DATE"' . ' class="textfield datetimefield" c tabindex="25" id="field_0_3" />', $result);
     // case 3 timestamp
     $column['pma_type'] = 'timestamp';
     $column['True_Type'] = 'timestamp';
     $result = PMA_getHTMLinput($column, 'a', 'b', 30, 'c', 23, 2, 0, 'DATE', false);
     $this->assertEquals('<input type="text" name="fieldsa" value="b" size="30" data-type="DATE"' . ' class="textfield datetimefield" c tabindex="25" id="field_0_3" />', $result);
 }