/**
  * The "PMA_Svg_Relation_Schema" constructor
  *
  * Upon instantiation This starts writing the SVG XML document
  * user will be prompted for download as .svg extension
  *
  * @return void
  * @see PMA_SVG
  */
 function __construct()
 {
     global $svg, $db;
     $this->setPageNumber($_POST['pdf_page_number']);
     $this->setShowColor(isset($_POST['show_color']));
     $this->setShowKeys(isset($_POST['show_keys']));
     $this->setTableDimension(isset($_POST['show_table_dimension']));
     $this->setAllTableSameWidth(isset($_POST['all_table_same_wide']));
     $this->setExportType($_POST['export_type']);
     $svg = new PMA_SVG();
     $svg->setTitle(sprintf(__('Schema of the %s database - Page %s'), $db, $this->pageNumber));
     $svg->SetAuthor('phpMyAdmin ' . PMA_VERSION);
     $svg->setFont('Arial');
     $svg->setFontSize('16px');
     $svg->startSvgDoc('1000px', '1000px');
     $alltables = $this->getAllTables($db, $this->pageNumber);
     foreach ($alltables as $table) {
         if (!isset($this->tables[$table])) {
             $this->tables[$table] = new Table_Stats($table, $svg->getFont(), $svg->getFontSize(), $this->pageNumber, $this->_tablewidth, $this->showKeys, $this->tableDimension);
         }
         if ($this->sameWide) {
             $this->tables[$table]->width = $this->_tablewidth;
         }
         $this->_setMinMax($this->tables[$table]);
     }
     $seen_a_relation = false;
     foreach ($alltables as $one_table) {
         $exist_rel = PMA_getForeigners($db, $one_table, '', 'both');
         if ($exist_rel) {
             $seen_a_relation = true;
             foreach ($exist_rel as $master_field => $rel) {
                 /* put the foreign table on the schema only if selected
                  * by the user
                  * (do not use array_search() because we would have to
                  * to do a === FALSE and this is not PHP3 compatible)
                  */
                 if (in_array($rel['foreign_table'], $alltables)) {
                     $this->_addRelation($one_table, $svg->getFont(), $svg->getFontSize(), $master_field, $rel['foreign_table'], $rel['foreign_field'], $this->tableDimension);
                 }
             }
         }
     }
     if ($seen_a_relation) {
         $this->_drawRelations($this->showColor);
     }
     $this->_drawTables($this->showColor);
     $svg->endSvgDoc();
     $svg->showOutput($db . '-' . $this->pageNumber);
     exit;
 }
 /**
  * The "PMA_Svg_Relation_Schema" constructor
  *
  * Upon instantiation This starts writing the SVG XML document
  * user will be prompted for download as .svg extension
  *
  * @see PMA_SVG
  */
 function __construct()
 {
     parent::__construct();
     global $svg;
     $this->setShowColor(isset($_REQUEST['svg_show_color']));
     $this->setShowKeys(isset($_REQUEST['svg_show_keys']));
     $this->setTableDimension(isset($_REQUEST['svg_show_table_dimension']));
     $this->setAllTablesSameWidth(isset($_REQUEST['svg_all_tables_same_width']));
     $svg = new PMA_SVG();
     $svg->setTitle(sprintf(__('Schema of the %s database - Page %s'), $GLOBALS['db'], $this->pageNumber));
     $svg->SetAuthor('phpMyAdmin ' . PMA_VERSION);
     $svg->setFont('Arial');
     $svg->setFontSize('16px');
     $svg->startSvgDoc('1000px', '1000px');
     $alltables = $this->getTablesFromRequest();
     foreach ($alltables as $table) {
         if (!isset($this->_tables[$table])) {
             $this->_tables[$table] = new Table_Stats_Svg($table, $svg->getFont(), $svg->getFontSize(), $this->pageNumber, $this->_tablewidth, $this->showKeys, $this->tableDimension, $this->offline);
         }
         if ($this->sameWide) {
             $this->_tables[$table]->width = $this->_tablewidth;
         }
         $this->_setMinMax($this->_tables[$table]);
     }
     $seen_a_relation = false;
     foreach ($alltables as $one_table) {
         $exist_rel = PMA_getForeigners($GLOBALS['db'], $one_table, '', 'both');
         if (!$exist_rel) {
             continue;
         }
         $seen_a_relation = true;
         foreach ($exist_rel as $master_field => $rel) {
             /* put the foreign table on the schema only if selected
              * by the user
              * (do not use array_search() because we would have to
              * to do a === false and this is not PHP3 compatible)
              */
             if ($master_field != 'foreign_keys_data') {
                 if (in_array($rel['foreign_table'], $alltables)) {
                     $this->_addRelation($one_table, $svg->getFont(), $svg->getFontSize(), $master_field, $rel['foreign_table'], $rel['foreign_field'], $this->tableDimension);
                 }
                 continue;
             }
             foreach ($rel as $one_key) {
                 if (!in_array($one_key['ref_table_name'], $alltables)) {
                     continue;
                 }
                 foreach ($one_key['index_list'] as $index => $one_field) {
                     $this->_addRelation($one_table, $svg->getFont(), $svg->getFontSize(), $one_field, $one_key['ref_table_name'], $one_key['ref_index_list'][$index], $this->tableDimension);
                 }
             }
         }
     }
     if ($seen_a_relation) {
         $this->_drawRelations();
     }
     $this->_drawTables();
     $svg->endSvgDoc();
 }