SchemaSvg.class.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 SVG
  8. */
  9. if (! defined('PHPMYADMIN')) {
  10. exit;
  11. }
  12. /* Get the schema export interface */
  13. require_once 'libraries/plugins/SchemaPlugin.class.php';
  14. require_once 'libraries/plugins/schema/svg/Svg_Relation_Schema.class.php';
  15. /**
  16. * Handles the schema export for the SVG format
  17. *
  18. * @package PhpMyAdmin-Schema
  19. * @subpackage SVG
  20. */
  21. class SchemaSvg extends SchemaPlugin
  22. {
  23. /**
  24. * Constructor
  25. */
  26. public function __construct()
  27. {
  28. $this->setProperties();
  29. }
  30. /**
  31. * Sets the schema export SVG properties
  32. *
  33. * @return void
  34. */
  35. protected function setProperties()
  36. {
  37. $props = 'libraries/properties/';
  38. include_once "$props/plugins/SchemaPluginProperties.class.php";
  39. include_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
  40. include_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
  41. include_once "$props/options/items/BoolPropertyItem.class.php";
  42. $schemaPluginProperties = new SchemaPluginProperties();
  43. $schemaPluginProperties->setText('SVG');
  44. $schemaPluginProperties->setExtension('svg');
  45. $schemaPluginProperties->setMimeType('application/svg');
  46. // create the root group that will be the options field for
  47. // $schemaPluginProperties
  48. // this will be shown as "Format specific options"
  49. $exportSpecificOptions = new OptionsPropertyRootGroup();
  50. $exportSpecificOptions->setName("Format Specific Options");
  51. // specific options main group
  52. $specificOptions = new OptionsPropertyMainGroup();
  53. $specificOptions->setName("general_opts");
  54. // add options common to all plugins
  55. $this->addCommonOptions($specificOptions);
  56. // create leaf items and add them to the group
  57. $leaf = new BoolPropertyItem();
  58. $leaf->setName('all_tables_same_width');
  59. $leaf->setText(__('Same width for all tables'));
  60. $specificOptions->addProperty($leaf);
  61. // add the main group to the root group
  62. $exportSpecificOptions->addProperty($specificOptions);
  63. // set the options for the schema export plugin property item
  64. $schemaPluginProperties->setOptions($exportSpecificOptions);
  65. $this->properties = $schemaPluginProperties;
  66. }
  67. /**
  68. * Exports the schema into SVG format.
  69. *
  70. * @param string $db database name
  71. *
  72. * @return bool Whether it succeeded
  73. */
  74. public function exportSchema($db)
  75. {
  76. $export = new PMA_Svg_Relation_Schema($db);
  77. $export->showOutput();
  78. }
  79. }