Exemplo n.º 1
0
 /**
  * Sets the schema export Dia properties
  *
  * @return void
  */
 protected function setProperties()
 {
     $schemaPluginProperties = new SchemaPluginProperties();
     $schemaPluginProperties->setText('Dia');
     $schemaPluginProperties->setExtension('dia');
     $schemaPluginProperties->setMimeType('application/dia');
     // create the root group that will be the options field for
     // $schemaPluginProperties
     // this will be shown as "Format specific options"
     $exportSpecificOptions = new OptionsPropertyRootGroup();
     $exportSpecificOptions->setName("Format Specific Options");
     // specific options main group
     $specificOptions = new OptionsPropertyMainGroup();
     $specificOptions->setName("general_opts");
     // add options common to all plugins
     $this->addCommonOptions($specificOptions);
     $leaf = new SelectPropertyItem();
     $leaf->setName("orientation");
     $leaf->setText(__('Orientation'));
     $leaf->setValues(array('L' => __('Landscape'), 'P' => __('Portrait')));
     $specificOptions->addProperty($leaf);
     $leaf = new SelectPropertyItem();
     $leaf->setName("paper");
     $leaf->setText(__('Paper size'));
     $leaf->setValues($this->_getPaperSizeArray());
     $specificOptions->addProperty($leaf);
     // add the main group to the root group
     $exportSpecificOptions->addProperty($specificOptions);
     // set the options for the schema export plugin property item
     $schemaPluginProperties->setOptions($exportSpecificOptions);
     $this->properties = $schemaPluginProperties;
 }
Exemplo n.º 2
0
 /**
  * Sets the schema export EPS properties
  *
  * @return void
  */
 protected function setProperties()
 {
     $schemaPluginProperties = new SchemaPluginProperties();
     $schemaPluginProperties->setText('EPS');
     $schemaPluginProperties->setExtension('eps');
     $schemaPluginProperties->setMimeType('application/eps');
     // create the root group that will be the options field for
     // $schemaPluginProperties
     // this will be shown as "Format specific options"
     $exportSpecificOptions = new OptionsPropertyRootGroup("Format Specific Options");
     // specific options main group
     $specificOptions = new OptionsPropertyMainGroup("general_opts");
     // add options common to all plugins
     $this->addCommonOptions($specificOptions);
     // create leaf items and add them to the group
     $leaf = new BoolPropertyItem('all_tables_same_width', __('Same width for all tables'));
     $specificOptions->addProperty($leaf);
     $leaf = new SelectPropertyItem("orientation", __('Orientation'));
     $leaf->setValues(array('L' => __('Landscape'), 'P' => __('Portrait')));
     $specificOptions->addProperty($leaf);
     // add the main group to the root group
     $exportSpecificOptions->addProperty($specificOptions);
     // set the options for the schema export plugin property item
     $schemaPluginProperties->setOptions($exportSpecificOptions);
     $this->properties = $schemaPluginProperties;
 }
Exemplo n.º 3
0
 /**
  * Sets the export CodeGen properties
  *
  * @return void
  */
 protected function setProperties()
 {
     $exportPluginProperties = new ExportPluginProperties();
     $exportPluginProperties->setText('CodeGen');
     $exportPluginProperties->setExtension('cs');
     $exportPluginProperties->setMimeType('text/cs');
     $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("Format Specific Options");
     // general options main group
     $generalOptions = new OptionsPropertyMainGroup("general_opts");
     // create primary items and add them to the group
     $leaf = new HiddenPropertyItem("structure_or_data");
     $generalOptions->addProperty($leaf);
     $leaf = new SelectPropertyItem("format", __('Format:'));
     $leaf->setValues($this->_getCgFormats());
     $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;
 }
Exemplo n.º 4
0
 /**
  * Sets the export CSV for Excel properties
  *
  * @return void
  */
 protected function setProperties()
 {
     $exportPluginProperties = new ExportPluginProperties();
     $exportPluginProperties->setText('CSV for MS Excel');
     $exportPluginProperties->setExtension('csv');
     $exportPluginProperties->setMimeType('text/comma-separated-values');
     $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("Format Specific Options");
     // general options main group
     $generalOptions = new OptionsPropertyMainGroup("general_opts");
     // create primary items and add them to the group
     $leaf = new TextPropertyItem('null', __('Replace NULL with:'));
     $generalOptions->addProperty($leaf);
     $leaf = new BoolPropertyItem('removeCRLF', __('Remove carriage return/line feed characters within columns'));
     $generalOptions->addProperty($leaf);
     $leaf = new BoolPropertyItem('columns', __('Put columns names in the first row'));
     $generalOptions->addProperty($leaf);
     $leaf = new SelectPropertyItem('edition', __('Excel edition:'));
     $leaf->setValues(array('win' => 'Windows', 'mac_excel2003' => 'Excel 2003 / Macintosh', 'mac_excel2008' => 'Excel 2008 / Macintosh'));
     $generalOptions->addProperty($leaf);
     $leaf = new HiddenPropertyItem('structure_or_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;
 }
Exemplo n.º 5
0
 /**
  * Sets the import plugin properties.
  * Called in the constructor.
  *
  * @return void
  */
 protected function setProperties()
 {
     $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("Format Specific Options");
         // general options main group
         $generalOptions = new OptionsPropertyMainGroup("general_opts");
         // create primary items and add them to the group
         $leaf = new SelectPropertyItem("compatibility", __('SQL compatibility mode:'));
         $leaf->setValues($values);
         $leaf->setDoc(array('manual_MySQL_Database_Administration', 'Server_SQL_mode'));
         $generalOptions->addProperty($leaf);
         $leaf = new BoolPropertyItem("no_auto_value_on_zero", __('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;
 }
 /**
  * Sets the schema export PDF properties
  *
  * @return void
  */
 protected function setProperties()
 {
     $schemaPluginProperties = new SchemaPluginProperties();
     $schemaPluginProperties->setText('PDF');
     $schemaPluginProperties->setExtension('pdf');
     $schemaPluginProperties->setMimeType('application/pdf');
     // create the root group that will be the options field for
     // $schemaPluginProperties
     // this will be shown as "Format specific options"
     $exportSpecificOptions = new OptionsPropertyRootGroup();
     $exportSpecificOptions->setName("Format Specific Options");
     // specific options main group
     $specificOptions = new OptionsPropertyMainGroup();
     $specificOptions->setName("general_opts");
     // add options common to all plugins
     $this->addCommonOptions($specificOptions);
     // create leaf items and add them to the group
     $leaf = new BoolPropertyItem();
     $leaf->setName('all_tables_same_width');
     $leaf->setText(__('Same width for all tables'));
     $specificOptions->addProperty($leaf);
     $leaf = new SelectPropertyItem();
     $leaf->setName("orientation");
     $leaf->setText(__('Orientation'));
     $leaf->setValues(array('L' => __('Landscape'), 'P' => __('Portrait')));
     $specificOptions->addProperty($leaf);
     $leaf = new SelectPropertyItem();
     $leaf->setName("paper");
     $leaf->setText(__('Paper size'));
     $leaf->setValues($this->_getPaperSizeArray());
     $specificOptions->addProperty($leaf);
     $leaf = new BoolPropertyItem();
     $leaf->setName('show_grid');
     $leaf->setText(__('Show grid'));
     $specificOptions->addProperty($leaf);
     $leaf = new BoolPropertyItem();
     $leaf->setName('with_doc');
     $leaf->setText(__('Data dictionary'));
     $specificOptions->addProperty($leaf);
     $leaf = new SelectPropertyItem();
     $leaf->setName("table_order");
     $leaf->setText(__('Order of the tables'));
     $leaf->setValues(array('' => __('None'), 'name_asc' => __('Name (Ascending)'), 'name_desc' => __('Name (Descending)')));
     $specificOptions->addProperty($leaf);
     // add the main group to the root group
     $exportSpecificOptions->addProperty($specificOptions);
     // set the options for the schema export plugin property item
     $schemaPluginProperties->setOptions($exportSpecificOptions);
     $this->properties = $schemaPluginProperties;
 }
Exemplo n.º 7
0
 /**
  * Sets the export SQL properties
  *
  * @return void
  */
 protected function setProperties()
 {
     global $plugin_param;
     $hide_sql = false;
     $hide_structure = false;
     if ($plugin_param['export_type'] == 'table' && !$plugin_param['single_table']) {
         $hide_structure = true;
         $hide_sql = true;
     }
     if (!$hide_sql) {
         $exportPluginProperties = new ExportPluginProperties();
         $exportPluginProperties->setText('SQL');
         $exportPluginProperties->setExtension('sql');
         $exportPluginProperties->setMimeType('text/x-sql');
         $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");
         // comments
         $subgroup = new OptionsPropertySubgroup();
         $subgroup->setName("include_comments");
         $leaf = new BoolPropertyItem();
         $leaf->setName('include_comments');
         $leaf->setText(__('Display comments <i>(includes info such as export' . ' timestamp, PHP version, and server version)</i>'));
         $subgroup->setSubgroupHeader($leaf);
         $leaf = new TextPropertyItem();
         $leaf->setName('header_comment');
         $leaf->setText(__('Additional custom header comment (\\n splits lines):'));
         $subgroup->addProperty($leaf);
         $leaf = new BoolPropertyItem();
         $leaf->setName('dates');
         $leaf->setText(__('Include a timestamp of when databases were created, last' . ' updated, and last checked'));
         $subgroup->addProperty($leaf);
         if (!empty($GLOBALS['cfgRelation']['relation'])) {
             $leaf = new BoolPropertyItem();
             $leaf->setName('relation');
             $leaf->setText(__('Display foreign key relationships'));
             $subgroup->addProperty($leaf);
         }
         if (!empty($GLOBALS['cfgRelation']['mimework'])) {
             $leaf = new BoolPropertyItem();
             $leaf->setName('mime');
             $leaf->setText(__('Display MIME types'));
             $subgroup->addProperty($leaf);
         }
         $generalOptions->addProperty($subgroup);
         // enclose in a transaction
         $leaf = new BoolPropertyItem();
         $leaf->setName("use_transaction");
         $leaf->setText(__('Enclose export in a transaction'));
         $leaf->setDoc(array('programs', 'mysqldump', 'option_mysqldump_single-transaction'));
         $generalOptions->addProperty($leaf);
         // disable foreign key checks
         $leaf = new BoolPropertyItem();
         $leaf->setName("disable_fk");
         $leaf->setText(__('Disable foreign key checks'));
         $leaf->setDoc(array('manual_MySQL_Database_Administration', 'server-system-variables', 'sysvar_foreign_key_checks'));
         $generalOptions->addProperty($leaf);
         // export views as tables
         $leaf = new BoolPropertyItem();
         $leaf->setName("views_as_tables");
         $leaf->setText(__('Export views as tables'));
         $generalOptions->addProperty($leaf);
         // export metadata
         $leaf = new BoolPropertyItem();
         $leaf->setName("metadata");
         $leaf->setText(__('Export metadata'));
         $generalOptions->addProperty($leaf);
         // compatibility maximization
         $compats = $GLOBALS['dbi']->getCompatibilities();
         if (count($compats) > 0) {
             $values = array();
             foreach ($compats as $val) {
                 $values[$val] = $val;
             }
             $leaf = new SelectPropertyItem();
             $leaf->setName("compatibility");
             $leaf->setText(__('Database system or older MySQL server to maximize output' . ' compatibility with:'));
             $leaf->setValues($values);
             $leaf->setDoc(array('manual_MySQL_Database_Administration', 'Server_SQL_mode'));
             $generalOptions->addProperty($leaf);
             unset($values);
         }
         // what to dump (structure/data/both)
         $subgroup = new OptionsPropertySubgroup();
         $subgroup->setName("dump_table");
         $subgroup->setText("Dump table");
         $leaf = new RadioPropertyItem();
         $leaf->setName('structure_or_data');
         $leaf->setValues(array('structure' => __('structure'), 'data' => __('data'), 'structure_and_data' => __('structure and data')));
         $subgroup->setSubgroupHeader($leaf);
         $generalOptions->addProperty($subgroup);
         // add the main group to the root group
         $exportSpecificOptions->addProperty($generalOptions);
         // structure options main group
         if (!$hide_structure) {
             $structureOptions = new OptionsPropertyMainGroup();
             $structureOptions->setName("structure");
             $structureOptions->setText(__('Object creation options'));
             $structureOptions->setForce('data');
             // begin SQL Statements
             $subgroup = new OptionsPropertySubgroup();
             $leaf = new MessageOnlyPropertyItem();
             $leaf->setName('add_statements');
             $leaf->setText(__('Add statements:'));
             $subgroup->setSubgroupHeader($leaf);
             // server export options
             if ($plugin_param['export_type'] == 'server') {
                 $leaf = new BoolPropertyItem();
                 $leaf->setName("drop_database");
                 $leaf->setText(sprintf(__('Add %s statement'), '<code>DROP DATABASE</code>'));
                 $subgroup->addProperty($leaf);
             }
             if ($plugin_param['export_type'] == 'database') {
                 $leaf = new BoolPropertyItem();
                 $leaf->setName('create_database');
                 $create_clause = '<code>CREATE DATABASE / USE</code>';
                 $leaf->setText(sprintf(__('Add %s statement'), $create_clause));
                 $subgroup->addProperty($leaf);
             }
             if ($plugin_param['export_type'] == 'table') {
                 if ($GLOBALS['dbi']->getTable($GLOBALS['db'], $GLOBALS['table'])->isView()) {
                     $drop_clause = '<code>DROP VIEW</code>';
                 } else {
                     $drop_clause = '<code>DROP TABLE</code>';
                 }
             } else {
                 $drop_clause = '<code>DROP TABLE / VIEW / PROCEDURE' . ' / FUNCTION / EVENT</code>';
             }
             $drop_clause .= '<code> / TRIGGER</code>';
             $leaf = new BoolPropertyItem();
             $leaf->setName('drop_table');
             $leaf->setText(sprintf(__('Add %s statement'), $drop_clause));
             $subgroup->addProperty($leaf);
             $subgroup_create_table = new OptionsPropertySubgroup();
             // Add table structure option
             $leaf = new BoolPropertyItem();
             $leaf->setName('create_table');
             $leaf->setText(sprintf(__('Add %s statement'), '<code>CREATE TABLE</code>'));
             $subgroup_create_table->setSubgroupHeader($leaf);
             $leaf = new BoolPropertyItem();
             $leaf->setName('if_not_exists');
             $leaf->setText('<code>IF NOT EXISTS</code> ' . __('(less efficient as indexes will be generated during table ' . 'creation)'));
             $subgroup_create_table->addProperty($leaf);
             $leaf = new BoolPropertyItem();
             $leaf->setName('auto_increment');
             $leaf->setText(sprintf(__('%s value'), '<code>AUTO_INCREMENT</code>'));
             $subgroup_create_table->addProperty($leaf);
             $subgroup->addProperty($subgroup_create_table);
             // Add view option
             $leaf = new BoolPropertyItem();
             $leaf->setName('create_view');
             $leaf->setText(sprintf(__('Add %s statement'), '<code>CREATE VIEW</code>'));
             $subgroup->addProperty($leaf);
             $leaf = new BoolPropertyItem();
             $leaf->setName('procedure_function');
             $leaf->setText(sprintf(__('Add %s statement'), '<code>CREATE PROCEDURE / FUNCTION / EVENT</code>'));
             $subgroup->addProperty($leaf);
             // Add triggers option
             $leaf = new BoolPropertyItem();
             $leaf->setName('create_trigger');
             $leaf->setText(sprintf(__('Add %s statement'), '<code>CREATE TRIGGER</code>'));
             $subgroup->addProperty($leaf);
             $structureOptions->addProperty($subgroup);
             $leaf = new BoolPropertyItem();
             $leaf->setName("backquotes");
             $leaf->setText(__('Enclose table and column names with backquotes ' . '<i>(Protects column and table names formed with' . ' special characters or keywords)</i>'));
             $structureOptions->addProperty($leaf);
             // add the main group to the root group
             $exportSpecificOptions->addProperty($structureOptions);
         }
         // begin Data options
         $dataOptions = new OptionsPropertyMainGroup();
         $dataOptions->setName("data");
         $dataOptions->setText(__('Data creation options'));
         $dataOptions->setForce('structure');
         $leaf = new BoolPropertyItem();
         $leaf->setName("truncate");
         $leaf->setText(__('Truncate table before insert'));
         $dataOptions->addProperty($leaf);
         // begin SQL Statements
         $subgroup = new OptionsPropertySubgroup();
         $leaf = new MessageOnlyPropertyItem();
         $leaf->setText(__('Instead of <code>INSERT</code> statements, use:'));
         $subgroup->setSubgroupHeader($leaf);
         $leaf = new BoolPropertyItem();
         $leaf->setName("delayed");
         $leaf->setText(__('<code>INSERT DELAYED</code> statements'));
         $leaf->setDoc(array('manual_MySQL_Database_Administration', 'insert_delayed'));
         $subgroup->addProperty($leaf);
         $leaf = new BoolPropertyItem();
         $leaf->setName("ignore");
         $leaf->setText(__('<code>INSERT IGNORE</code> statements'));
         $leaf->setDoc(array('manual_MySQL_Database_Administration', 'insert'));
         $subgroup->addProperty($leaf);
         $dataOptions->addProperty($subgroup);
         // Function to use when dumping dat
         $leaf = new SelectPropertyItem();
         $leaf->setName("type");
         $leaf->setText(__('Function to use when dumping data:'));
         $leaf->setValues(array('INSERT' => 'INSERT', 'UPDATE' => 'UPDATE', 'REPLACE' => 'REPLACE'));
         $dataOptions->addProperty($leaf);
         /* Syntax to use when inserting data */
         $subgroup = new OptionsPropertySubgroup();
         $leaf = new MessageOnlyPropertyItem();
         $leaf->setText(__('Syntax to use when inserting data:'));
         $subgroup->setSubgroupHeader($leaf);
         $leaf = new RadioPropertyItem();
         $leaf->setName("insert_syntax");
         $leaf->setText(__('<code>INSERT IGNORE</code> statements'));
         $leaf->setValues(array('complete' => __('include column names in every <code>INSERT</code> statement' . ' <br /> &nbsp; &nbsp; &nbsp; Example: <code>INSERT INTO' . ' tbl_name (col_A,col_B,col_C) VALUES (1,2,3)</code>'), 'extended' => __('insert multiple rows in every <code>INSERT</code> statement' . '<br /> &nbsp; &nbsp; &nbsp; Example: <code>INSERT INTO' . ' tbl_name VALUES (1,2,3), (4,5,6), (7,8,9)</code>'), 'both' => __('both of the above<br /> &nbsp; &nbsp; &nbsp; Example:' . ' <code>INSERT INTO tbl_name (col_A,col_B,col_C) VALUES' . ' (1,2,3), (4,5,6), (7,8,9)</code>'), 'none' => __('neither of the above<br /> &nbsp; &nbsp; &nbsp; Example:' . ' <code>INSERT INTO tbl_name VALUES (1,2,3)</code>')));
         $subgroup->addProperty($leaf);
         $dataOptions->addProperty($subgroup);
         // Max length of query
         $leaf = new NumberPropertyItem();
         $leaf->setName("max_query_size");
         $leaf->setText(__('Maximal length of created query'));
         $dataOptions->addProperty($leaf);
         // Dump binary columns in hexadecimal
         $leaf = new BoolPropertyItem();
         $leaf->setName("hex_for_binary");
         $leaf->setText(__('Dump binary columns in hexadecimal notation' . ' <i>(for example, "abc" becomes 0x616263)</i>'));
         $dataOptions->addProperty($leaf);
         // Dump time in UTC
         $leaf = new BoolPropertyItem();
         $leaf->setName("utc_time");
         $leaf->setText(__('Dump TIMESTAMP columns in UTC <i>(enables TIMESTAMP columns' . ' to be dumped and reloaded between servers in different' . ' time zones)</i>'));
         $dataOptions->addProperty($leaf);
         // add the main group to the root group
         $exportSpecificOptions->addProperty($dataOptions);
         // set the options for the export plugin property item
         $exportPluginProperties->setOptions($exportSpecificOptions);
         $this->properties = $exportPluginProperties;
     }
 }
 /**
  * Test for PMA\libraries\properties\options\items\SelectPropertyItem::getItemType
  *
  * @return void
  */
 public function testGetItemTypeSelect()
 {
     $object = new SelectPropertyItem();
     $this->assertEquals("select", $object->getItemType());
 }