本文整理汇总了PHP中PMA_Util::getDropdown方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Util::getDropdown方法的具体用法?PHP PMA_Util::getDropdown怎么用?PHP PMA_Util::getDropdown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMA_Util
的用法示例。
在下文中一共展示了PMA_Util::getDropdown方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetDropdownWithActive
/**
* Test for getDropdown
*
* @return void
*/
function testGetDropdownWithActive()
{
$name = "&test_dropdown_name";
$choices = array("value_1" => "label_1", "value&_2\"" => "label_2");
$active_choice = "value&_2\"";
$id = "test_<dropdown>_name";
$result = '<select name="' . htmlspecialchars($name) . '" id="' . htmlspecialchars($id) . '">';
foreach ($choices as $one_choice_value => $one_choice_label) {
$result .= '<option value="' . htmlspecialchars($one_choice_value) . '"';
if ($one_choice_value == $active_choice) {
$result .= ' selected="selected"';
}
$result .= '>' . htmlspecialchars($one_choice_label) . '</option>';
}
$result .= '</select>';
$this->assertEquals($result, PMA_Util::getDropdown($name, $choices, $active_choice, $id));
}
示例2: _getAdditionalFieldsForTableNavigation
/**
* Prepare fields for table navigation
* Number of rows
*
* @param string $html_sql_query the sql encoded by htmlspecialchars()
*
* @return string $additional_fields_html html content
*
* @access private
*
* @see _getTableNavigation()
*/
private function _getAdditionalFieldsForTableNavigation($html_sql_query)
{
$additional_fields_html = '';
$additional_fields_html .= '<input type="hidden" name="sql_query" ' . 'value="' . $html_sql_query . '" />' . '<input type="hidden" name="goto" value="' . $this->__get('goto') . '" />' . '<input type="hidden" name="pos" size="3" value="' . $_SESSION['tmpval']['pos'] . '" />' . '<input type="hidden" name="is_browse_distinct" value="' . $this->__get('is_browse_distinct') . '" />';
$numberOfRowsPlaceholder = null;
if ($_SESSION['tmpval']['max_rows'] == self::ALL_ROWS) {
$numberOfRowsPlaceholder = __('All');
}
$numberOfRowsChoices = array('25' => 25, '50' => 50, '100' => 100, '250' => 250, '500' => 500);
$additional_fields_html .= __('Number of rows:') . ' ';
$additional_fields_html .= PMA_Util::getDropdown('session_max_rows', $numberOfRowsChoices, $_SESSION['tmpval']['max_rows'], '', 'autosubmit', $numberOfRowsPlaceholder);
return $additional_fields_html;
}
示例3: PMA_getTableOptionFieldset
/**
* Get HTML fieldset for Table option, it contains HTML table for options
*
* @param string $comment Comment
* @param array $tbl_collation table collation
* @param string $tbl_storage_engine table storage engine
* @param boolean $is_myisam_or_aria whether MYISAM | ARIA or not
* @param boolean $is_isam whether ISAM or not
* @param string $pack_keys pack keys
* @param string $delay_key_write delay key write
* @param string $auto_increment value of auto increment
* @param string $transactional value of transactional
* @param string $page_checksum value of page checksum
* @param boolean $is_innodb whether INNODB or not
* @param boolean $is_pbxt whether PBXT or not
* @param boolean $is_aria whether ARIA or not
* @param string $checksum the checksum
*
* @return string $html_output
*/
function PMA_getTableOptionFieldset($comment, $tbl_collation, $tbl_storage_engine, $is_myisam_or_aria, $is_isam, $pack_keys, $delay_key_write, $auto_increment, $transactional, $page_checksum, $is_innodb, $is_pbxt, $is_aria, $checksum)
{
$html_output = '<fieldset>' . '<legend>' . __('Table options') . '</legend>';
$html_output .= '<table>';
$html_output .= PMA_getHtmlForRenameTable();
$html_output .= PMA_getHtmlForTableComments($comment);
//Storage engine
$html_output .= '<tr><td class="vmiddle">' . __('Storage Engine') . ' ' . PMA_Util::showMySQLDocu('Storage_engines') . '</td>' . '<td>' . PMA_StorageEngine::getHtmlSelect('new_tbl_storage_engine', null, $tbl_storage_engine) . '</td>' . '</tr>';
//Table character set
$html_output .= '<tr><td class="vmiddle">' . __('Collation') . '</td>' . '<td>' . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'tbl_collation', null, $tbl_collation, false) . '</td>' . '</tr>';
// Change all Column collations
$html_output .= '<tr><td></td><td>' . '<input type="checkbox" name="change_all_collations" value="1" ' . 'id="checkbox_change_all_collations" />' . '<label for="checkbox_change_all_collations">' . __('Change all column collations') . '</label>' . '</td></tr>';
if ($is_myisam_or_aria || $is_isam) {
$html_output .= PMA_getHtmlForPackKeys($pack_keys);
}
// end if (MYISAM|ISAM)
if ($is_myisam_or_aria) {
$html_output .= PMA_getHtmlForTableRow('new_checksum', 'CHECKSUM', $checksum);
$html_output .= PMA_getHtmlForTableRow('new_delay_key_write', 'DELAY_KEY_WRITE', $delay_key_write);
}
// end if (MYISAM)
if ($is_aria) {
$html_output .= PMA_getHtmlForTableRow('new_transactional', 'TRANSACTIONAL', $transactional);
$html_output .= PMA_getHtmlForTableRow('new_page_checksum', 'PAGE_CHECKSUM', $page_checksum);
}
// end if (ARIA)
if (mb_strlen($auto_increment) > 0 && ($is_myisam_or_aria || $is_innodb || $is_pbxt)) {
$html_output .= '<tr><td class="vmiddle">' . '<label for="auto_increment_opt">AUTO_INCREMENT</label></td>' . '<td><input type="number" name="new_auto_increment" ' . 'id="auto_increment_opt"' . 'value="' . $auto_increment . '" /></td>' . '</tr> ';
}
// end if (MYISAM|INNODB)
$possible_row_formats = PMA_getPossibleRowFormat();
// for MYISAM there is also COMPRESSED but it can be set only by the
// myisampack utility, so don't offer here the choice because if we
// try it inside an ALTER TABLE, MySQL (at least in 5.1.23-maria)
// does not return a warning
// (if the table was compressed, it can be seen on the Structure page)
if (isset($possible_row_formats[$tbl_storage_engine])) {
$current_row_format = mb_strtoupper($GLOBALS['showtable']['Row_format']);
$html_output .= '<tr><td class="vmiddle">' . '<label for="new_row_format">ROW_FORMAT</label></td>' . '<td>';
$html_output .= PMA_Util::getDropdown('new_row_format', $possible_row_formats[$tbl_storage_engine], $current_row_format, 'new_row_format');
$html_output .= '</td></tr>';
}
$html_output .= '</table>' . '</fieldset>';
return $html_output;
}
示例4: _getAdditionalFieldsForTableNavigation
/**
* Prepare fields for table navigation
* Number of rows
*
* @param string $html_sql_query the sql encoded by htmlspecialchars()
* @param string $id_for_direction_dropdown the id for the direction dropdown
*
* @return string $additional_fields_html html content
*
* @access private
*
* @see _getTableNavigation()
*/
private function _getAdditionalFieldsForTableNavigation($html_sql_query, $id_for_direction_dropdown)
{
$additional_fields_html = '';
$additional_fields_html .= '<input type="hidden" name="sql_query" ' . 'value="' . $html_sql_query . '" />' . '<input type="hidden" name="goto" value="' . $this->__get('goto') . '" />' . '<input type="hidden" name="pos" size="3" value="' . $_SESSION['tmpval']['pos'] . '" />';
$numberOfRowsChoices = array('25' => 25, '50' => 50, '100' => 100, '250' => 250, '500' => 500);
$additional_fields_html .= __('Number of rows:') . ' ';
$additional_fields_html .= PMA_Util::getDropdown('session_max_rows', $numberOfRowsChoices, $_SESSION['tmpval']['max_rows'], '', 'autosubmit');
if ($GLOBALS['cfg']['ShowDisplayDirection']) {
// Display mode (horizontal/vertical)
$additional_fields_html .= __('Mode:') . ' ' . "\n";
$choices = array('horizontal' => __('horizontal'), 'horizontalflipped' => __('horizontal (rotated headers)'), 'vertical' => __('vertical'));
$additional_fields_html .= PMA_Util::getDropdown('disp_direction', $choices, $_SESSION['tmpval']['disp_direction'], $id_for_direction_dropdown, 'autosubmit');
unset($choices);
}
return $additional_fields_html;
}
示例5: _getAdditionalFieldsForTableNavigation
/**
* Prepare feilds followed by Show button for table navigation
* Start row, Number of rows, Headers every
*
* @param string $html_sql_query the sql encoded by html special
* characters
* @param integer $pos_next the offset for the "next" page
* @param string $id_for_direction_dropdown the id for the direction dropdown
*
* @return string $additional_fields_html html content
*
* @access private
*
* @see _getTableNavigation()
*/
private function _getAdditionalFieldsForTableNavigation($html_sql_query, $pos_next, $id_for_direction_dropdown)
{
$additional_fields_html = '';
$additional_fields_html .= '<input type="hidden" name="sql_query" ' . 'value="' . $html_sql_query . '" />' . '<input type="hidden" name="goto" value="' . $this->__get('goto') . '" />' . '<input type="submit" name="navig"' . ' class="ajax"' . ' value="' . __('Show') . ' :" />' . __('Start row') . ': ' . "\n" . '<input type="text" name="pos" size="3" value="' . ($pos_next >= $this->__get('unlim_num_rows') ? 0 : $pos_next) . '" class="textfield" onfocus="this.select()" />' . __('Number of rows') . ': ' . "\n" . '<input type="text" name="session_max_rows" size="3" value="' . ($_SESSION['tmp_user_values']['max_rows'] != self::ALL_ROWS ? $_SESSION['tmp_user_values']['max_rows'] : $GLOBALS['cfg']['MaxRows']) . '" class="textfield" onfocus="this.select()" />';
if ($GLOBALS['cfg']['ShowDisplayDirection']) {
// Display mode (horizontal/vertical and repeat headers)
$additional_fields_html .= __('Mode') . ': ' . "\n";
$choices = array('horizontal' => __('horizontal'), 'horizontalflipped' => __('horizontal (rotated headers)'), 'vertical' => __('vertical'));
$additional_fields_html .= PMA_Util::getDropdown('disp_direction', $choices, $_SESSION['tmp_user_values']['disp_direction'], $id_for_direction_dropdown);
unset($choices);
}
$additional_fields_html .= sprintf(__('Headers every %s rows'), '<input type="text" size="3" name="repeat_cells" value="' . $_SESSION['tmp_user_values']['repeat_cells'] . '" class="textfield" /> ');
return $additional_fields_html;
}
示例6: PMA_getTableOptionFieldset
/**
* Get HTML fieldset for Table option, it contains HTML table for options
*
* @param string $comment Comment
* @param array $tbl_collation table collation
* @param string $tbl_storage_engine table storage engine
* @param boolean $is_myisam_or_aria whether MYISAM | ARIA or not
* @param boolean $is_isam whether ISAM or not
* @param array $pack_keys pack keys
* @param string $delay_key_write delay key write
* @param string $auto_increment value of auto increment
* @param string $transactional value of transactional
* @param string $page_checksum value of page checksum
* @param boolean $is_innodb whether INNODB or not
* @param boolean $is_pbxt whether PBXT or not
* @param boolean $is_aria whether ARIA or not
* @param string $checksum the checksum
*
* @return string $html_output
*/
function PMA_getTableOptionFieldset($comment, $tbl_collation, $tbl_storage_engine, $is_myisam_or_aria, $is_isam, $pack_keys, $delay_key_write, $auto_increment, $transactional, $page_checksum, $is_innodb, $is_pbxt, $is_aria, $checksum)
{
$html_output = '<fieldset>' . '<legend>' . __('Table options') . '</legend>';
$html_output .= '<table>';
//Change table name
$html_output .= '<tr><td>' . __('Rename table to') . '</td>' . '<td>' . '<input type="text" size="20" name="new_name" onfocus="this.select()"' . 'value="' . htmlspecialchars($GLOBALS['table']) . '" required="required" />' . '</td>' . '</tr>';
//Table comments
$html_output .= '<tr><td>' . __('Table comments') . '</td>' . '<td><input type="text" name="comment" maxlength="60" size="30"' . 'value="' . htmlspecialchars($comment) . '" onfocus="this.select()" />' . '<input type="hidden" name="prev_comment" value="' . htmlspecialchars($comment) . '" />' . '</td>' . '</tr>';
//Storage engine
$html_output .= '<tr><td>' . __('Storage Engine') . PMA_Util::showMySQLDocu('Storage_engines') . '</td>' . '<td>' . PMA_StorageEngine::getHtmlSelect('new_tbl_storage_engine', null, $tbl_storage_engine) . '</td>' . '</tr>';
//Table character set
$html_output .= '<tr><td>' . __('Collation') . '</td>' . '<td>' . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'tbl_collation', null, $tbl_collation, false, 3) . '</td>' . '</tr>';
if ($is_myisam_or_aria || $is_isam) {
$html_output .= '<tr>' . '<td><label for="new_pack_keys">PACK_KEYS</label></td>' . '<td><select name="new_pack_keys" id="new_pack_keys">';
$html_output .= '<option value="DEFAULT"';
if ($pack_keys == 'DEFAULT') {
$html_output .= 'selected="selected"';
}
$html_output .= '>DEFAULT</option>
<option value="0"';
if ($pack_keys == '0') {
$html_output .= 'selected="selected"';
}
$html_output .= '>0</option>
<option value="1" ';
if ($pack_keys == '1') {
$html_output .= 'selected="selected"';
}
$html_output .= '>1</option>' . '</select>' . '</td>' . '</tr>';
}
// end if (MYISAM|ISAM)
if ($is_myisam_or_aria) {
$html_output .= PMA_getHtmlForTableRow('new_checksum', 'CHECKSUM', $checksum);
$html_output .= PMA_getHtmlForTableRow('new_delay_key_write', 'DELAY_KEY_WRITE', $delay_key_write);
}
// end if (MYISAM)
if ($is_aria) {
$html_output .= PMA_getHtmlForTableRow('new_transactional', 'TRANSACTIONAL', $transactional);
$html_output .= PMA_getHtmlForTableRow('new_page_checksum', 'PAGE_CHECKSUM', $page_checksum);
}
// end if (ARIA)
/** @var PMA_String $pmaString */
$pmaString = $GLOBALS['PMA_String'];
if ($pmaString->strlen($auto_increment) > 0 && ($is_myisam_or_aria || $is_innodb || $is_pbxt)) {
$html_output .= '<tr><td>' . '<label for="auto_increment_opt">AUTO_INCREMENT</label></td>' . '<td><input type="number" name="new_auto_increment" ' . 'id="auto_increment_opt"' . 'value="' . $auto_increment . '" /></td>' . '</tr> ';
}
// end if (MYISAM|INNODB)
$possible_row_formats = PMA_getPossibleRowFormat();
// for MYISAM there is also COMPRESSED but it can be set only by the
// myisampack utility, so don't offer here the choice because if we
// try it inside an ALTER TABLE, MySQL (at least in 5.1.23-maria)
// does not return a warning
// (if the table was compressed, it can be seen on the Structure page)
if (isset($possible_row_formats[$tbl_storage_engine])) {
$current_row_format = $pmaString->strtoupper($GLOBALS['showtable']['Row_format']);
$html_output .= '<tr><td>' . '<label for="new_row_format">ROW_FORMAT</label></td>' . '<td>';
$html_output .= PMA_Util::getDropdown('new_row_format', $possible_row_formats[$tbl_storage_engine], $current_row_format, 'new_row_format');
$html_output .= '</td></tr>';
}
$html_output .= '</table>' . '</fieldset>';
return $html_output;
}
示例7: generateIndexTypeSelector
/**
* Returns HTML for the index type selector
*
* @return string HTML for the index type selector
*/
public function generateIndexTypeSelector()
{
$types = array("" => "--");
foreach (PMA_Index::getIndexTypes() as $type) {
$types[$type] = $type;
}
return PMA_Util::getDropdown("index[Index_type]", $types, $this->_type, "select_index_type");
}