/** * Function to get html for displaying the page save as form * * @param string $db database name * * @return string html content */ function PMA_getHtmlForPageSaveAs($db) { $cfgRelation = PMA_getRelationsParam(); $choices = array('same' => __('Save to selected page'), 'new' => __('Create a page and save to it')); $html = '<form action="db_designer.php" method="post"' . ' name="save_as_pages" id="save_as_pages" class="ajax">'; $html .= PMA_URL_getHiddenInputs($db); $html .= '<fieldset id="page_save_as_options">'; $html .= '<table><tbody>'; $html .= '<tr>'; $html .= '<td>'; $html .= '<input type="hidden" name="operation" value="savePage" />'; $html .= PMA_getHtmlForPageSelector($cfgRelation, $db); $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td>'; $html .= PMA_Util::getRadioFields('save_page', $choices, 'same', true); $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td>'; $html .= '<label for="selected_value">' . __('New page name') . '</label>'; $html .= '<input type="text" name="selected_value" id="selected_value" />'; $html .= '</td>'; $html .= '</tr>'; $html .= '</tbody></table>'; $html .= '</fieldset>'; $html .= '</form>'; return $html; }
/** * Function to get html for displaying the page save as form * * @param string $db database name * * @return string html content */ function PMA_getHtmlForPageSaveAs($db) { $cfgRelation = PMA_getRelationsParam(); $choices = array('same' => __('Save to selected page'), 'new' => __('Create a page and save to it')); $html = '<form action="db_designer.php" method="post"' . ' name="save_as_pages" id="save_as_pages" class="ajax">'; $html .= PMA_URL_getHiddenInputs($db); $html .= '<fieldset id="page_save_as_options">'; $html .= '<table><tbody>'; $html .= '<tr>'; $html .= '<td>'; $html .= '<input type="hidden" name="operation" value="savePage" />'; $html .= '<select name="selected_page" id="selected_page">'; $html .= '<option value="0">-- ' . __('Select page') . ' --</option>'; if ($cfgRelation['pdfwork']) { $pages = PMA_getPageIdsAndNames($db); foreach ($pages as $nr => $desc) { $html .= '<option value="' . $nr . '">'; $html .= htmlspecialchars($desc) . '</option>'; } } $html .= '</select>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td>'; $html .= PMA_Util::getRadioFields('save_page', $choices, 'same', true); $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td>'; $html .= '<label for="selected_value">' . __('New page name') . '</label>'; $html .= '<input type="text" name="selected_value" id="selected_value" />'; $html .= '</td>'; $html .= '</tr>'; $html .= '</tbody></table>'; $html .= '</fieldset>'; $html .= '</form>'; return $html; }
/** * Get the HTML snippet for change user login information * * @param string $username username * @param string $hostname host name * * @return string HTML snippet */ function PMA_getChangeLoginInformationHtmlForm($username, $hostname) { $choices = array('4' => __('… keep the old one.'), '1' => __('… delete the old one from the user tables.'), '2' => __('… revoke all active privileges from ' . 'the old one and delete it afterwards.'), '3' => __('… delete the old one from the user tables ' . 'and reload the privileges afterwards.')); $html_output = '<form action="server_privileges.php" ' . 'onsubmit="return checkAddUser(this);" ' . 'method="post" class="copyUserForm submenu-item">' . "\n" . PMA_URL_getHiddenInputs('', '') . '<input type="hidden" name="old_username" ' . 'value="' . htmlspecialchars($username) . '" />' . "\n" . '<input type="hidden" name="old_hostname" ' . 'value="' . htmlspecialchars($hostname) . '" />' . "\n" . '<fieldset id="fieldset_change_copy_user">' . "\n" . '<legend data-submenu-label="' . __('Login Information') . '">' . "\n" . __('Change Login Information / Copy User') . '</legend>' . "\n" . PMA_getHtmlForLoginInformationFields('change'); $html_output .= '<fieldset id="fieldset_mode">' . "\n" . ' <legend>' . __('Create a new user with the same privileges and …') . '</legend>' . "\n"; $html_output .= PMA_Util::getRadioFields('mode', $choices, '4', true); $html_output .= '</fieldset>' . "\n" . '</fieldset>' . "\n"; $html_output .= '<fieldset id="fieldset_change_copy_user_footer" ' . 'class="tblFooters">' . "\n" . '<input type="hidden" name="change_copy" value="1" />' . "\n" . '<input type="submit" value="' . __('Go') . '" />' . "\n" . '</fieldset>' . "\n" . '</form>' . "\n"; return $html_output; }
/** * Prepare option fields block * * @return string $options_html html content * * @access private * * @see _getTableHeaders() */ private function _getOptionsBlock() { $options_html = ''; $options_html .= '<form method="post" action="sql.php" ' . 'name="displayOptionsForm"'; $options_html .= ' class="ajax" '; $options_html .= '>'; $url_params = array('db' => $this->__get('db'), 'table' => $this->__get('table'), 'sql_query' => $this->__get('sql_query'), 'goto' => $this->__get('goto'), 'display_options_form' => 1); $options_html .= PMA_URL_getHiddenInputs($url_params) . '<br />' . PMA_Util::getDivForSliderEffect('', __('Options')) . '<fieldset>'; $options_html .= '<div class="formelement">'; $choices = array('P' => __('Partial texts'), 'F' => __('Full texts')); // pftext means "partial or full texts" (done to reduce line lengths) $options_html .= PMA_Util::getRadioFields('pftext', $choices, $_SESSION['tmpval']['pftext'], true, true, '', 'pftext_' . $this->__get('unique_id')) . '</div>'; if ($GLOBALS['cfgRelation']['relwork'] && $GLOBALS['cfgRelation']['displaywork']) { $options_html .= '<div class="formelement">'; $choices = array('K' => __('Relational key'), 'D' => __('Relational display column')); $options_html .= PMA_Util::getRadioFields('relational_display', $choices, $_SESSION['tmpval']['relational_display'], true, true, '', 'relational_display_' . $this->__get('unique_id')) . '</div>'; } $options_html .= '<div class="formelement">' . PMA_Util::getCheckbox('display_binary', __('Show binary contents'), !empty($_SESSION['tmpval']['display_binary']), false, 'display_binary_' . $this->__get('unique_id')) . '<br />' . PMA_Util::getCheckbox('display_blob', __('Show BLOB contents'), !empty($_SESSION['tmpval']['display_blob']), false, 'display_blob_' . $this->__get('unique_id')) . '</div>'; // I would have preferred to name this "display_transformation". // This is the only way I found to be able to keep this setting sticky // per SQL query, and at the same time have a default that displays // the transformations. $options_html .= '<div class="formelement">' . PMA_Util::getCheckbox('hide_transformation', __('Hide browser transformation'), !empty($_SESSION['tmpval']['hide_transformation']), false, 'hide_transformation_' . $this->__get('unique_id')) . '</div>'; if (!PMA_DRIZZLE) { $options_html .= '<div class="formelement">'; $choices = array('GEOM' => __('Geometry'), 'WKT' => __('Well Known Text'), 'WKB' => __('Well Known Binary')); $options_html .= PMA_Util::getRadioFields('geoOption', $choices, $_SESSION['tmpval']['geoOption'], true, true, '', 'geoOption_' . $this->__get('unique_id')) . '</div>'; } $options_html .= '<div class="clearfloat"></div>' . '</fieldset>'; $options_html .= '<fieldset class="tblFooters">' . '<input type="submit" value="' . __('Go') . '" />' . '</fieldset>' . '</div>' . '</form>'; return $options_html; }
/** * Provides the main search form's html * * @return string HTML for selection form */ public function getSelectionForm() { $html_output = '<a id="db_search"></a>'; $html_output .= '<form id="db_search_form"' . ' class="ajax"' . ' method="post" action="db_search.php" name="db_search">'; $html_output .= PMA_URL_getHiddenInputs($GLOBALS['db']); $html_output .= '<fieldset>'; // set legend caption $html_output .= '<legend>' . __('Search in database') . '</legend>'; $html_output .= '<table class="formlayout">'; // inputbox for search phrase $html_output .= '<tr>'; $html_output .= '<td>' . __('Words or values to search for (wildcard: "%"):') . '</td>'; $html_output .= '<td><input type="text"' . ' name="criteriaSearchString" size="60"' . ' value="' . htmlspecialchars($this->_criteriaSearchString) . '" />'; $html_output .= '</td>'; $html_output .= '</tr>'; // choices for types of search $html_output .= '<tr>'; $html_output .= '<td class="right vtop">' . __('Find:') . '</td>'; $html_output .= '<td>'; $choices = array('1' => __('at least one of the words') . PMA_Util::showHint(__('Words are separated by a space character (" ").')), '2' => __('all words') . PMA_Util::showHint(__('Words are separated by a space character (" ").')), '3' => __('the exact phrase'), '4' => __('as regular expression') . ' ' . PMA_Util::showMySQLDocu('Regexp')); // 4th parameter set to true to add line breaks // 5th parameter set to false to avoid htmlspecialchars() escaping // in the label since we have some HTML in some labels $html_output .= PMA_Util::getRadioFields('criteriaSearchType', $choices, $this->_criteriaSearchType, true, false); $html_output .= '</td></tr>'; // displays table names as select options $html_output .= '<tr>'; $html_output .= '<td class="right vtop">' . __('Inside tables:') . '</td>'; $html_output .= '<td rowspan="2">'; $html_output .= '<select name="criteriaTables[]" size="6"' . ' multiple="multiple">'; foreach ($this->_tables_names_only as $each_table) { if (in_array($each_table, $this->_criteriaTables)) { $is_selected = ' selected="selected"'; } else { $is_selected = ''; } $html_output .= '<option value="' . htmlspecialchars($each_table) . '"' . $is_selected . '>' . str_replace(' ', ' ', htmlspecialchars($each_table)) . '</option>'; } // end for $html_output .= '</select>'; $html_output .= '</td></tr>'; // Displays 'select all' and 'unselect all' links $alter_select = '<a href="#" ' . 'onclick="setSelectOptions(\'db_search\',' . ' \'criteriaTables[]\', true); return false;">' . __('Select All') . '</a> / '; $alter_select .= '<a href="#" ' . 'onclick="setSelectOptions(\'db_search\',' . ' \'criteriaTables[]\', false); return false;">' . __('Unselect All') . '</a>'; $html_output .= '<tr><td class="right vbottom">' . $alter_select . '</td></tr>'; // Inputbox for column name entry $html_output .= '<tr>'; $html_output .= '<td class="right">' . __('Inside column:') . '</td>'; $html_output .= '<td><input type="text" name="criteriaColumnName" size="60"' . 'value="' . (!empty($this->_criteriaColumnName) ? htmlspecialchars($this->_criteriaColumnName) : '') . '" /></td>'; $html_output .= '</tr>'; $html_output .= '</table>'; $html_output .= '</fieldset>'; $html_output .= '<fieldset class="tblFooters">'; $html_output .= '<input type="submit" name="submit_search" value="' . __('Go') . '" id="buttonGo" />'; $html_output .= '</fieldset>'; $html_output .= '</form>'; $html_output .= '<div id="togglesearchformdiv">' . '<a id="togglesearchformlink"></a></div>'; return $html_output; }
/** * Get HTML snippet for partition maintenance * * @param array $partition_names array of partition names for a specific db/table * @param array $url_params url parameters * * @return string $html_output */ function PMA_getHtmlForPartitionMaintenance($partition_names, $url_params) { $choices = array('ANALYZE' => __('Analyze'), 'CHECK' => __('Check'), 'OPTIMIZE' => __('Optimize'), 'REBUILD' => __('Rebuild'), 'REPAIR' => __('Repair'), 'TRUNCATE' => __('Truncate')); $partition_method = PMA_Partition::getPartitionMethod($GLOBALS['db'], $GLOBALS['table']); // add COALESCE or DROP option to choices array depeding on Partition method if ($partition_method == 'RANGE' || $partition_method == 'LIST') { $choices['DROP'] = __('Drop'); } else { $choices['COALESCE'] = __('Coalesce'); } $html_output = '<div class="operations_half_width">' . '<form id="partitionsForm" class="ajax" ' . 'method="post" action="tbl_operations.php" >' . PMA_URL_getHiddenInputs($GLOBALS['db'], $GLOBALS['table']) . '<fieldset>' . '<legend>' . __('Partition maintenance') . PMA_Util::showMySQLDocu('partitioning_maintenance') . '</legend>'; $html_select = '<select id="partition_name" name="partition_name[]"' . ' multiple="multiple" required="required">' . "\n"; $first = true; foreach ($partition_names as $one_partition) { $one_partition = htmlspecialchars($one_partition); $html_select .= '<option value="' . $one_partition . '"'; if ($first) { $html_select .= ' selected="selected"'; $first = false; } $html_select .= '>' . $one_partition . '</option>' . "\n"; } $html_select .= '</select>' . "\n"; $html_output .= sprintf(__('Partition %s'), $html_select); $html_output .= '<div class="clearfloat" />'; $html_output .= PMA_Util::getRadioFields('partition_operation', $choices, 'ANALYZE', false, true, 'floatleft'); $this_url_params = array_merge($url_params, array('sql_query' => 'ALTER TABLE ' . PMA_Util::backquote($GLOBALS['table']) . ' REMOVE PARTITIONING;')); $html_output .= '<div class="clearfloat" /><br />'; $html_output .= '<a href="sql.php' . PMA_URL_getCommon($this_url_params) . '">' . __('Remove partitioning') . '</a>'; $html_output .= '</fieldset>' . '<fieldset class="tblFooters">' . '<input type="hidden" name="submit_partition" value="1">' . '<input type="submit" value="' . __('Go') . '" />' . '</fieldset>' . '</form>' . '</div>'; return $html_output; }
/** * Generates formatted HTML for extra search options in table search form * * @return string the generated HTML */ private function _getOptions() { $html_output = ''; $html_output .= PMA_Util::getDivForSliderEffect('searchoptions', __('Options')); /** * Displays columns select list for selecting distinct columns in the search */ $html_output .= '<fieldset id="fieldset_select_fields">' . '<legend>' . __('Select columns (at least one):') . '</legend>' . '<select name="columnsToDisplay[]"' . ' size="' . min(count($this->_columnNames), 10) . '"' . ' multiple="multiple">'; // Displays the list of the fields foreach ($this->_columnNames as $each_field) { $html_output .= ' ' . '<option value="' . htmlspecialchars($each_field) . '"' . ' selected="selected">' . htmlspecialchars($each_field) . '</option>' . "\n"; } // end for $html_output .= '</select>' . '<input type="checkbox" name="distinct" value="DISTINCT"' . ' id="oDistinct" />' . '<label for="oDistinct">DISTINCT</label></fieldset>'; /** * Displays input box for custom 'Where' clause to be used in the search */ $html_output .= '<fieldset id="fieldset_search_conditions">' . '<legend>' . '<em>' . __('Or') . '</em> ' . __('Add search conditions (body of the "where" clause):') . '</legend>'; $html_output .= PMA_Util::showMySQLDocu('Functions'); $html_output .= '<input type="text" name="customWhereClause"' . ' class="textfield" size="64" />'; $html_output .= '</fieldset>'; /** * Displays option of changing default number of rows displayed per page */ $html_output .= '<fieldset id="fieldset_limit_rows">' . '<legend>' . __('Number of rows per page') . '</legend>' . '<input type="number" name="session_max_rows" required="required" ' . 'min="1" ' . 'value="' . $GLOBALS['cfg']['MaxRows'] . '" class="textfield" />' . '</fieldset>'; /** * Displays option for ordering search results * by a column value (Asc or Desc) */ $html_output .= '<fieldset id="fieldset_display_order">' . '<legend>' . __('Display order:') . '</legend>' . '<select name="orderByColumn"><option value="--nil--"></option>'; foreach ($this->_columnNames as $each_field) { $html_output .= ' ' . '<option value="' . htmlspecialchars($each_field) . '">' . htmlspecialchars($each_field) . '</option>' . "\n"; } // end for $html_output .= '</select>'; $choices = array('ASC' => __('Ascending'), 'DESC' => __('Descending')); $html_output .= PMA_Util::getRadioFields('order', $choices, 'ASC', false, true, "formelement"); unset($choices); $html_output .= '</fieldset><br style="clear: both;"/></div>'; return $html_output; }
/** * Get HTML snippet for "Add column" feature in structure table * * @param array $columns_list column list array * * @return string $html_output */ function PMA_getHtmlForAddColumn($columns_list) { $html_output = '<form method="post" action="tbl_addfield.php" ' . 'id="addColumns" name="addColumns" ' . 'onsubmit="return checkFormElementInRange(' . 'this, \'num_fields\', \'' . str_replace('\'', '\\\'', __('You have to add at least one column.')) . '\', 1)' . '">'; $html_output .= PMA_URL_getHiddenInputs($GLOBALS['db'], $GLOBALS['table']); if (PMA_Util::showIcons('ActionLinksMode')) { $html_output .= PMA_Util::getImage('b_insrow.png', __('Add column')); } $num_fields = '<input type="number" name="num_fields" ' . 'value="1" onfocus="this.select()" ' . 'min="1" required />'; $html_output .= sprintf(__('Add %s column(s)'), $num_fields); // I tried displaying the drop-down inside the label but with Firefox // the drop-down was blinking $column_selector = '<select name="after_field" ' . 'onclick="this.form.field_where[2].checked=true" ' . 'onchange="this.form.field_where[2].checked=true">'; foreach ($columns_list as $one_column_name) { $column_selector .= '<option ' . 'value="' . htmlspecialchars($one_column_name) . '">' . htmlspecialchars($one_column_name) . '</option>'; } $column_selector .= '</select>'; $choices = array('last' => __('At End of Table'), 'first' => __('At Beginning of Table'), 'after' => sprintf(__('After %s'), '')); $html_output .= PMA_Util::getRadioFields('field_where', $choices, 'last', false); $html_output .= $column_selector; $html_output .= '<input type="submit" value="' . __('Go') . '" />' . '</form>'; return $html_output; }
/** * shows/displays the created page names in a drop down list * User can select any page number and edit it using dashboard etc * * @return void * @access public */ public function selectPage() { global $db, $table, $cfgRelation; $page_query = 'SELECT * FROM ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_Util::backquote($cfgRelation['pdf_pages']) . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\''; $page_rs = PMA_queryAsControlUser($page_query, false, PMA_DatabaseInterface::QUERY_STORE); if ($page_rs && $GLOBALS['dbi']->numRows($page_rs) > 0) { ?> <form method="get" action="schema_edit.php" name="frm_select_page"> <fieldset> <legend> <?php echo __('Please choose a page to edit') . "\n"; ?> </legend> <?php echo PMA_URL_getHiddenInputs($db, $table); ?> <input type="hidden" name="do" value="selectpage" /> <select name="chpage" id="chpage" class="autosubmit"> <option value="0"><?php echo __('Select page'); ?> </option> <?php while ($curr_page = $GLOBALS['dbi']->fetchAssoc($page_rs)) { echo "\n" . ' ' . '<option value="' . $curr_page['page_nr'] . '"'; if (isset($this->chosenPage) && $this->chosenPage == $curr_page['page_nr']) { echo ' selected="selected"'; } echo '>' . $curr_page['page_nr'] . ': ' . htmlspecialchars($curr_page['page_descr']) . '</option>'; } // end while echo "\n"; ?> </select> <?php $choices = array('0' => __('Edit'), '1' => __('Delete')); echo PMA_Util::getRadioFields('action_choose', $choices, '0', false); unset($choices); ?> </fieldset> <fieldset class="tblFooters"> <input type="submit" value="<?php echo __('Go'); ?> " /><br /> </fieldset> </form> <?php } // end IF echo "\n"; }
/** * Test for PMA_getHtmlForNormalizetable * * @return void */ public function testPMAGetHtmlForNormalizetable() { $result = PMA_getHtmlForNormalizetable(); $this->assertContains('<form method="post" action="normalization.php"' . ' name="normalize" id="normalizeTable"', $result); $this->assertContains('<input type="hidden" name="step1" value="1">', $result); $choices = array('1nf' => __('First step of normalization (1NF)'), '2nf' => __('Second step of normalization (1NF+2NF)'), '3nf' => __('Third step of normalization (1NF+2NF+3NF)')); $html_tmp = PMA_Util::getRadioFields('normalizeTo', $choices, '1nf', true); $this->assertContains($html_tmp, $result); }
/** * Get HTML snippet for partition maintenance * * @param array $partition_names array of partition names for a specific db/table * @param array $url_params url parameters * * @return string $html_output */ function PMA_getHtmlForPartitionMaintenance($partition_names, $url_params) { $choices = array('ANALYZE' => __('Analyze'), 'CHECK' => __('Check'), 'OPTIMIZE' => __('Optimize'), 'REBUILD' => __('Rebuild'), 'REPAIR' => __('Repair')); $html_output = '<div class="operations_half_width">' . '<form method="post" action="tbl_operations.php">' . PMA_URL_getHiddenInputs($GLOBALS['db'], $GLOBALS['table']) . '<fieldset>' . '<legend>' . __('Partition maintenance') . '</legend>'; $html_select = '<select name="partition_name">' . "\n"; foreach ($partition_names as $one_partition) { $one_partition = htmlspecialchars($one_partition); $html_select .= '<option value="' . $one_partition . '">' . $one_partition . '</option>' . "\n"; } $html_select .= '</select>' . "\n"; $html_output .= sprintf(__('Partition %s'), $html_select); $html_output .= PMA_Util::getRadioFields('partition_operation', $choices, '', false); $html_output .= PMA_Util::showMySQLDocu('partitioning_maintenance'); $this_url_params = array_merge($url_params, array('sql_query' => 'ALTER TABLE ' . PMA_Util::backquote($GLOBALS['table']) . ' REMOVE PARTITIONING;')); $html_output .= '<br /><a href="sql.php' . PMA_URL_getCommon($this_url_params) . '">' . __('Remove partitioning') . '</a>'; $html_output .= '</fieldset>' . '<fieldset class="tblFooters">' . '<input type="hidden" name="submit_partition" value="1">' . '<input type="submit" value="' . __('Go') . '" />' . '</fieldset>' . '</form>' . '</div>'; return $html_output; }
/** * get html for options to normalize table * * @return HTML */ function PMA_getHtmlForNormalizetable() { $html_output = '<form method="post" action="normalization.php" ' . 'name="normalize" ' . 'id="normalizeTable" ' . '>' . PMA_URL_getHiddenInputs($GLOBALS['db'], $GLOBALS['table']) . '<input type="hidden" name="step1" value="1">'; $html_output .= '<fieldset>'; $html_output .= '<legend>' . __('Improve table structure (Normalization):') . '</legend>'; $html_output .= '<h3>' . __('Select up to what step you want to normalize') . '</h3>'; $choices = array('1nf' => __('First step of normalization (1NF)'), '2nf' => __('Second step of normalization (1NF+2NF)'), '3nf' => __('Third step of normalization (1NF+2NF+3NF)')); $html_output .= PMA_Util::getRadioFields('normalizeTo', $choices, '1nf', true); $html_output .= '</fieldset><fieldset class="tblFooters">' . "<span class='floatleft'>" . __('Hint: Please follow the procedure carefully in order ' . 'to obtain correct normalization') . "</span>" . '<input type="submit" name="submit_normalize" value="' . __('Go') . '" />' . '</fieldset>' . '</form>' . '</div>'; return $html_output; }
/** * Get the HTML snippet for change user login information * * @param string $username username * @param string $hostname host name * * @return string HTML snippet */ function PMA_getChangeLoginInformationHtmlForm($username, $hostname) { $choices = ['4' => __('… keep the old one.'), '1' => __('… delete the old one from the user tables.'), '2' => __('… revoke all active privileges from the old one and delete it afterwards.'), '3' => __('… delete the old one from the user tables and reload the privileges afterwards.')]; $class = ' ajax'; $html_output = '<form action="server_privileges.php" ' . 'method="post" class="copyUserForm' . $class . '">' . "\n" . PMA_generate_common_hidden_inputs('', '') . '<input type="hidden" name="old_username" ' . 'value="' . htmlspecialchars($username) . '" />' . "\n" . '<input type="hidden" name="old_hostname" ' . 'value="' . htmlspecialchars($hostname) . '" />' . "\n" . '<fieldset id="fieldset_change_copy_user">' . "\n" . '<legend>' . __('Change Login Information / Copy User') . '</legend>' . "\n" . PMA_getHtmlForDisplayLoginInformationFields('change'); $html_output .= '<fieldset id="fieldset_mode">' . "\n" . ' <legend>' . __('Create a new user with the same privileges and …') . '</legend>' . "\n"; $html_output .= PMA_Util::getRadioFields('mode', $choices, '4', true); $html_output .= '</fieldset>' . "\n" . '</fieldset>' . "\n"; $html_output .= '<fieldset id="fieldset_change_copy_user_footer" ' . 'class="tblFooters">' . "\n" . '<input type="submit" name="change_copy" ' . 'value="' . __('Go') . '" />' . "\n" . '</fieldset>' . "\n" . '</form>' . "\n"; return $html_output; }
/** * Test for PMA_getHtmlForNormalizetable * * @return void */ public function testPMAGetHtmlForNormalizetable() { $result = PMA_getHtmlForNormalizetable(); $this->assertTag(array('tag' => 'form', 'attributes' => array('action' => 'normalization.php', 'id' => 'normalizeTable')), $result); $this->assertContains('<input type="hidden" name="step1" value="1">', $result); $choices = array('1nf' => __('First step of normalization (1NF)'), '2nf' => __('Second step of normalization (1NF+2NF)'), '3nf' => __('Third step of normalization (1NF+2NF+3NF)')); $html_tmp = PMA_Util::getRadioFields('normalizeTo', $choices, '1nf', true); $this->assertContains($html_tmp, $result); }
while ($page = PMA_DBI_fetch_assoc($table_info_result)) { echo '<option value="' . $page['page_nr'] . '">'; echo htmlspecialchars($page['page_descr']); echo '</option>'; } echo '</select>'; echo '</p>'; $choices['import'] = __('Import from selected page'); $choices['export'] = __('Export to selected page'); } $choices['create_export'] = __('Create a page and export to it'); if (1 == count($choices)) { echo $choices['create_export']; echo '<input type="hidden" name="mode" value="create_export" />'; } else { echo PMA_Util::getRadioFields('mode', $choices, $checked_choice = '', $line_break = true, $escape_label = false, $class = ''); } echo '<br />'; echo '<label for="newpage">' . __('New page name: ') . '</label>'; echo '<input id="newpage" type="text" name="newpage" />'; echo '<p>' . __('Export/Import to scale') . ':'; ?> <select name="scale"> <option value="1">1:1</option> <option value="2">1:2</option> <option value="3" selected="selected">1:3 (<?php echo __('recommended'); ?> )</option> <option value="4">1:4</option> <option value="5">1:5</option>
/** * Test for getRadioFields * * @return void */ function testGetRadioFieldsEscapeLabelEscapeLabelWithClass() { $name = "test_display_radio"; $choices = array('value_1' => 'choice_1', 'value_&2' => 'choice&_<2>'); $checked_choice = "value_2"; $class = "test_class"; $out = ""; foreach ($choices as $choice_value => $choice_label) { $html_field_id = $name . '_' . $choice_value; $out .= '<div class="' . $class . '">'; $out .= '<input type="radio" name="' . $name . '" id="' . $html_field_id . '" value="' . htmlspecialchars($choice_value) . '"'; if ($choice_value == $checked_choice) { $out .= ' checked="checked"'; } $out .= ' />' . "\n"; $out .= '<label for="' . $html_field_id . '">' . htmlspecialchars($choice_label) . '</label>'; $out .= '<br />'; $out .= '</div>'; $out .= "\n"; } $this->assertEquals(PMA_Util::getRadioFields($name, $choices, $checked_choice, true, true, $class), $out); }