phpmyadmin/libraries/plugins/export
Hugues Peccatte 2fe6ff4655 Set namespace on Advisor, Config, Console and Util classes.
Set namespace on DbQbe.
Set namespace to 'DbSearch'.
Split Advisor.class.php file.
Change Advisor namespace.
Rename DbQbe class and file.
Set namespace on DisplayResults.
Set namespace on Error.
Use namespace for ErrorHandler.
Add class autoloader.
Change ErrorHandler filename.
Remove some require.
Update Config namespace path.
Update PMA_Util to PMA\libraries\Util.
Rename Font and File classes files.
Use namespace for Footer.
Set namespace in all libraries classes.
Namespace OutputBuffering.
Export SubPartition.
Rename Partition file.
Namespace PDF.
Namespace RecentFavoriteTable.
Replace PMA_Response by Response and PMA_Message by Message.
Update uses and calls.
Fix unit tests.
Fix SqlParser autoload.

Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
2015-08-29 16:27:21 +02:00
..
ExportCodegen.class.php Set namespace on Advisor, Config, Console and Util classes. 2015-08-29 16:27:21 +02:00
ExportCsv.class.php Set namespace on Advisor, Config, Console and Util classes. 2015-08-29 16:27:21 +02:00
ExportExcel.class.php Remove unneeded closing tags. 2015-07-19 00:18:38 +03:00
ExportHtmlword.class.php Set namespace on Advisor, Config, Console and Util classes. 2015-08-29 16:27:21 +02:00
ExportJson.class.php Set namespace on Advisor, Config, Console and Util classes. 2015-08-29 16:27:21 +02:00
ExportLatex.class.php Set namespace on Advisor, Config, Console and Util classes. 2015-08-29 16:27:21 +02:00
ExportMediawiki.class.php Set namespace on Advisor, Config, Console and Util classes. 2015-08-29 16:27:21 +02:00
ExportOds.class.php Set namespace on Advisor, Config, Console and Util classes. 2015-08-29 16:27:21 +02:00
ExportOdt.class.php Set namespace on Advisor, Config, Console and Util classes. 2015-08-29 16:27:21 +02:00
ExportPdf.class.php Fix #11436 CREATE DATABASE should be enabled by default on server exports 2015-08-28 18:52:37 +10:00
ExportPhparray.class.php Set namespace on Advisor, Config, Console and Util classes. 2015-08-29 16:27:21 +02:00
ExportSql.class.php Set namespace on Advisor, Config, Console and Util classes. 2015-08-29 16:27:21 +02:00
ExportTexytext.class.php Set namespace on Advisor, Config, Console and Util classes. 2015-08-29 16:27:21 +02:00
ExportXml.class.php Set namespace on Advisor, Config, Console and Util classes. 2015-08-29 16:27:21 +02:00
ExportYaml.class.php Set namespace on Advisor, Config, Console and Util classes. 2015-08-29 16:27:21 +02:00
PMA_ExportPdf.class.php Set namespace on Advisor, Config, Console and Util classes. 2015-08-29 16:27:21 +02:00
README Remove plugin manager and observer classes 2014-06-25 09:25:59 +02:00
TableProperty.class.php Fixed more issues. 2015-07-25 19:39:33 +03:00

This directory holds export plugins for phpMyAdmin. Any new plugin should
basically follow the structure presented here. Official plugins need to
have str* messages with their definition in language files, but if you build
some plugins for your use, you can directly use texts in plugin.

<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * [Name] export plugin for phpMyAdmin
 *
 * @package    PhpMyAdmin-Export
 * @subpackage [Name]
 */
if (! defined('PHPMYADMIN')) {
    exit;
}

/* Get the export interface */
require_once 'libraries/plugins/ExportPlugin.class.php';

/**
 * Handles the export for the [Name] format
 *
 * @package PhpMyAdmin-Export
 */
class Export[Name] extends ExportPlugin
{
    /**
     * optional - declare variables and descriptions
     *
     * @var type
     */
    private $_myOptionalVariable;

    /**
     * optional - declare global variables and descriptions
     *
     * @var type
     */
    private $_globalVariableName;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->setProperties();
    }

    // optional - declare global variables and use getters later
    /**
     * Initialize the local variables that are used specific for export SQL
     *
     * @global type $global_variable_name
     * [..]
     *
     * @return void
     */
    protected function initSpecificVariables()
    {
        global $global_variable_name;
        $this->_setGlobalVariableName($global_variable_name);
    }

    /**
     * Sets the export plugin properties.
     * Called in the constructor.
     *
     * @return void
     */
    protected function setProperties()
    {
        // set properties
        $props = 'libraries/properties/';
        // include the main class for properties for the export plug-ins
        include_once "$props/plugins/ExportPluginProperties.class.php";
        // include the group properties classes
        include_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
        include_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
        // include the needed single property items
        include_once "$props/options/items/RadioPropertyItem.class.php";

        $exportPluginProperties = new ExportPluginProperties();
        $exportPluginProperties->setText('[name]');             // the name of your plug-in
        $exportPluginProperties->setExtension('[ext]');         // extension this plug-in can handle
        $exportPluginProperties->setOptionsText(__('Options'));

        // create the root group that will be the options field for
        // $exportPluginProperties
        // this will be shown as "Format specific options"
        $exportSpecificOptions = new OptionsPropertyRootGroup();
        $exportSpecificOptions->setName("Format Specific Options");

        // general options main group
        $generalOptions = new OptionsPropertyMainGroup();
        $generalOptions->setName("general_opts");

        // optional :
        // create primary items and add them to the group
        // type - one of the classes listed in libraries/properties/options/items/
        // name - form element name
        // text - description in GUI
        // size - size of text element
        // len  - maximal size of input
        // values - possible values of the item
        $leaf = new RadioPropertyItem();
        $leaf->setName("structure_or_data");
        $leaf->setValues(
            array(
                'structure' => __('structure'),
                'data' => __('data'),
                'structure_and_data' => __('structure and data')
            )
        );
        $generalOptions->addProperty($leaf);

        // add the main group to the root group
        $exportSpecificOptions->addProperty($generalOptions);

        // set the options for the export plugin property item
        $exportPluginProperties->setOptions($exportSpecificOptions);
        $this->properties = $exportPluginProperties;
    }

    /**
     * Outputs export header
     *
     * @return bool Whether it succeeded
     */
    public function exportHeader ()
    {
        // implementation
        return true;
    }

    /**
     * Outputs export footer
     *
     * @return bool Whether it succeeded
     */
    public function exportFooter ()
    {
        // implementation
        return true;
    }

    /**
     * Outputs database header
     *
     * @param string $db       Database name
     * @param string $db_alias Aliases of db
     *
     * @return bool Whether it succeeded
     */
    public function exportDBHeader ($db, $db_alias = '')
    {
        // implementation
        return true;
    }

    /**
     * Outputs database footer
     *
     * @param string $db Database name
     *
     * @return bool Whether it succeeded
     */
    public function exportDBFooter ($db)
    {
        // implementation
        return true;
    }

    /**
     * Outputs CREATE DATABASE statement
     *
     * @param string $db       Database name
     * @param string $db_alias Aliases of db
     *
     * @return bool Whether it succeeded
     */
    public function exportDBCreate($db, $db_alias = '')
    {
        // implementation
        return true;
    }

    /**
     * Outputs the content of a table in [Name] format
     *
     * @param string $db        database name
     * @param string $table     table name
     * @param string $crlf      the end of line sequence
     * @param string $error_url the url to go back in case of error
     * @param string $sql_query SQL query for obtaining data
     * @param array  $aliases   Aliases of db/table/columns
     *
     * @return bool Whether it succeeded
     */
    public function exportData(
        $db, $table, $crlf, $error_url, $sql_query, $aliases = array()
    ) {
        // implementation;
        return true;
    }

    // optional - implement other methods defined in ExportPlugin.class.php:
    //  - exportRoutines()
    //  - exportStructure()
    //  - getTableDefStandIn()
    //  - getTriggers()

    // optional - implement other private methods in order to avoid
    // having huge methods or avoid duplicate code. Make use of them
    // as well as of the getters and setters declared both here
    // and in the ExportPlugin class


    // optional:
    /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */


    /**
     * Getter description
     *
     * @return type
     */
    private function _getMyOptionalVariable()
    {
        return $this->_myOptionalVariable;
    }

    /**
     * Setter description
     *
     * @param type $my_optional_variable description
     *
     * @return void
     */
    private function _setMyOptionalVariable($my_optional_variable)
    {
        $this->_myOptionalVariable = $my_optional_variable;
    }

    /**
     * Getter description
     *
     * @return type
     */
    private function _getGlobalVariableName()
    {
        return $this->_globalVariableName;
    }

    /**
     * Setter description
     *
     * @param type $global_variable_name description
     *
     * @return void
     */
    private function _setGlobalVariableName($global_variable_name)
    {
        $this->_globalVariableName = $global_variable_name;
    }
}
?>