Converting number of Excel column names no longer limited
[phpmyadmin/arisferyanto.git] / libraries / display_export.lib.php
blob186b0d36f087691ab3b791b0175033c10821e741
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 * @package phpMyAdmin
7 */
8 if (! defined('PHPMYADMIN')) {
9 exit;
12 /**
15 require_once './libraries/Table.class.php';
17 // Get relations & co. status
18 require_once './libraries/relation.lib.php';
19 $cfgRelation = PMA_getRelationsParam();
22 require_once './libraries/file_listing.php';
23 require_once './libraries/plugin_interface.lib.php';
25 function PMA_exportCheckboxCheck($str) {
26 if (isset($GLOBALS['cfg']['Export'][$str]) && $GLOBALS['cfg']['Export'][$str]) {
27 echo ' checked="checked"';
31 function PMA_exportIsActive($what, $val) {
32 if (isset($GLOBALS['cfg']['Export'][$what]) && $GLOBALS['cfg']['Export'][$what] == $val) {
33 echo ' checked="checked"';
37 /* Scan for plugins */
38 $export_list = PMA_getPlugins('./libraries/export/', array('export_type' => $export_type, 'single_table' => isset($single_table)));
40 /* Fail if we didn't find any plugin */
41 if (empty($export_list)) {
42 PMA_Message::error('strCanNotLoadExportPlugins')->display();
43 require './libraries/footer.inc.php';
47 <form method="post" action="export.php" name="dump">
49 <?php
50 if ($export_type == 'server') {
51 echo PMA_generate_common_hidden_inputs('', '', 1);
52 } elseif ($export_type == 'database') {
53 echo PMA_generate_common_hidden_inputs($db, '', 1);
54 } else {
55 echo PMA_generate_common_hidden_inputs($db, $table, 1);
58 // just to keep this value for possible next display of this form after saving on server
59 if (isset($single_table)) {
60 echo '<input type="hidden" name="single_table" value="TRUE" />' . "\n";
63 echo '<input type="hidden" name="export_type" value="' . $export_type . '" />' . "\n";
65 if (! empty($sql_query)) {
66 echo '<input type="hidden" name="sql_query" value="' . htmlspecialchars($sql_query) . '" />' . "\n";
68 echo PMA_pluginGetJavascript($export_list);
70 <fieldset id="fieldsetexport">
71 <legend><?php echo $export_page_title; ?></legend>
73 <?php
75 * this table is needed to fix rendering in Opera <= 9 and Safari <= 2
76 * normaly just the two fieldset would have float: left
79 <table><tr><td>
81 <div id="div_container_exportoptions">
82 <fieldset id="exportoptions">
83 <legend><?php echo $strExport; ?></legend>
85 <?php if (! empty($multi_values)) { ?>
86 <div class="formelementrow">
87 <?php echo $multi_values; ?>
88 </div>
89 <?php } ?>
90 <?php echo PMA_pluginGetChoice('Export', 'what', $export_list, 'format'); ?>
91 </fieldset>
92 </div>
94 </td><td>
96 <div id="div_container_sub_exportoptions">
97 <?php echo PMA_pluginGetOptions('Export', $export_list); ?>
98 </div>
99 </td></tr></table>
101 <script type="text/javascript">
102 //<![CDATA[
103 init_options();
104 //]]>
105 </script>
107 <?php if (strlen($table) && ! isset($num_tables) && ! PMA_Table::isMerge($db, $table)) { ?>
108 <div class="formelementrow">
109 <?php
110 echo '<input type="radio" name="allrows" value="0" id="radio_allrows_0" checked="checked" />';
112 echo sprintf($strDumpXRows,
113 '<input type="text" name="limit_to" size="5" value="'
114 . (isset($unlim_num_rows) ? $unlim_num_rows : PMA_Table::countRecords($db, $table))
115 . '" onfocus="this.select()" />',
116 '<input type="text" name="limit_from" value="0" size="5"'
117 .' onfocus="this.select()" /> ');
119 echo '<input type="radio" name="allrows" value="1" id="radio_allrows_1" />';
120 echo '<label for="radio_allrows_1">' . $strDumpAllRows . '</label>';
122 </div>
123 <?php } ?>
124 </fieldset>
126 <fieldset>
127 <legend>
128 <input type="checkbox" name="asfile" value="sendit"
129 id="checkbox_dump_asfile" <?php PMA_exportCheckboxCheck('asfile'); ?> />
130 <label for="checkbox_dump_asfile"><?php echo $strSend; ?></label>
131 </legend>
133 <?php if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) { ?>
134 <input type="checkbox" name="onserver" value="saveit"
135 id="checkbox_dump_onserver"
136 onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
137 <?php PMA_exportCheckboxCheck('onserver'); ?> />
138 <label for="checkbox_dump_onserver">
139 <?php echo sprintf($strSaveOnServer, htmlspecialchars(PMA_userDir($cfg['SaveDir']))); ?>
140 </label>,<br />
141 <input type="checkbox" name="onserverover" value="saveitover"
142 id="checkbox_dump_onserverover"
143 onclick="document.getElementById('checkbox_dump_onserver').checked = true;
144 document.getElementById('checkbox_dump_asfile').checked = true;"
145 <?php PMA_exportCheckboxCheck('onserver_overwrite'); ?> />
146 <label for="checkbox_dump_onserverover">
147 <?php echo $strOverwriteExisting; ?></label>
148 <br />
149 <?php } ?>
151 <label for="filename_template">
152 <?php
153 echo $strFileNameTemplate;
155 $trans = new PMA_Message;
156 $trans->addMessage('__SERVER__/');
157 $trans->addString('strFileNameTemplateDescriptionServer');
158 if ($export_type == 'database' || $export_type == 'table') {
159 $trans->addMessage('__DB__/');
160 $trans->addString('strFileNameTemplateDescriptionDatabase');
161 if ($export_type == 'table') {
162 $trans->addMessage('__TABLE__/');
163 $trans->addString('strFileNameTemplateDescriptionTable');
167 $message = new PMA_Message('strFileNameTemplateDescription');
168 $message->addParam('<a href="http://php.net/strftime" target="documentation" title="'
169 . $strDocu . '">', false);
170 $message->addParam('</a>', false);
171 $message->addParam($trans);
173 echo PMA_showHint($message);
175 </label>:
176 <input type="text" name="filename_template" id="filename_template"
177 <?php
178 echo ' value="';
179 if ($export_type == 'database') {
180 if (isset($_COOKIE) && !empty($_COOKIE['pma_db_filename_template'])) {
181 echo htmlspecialchars($_COOKIE['pma_db_filename_template']);
182 } else {
183 echo $GLOBALS['cfg']['Export']['file_template_database'];
185 } elseif ($export_type == 'table') {
186 if (isset($_COOKIE) && !empty($_COOKIE['pma_table_filename_template'])) {
187 echo htmlspecialchars($_COOKIE['pma_table_filename_template']);
188 } else {
189 echo $GLOBALS['cfg']['Export']['file_template_table'];
191 } else {
192 if (isset($_COOKIE) && !empty($_COOKIE['pma_server_filename_template'])) {
193 echo htmlspecialchars($_COOKIE['pma_server_filename_template']);
194 } else {
195 echo $GLOBALS['cfg']['Export']['file_template_server'];
198 echo '"';
203 <input type="checkbox" name="remember_template"
204 id="checkbox_remember_template"
205 <?php PMA_exportCheckboxCheck('remember_file_template'); ?> />
206 <label for="checkbox_remember_template">
207 <?php echo $strFileNameTemplateRemember; ?></label>
210 <div class="formelementrow">
211 <?php
212 // charset of file
213 if ($cfg['AllowAnywhereRecoding']) {
214 echo ' <label for="select_charset_of_file">'
215 . $strCharsetOfFile . '</label>' . "\n";
217 reset($cfg['AvailableCharsets']);
218 echo '<select id="select_charset_of_file" name="charset_of_file" size="1">';
219 foreach ($cfg['AvailableCharsets'] as $temp_charset) {
220 echo '<option value="' . $temp_charset . '"';
221 if ((empty($cfg['Export']['charset']) && $temp_charset == $charset)
222 || $temp_charset == $cfg['Export']['charset']) {
223 echo ' selected="selected"';
225 echo '>' . $temp_charset . '</option>';
226 } // end foreach
227 echo '</select>';
228 } // end if
230 </div>
232 <?php
233 // zip, gzip and bzip2 encode features
234 $is_zip = ($cfg['ZipDump'] && @function_exists('gzcompress'));
235 $is_gzip = ($cfg['GZipDump'] && @function_exists('gzencode'));
236 $is_bzip = ($cfg['BZipDump'] && @function_exists('bzcompress'));
238 if ($is_zip || $is_gzip || $is_bzip) { ?>
239 <div class="formelementrow">
240 <?php echo $strCompression; ?>:
241 <input type="radio" name="compression" value="none"
242 id="radio_compression_none"
243 onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
244 <?php PMA_exportIsActive('compression', 'none'); ?> />
245 <label for="radio_compression_none"><?php echo $strNone; ?></label>
246 <?php
247 if ($is_zip) { ?>
248 <input type="radio" name="compression" value="zip"
249 id="radio_compression_zip"
250 onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
251 <?php PMA_exportIsActive('compression', 'zip'); ?> />
252 <label for="radio_compression_zip"><?php echo $strZip; ?></label>
253 <?php } if ($is_gzip) { ?>
254 <input type="radio" name="compression" value="gzip"
255 id="radio_compression_gzip"
256 onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
257 <?php PMA_exportIsActive('compression', 'gzip'); ?> />
258 <label for="radio_compression_gzip"><?php echo $strGzip; ?></label>
259 <?php } if ($is_bzip) { ?>
260 <input type="radio" name="compression" value="bzip"
261 id="radio_compression_bzip"
262 onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
263 <?php PMA_exportIsActive('compression', 'bzip2'); ?> />
264 <label for="radio_compression_bzip"><?php echo $strBzip; ?></label>
265 <?php } ?>
266 </div>
267 <?php } else { ?>
268 <input type="hidden" name="compression" value="none" />
269 <?php } ?>
270 </fieldset>
272 <?php if (function_exists('PMA_set_enc_form')) { ?>
273 <!-- Encoding setting form appended by Y.Kawada -->
274 <!-- Japanese encoding setting -->
275 <fieldset>
276 <?php echo PMA_set_enc_form(' '); ?>
277 </fieldset>
278 <?php } ?>
280 <fieldset class="tblFooters">
281 <?php PMA_externalBug($GLOBALS['strSQLCompatibility'], 'mysql', '50027', '14515'); ?>
282 <input type="submit" value="<?php echo $strGo; ?>" id="buttonGo" />
283 </fieldset>
284 </form>