Skip to content

Loading…

refactor display_create_table.lib.php #704

Merged
merged 1 commit into from

3 participants

@xmujay

No description provided.

@coveralls

Coverage Status

Coverage decreased (-0.02%) when pulling 2b1acfa on xmujay:0919_refactor_display_table into 6ceeceb on phpmyadmin:master.

@lem9 lem9 was assigned
@lem9

Nice work.

@lem9 lem9 merged commit 7e3d92f into phpmyadmin:master

1 check passed

Details default The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 19, 2013
  1. @xmujay

    refactor display_create_table

    xmujay committed
Showing with 40 additions and 24 deletions.
  1. +40 −24 libraries/display_create_table.lib.php
View
64 libraries/display_create_table.lib.php
@@ -35,29 +35,45 @@
$is_create_table_priv = true;
-?>
- <form id="create_table_form_minimal" method="post" action="tbl_create.php">
-<fieldset>
- <legend>
-<?php
-if (PMA_Util::showIcons('ActionLinksMode')) {
- echo PMA_Util::getImage('b_newtbl.png');
+/**
+ * Returns the html for create table.
+ *
+ * @param string $db database name
+ *
+ * @return string
+ */
+function PMA_getHtmlForCreateTable($db)
+{
+ $html = '<form id="create_table_form_minimal" method="post" '
+ . 'action="tbl_create.php">';
+ $html .= '<fieldset>';
+ $html .= '<legend>';
+
+ if (PMA_Util::showIcons('ActionLinksMode')) {
+ $html .= PMA_Util::getImage('b_newtbl.png');
+ }
+ $html .= __('Create table');
+
+ $html .= ' </legend>';
+ $html .= PMA_URL_getHiddenInputs($db);
+ $html .= '<div class="formelement">';
+ $html .= __('Name') . ":";
+ $html .= ' <input type="text" name="table" maxlength="64" '
+ . 'size="30" required />';
+ $html .= ' </div>';
+ $html .= ' <div class="formelement">';
+ $html .= __('Number of columns') . ":";
+ $html .= ' <input type="number" min="1" name="num_fields" size="2" />';
+ $html .= ' </div>';
+ $html .= ' <div class="clearfloat"></div>';
+ $html .= '</fieldset>';
+ $html .= '<fieldset class="tblFooters">';
+ $html .= ' <input type="submit" value="' . __('Go') . '" />';
+ $html .= '</fieldset>';
+ $html .= '</form>';
+
+ return $html;
}
-echo __('Create table');
+
+echo PMA_getHtmlForCreateTable($db);
?>
- </legend>
- <?php echo PMA_URL_getHiddenInputs($db); ?>
- <div class="formelement">
- <?php echo __('Name'); ?>:
- <input type="text" name="table" maxlength="64" size="30" required />
- </div>
- <div class="formelement">
- <?php echo __('Number of columns'); ?>:
- <input type="number" min="1" name="num_fields" size="2" />
- </div>
- <div class="clearfloat"></div>
-</fieldset>
-<fieldset class="tblFooters">
- <input type="submit" value="<?php echo __('Go'); ?>" />
-</fieldset>
-</form>
Something went wrong with that request. Please try again.