本文整理汇总了PHP中PMA_getColumnSize函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_getColumnSize函数的具体用法?PHP PMA_getColumnSize怎么用?PHP PMA_getColumnSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_getColumnSize函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_getValueColumnForOtherDatatypes
/**
* 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;
}
示例2: testGetColumnSize
/**
* Test for PMA_getColumnSize
*
* @return void
*/
public function testGetColumnSize()
{
$column = $extracted_columnspec = array();
$column['is_char'] = true;
$extracted_columnspec['spec_in_brackets'] = 45;
$GLOBALS['cfg']['MinSizeForInputField'] = 30;
$GLOBALS['cfg']['MaxSizeForInputField'] = 40;
$this->assertEquals(40, PMA_getColumnSize($column, $extracted_columnspec));
$this->assertEquals('textarea', $GLOBALS['cfg']['CharEditing']);
// case 2
$column['is_char'] = false;
$column['len'] = 20;
$this->assertEquals(30, PMA_getColumnSize($column, $extracted_columnspec));
}