本文整理匯總了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));
}