Translation update done using Pootle.
[phpmyadmin-themes.git] / libraries / export / mediawiki.php
blob9fa1b483ead06eaa3d8c456d3a20127e63a6bfa4
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-MediaWiki
7 * @version $Id: mediawiki.php 12972 2009-09-14 06:21:04Z drummingds1 $
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 comment
30 * @param string Text of comment
32 * @return bool Whether it suceeded
34 function PMA_exportComment($text) {
35 return TRUE;
38 /**
39 * Outputs export footer
41 * @return bool Whether it suceeded
43 * @access public
45 function PMA_exportFooter() {
46 return TRUE;
49 /**
50 * Outputs export header
52 * @return bool Whether it suceeded
54 * @access public
56 function PMA_exportHeader() {
57 return TRUE;
60 /**
61 * Outputs database header
63 * @param string Database name
65 * @return bool Whether it suceeded
67 * @access public
69 function PMA_exportDBHeader($db) {
70 return TRUE;
73 /**
74 * Outputs database footer
76 * @param string Database name
78 * @return bool Whether it suceeded
80 * @access public
82 function PMA_exportDBFooter($db) {
83 return TRUE;
86 /**
87 * Outputs create database database
89 * @param string Database name
91 * @return bool Whether it suceeded
93 * @access public
95 function PMA_exportDBCreate($db) {
96 return TRUE;
99 /**
100 * Outputs the content of a table in MediaWiki format
102 * @param string the database name
103 * @param string the table name
104 * @param string the end of line sequence
105 * @param string the url to go back in case of error
106 * @param string SQL query for obtaining data
108 * @return bool Whether it suceeded
110 * @access public
112 function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
113 global $mediawiki_export_struct;
114 global $mediawiki_export_data;
116 $result = PMA_DBI_fetch_result("SHOW COLUMNS FROM `" . $db . "`.`" . $table . "`");
117 $row_cnt = count($result);
119 $output = "{| cellpadding=\"10\" cellspacing=\"0\" border=\"1\" style=\"text-align:center;\"\n";
120 $output .= "|+'''" . $table . "'''\n";
121 $output .= "|- style=\"background:#ffdead;\"\n";
122 $output .= "! style=\"background:#ffffff\" | \n";
123 for ($i = 0; $i < $row_cnt; ++$i) {
124 $output .= " | " . $result[$i]['Field'];
125 if (($i + 1) != $row_cnt) {
126 $output .= "\n";
129 $output .= "\n";
131 $output .= "|- style=\"background:#f9f9f9;\"\n";
132 $output .= "! style=\"background:#f2f2f2\" | Type\n";
133 for ($i = 0; $i < $row_cnt; ++$i) {
134 $output .= " | " . $result[$i]['Type'];
135 if (($i + 1) != $row_cnt) {
136 $output .= "\n";
139 $output .= "\n";
141 $output .= "|- style=\"background:#f9f9f9;\"\n";
142 $output .= "! style=\"background:#f2f2f2\" | Null\n";
143 for ($i = 0; $i < $row_cnt; ++$i) {
144 $output .= " | " . $result[$i]['Null'];
145 if (($i + 1) != $row_cnt) {
146 $output .= "\n";
149 $output .= "\n";
151 $output .= "|- style=\"background:#f9f9f9;\"\n";
152 $output .= "! style=\"background:#f2f2f2\" | Default\n";
153 for ($i = 0; $i < $row_cnt; ++$i) {
154 $output .= " | " . $result[$i]['Default'];
155 if (($i + 1) != $row_cnt) {
156 $output .= "\n";
159 $output .= "\n";
161 $output .= "|- style=\"background:#f9f9f9;\"\n";
162 $output .= "! style=\"background:#f2f2f2\" | Extra\n";
163 for ($i = 0; $i < $row_cnt; ++$i) {
164 $output .= " | " . $result[$i]['Extra'];
165 if (($i + 1) != $row_cnt) {
166 $output .= "\n";
169 $output .= "\n";
171 $output .= "|}\n\n\n\n";
172 return PMA_exportOutputHandler($output);