Upgraded phpmyadmin to 4.0.4 (All Languages) - No modifications yet
[openemr.git] / phpmyadmin / libraries / plugins / import / AbstractImportCsv.class.php
blob62ca8bb541751d376107cb4ef96248d7a2b0e560
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Super class of CSV import plugins for phpMyAdmin
6 * @package PhpMyAdmin-Import
7 * @subpackage CSV
8 */
9 if (! defined('PHPMYADMIN')) {
10 exit;
13 /* Get the import interface */
14 require_once 'libraries/plugins/ImportPlugin.class.php';
16 /**
17 * Super class of the import plugins for the CSV format
19 * @package PhpMyAdmin-Import
20 * @subpackage CSV
22 abstract class AbstractImportCsv extends ImportPlugin
24 /**
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:'));
60 $leaf->setSize(2);
61 $leaf->setLen(2);
62 $generalOptions->addProperty($leaf);
63 $leaf = new TextPropertyItem();
64 $leaf->setName("enclosed");
65 $leaf->setText(__('Columns enclosed with:'));
66 $leaf->setSize(2);
67 $leaf->setLen(2);
68 $generalOptions->addProperty($leaf);
69 $leaf = new TextPropertyItem();
70 $leaf->setName("escaped");
71 $leaf->setText(__('Columns escaped with:'));
72 $leaf->setSize(2);
73 $leaf->setLen(2);
74 $generalOptions->addProperty($leaf);
75 $leaf = new TextPropertyItem();
76 $leaf->setName("new_line");
77 $leaf->setText(__('Lines terminated with:'));
78 $leaf->setSize(2);
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;