display_export.lib.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * functions for displaying server, database and table export
  5. *
  6. * @usedby display_export.inc.php
  7. *
  8. * @package PhpMyAdmin
  9. */
  10. if (! defined('PHPMYADMIN')) {
  11. exit;
  12. }
  13. /**
  14. * Outputs appropriate checked statement for checkbox.
  15. *
  16. * @param string $str option name
  17. *
  18. * @return string|void
  19. */
  20. function PMA_exportCheckboxCheck($str)
  21. {
  22. if (isset($GLOBALS['cfg']['Export'][$str]) && $GLOBALS['cfg']['Export'][$str]) {
  23. return ' checked="checked"';
  24. }
  25. }
  26. /**
  27. * Prints Html For Export Selection Options
  28. *
  29. * @param String $tmp_select Tmp selected method of export
  30. *
  31. * @return string
  32. */
  33. function PMA_getHtmlForExportSelectOptions($tmp_select = '')
  34. {
  35. $multi_values = '<div style="text-align: left">';
  36. $multi_values .= '<a href="#"';
  37. $multi_values .= ' onclick="setSelectOptions'
  38. . '(\'dump\', \'db_select[]\', true); return false;">';
  39. $multi_values .= __('Select All');
  40. $multi_values .= '</a>';
  41. $multi_values .= ' / ';
  42. $multi_values .= '<a href="#"';
  43. $multi_values .= ' onclick="setSelectOptions'
  44. . '(\'dump\', \'db_select[]\', false); return false;">';
  45. $multi_values .= __('Unselect All') . '</a><br />';
  46. $multi_values .= '<select name="db_select[]" '
  47. . 'id="db_select" size="10" multiple="multiple">';
  48. $multi_values .= "\n";
  49. // Check if the selected databases are defined in $_GET
  50. // (from clicking Back button on export.php)
  51. if (isset($_GET['db_select'])) {
  52. $_GET['db_select'] = urldecode($_GET['db_select']);
  53. $_GET['db_select'] = explode(",", $_GET['db_select']);
  54. }
  55. foreach ($GLOBALS['pma']->databases as $current_db) {
  56. if ($current_db == 'information_schema'
  57. || $current_db == 'performance_schema'
  58. || $current_db == 'mysql'
  59. ) {
  60. continue;
  61. }
  62. if (isset($_GET['db_select'])) {
  63. if (in_array($current_db, $_GET['db_select'])) {
  64. $is_selected = ' selected="selected"';
  65. } else {
  66. $is_selected = '';
  67. }
  68. } elseif (!empty($tmp_select)) {
  69. if (strpos(' ' . $tmp_select, '|' . $current_db . '|')) {
  70. $is_selected = ' selected="selected"';
  71. } else {
  72. $is_selected = '';
  73. }
  74. } else {
  75. $is_selected = ' selected="selected"';
  76. }
  77. $current_db = htmlspecialchars($current_db);
  78. $multi_values .= ' <option value="' . $current_db . '"'
  79. . $is_selected . '>' . $current_db . '</option>' . "\n";
  80. } // end while
  81. $multi_values .= "\n";
  82. $multi_values .= '</select></div>';
  83. return $multi_values;
  84. }
  85. /**
  86. * Prints Html For Export Hidden Input
  87. *
  88. * @param String $export_type Selected Export Type
  89. * @param String $db Selected DB
  90. * @param String $table Selected Table
  91. * @param String $single_table Single Table
  92. * @param String $sql_query Sql Query
  93. *
  94. * @return string
  95. */
  96. function PMA_getHtmlForHiddenInput(
  97. $export_type, $db, $table, $single_table, $sql_query
  98. ) {
  99. global $cfg;
  100. $html = "";
  101. if ($export_type == 'server') {
  102. $html .= PMA_URL_getHiddenInputs('', '', 1);
  103. } elseif ($export_type == 'database') {
  104. $html .= PMA_URL_getHiddenInputs($db, '', 1);
  105. } else {
  106. $html .= PMA_URL_getHiddenInputs($db, $table, 1);
  107. }
  108. // just to keep this value for possible next display of this form after saving
  109. // on server
  110. if (!empty($single_table)) {
  111. $html .= '<input type="hidden" name="single_table" value="TRUE" />'
  112. . "\n";
  113. }
  114. $html .= '<input type="hidden" name="export_type" value="'
  115. . $export_type . '" />';
  116. $html .= "\n";
  117. // If the export method was not set, the default is quick
  118. if (isset($_GET['export_method'])) {
  119. $cfg['Export']['method'] = $_GET['export_method'];
  120. } elseif (! isset($cfg['Export']['method'])) {
  121. $cfg['Export']['method'] = 'quick';
  122. }
  123. // The export method (quick, custom or custom-no-form)
  124. $html .= '<input type="hidden" name="export_method" value="'
  125. . htmlspecialchars($cfg['Export']['method']) . '" />';
  126. if (isset($_GET['sql_query'])) {
  127. $html .= '<input type="hidden" name="sql_query" value="'
  128. . htmlspecialchars($_GET['sql_query']) . '" />' . "\n";
  129. } elseif (! empty($sql_query)) {
  130. $html .= '<input type="hidden" name="sql_query" value="'
  131. . htmlspecialchars($sql_query) . '" />' . "\n";
  132. }
  133. return $html;
  134. }
  135. /**
  136. * Prints Html For Export Options Header
  137. *
  138. * @param String $export_type Selected Export Type
  139. * @param String $db Selected DB
  140. * @param String $table Selected Table
  141. *
  142. * @return string
  143. */
  144. function PMA_getHtmlForExportOptionHeader($export_type, $db, $table)
  145. {
  146. $html = '<div class="exportoptions" id="header">';
  147. $html .= '<h2>';
  148. $html .= PMA_Util::getImage('b_export.png', __('Export'));
  149. if ($export_type == 'server') {
  150. $html .= __('Exporting databases from the current server');
  151. } elseif ($export_type == 'database') {
  152. $html .= sprintf(
  153. __('Exporting tables from "%s" database'),
  154. htmlspecialchars($db)
  155. );
  156. } else {
  157. $html .= sprintf(
  158. __('Exporting rows from "%s" table'),
  159. htmlspecialchars($table)
  160. );
  161. }
  162. $html .= '</h2>';
  163. $html .= '</div>';
  164. return $html;
  165. }
  166. /**
  167. * Prints Html For Export Options Method
  168. *
  169. * @return string
  170. */
  171. function PMA_getHtmlForExportOptionsMethod()
  172. {
  173. global $cfg;
  174. if (isset($_GET['quick_or_custom'])) {
  175. $export_method = $_GET['quick_or_custom'];
  176. } else {
  177. $export_method = $cfg['Export']['method'];
  178. }
  179. $html = '<div class="exportoptions" id="quick_or_custom">';
  180. $html .= '<h3>' . __('Export Method:') . '</h3>';
  181. $html .= '<ul>';
  182. $html .= '<li>';
  183. $html .= '<input type="radio" name="quick_or_custom" value="quick" '
  184. . ' id="radio_quick_export"';
  185. if ($export_method == 'quick' || $export_method == 'quick_no_form') {
  186. $html .= ' checked="checked"';
  187. }
  188. $html .= ' />';
  189. $html .= '<label for ="radio_quick_export">';
  190. $html .= __('Quick - display only the minimal options');
  191. $html .= '</label>';
  192. $html .= '</li>';
  193. $html .= '<li>';
  194. $html .= '<input type="radio" name="quick_or_custom" value="custom" '
  195. . ' id="radio_custom_export"';
  196. if ($export_method == 'custom' || $export_method == 'custom_no_form') {
  197. $html .= ' checked="checked"';
  198. }
  199. $html .= ' />';
  200. $html .= '<label for="radio_custom_export">';
  201. $html .= __('Custom - display all possible options');
  202. $html .= '</label>';
  203. $html .= '</li>';
  204. $html .= '</ul>';
  205. $html .= '</div>';
  206. return $html;
  207. }
  208. /**
  209. * Prints Html For Export Options Selection
  210. *
  211. * @param String $export_type Selected Export Type
  212. * @param String $multi_values Export Options
  213. *
  214. * @return string
  215. */
  216. function PMA_getHtmlForExportOptionsSelection($export_type, $multi_values)
  217. {
  218. $html = '<div class="exportoptions" id="databases_and_tables">';
  219. if ($export_type == 'server') {
  220. $html .= '<h3>' . __('Database(s):') . '</h3>';
  221. } else if ($export_type == 'database') {
  222. $html .= '<h3>' . __('Table(s):') . '</h3>';
  223. }
  224. if (! empty($multi_values)) {
  225. $html .= $multi_values;
  226. }
  227. $html .= '</div>';
  228. return $html;
  229. }
  230. /**
  231. * Prints Html For Export Options Format
  232. *
  233. * @param array $export_list Export List
  234. *
  235. * @return string
  236. */
  237. function PMA_getHtmlForExportOptionsFormat($export_list)
  238. {
  239. $html = '<div class="exportoptions" id="format">';
  240. $html .= '<h3>' . __('Format:') . '</h3>';
  241. $html .= PMA_pluginGetChoice('Export', 'what', $export_list, 'format');
  242. $html .= '</div>';
  243. $html .= '<div class="exportoptions" id="format_specific_opts">';
  244. $html .= '<h3>' . __('Format-specific options:') . '</h3>';
  245. $html .= '<p class="no_js_msg" id="scroll_to_options_msg">';
  246. $html .= __(
  247. 'Scroll down to fill in the options for the selected format '
  248. . 'and ignore the options for other formats.'
  249. );
  250. $html .= '</p>';
  251. $html .= PMA_pluginGetOptions('Export', $export_list);
  252. $html .= '</div>';
  253. if (function_exists('PMA_Kanji_encodingForm')) {
  254. // Encoding setting form appended by Y.Kawada
  255. // Japanese encoding setting
  256. $html .= '<div class="exportoptions" id="kanji_encoding">';
  257. $html .= '<h3>' . __('Encoding Conversion:') . '</h3>';
  258. $html .= PMA_Kanji_encodingForm();
  259. $html .= '</div>';
  260. }
  261. $html .= '<div class="exportoptions" id="submit">';
  262. $html .= PMA_Util::getExternalBug(
  263. __('SQL compatibility mode'), 'mysql', '50027', '14515'
  264. );
  265. global $cfg;
  266. if ($cfg['ExecTimeLimit'] > 0) {
  267. $html .= '<input type="submit" value="' . __('Go')
  268. . '" id="buttonGo" onclick="check_time_out('
  269. . $cfg['ExecTimeLimit'] . ')"/>';
  270. } else {
  271. // if the time limit set is zero, then time out won't occur
  272. // So no need to check for time out.
  273. $html .= '<input type="submit" value="' . __('Go') . '" id="buttonGo" />';
  274. }
  275. $html .= '</div>';
  276. return $html;
  277. }
  278. /**
  279. * Prints Html For Export Options Rows
  280. *
  281. * @param String $db Selected DB
  282. * @param String $table Selected Table
  283. * @param String $unlim_num_rows Num of Rows
  284. *
  285. * @return string
  286. */
  287. function PMA_getHtmlForExportOptionsRows($db, $table, $unlim_num_rows)
  288. {
  289. $html = '<div class="exportoptions" id="rows">';
  290. $html .= '<h3>' . __('Rows:') . '</h3>';
  291. $html .= '<ul>';
  292. $html .= '<li>';
  293. $html .= '<input type="radio" name="allrows" value="0" id="radio_allrows_0"';
  294. if (isset($_GET['allrows']) && $_GET['allrows'] == 0) {
  295. $html .= ' checked="checked"';
  296. }
  297. $html .= '/>';
  298. $html .= '<label for ="radio_allrows_0">' . __('Dump some row(s)') . '</label>';
  299. $html .= '<ul>';
  300. $html .= '<li>';
  301. $html .= '<label for="limit_to">' . __('Number of rows:') . '</label>';
  302. $html .= '<input type="text" id="limit_to" name="limit_to" size="5" value="';
  303. if (isset($_GET['limit_to'])) {
  304. $html .= htmlspecialchars($_GET['limit_to']);
  305. } elseif (!empty($unlim_num_rows)) {
  306. $html .= $unlim_num_rows;
  307. } else {
  308. $html .= PMA_Table::countRecords($db, $table);
  309. }
  310. $html .= '" onfocus="this.select()" />';
  311. $html .= '</li>';
  312. $html .= '<li>';
  313. $html .= '<label for="limit_from">' . __('Row to begin at:') . '</label>';
  314. $html .= '<input type="text" id="limit_from" name="limit_from" value="';
  315. if (isset($_GET['limit_from'])) {
  316. $html .= htmlspecialchars($_GET['limit_from']);
  317. } else {
  318. $html .= '0';
  319. }
  320. $html .= '" size="5" onfocus="this.select()" />';
  321. $html .= '</li>';
  322. $html .= '</ul>';
  323. $html .= '</li>';
  324. $html .= '<li>';
  325. $html .= '<input type="radio" name="allrows" value="1" id="radio_allrows_1"';
  326. if (! isset($_GET['allrows']) || $_GET['allrows'] == 1) {
  327. $html .= ' checked="checked"';
  328. }
  329. $html .= '/>';
  330. $html .= ' <label for="radio_allrows_1">' . __('Dump all rows') . '</label>';
  331. $html .= '</li>';
  332. $html .= '</ul>';
  333. $html .= '</div>';
  334. return $html;
  335. }
  336. /**
  337. * Prints Html For Export Options Quick Export
  338. *
  339. * @return string
  340. */
  341. function PMA_getHtmlForExportOptionsQuickExport()
  342. {
  343. global $cfg;
  344. $html = '<div class="exportoptions" id="output_quick_export">';
  345. $html .= '<h3>' . __('Output:') . '</h3>';
  346. $html .= '<ul>';
  347. $html .= '<li>';
  348. $html .= '<input type="checkbox" name="quick_export_onserver" value="saveit" ';
  349. $html .= 'id="checkbox_quick_dump_onserver" ';
  350. $html .= PMA_exportCheckboxCheck('quick_export_onserver');
  351. $html .= '/>';
  352. $html .= '<label for="checkbox_quick_dump_onserver">';
  353. $html .= sprintf(
  354. __('Save on server in the directory <b>%s</b>'),
  355. htmlspecialchars(PMA_Util::userDir($cfg['SaveDir']))
  356. );
  357. $html .= '</label>';
  358. $html .= '</li>';
  359. $html .= '<li>';
  360. $html .= '<input type="checkbox" name="quick_export_onserverover" ';
  361. $html .= 'value="saveitover" id="checkbox_quick_dump_onserverover" ';
  362. $html .= PMA_exportCheckboxCheck('quick_export_onserver_overwrite');
  363. $html .= '/>';
  364. $html .= '<label for="checkbox_quick_dump_onserverover">';
  365. $html .= __('Overwrite existing file(s)');
  366. $html .= '</label>';
  367. $html .= '</li>';
  368. $html .= '</ul>';
  369. $html .= '</div>';
  370. return $html;
  371. }
  372. /**
  373. * Prints Html For Export Options Save Dir
  374. *
  375. * @return string
  376. */
  377. function PMA_getHtmlForExportOptionsOutputSaveDir()
  378. {
  379. global $cfg;
  380. $html = '<li>';
  381. $html .= '<input type="checkbox" name="onserver" value="saveit" ';
  382. $html .= 'id="checkbox_dump_onserver" ';
  383. $html .= PMA_exportCheckboxCheck('onserver');
  384. $html .= '/>';
  385. $html .= '<label for="checkbox_dump_onserver">';
  386. $html .= sprintf(
  387. __('Save on server in the directory <b>%s</b>'),
  388. htmlspecialchars(PMA_Util::userDir($cfg['SaveDir']))
  389. );
  390. $html .= '</label>';
  391. $html .= '</li>';
  392. $html .= '<li>';
  393. $html .= '<input type="checkbox" name="onserverover" value="saveitover"';
  394. $html .= ' id="checkbox_dump_onserverover" ';
  395. $html .= PMA_exportCheckboxCheck('onserver_overwrite');
  396. $html .= '/>';
  397. $html .= '<label for="checkbox_dump_onserverover">';
  398. $html .= __('Overwrite existing file(s)');
  399. $html .= '</label>';
  400. $html .= '</li>';
  401. return $html;
  402. }
  403. /**
  404. * Prints Html For Export Options
  405. *
  406. * @param String $export_type Selected Export Type
  407. *
  408. * @return string
  409. */
  410. function PMA_getHtmlForExportOptionsOutputFormat($export_type)
  411. {
  412. $html = '<li>';
  413. $html .= '<label for="filename_template" class="desc">';
  414. $html .= __('File name template:');
  415. $trans = new PMA_Message;
  416. $trans->addMessage(__('@SERVER@ will become the server name'));
  417. if ($export_type == 'database' || $export_type == 'table') {
  418. $trans->addMessage(__(', @DATABASE@ will become the database name'));
  419. if ($export_type == 'table') {
  420. $trans->addMessage(__(', @TABLE@ will become the table name'));
  421. }
  422. }
  423. $msg = new PMA_Message(
  424. __(
  425. 'This value is interpreted using %1$sstrftime%2$s, '
  426. . 'so you can use time formatting strings. '
  427. . 'Additionally the following transformations will happen: %3$s. '
  428. . 'Other text will be kept as is. See the %4$sFAQ%5$s for details.'
  429. )
  430. );
  431. $msg->addParam(
  432. '<a href="' . PMA_linkURL(PMA_getPHPDocLink('function.strftime.php'))
  433. . '" target="documentation" title="' . __('Documentation') . '">',
  434. false
  435. );
  436. $msg->addParam('</a>', false);
  437. $msg->addParam($trans);
  438. $doc_url = PMA_Util::getDocuLink('faq', 'faq6-27');
  439. $msg->addParam(
  440. '<a href="' . $doc_url . '" target="documentation">',
  441. false
  442. );
  443. $msg->addParam('</a>', false);
  444. $html .= PMA_Util::showHint($msg);
  445. $html .= '</label>';
  446. $html .= '<input type="text" name="filename_template" id="filename_template" ';
  447. $html .= ' value="';
  448. if (isset($_GET['filename_template'])) {
  449. $html .= htmlspecialchars($_GET['filename_template']);
  450. } else {
  451. if ($export_type == 'database') {
  452. $html .= htmlspecialchars(
  453. $GLOBALS['PMA_Config']->getUserValue(
  454. 'pma_db_filename_template',
  455. $GLOBALS['cfg']['Export']['file_template_database']
  456. )
  457. );
  458. } elseif ($export_type == 'table') {
  459. $html .= htmlspecialchars(
  460. $GLOBALS['PMA_Config']->getUserValue(
  461. 'pma_table_filename_template',
  462. $GLOBALS['cfg']['Export']['file_template_table']
  463. )
  464. );
  465. } else {
  466. $html .= htmlspecialchars(
  467. $GLOBALS['PMA_Config']->getUserValue(
  468. 'pma_server_filename_template',
  469. $GLOBALS['cfg']['Export']['file_template_server']
  470. )
  471. );
  472. }
  473. }
  474. $html .= '"';
  475. $html .= '/>';
  476. $html .= '<input type="checkbox" name="remember_template" ';
  477. $html .= 'id="checkbox_remember_template" ';
  478. $html .= PMA_exportCheckboxCheck('remember_file_template');
  479. $html .= '/>';
  480. $html .= '<label for="checkbox_remember_template">';
  481. $html .= __('use this for future exports');
  482. $html .= '</label>';
  483. $html .= '</li>';
  484. return $html;
  485. }
  486. /**
  487. * Prints Html For Export Options Charset
  488. *
  489. * @return string
  490. */
  491. function PMA_getHtmlForExportOptionsOutputCharset()
  492. {
  493. global $cfg;
  494. $html = ' <li><label for="select_charset_of_file" class="desc">'
  495. . __('Character set of the file:') . '</label>' . "\n";
  496. reset($cfg['AvailableCharsets']);
  497. $html .= '<select id="select_charset_of_file" name="charset_of_file" size="1">';
  498. foreach ($cfg['AvailableCharsets'] as $temp_charset) {
  499. $html .= '<option value="' . $temp_charset . '"';
  500. if (isset($_GET['charset_of_file'])
  501. && ($_GET['charset_of_file'] != $temp_charset)
  502. ) {
  503. $html .= '';
  504. } elseif ((empty($cfg['Export']['charset']) && $temp_charset == 'utf-8')
  505. || $temp_charset == $cfg['Export']['charset']
  506. ) {
  507. $html .= ' selected="selected"';
  508. }
  509. $html .= '>' . $temp_charset . '</option>';
  510. } // end foreach
  511. $html .= '</select></li>';
  512. return $html;
  513. }
  514. /**
  515. * Prints Html For Export Options Compression
  516. *
  517. * @return string
  518. */
  519. function PMA_getHtmlForExportOptionsOutputCompression()
  520. {
  521. global $cfg;
  522. if (isset($_GET['compression'])) {
  523. $selected_compression = $_GET['compression'];
  524. } elseif (isset($cfg['Export']['compression'])) {
  525. $selected_compression = $cfg['Export']['compression'];
  526. } else {
  527. $selected_compression = "none";
  528. }
  529. $html = "";
  530. // zip and gzip encode features
  531. $is_zip = ($cfg['ZipDump'] && @function_exists('gzcompress'));
  532. $is_gzip = ($cfg['GZipDump'] && @function_exists('gzencode'));
  533. if ($is_zip || $is_gzip) {
  534. $html .= '<li>';
  535. $html .= '<label for="compression" class="desc">'
  536. . __('Compression:') . '</label>';
  537. $html .= '<select id="compression" name="compression">';
  538. $html .= '<option value="none">' . __('None') . '</option>';
  539. if ($is_zip) {
  540. $html .= '<option value="zip" ';
  541. if ($selected_compression == "zip") {
  542. $html .= 'selected="selected"';
  543. }
  544. $html .= '>' . __('zipped') . '</option>';
  545. }
  546. if ($is_gzip) {
  547. $html .= '<option value="gzip" ';
  548. if ($selected_compression == "gzip") {
  549. $html .= 'selected="selected"';
  550. }
  551. $html .= '>' . __('gzipped') . '</option>';
  552. }
  553. $html .= '</select>';
  554. $html .= '</li>';
  555. } else {
  556. $html .= '<input type="hidden" name="compression" value="'
  557. . htmlspecialchars($selected_compression) . '" />';
  558. }
  559. return $html;
  560. }
  561. /**
  562. * Prints Html For Export Options Radio
  563. *
  564. * @return string
  565. */
  566. function PMA_getHtmlForExportOptionsOutputRadio()
  567. {
  568. $html = '<li>';
  569. $html .= '<input type="radio" id="radio_view_as_text" '
  570. . ' name="output_format" value="astext" ';
  571. if (isset($_GET['repopulate']) || $GLOBALS['cfg']['Export']['asfile'] == false) {
  572. $html .= 'checked="checked"';
  573. }
  574. $html .= '/>';
  575. $html .= '<label for="radio_view_as_text">'
  576. . __('View output as text') . '</label></li>';
  577. return $html;
  578. }
  579. /**
  580. * Prints Html For Export Options
  581. *
  582. * @param String $export_type Selected Export Type
  583. *
  584. * @return string
  585. */
  586. function PMA_getHtmlForExportOptionsOutput($export_type)
  587. {
  588. global $cfg;
  589. $html = '<div class="exportoptions" id="output">';
  590. $html .= '<h3>' . __('Output:') . '</h3>';
  591. $html .= '<ul id="ul_output">';
  592. $html .= '<li>';
  593. $html .= '<input type="radio" name="output_format" value="sendit" ';
  594. $html .= 'id="radio_dump_asfile" ';
  595. if (!isset($_GET['repopulate'])) {
  596. $html .= PMA_exportCheckboxCheck('asfile');
  597. }
  598. $html .= '/>';
  599. $html .= '<label for="radio_dump_asfile">'
  600. . __('Save output to a file') . '</label>';
  601. $html .= '<ul id="ul_save_asfile">';
  602. if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) {
  603. $html .= PMA_getHtmlForExportOptionsOutputSaveDir();
  604. }
  605. $html .= PMA_getHtmlForExportOptionsOutputFormat($export_type);
  606. // charset of file
  607. if ($GLOBALS['PMA_recoding_engine'] != PMA_CHARSET_NONE) {
  608. $html .= PMA_getHtmlForExportOptionsOutputCharset();
  609. } // end if
  610. $html .= PMA_getHtmlForExportOptionsOutputCompression();
  611. $html .= '</ul>';
  612. $html .= '</li>';
  613. $html .= PMA_getHtmlForExportOptionsOutputRadio();
  614. $html .= '</ul>';
  615. /*
  616. * @todo use sprintf() for better translatability, while keeping the
  617. * <label></label> principle (for screen readers)
  618. */
  619. $html .= '<label for="maxsize">'
  620. . __('Skip tables larger than') . '</label>';
  621. $html .= '<input type="text" id="maxsize" name="maxsize" size="4">' . __('MiB');
  622. $html .= '</div>';
  623. return $html;
  624. }
  625. /**
  626. * Prints Html For Export Options
  627. *
  628. * @param string $export_type Selected Export Type
  629. * @param string $db Selected DB
  630. * @param string $table Selected Table
  631. * @param string $multi_values Export selection
  632. * @param string $num_tables number of tables
  633. * @param array $export_list Export List
  634. * @param string $unlim_num_rows Number of Rows
  635. *
  636. * @return string
  637. */
  638. function PMA_getHtmlForExportOptions(
  639. $export_type, $db, $table, $multi_values,
  640. $num_tables, $export_list, $unlim_num_rows
  641. ) {
  642. global $cfg;
  643. $html = PMA_getHtmlForExportOptionHeader($export_type, $db, $table);
  644. $html .= PMA_getHtmlForExportOptionsMethod();
  645. $html .= PMA_getHtmlForExportOptionsSelection($export_type, $multi_values);
  646. if (strlen($table) && empty($num_tables) && ! PMA_Table::isMerge($db, $table)) {
  647. $html .= PMA_getHtmlForExportOptionsRows($db, $table, $unlim_num_rows);
  648. }
  649. if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) {
  650. $html .= PMA_getHtmlForExportOptionsQuickExport();
  651. }
  652. $html .= PMA_getHtmlForExportOptionsOutput($export_type);
  653. $html .= PMA_getHtmlForExportOptionsFormat($export_list);
  654. return $html;
  655. }
  656. ?>