SchemaEps.php 2.8 KB

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