Upgraded phpmyadmin to 4.0.4 (All Languages) - No modifications yet
[openemr.git] / phpmyadmin / libraries / plugins / export / README
blob68d5a26f131781da33537eacde82fc088a74ebac
1 This directory holds export plugins for phpMyAdmin. Any new plugin should
2 basically follow the structure presented here. Official plugins need to
3 have str* messages with their definition in language files, but if you build
4 some plugins for your use, you can directly use texts in plugin.
6 <?php
7 /* vim: set expandtab sw=4 ts=4 sts=4: */
8 /**
9  * [Name] export plugin for phpMyAdmin
10  *
11  * @package    PhpMyAdmin-Export
12  * @subpackage [Name]
13  */
14 if (! defined('PHPMYADMIN')) {
15     exit;
18 /* Get the export interface */
19 require_once 'libraries/plugins/ExportPlugin.class.php';
21 /**
22  * Handles the export for the [Name] format
23  *
24  * @package PhpMyAdmin-Export
25  */
26 class Export[Name] extends ExportPlugin
28     /**
29      * optional - declare variables and descriptions
30      *
31      * @var type
32      */
33     private $_myOptionalVariable;
35     /**
36      * optional - declare global variables and descriptions
37      *
38      * @var type
39      */
40     private $_globalVariableName;
42     /**
43      * Constructor
44      */
45     public function __construct()
46     {
47         $this->setProperties();
48     }
50     // optional - declare global variables and use getters later
51     /**
52      * Initialize the local variables that are used specific for export SQL
53      *
54      * @global type $global_variable_name
55      * [..]
56      *
57      * @return void
58      */
59     protected function initSpecificVariables()
60     {
61         global $global_variable_name;
62         $this->_setGlobalVariableName($global_variable_name);
63     }
65     /**
66      * Sets the export plugin properties.
67      * Called in the constructor.
68      *
69      * @return void
70      */
71     protected function setProperties()
72     {
73         // set properties
74         $props = 'libraries/properties/';
75         // include the main class for properties for the export plug-ins
76         include_once "$props/plugins/ExportPluginProperties.class.php";
77         // include the group properties classes
78         include_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
79         include_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
80         // include the needed single property items
81         include_once "$props/options/items/RadioPropertyItem.class.php";
83         $exportPluginProperties = new ExportPluginProperties();
84         $exportPluginProperties->setText('[name]');             // the name of your plug-in
85         $exportPluginProperties->setExtension('[ext]');         // extension this plug-in can handle
86         $exportPluginProperties->setOptionsText(__('Options'));
88         // create the root group that will be the options field for
89         // $exportPluginProperties
90         // this will be shown as "Format specific options"
91         $exportSpecificOptions = new OptionsPropertyRootGroup();
92         $exportSpecificOptions->setName("Format Specific Options");
94         // general options main group
95         $generalOptions = new OptionsPropertyMainGroup();
96         $generalOptions->setName("general_opts");
98         // optional :
99         // create primary items and add them to the group
100         // type - one of the classes listed in libraries/properties/options/items/
101         // name - form element name
102         // text - description in GUI
103         // size - size of text element
104         // len  - maximal size of input
105         // values - possible values of the item
106         $leaf = new RadioPropertyItem();
107         $leaf->setName("structure_or_data");
108         $leaf->setValues(
109             array(
110                 'structure' => __('structure'),
111                 'data' => __('data'),
112                 'structure_and_data' => __('structure and data')
113             )
114         );
115         $generalOptions->addProperty($leaf);
117         // add the main group to the root group
118         $exportSpecificOptions->addProperty($generalOptions);
120         // set the options for the export plugin property item
121         $exportPluginProperties->setOptions($exportSpecificOptions);
122         $this->properties = $exportPluginProperties;
123     }
125     /**
126      * This method is called when any PluginManager to which the observer
127      * is attached calls PluginManager::notify()
128      *
129      * @param SplSubject $subject The PluginManager notifying the observer
130      *                            of an update.
131      *
132      * @return void
133      */
134     public function update (SplSubject $subject)
135     {
136     }
138     /**
139      * Outputs export header
140      *
141      * @return bool Whether it succeeded
142      */
143     public function exportHeader ()
144     {
145         // implementation
146         return true;
147     }
149     /**
150      * Outputs export footer
151      *
152      * @return bool Whether it succeeded
153      */
154     public function exportFooter ()
155     {
156         // implementation
157         return true;
158     }
160     /**
161      * Outputs database header
162      *
163      * @param string $db Database name
164      *
165      * @return bool Whether it succeeded
166      */
167     public function exportDBHeader ($db)
168     {
169         // implementation
170         return true;
171     }
173     /**
174      * Outputs database footer
175      *
176      * @param string $db Database name
177      *
178      * @return bool Whether it succeeded
179      */
180     public function exportDBFooter ($db)
181     {
182         // implementation
183         return true;
184     }
186     /**
187      * Outputs CREATE DATABASE statement
188      *
189      * @param string $db Database name
190      *
191      * @return bool Whether it succeeded
192      */
193     public function exportDBCreate($db)
194     {
195         // implementation
196         return true;
197     }
199     /**
200      * Outputs the content of a table in [Name] format
201      *
202      * @param string $db        database name
203      * @param string $table     table name
204      * @param string $crlf      the end of line sequence
205      * @param string $error_url the url to go back in case of error
206      * @param string $sql_query SQL query for obtaining data
207      *
208      * @return bool Whether it succeeded
209      */
210     public function exportData($db, $table, $crlf, $error_url, $sql_query)
211     {
212         // implementation;
213         return true;
214     }
216     // optional - implement other methods defined in ExportPlugin.class.php:
217     //  - exportRoutines()
218     //  - exportStructure()
219     //  - getTableDefStandIn()
220     //  - getTriggers()
222     // optional - implement other private methods in order to avoid
223     // having huge methods or avoid duplicate code. Make use of them
224     // as well as of the getters and setters declared both here
225     // and in the ExportPlugin class
228     // optional:
229     /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
232     /**
233      * Getter description
234      *
235      * @return type
236      */
237     private function _getMyOptionalVariable()
238     {
239         return $this->_myOptionalVariable;
240     }
242     /**
243      * Setter description
244      *
245      * @param type $my_optional_variable description
246      *
247      * @return void
248      */
249     private function _setMyOptionalVariable($my_optional_variable)
250     {
251         $this->_myOptionalVariable = $my_optional_variable;
252     }
254     /**
255      * Getter description
256      *
257      * @return type
258      */
259     private function _getGlobalVariableName()
260     {
261         return $this->_globalVariableName;
262     }
264     /**
265      * Setter description
266      *
267      * @param type $global_variable_name description
268      *
269      * @return void
270      */
271     private function _setGlobalVariableName($global_variable_name)
272     {
273         $this->_globalVariableName = $global_variable_name;
274     }