Translation update done using Pootle.
[phpmyadmin/madhuracj.git] / libraries / export / mediawiki.php
blobd03610d8366773fb2fab524493d704df19d4b1c9
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Set of functions used to build MediaWiki dumps of tables
6 * @package phpMyAdmin-Export
7 * @subpackage MediaWiki
8 */
9 if (! defined('PHPMYADMIN')) {
10 exit;
13 if (isset($plugin_list)) {
14 $plugin_list['mediawiki'] = array(
15 'text' => __('MediaWiki Table'),
16 'extension' => 'txt',
17 'mime_type' => 'text/plain',
18 'options' => array(
19 array('type' => 'begin_group', 'name' => 'general_opts'),
20 array('type' => 'hidden', 'name' => 'structure_or_data'),
21 array('type' => 'end_group')
23 'options_text' => __('Options'),
25 } else {
27 /**
28 * Outputs export footer
30 * @return bool Whether it suceeded
32 * @access public
34 function PMA_exportFooter() {
35 return true;
38 /**
39 * Outputs export header
41 * @return bool Whether it suceeded
43 * @access public
45 function PMA_exportHeader() {
46 return true;
49 /**
50 * Outputs database header
52 * @param string $db Database name
53 * @return bool Whether it suceeded
55 * @access public
57 function PMA_exportDBHeader($db) {
58 return true;
61 /**
62 * Outputs database footer
64 * @param string $db Database name
65 * @return bool Whether it suceeded
67 * @access public
69 function PMA_exportDBFooter($db) {
70 return true;
73 /**
74 * Outputs CREATE DATABASE statement
76 * @param string $db Database name
77 * @return bool Whether it suceeded
79 * @access public
81 function PMA_exportDBCreate($db) {
82 return true;
85 /**
86 * Outputs the content of a table in MediaWiki format
88 * @param string $db database name
89 * @param string $table table name
90 * @param string $crlf the end of line sequence
91 * @param string $error_url the url to go back in case of error
92 * @param string $sql_query SQL query for obtaining data
93 * @return bool Whether it suceeded
95 * @access public
97 function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
98 $columns = PMA_DBI_get_columns($db, $table);
99 $columns = array_values($columns);
100 $row_cnt = count($columns);
102 $output = "{| cellpadding=\"10\" cellspacing=\"0\" border=\"1\" style=\"text-align:center;\"\n";
103 $output .= "|+'''" . $table . "'''\n";
104 $output .= "|- style=\"background:#ffdead;\"\n";
105 $output .= "! style=\"background:#ffffff\" | \n";
106 for ($i = 0; $i < $row_cnt; ++$i) {
107 $output .= " | " . $columns[$i]['Field'];
108 if (($i + 1) != $row_cnt) {
109 $output .= "\n";
112 $output .= "\n";
114 $output .= "|- style=\"background:#f9f9f9;\"\n";
115 $output .= "! style=\"background:#f2f2f2\" | Type\n";
116 for ($i = 0; $i < $row_cnt; ++$i) {
117 $output .= " | " . $columns[$i]['Type'];
118 if (($i + 1) != $row_cnt) {
119 $output .= "\n";
122 $output .= "\n";
124 $output .= "|- style=\"background:#f9f9f9;\"\n";
125 $output .= "! style=\"background:#f2f2f2\" | Null\n";
126 for ($i = 0; $i < $row_cnt; ++$i) {
127 $output .= " | " . $columns[$i]['Null'];
128 if (($i + 1) != $row_cnt) {
129 $output .= "\n";
132 $output .= "\n";
134 $output .= "|- style=\"background:#f9f9f9;\"\n";
135 $output .= "! style=\"background:#f2f2f2\" | Default\n";
136 for ($i = 0; $i < $row_cnt; ++$i) {
137 $output .= " | " . $columns[$i]['Default'];
138 if (($i + 1) != $row_cnt) {
139 $output .= "\n";
142 $output .= "\n";
144 $output .= "|- style=\"background:#f9f9f9;\"\n";
145 $output .= "! style=\"background:#f2f2f2\" | Extra\n";
146 for ($i = 0; $i < $row_cnt; ++$i) {
147 $output .= " | " . $columns[$i]['Extra'];
148 if (($i + 1) != $row_cnt) {
149 $output .= "\n";
152 $output .= "\n";
154 $output .= "|}\n\n\n\n";
155 return PMA_exportOutputHandler($output);