Пример #1
0
 /**
  * Sets the import plugin properties.
  * Called in the constructor.
  *
  * @return void
  */
 protected function setProperties()
 {
     $this->_setCfgRelation(PMA_getRelationsParam());
     $cfgRelation = $this->_getCfgRelation();
     if ($GLOBALS['num_tables'] < 1 || !$cfgRelation['relwork'] || !$cfgRelation['commwork']) {
         return;
     }
     $props = 'libraries/properties/';
     include_once "{$props}/plugins/ImportPluginProperties.class.php";
     include_once "{$props}/options/groups/OptionsPropertyRootGroup.class.php";
     include_once "{$props}/options/groups/OptionsPropertyMainGroup.class.php";
     include_once "{$props}/options/items/TextPropertyItem.class.php";
     $importPluginProperties = new ImportPluginProperties();
     $importPluginProperties->setText('DocSQL');
     $importPluginProperties->setExtension('');
     $importPluginProperties->setOptionsText(__('Options'));
     // create the root group that will be the options field for
     // $importPluginProperties
     // this will be shown as "Format specific options"
     $importSpecificOptions = new OptionsPropertyRootGroup();
     $importSpecificOptions->setName("Format Specific Options");
     // general options main group
     $generalOptions = new OptionsPropertyMainGroup();
     $generalOptions->setName("general_opts");
     // create primary items and add them to the group
     $leaf = new TextPropertyItem();
     $leaf->setName("table");
     $leaf->setText(__('Table name'));
     $generalOptions->addProperty($leaf);
     // add the main group to the root group
     $importSpecificOptions->addProperty($generalOptions);
     // set the options for the import plugin property item
     $importPluginProperties->setOptions($importSpecificOptions);
     $this->properties = $importPluginProperties;
 }
Пример #2
0
 /**
  * Sets the import plugin properties.
  * Called in the constructor.
  *
  * @return void
  */
 protected function setProperties()
 {
     $props = 'libraries/properties/';
     include_once "{$props}/plugins/ImportPluginProperties.class.php";
     $importPluginProperties = new ImportPluginProperties();
     $importPluginProperties->setText(__('ESRI Shape File'));
     $importPluginProperties->setExtension('shp');
     $importPluginProperties->setOptions(array());
     $importPluginProperties->setOptionsText(__('Options'));
     $this->properties = $importPluginProperties;
 }
Пример #3
0
 /**
  * Sets the import plugin properties.
  * Called in the constructor.
  *
  * @return OptionsPropertyMainGroup OptionsPropertyMainGroup object of the plugin
  */
 protected function setProperties()
 {
     $props = 'libraries/properties/';
     include_once "{$props}/plugins/ImportPluginProperties.class.php";
     include_once "{$props}/options/groups/OptionsPropertyRootGroup.class.php";
     include_once "{$props}/options/groups/OptionsPropertyMainGroup.class.php";
     include_once "{$props}/options/items/BoolPropertyItem.class.php";
     include_once "{$props}/options/items/TextPropertyItem.class.php";
     $importPluginProperties = new ImportPluginProperties();
     $importPluginProperties->setOptionsText(__('Options'));
     // create the root group that will be the options field for
     // $importPluginProperties
     // this will be shown as "Format specific options"
     $importSpecificOptions = new OptionsPropertyRootGroup();
     $importSpecificOptions->setName("Format Specific Options");
     // general options main group
     $generalOptions = new OptionsPropertyMainGroup();
     $generalOptions->setName("general_opts");
     // create common items and add them to the group
     $leaf = new BoolPropertyItem();
     $leaf->setName("replace");
     $leaf->setText(__('Replace table data with file'));
     $generalOptions->addProperty($leaf);
     $leaf = new TextPropertyItem();
     $leaf->setName("terminated");
     $leaf->setText(__('Columns separated with:'));
     $leaf->setSize(2);
     $leaf->setLen(2);
     $generalOptions->addProperty($leaf);
     $leaf = new TextPropertyItem();
     $leaf->setName("enclosed");
     $leaf->setText(__('Columns enclosed with:'));
     $leaf->setSize(2);
     $leaf->setLen(2);
     $generalOptions->addProperty($leaf);
     $leaf = new TextPropertyItem();
     $leaf->setName("escaped");
     $leaf->setText(__('Columns escaped with:'));
     $leaf->setSize(2);
     $leaf->setLen(2);
     $generalOptions->addProperty($leaf);
     $leaf = new TextPropertyItem();
     $leaf->setName("new_line");
     $leaf->setText(__('Lines terminated with:'));
     $leaf->setSize(2);
     $generalOptions->addProperty($leaf);
     // add the main group to the root group
     $importSpecificOptions->addProperty($generalOptions);
     // set the options for the import plugin property item
     $importPluginProperties->setOptions($importSpecificOptions);
     $this->properties = $importPluginProperties;
     return $generalOptions;
 }
Пример #4
0
 /**
  * Sets the import plugin properties.
  * Called in the constructor.
  *
  * @return void
  */
 protected function setProperties()
 {
     $props = 'libraries/properties/';
     include_once "{$props}/plugins/ImportPluginProperties.class.php";
     include_once "{$props}/options/groups/OptionsPropertyRootGroup.class.php";
     include_once "{$props}/options/groups/OptionsPropertyMainGroup.class.php";
     include_once "{$props}/options/items/SelectPropertyItem.class.php";
     include_once "{$props}/options/items/BoolPropertyItem.class.php";
     $importPluginProperties = new ImportPluginProperties();
     $importPluginProperties->setText('SQL');
     $importPluginProperties->setExtension('sql');
     $importPluginProperties->setOptionsText(__('Options'));
     $compats = $GLOBALS['dbi']->getCompatibilities();
     if (count($compats) > 0) {
         $values = array();
         foreach ($compats as $val) {
             $values[$val] = $val;
         }
         // create the root group that will be the options field for
         // $importPluginProperties
         // this will be shown as "Format specific options"
         $importSpecificOptions = new OptionsPropertyRootGroup();
         $importSpecificOptions->setName("Format Specific Options");
         // general options main group
         $generalOptions = new OptionsPropertyMainGroup();
         $generalOptions->setName("general_opts");
         // create primary items and add them to the group
         $leaf = new SelectPropertyItem();
         $leaf->setName("compatibility");
         $leaf->setText(__('SQL compatibility mode:'));
         $leaf->setValues($values);
         $leaf->setDoc(array('manual_MySQL_Database_Administration', 'Server_SQL_mode'));
         $generalOptions->addProperty($leaf);
         $leaf = new BoolPropertyItem();
         $leaf->setName("no_auto_value_on_zero");
         $leaf->setText(__('Do not use <code>AUTO_INCREMENT</code> for zero values'));
         $leaf->setDoc(array('manual_MySQL_Database_Administration', 'Server_SQL_mode', 'sqlmode_no_auto_value_on_zero'));
         $generalOptions->addProperty($leaf);
         // add the main group to the root group
         $importSpecificOptions->addProperty($generalOptions);
         // set the options for the import plugin property item
         $importPluginProperties->setOptions($importSpecificOptions);
     }
     $this->properties = $importPluginProperties;
 }
Пример #5
0
 /**
  * Sets the import plugin properties.
  * Called in the constructor.
  *
  * @return void
  */
 protected function setProperties()
 {
     if ($GLOBALS['cfg']['Import']['ldi_local_option'] == 'auto') {
         $GLOBALS['cfg']['Import']['ldi_local_option'] = false;
         $result = PMA_DBI_try_query('SHOW VARIABLES LIKE \'local\\_infile\';');
         if ($result != false && PMA_DBI_num_rows($result) > 0) {
             $tmp = PMA_DBI_fetch_row($result);
             if ($tmp[1] == 'ON') {
                 $GLOBALS['cfg']['Import']['ldi_local_option'] = true;
             }
         }
         PMA_DBI_free_result($result);
         unset($result);
     }
     $props = 'libraries/properties/';
     include_once "{$props}/plugins/ImportPluginProperties.class.php";
     include_once "{$props}/options/groups/OptionsPropertyRootGroup.class.php";
     include_once "{$props}/options/groups/OptionsPropertyMainGroup.class.php";
     include_once "{$props}/options/items/BoolPropertyItem.class.php";
     include_once "{$props}/options/items/TextPropertyItem.class.php";
     $importPluginProperties = new ImportPluginProperties();
     $importPluginProperties->setText('CSV using LOAD DATA');
     $importPluginProperties->setExtension('ldi');
     $importPluginProperties->setOptionsText(__('Options'));
     // create the root group that will be the options field for
     // $importPluginProperties
     // this will be shown as "Format specific options"
     $importSpecificOptions = new OptionsPropertyRootGroup();
     $importSpecificOptions->setName("Format Specific Options");
     // general options main group
     $generalOptions = new OptionsPropertyMainGroup();
     $generalOptions->setName("general_opts");
     // create primary items and add them to the group
     $leaf = new BoolPropertyItem();
     $leaf->setName("replace");
     $leaf->setText(__('Replace table data with file'));
     $generalOptions->addProperty($leaf);
     // add the main group to the root group
     $importSpecificOptions->addProperty($generalOptions);
     // set the options for the import plugin property item
     $importPluginProperties->setOptions($importSpecificOptions);
     $this->properties = $importPluginProperties;
 }
 /**
  * Sets the import plugin properties.
  * Called in the constructor.
  *
  * @return void
  */
 protected function setProperties()
 {
     $props = 'libraries/properties/';
     include_once "{$props}/plugins/ImportPluginProperties.class.php";
     include_once "{$props}/options/groups/OptionsPropertyRootGroup.class.php";
     include_once "{$props}/options/groups/OptionsPropertyMainGroup.class.php";
     include_once "{$props}/options/items/BoolPropertyItem.class.php";
     $importPluginProperties = new ImportPluginProperties();
     $importPluginProperties->setText('OpenDocument Spreadsheet');
     $importPluginProperties->setExtension('ods');
     $importPluginProperties->setOptionsText(__('Options'));
     // create the root group that will be the options field for
     // $importPluginProperties
     // this will be shown as "Format specific options"
     $importSpecificOptions = new OptionsPropertyRootGroup();
     $importSpecificOptions->setName("Format Specific Options");
     // general options main group
     $generalOptions = new OptionsPropertyMainGroup();
     $generalOptions->setName("general_opts");
     // create primary items and add them to the group
     $leaf = new BoolPropertyItem();
     $leaf->setName("col_names");
     $leaf->setText(__('The first line of the file contains the table column names' . ' <i>(if this is unchecked, the first line will become part' . ' of the data)</i>'));
     $generalOptions->addProperty($leaf);
     $leaf = new BoolPropertyItem();
     $leaf->setName("empty_rows");
     $leaf->setText(__('Do not import empty rows'));
     $generalOptions->addProperty($leaf);
     $leaf = new BoolPropertyItem();
     $leaf->setName("recognize_percentages");
     $leaf->setText(__('Import percentages as proper decimals <i>(ex. 12.00% to .12)</i>'));
     $generalOptions->addProperty($leaf);
     $leaf = new BoolPropertyItem();
     $leaf->setName("recognize_currency");
     $leaf->setText(__('Import currencies <i>(ex. $5.00 to 5.00)</i>'));
     $generalOptions->addProperty($leaf);
     // add the main group to the root group
     $importSpecificOptions->addProperty($generalOptions);
     // set the options for the import plugin property item
     $importPluginProperties->setOptions($importSpecificOptions);
     $this->properties = $importPluginProperties;
 }
Пример #7
0
 /**
  * Sets the import plugin properties.
  * Called in the constructor.
  *
  * @return void
  */
 protected function setProperties()
 {
     $props = 'libraries/properties/';
     include_once "{$props}/plugins/ImportPluginProperties.class.php";
     $importPluginProperties = new ImportPluginProperties();
     $importPluginProperties->setText(__('XML'));
     $importPluginProperties->setExtension('xml');
     $importPluginProperties->setMimeType('text/xml');
     $importPluginProperties->setOptions(array());
     $importPluginProperties->setOptionsText(__('Options'));
     $this->properties = $importPluginProperties;
 }
Пример #8
0
 /**
  * Sets the import plugin properties.
  * Called in the constructor.
  *
  * @return void
  */
 protected function setProperties()
 {
     $this->_setAnalyze(false);
     if ($GLOBALS['plugin_param'] !== 'table') {
         $this->_setAnalyze(true);
     }
     $props = 'libraries/properties/';
     include_once "{$props}/plugins/ImportPluginProperties.class.php";
     $importPluginProperties = new ImportPluginProperties();
     $importPluginProperties->setText(__('MediaWiki Table'));
     $importPluginProperties->setExtension('txt');
     $importPluginProperties->setMimeType('text/plain');
     $importPluginProperties->setOptions(array());
     $importPluginProperties->setOptionsText(__('Options'));
     $this->properties = $importPluginProperties;
 }
Пример #9
0
 /**
  * Sets the import plugin properties.
  * Called in the constructor.
  *
  * @return void
  */
 protected function setProperties()
 {
     $this->_setAnalyze(false);
     if ($GLOBALS['plugin_param'] !== 'table') {
         $this->_setAnalyze(true);
     }
     $props = 'libraries/properties/';
     include_once "{$props}/plugins/ImportPluginProperties.class.php";
     include_once "{$props}/options/groups/OptionsPropertyRootGroup.class.php";
     include_once "{$props}/options/groups/OptionsPropertyMainGroup.class.php";
     include_once "{$props}/options/items/BoolPropertyItem.class.php";
     include_once "{$props}/options/items/TextPropertyItem.class.php";
     $importPluginProperties = new ImportPluginProperties();
     $importPluginProperties->setText('CSV');
     $importPluginProperties->setExtension('csv');
     $importPluginProperties->setOptionsText(__('Options'));
     // create the root group that will be the options field for
     // $importPluginProperties
     // this will be shown as "Format specific options"
     $importSpecificOptions = new OptionsPropertyRootGroup();
     $importSpecificOptions->setName("Format Specific Options");
     // general options main group
     $generalOptions = new OptionsPropertyMainGroup();
     $generalOptions->setName("general_opts");
     // create primary items and add them to the group
     $leaf = new BoolPropertyItem();
     $leaf->setName("replace");
     $leaf->setText(__('Replace table data with file'));
     $generalOptions->addProperty($leaf);
     $leaf = new TextPropertyItem();
     $leaf->setName("terminated");
     $leaf->setText(__('Columns separated with:'));
     $leaf->setSize(2);
     $leaf->setLen(2);
     $generalOptions->addProperty($leaf);
     $leaf = new TextPropertyItem();
     $leaf->setName("enclosed");
     $leaf->setText(__('Columns enclosed with:'));
     $leaf->setSize(2);
     $leaf->setLen(2);
     $generalOptions->addProperty($leaf);
     $leaf = new TextPropertyItem();
     $leaf->setName("escaped");
     $leaf->setText(__('Columns escaped with:'));
     $leaf->setSize(2);
     $leaf->setLen(2);
     $generalOptions->addProperty($leaf);
     $leaf = new TextPropertyItem();
     $leaf->setName("new_line");
     $leaf->setText(__('Lines terminated with:'));
     $leaf->setSize(2);
     $generalOptions->addProperty($leaf);
     if ($GLOBALS['plugin_param'] !== 'table') {
         $leaf = new BoolPropertyItem();
         $leaf->setName("col_names");
         $leaf->setText(__('The first line of the file contains the table column names' . ' <i>(if this is unchecked, the first line will become part' . ' of the data)</i>'));
         $generalOptions->addProperty($leaf);
     } else {
         $hint = new PMA_Message(__('If the data in each row of the file is not' . ' in the same order as in the database, list the corresponding' . ' column names here. Column names must be separated by commas' . ' and not enclosed in quotations.'));
         $leaf = new TextPropertyItem();
         $leaf->setName("columns");
         $leaf->setText(__('Column names: ') . PMA_CommonFunctions::getInstance()->showHint($hint));
         $generalOptions->addProperty($leaf);
     }
     // add the main group to the root group
     $importSpecificOptions->addProperty($generalOptions);
     // set the options for the import plugin property item
     $importPluginProperties->setOptions($importSpecificOptions);
     $this->properties = $importPluginProperties;
 }