Permalink
Browse files

improve coding style : remove mixed php and html

  • Loading branch information...
1 parent c5dce87 commit dd8cdd3958806830c925033131a8be5d92ad28d1 @ruleant ruleant committed Jan 21, 2013
Showing with 89 additions and 87 deletions.
  1. +89 −87 view_create.php
View
@@ -72,7 +72,7 @@
$view_columns = explode(',', $_REQUEST['view']['column_names']);
}
- $column_map = PMA_getColumnMap($_REQUEST['view']['as'], $view_columns);
+ $column_map = PMA_getColumnMap($_REQUEST['view']['as'], $view_columns);
$pma_tranformation_data = PMA_getExistingTranformationData($GLOBALS['db']);
if ($pma_tranformation_data !== false) {
@@ -143,90 +143,92 @@
/**
* Displays the page
*/
-?>
-<!-- CREATE VIEW options -->
-<div id="div_view_options">
-<form method="post" action="view_create.php">
-<?php echo PMA_generate_common_hidden_inputs($url_params); ?>
-<fieldset>
- <legend><?php echo __('Create view') . PMA_Util::showMySQLDocu('SQL-Syntax', 'CREATE_VIEW'); ?></legend>
- <table class="rte_table">
- <tr><td><label for="or_replace">OR REPLACE</label></td>
- <td><input type="checkbox" name="view[or_replace]" id="or_replace"
- <?php if ($view['or_replace']) { ?>
- checked="checked"
- <?php } ?>
- value="1" />
- </td>
- </tr>
- <tr>
- <td><label for="algorithm">ALGORITHM</label></td>
- <td><select name="view[algorithm]" id="algorithm">
- <?php
- foreach ($view_algorithm_options as $option) {
- echo '<option value="' . htmlspecialchars($option) . '"';
- if ($view['algorithm'] === $option) {
- echo 'selected="selected"';
- }
- echo '>' . htmlspecialchars($option) . '</option>';
- }
- ?>
- </select>
- </td>
- </tr>
- <tr><td><?php echo __('VIEW name'); ?></td>
- <td><input type="text" size="20" name="view[name]" onfocus="this.select()"
- value="<?php echo htmlspecialchars($view['name']); ?>" />
- </td>
- </tr>
- <tr><td><?php echo __('Column names'); ?></td>
- <td><input type="text" maxlength="100" size="50" name="view[column_names]"
- onfocus="this.select()"
- value="<?php echo htmlspecialchars($view['column_names']); ?>" />
- </td>
- </tr>
- <tr><td>AS</td>
- <td>
- <textarea name="view[as]" rows="<?php echo $cfg['TextareaRows']; ?>"
- cols="<?php echo $cfg['TextareaCols']; ?>"
- dir="<?php echo $text_dir; ?>"<?php
- if ($GLOBALS['cfg']['TextareaAutoSelect'] || true) {
- echo ' onclick="selectContent(this, sql_box_locked, true)"';
- }
- ?>><?php echo htmlspecialchars($view['as']); ?></textarea>
- </td>
- </tr>
- <tr><td>WITH</td>
- <td>
- <?php
- foreach ($view_with_options as $option) {
- echo '<input type="checkbox" name="view[with][]"';
- if (in_array($option, $view['with'])) {
- echo ' checked="checked"';
- }
- echo ' id="view_with_' . str_replace(' ', '_', htmlspecialchars($option)) . '"';
- echo ' value="' . htmlspecialchars($option) . '" />';
- echo '<label for="view_with_' . str_replace(' ', '_', htmlspecialchars($option)) . '">&nbsp;';
- echo htmlspecialchars($option) . '</label><br />';
- }
- ?>
- </td>
- </tr>
- </table>
-</fieldset>
-<?php
- if ($GLOBALS['is_ajax_request'] != true) {
-?>
-<fieldset class="tblFooters">
- <input type="submit" name="createview" value="<?php echo __('Go'); ?>" />
-</fieldset>
-<?php
- } else {
-?>
- <input type="hidden" name="createview" value="1" />
- <input type="hidden" name="ajax_request" value="1" />
-<?php
+$htmlString = '<!-- CREATE VIEW options -->'
+ . '<div id="div_view_options">'
+ . '<form method="post" action="view_create.php">'
+ . PMA_generate_common_hidden_inputs($url_params)
+ . '<fieldset>'
+ . '<legend>' . __('Create view')
+ . PMA_Util::showMySQLDocu('SQL-Syntax', 'CREATE_VIEW') . '</legend>'
+ . '<table class="rte_table">'
+ . '<tr><td><label for="or_replace">OR REPLACE</label></td>'
+ . '<td><input type="checkbox" name="view[or_replace]" id="or_replace"';
+if ($view['or_replace']) {
+ $htmlString .= ' checked="checked"';
+}
+$htmlString .= ' value="1" />'
+ . '</td>'
+ . '</tr>'
+ . '<tr>'
+ . '<td><label for="algorithm">ALGORITHM</label></td>'
+ . '<td><select name="view[algorithm]" id="algorithm">';
+
+foreach ($view_algorithm_options as $option) {
+ $htmlString .= '<option value="' . htmlspecialchars($option) . '"';
+ if ($view['algorithm'] === $option) {
+ $htmlString .= ' selected="selected"';
+ }
+ $htmlString .= '>' . htmlspecialchars($option) . '</option>';
+}
+
+$htmlString .= '</select>'
+ . '</td>'
+ . '</tr>'
+ . '<tr><td>' . __('VIEW name') . '</td>'
+ . '<td><input type="text" size="20" name="view[name]" onfocus="this.select()"'
+ . ' value="' . htmlspecialchars($view['name']) . '" />'
+ . '</td>'
+ . '</tr>'
+ . '<tr><td>' . __('Column names') . '</td>'
+ . '<td><input type="text" maxlength="100" size="50" name="view[column_names]"'
+ . ' onfocus="this.select()"'
+ . ' value="' . htmlspecialchars($view['column_names']) . '" />'
+ . '</td>'
+ . '</tr>'
+ . '<tr><td>AS</td>'
+ . '<td>'
+ . '<textarea name="view[as]" rows="' . $cfg['TextareaRows'] . '"'
+ . ' cols="' . $cfg['TextareaCols'] . '"'
+ . ' dir="' . $text_dir . '"';
+
+if ($GLOBALS['cfg']['TextareaAutoSelect'] || true) {
+ $htmlString .= ' onclick="selectContent(this, sql_box_locked, true)"';
+}
+
+$htmlString .= '>' . htmlspecialchars($view['as']) . '</textarea>'
+ . '</td>'
+ . '</tr>'
+ . '<tr><td>WITH</td>'
+ . '<td>';
+
+foreach ($view_with_options as $option) {
+ $htmlString .= '<input type="checkbox" name="view[with][]"';
+ if (in_array($option, $view['with'])) {
+ $htmlString .= ' checked="checked"';
}
-?>
-</form>
-</div>
+ $htmlString .= ' id="view_with_'
+ . str_replace(' ', '_', htmlspecialchars($option)) . '"'
+ . ' value="' . htmlspecialchars($option) . '" />'
+ . '<label for="view_with_' . str_replace(' ', '_', htmlspecialchars($option))
+ . '">&nbsp;'
+ . htmlspecialchars($option) . '</label><br />';
+}
+
+$htmlString .= '</td>'
+ . '</tr>'
+ . '</table>'
+ . '</fieldset>';
+
+if ($GLOBALS['is_ajax_request'] != true) {
+ $htmlString .= '<fieldset class="tblFooters">'
+ . '<input type="submit" name="createview" value="' . __('Go') . '" />'
+ . '</fieldset>';
+} else {
+ $htmlString .= '<input type="hidden" name="createview" value="1" />'
+ . '<input type="hidden" name="ajax_request" value="1" />';
+}
+
+$htmlString .= '</form>'
+ . '</div>';
+
+echo $htmlString;

0 comments on commit dd8cdd3

Please sign in to comment.