SchemaEps.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * PDF schema export code
  5. *
  6. * @package PhpMyAdmin-Schema
  7. * @subpackage EPS
  8. */
  9. namespace PhpMyAdmin\Plugins\Schema;
  10. use PhpMyAdmin\Properties\Options\Items\BoolPropertyItem;
  11. use PhpMyAdmin\Properties\Options\Groups\OptionsPropertyMainGroup;
  12. use PhpMyAdmin\Properties\Options\Groups\OptionsPropertyRootGroup;
  13. use PhpMyAdmin\Plugins\Schema\Eps\EpsRelationSchema;
  14. use PhpMyAdmin\Plugins\SchemaPlugin;
  15. use PhpMyAdmin\Properties\Plugins\SchemaPluginProperties;
  16. use PhpMyAdmin\Properties\Options\Items\SelectPropertyItem;
  17. /**
  18. * Handles the schema export for the EPS format
  19. *
  20. * @package PhpMyAdmin-Schema
  21. * @subpackage EPS
  22. */
  23. class SchemaEps extends SchemaPlugin
  24. {
  25. /**
  26. * Constructor
  27. */
  28. public function __construct()
  29. {
  30. $this->setProperties();
  31. }
  32. /**
  33. * Sets the schema export EPS properties
  34. *
  35. * @return void
  36. */
  37. protected function setProperties()
  38. {
  39. $schemaPluginProperties = new SchemaPluginProperties();
  40. $schemaPluginProperties->setText('EPS');
  41. $schemaPluginProperties->setExtension('eps');
  42. $schemaPluginProperties->setMimeType('application/eps');
  43. // create the root group that will be the options field for
  44. // $schemaPluginProperties
  45. // this will be shown as "Format specific options"
  46. $exportSpecificOptions = new OptionsPropertyRootGroup(
  47. "Format Specific Options"
  48. );
  49. // specific options main group
  50. $specificOptions = new OptionsPropertyMainGroup("general_opts");
  51. // add options common to all plugins
  52. $this->addCommonOptions($specificOptions);
  53. // create leaf items and add them to the group
  54. $leaf = new BoolPropertyItem(
  55. 'all_tables_same_width',
  56. __('Same width for all tables')
  57. );
  58. $specificOptions->addProperty($leaf);
  59. $leaf = new SelectPropertyItem(
  60. "orientation",
  61. __('Orientation')
  62. );
  63. $leaf->setValues(
  64. array(
  65. 'L' => __('Landscape'),
  66. 'P' => __('Portrait'),
  67. )
  68. );
  69. $specificOptions->addProperty($leaf);
  70. // add the main group to the root group
  71. $exportSpecificOptions->addProperty($specificOptions);
  72. // set the options for the schema export plugin property item
  73. $schemaPluginProperties->setOptions($exportSpecificOptions);
  74. $this->properties = $schemaPluginProperties;
  75. }
  76. /**
  77. * Exports the schema into EPS format.
  78. *
  79. * @param string $db database name
  80. *
  81. * @return bool Whether it succeeded
  82. */
  83. public function exportSchema($db)
  84. {
  85. $export = new EpsRelationSchema($db);
  86. $export->showOutput();
  87. }
  88. }