2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Super class of CSV import plugins for phpMyAdmin
6 * @package PhpMyAdmin-Import
9 if (! defined('PHPMYADMIN')) {
13 /* Get the import interface */
14 require_once 'libraries/plugins/ImportPlugin.class.php';
17 * Super class of the import plugins for the CSV format
19 * @package PhpMyAdmin-Import
22 abstract class AbstractImportCsv
extends ImportPlugin
25 * Sets the import plugin properties.
26 * Called in the constructor.
28 * @return object OptionsPropertyMainGroup object of the plugin
30 protected function setProperties()
32 $props = 'libraries/properties/';
33 include_once "$props/plugins/ImportPluginProperties.class.php";
34 include_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
35 include_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
36 include_once "$props/options/items/BoolPropertyItem.class.php";
37 include_once "$props/options/items/TextPropertyItem.class.php";
39 $importPluginProperties = new ImportPluginProperties();
40 $importPluginProperties->setOptionsText(__('Options'));
42 // create the root group that will be the options field for
43 // $importPluginProperties
44 // this will be shown as "Format specific options"
45 $importSpecificOptions = new OptionsPropertyRootGroup();
46 $importSpecificOptions->setName("Format Specific Options");
48 // general options main group
49 $generalOptions = new OptionsPropertyMainGroup();
50 $generalOptions->setName("general_opts");
52 // create common items and add them to the group
53 $leaf = new BoolPropertyItem();
54 $leaf->setName("replace");
55 $leaf->setText(__('Replace table data with file'));
56 $generalOptions->addProperty($leaf);
57 $leaf = new TextPropertyItem();
58 $leaf->setName("terminated");
59 $leaf->setText(__('Columns separated with:'));
62 $generalOptions->addProperty($leaf);
63 $leaf = new TextPropertyItem();
64 $leaf->setName("enclosed");
65 $leaf->setText(__('Columns enclosed with:'));
68 $generalOptions->addProperty($leaf);
69 $leaf = new TextPropertyItem();
70 $leaf->setName("escaped");
71 $leaf->setText(__('Columns escaped with:'));
74 $generalOptions->addProperty($leaf);
75 $leaf = new TextPropertyItem();
76 $leaf->setName("new_line");
77 $leaf->setText(__('Lines terminated with:'));
79 $generalOptions->addProperty($leaf);
81 // add the main group to the root group
82 $importSpecificOptions->addProperty($generalOptions);
84 // set the options for the import plugin property item
85 $importPluginProperties->setOptions($importSpecificOptions);
86 $this->properties
= $importPluginProperties;
88 return $generalOptions;