Contao\Database\Installer::generateSqlForm PHP 메소드

generateSqlForm() 공개 메소드

Generate a HTML form with queries and return it as string
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0.
public generateSqlForm ( ) : string
리턴 string The form HTML markup
    public function generateSqlForm()
    {
        @trigger_error('Using the Contao\\Database\\Installer::generateSqlForm() has been deprecated and will no longer work in Contao 5.0.', E_USER_DEPRECATED);
        $count = 0;
        $return = '';
        $sql_command = $this->compileCommands();
        if (empty($sql_command)) {
            return '';
        }
        $_SESSION['sql_commands'] = array();
        $arrOperations = array('CREATE' => $GLOBALS['TL_LANG']['tl_install']['CREATE'], 'ALTER_ADD' => $GLOBALS['TL_LANG']['tl_install']['ALTER_ADD'], 'ALTER_CHANGE' => $GLOBALS['TL_LANG']['tl_install']['ALTER_CHANGE'], 'ALTER_DROP' => $GLOBALS['TL_LANG']['tl_install']['ALTER_DROP'], 'DROP' => $GLOBALS['TL_LANG']['tl_install']['DROP']);
        foreach ($arrOperations as $command => $label) {
            if (is_array($sql_command[$command])) {
                // Headline
                $return .= '
    <tr>
      <td colspan="2" class="tl_col_0">' . $label . '</td>
    </tr>';
                // Check all
                $return .= '
    <tr>
      <td class="tl_col_1"><input type="checkbox" id="check_all_' . $count . '" class="tl_checkbox" onclick="Backend.toggleCheckboxElements(this, \'' . strtolower($command) . '\')"></td>
      <td class="tl_col_2"><label for="check_all_' . $count . '" style="color:#a6a6a6"><em>' . $GLOBALS['TL_LANG']['MSC']['selectAll'] . '</em></label></td>
    </tr>';
                // Fields
                foreach ($sql_command[$command] as $vv) {
                    $key = md5($vv);
                    $_SESSION['sql_commands'][$key] = $vv;
                    $return .= '
    <tr>
      <td class="tl_col_1"><input type="checkbox" name="sql[]" id="sql_' . $count . '" class="tl_checkbox ' . strtolower($command) . '" value="' . $key . '"' . (stristr($command, 'DROP') === false ? ' checked="checked"' : '') . '></td>
      <td class="tl_col_2"><pre><label for="sql_' . $count++ . '">' . $vv . '</label></pre></td>
    </tr>';
                }
            }
        }
        return '
<div id="sql_wrapper">
  <table id="sql_table">' . $return . '
  </table>
</div>';
    }