"Fossies" - the Fresh Open Source Software Archive

Member "phpMyAdmin-5.1.0-english/libraries/classes/Plugins/Schema/SchemaPdf.php" (24 Feb 2021, 3563 Bytes) of package /linux/www/phpMyAdmin-5.1.0-english.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "SchemaPdf.php" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 5.0.4-english_vs_5.1.0-english.

    1 <?php
    2 /**
    3  * PDF schema export code
    4  */
    5 
    6 declare(strict_types=1);
    7 
    8 namespace PhpMyAdmin\Plugins\Schema;
    9 
   10 use PhpMyAdmin\Plugins\Schema\Pdf\PdfRelationSchema;
   11 use PhpMyAdmin\Plugins\SchemaPlugin;
   12 use PhpMyAdmin\Properties\Options\Groups\OptionsPropertyMainGroup;
   13 use PhpMyAdmin\Properties\Options\Groups\OptionsPropertyRootGroup;
   14 use PhpMyAdmin\Properties\Options\Items\BoolPropertyItem;
   15 use PhpMyAdmin\Properties\Options\Items\SelectPropertyItem;
   16 use PhpMyAdmin\Properties\Plugins\SchemaPluginProperties;
   17 
   18 /**
   19  * Handles the schema export for the PDF format
   20  */
   21 class SchemaPdf extends SchemaPlugin
   22 {
   23     public function __construct()
   24     {
   25         $this->setProperties();
   26     }
   27 
   28     /**
   29      * Sets the schema export PDF properties
   30      *
   31      * @return void
   32      */
   33     protected function setProperties()
   34     {
   35         $schemaPluginProperties = new SchemaPluginProperties();
   36         $schemaPluginProperties->setText('PDF');
   37         $schemaPluginProperties->setExtension('pdf');
   38         $schemaPluginProperties->setMimeType('application/pdf');
   39 
   40         // create the root group that will be the options field for
   41         // $schemaPluginProperties
   42         // this will be shown as "Format specific options"
   43         $exportSpecificOptions = new OptionsPropertyRootGroup(
   44             'Format Specific Options'
   45         );
   46 
   47         // specific options main group
   48         $specificOptions = new OptionsPropertyMainGroup('general_opts');
   49         // add options common to all plugins
   50         $this->addCommonOptions($specificOptions);
   51 
   52         // create leaf items and add them to the group
   53         $leaf = new BoolPropertyItem(
   54             'all_tables_same_width',
   55             __('Same width for all tables')
   56         );
   57         $specificOptions->addProperty($leaf);
   58 
   59         $leaf = new SelectPropertyItem(
   60             'orientation',
   61             __('Orientation')
   62         );
   63         $leaf->setValues(
   64             [
   65                 'L' => __('Landscape'),
   66                 'P' => __('Portrait'),
   67             ]
   68         );
   69         $specificOptions->addProperty($leaf);
   70 
   71         $leaf = new SelectPropertyItem(
   72             'paper',
   73             __('Paper size')
   74         );
   75         $leaf->setValues($this->getPaperSizeArray());
   76         $specificOptions->addProperty($leaf);
   77 
   78         $leaf = new BoolPropertyItem(
   79             'show_grid',
   80             __('Show grid')
   81         );
   82         $specificOptions->addProperty($leaf);
   83 
   84         $leaf = new BoolPropertyItem(
   85             'with_doc',
   86             __('Data dictionary')
   87         );
   88         $specificOptions->addProperty($leaf);
   89 
   90         $leaf = new SelectPropertyItem(
   91             'table_order',
   92             __('Order of the tables')
   93         );
   94         $leaf->setValues(
   95             [
   96                 ''          => __('None'),
   97                 'name_asc'  => __('Name (Ascending)'),
   98                 'name_desc' => __('Name (Descending)'),
   99             ]
  100         );
  101         $specificOptions->addProperty($leaf);
  102 
  103         // add the main group to the root group
  104         $exportSpecificOptions->addProperty($specificOptions);
  105 
  106         // set the options for the schema export plugin property item
  107         $schemaPluginProperties->setOptions($exportSpecificOptions);
  108         $this->properties = $schemaPluginProperties;
  109     }
  110 
  111     /**
  112      * Exports the schema into PDF format.
  113      *
  114      * @param string $db database name
  115      *
  116      * @return bool Whether it succeeded
  117      */
  118     public function exportSchema($db)
  119     {
  120         $export = new PdfRelationSchema($db);
  121         $export->showOutput();
  122 
  123         return true;
  124     }
  125 }