/**
  * The "PMA_EPS_Relation_Schema" constructor
  *
  * Upon instantiation This starts writing the EPS document
  * user will be prompted for download as .eps extension
  *
  * @see PMA_EPS
  */
 function __construct()
 {
     parent::__construct();
     global $eps;
     $this->setShowColor(isset($_REQUEST['eps_show_color']));
     $this->setShowKeys(isset($_REQUEST['eps_show_keys']));
     $this->setTableDimension(isset($_REQUEST['eps_show_table_dimension']));
     $this->setAllTablesSameWidth(isset($_REQUEST['eps_all_tables_same_width']));
     $this->setOrientation($_REQUEST['eps_orientation']);
     $eps = new PMA_EPS();
     $eps->setTitle(sprintf(__('Schema of the %s database - Page %s'), $GLOBALS['db'], $this->pageNumber));
     $eps->setAuthor('phpMyAdmin ' . PMA_VERSION);
     $eps->setDate(date("j F Y, g:i a"));
     $eps->setOrientation($this->orientation);
     $eps->setFont('Verdana', '10');
     $alltables = $this->getTablesFromRequest();
     foreach ($alltables as $table) {
         if (!isset($this->_tables[$table])) {
             $this->_tables[$table] = new Table_Stats_Eps($table, $eps->getFont(), $eps->getFontSize(), $this->pageNumber, $this->_tablewidth, $this->showKeys, $this->tableDimension, $this->offline);
         }
         if ($this->sameWide) {
             $this->_tables[$table]->width = $this->_tablewidth;
         }
     }
     $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, $eps->getFont(), $eps->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, $eps->getFont(), $eps->getFontSize(), $one_field, $one_key['ref_table_name'], $one_key['ref_index_list'][$index], $this->tableDimension);
                 }
             }
         }
     }
     if ($seen_a_relation) {
         $this->_drawRelations();
     }
     $this->_drawTables();
     $eps->endEpsDoc();
 }
 /**
  * The "PMA_EPS_Relation_Schema" constructor
  *
  * Upon instantiation This starts writing the EPS document
  * user will be prompted for download as .eps extension
  *
  * @return void
  * @see PMA_EPS
  */
 function __construct()
 {
     global $eps, $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->setAllTablesSameWidth(isset($_POST['all_tables_same_width']));
     $this->setOrientation($_POST['orientation']);
     $this->setExportType($_POST['export_type']);
     $eps = new PMA_EPS();
     $eps->setTitle(sprintf(__('Schema of the %s database - Page %s'), $db, $this->pageNumber));
     $eps->setAuthor('phpMyAdmin ' . PMA_VERSION);
     $eps->setDate(date("j F Y, g:i a"));
     $eps->setOrientation($this->orientation);
     $eps->setFont('Verdana', '10');
     $alltables = $this->getAllTables($db, $this->pageNumber);
     foreach ($alltables as $table) {
         if (!isset($this->tables[$table])) {
             $this->tables[$table] = new Table_Stats($table, $eps->getFont(), $eps->getFontSize(), $this->pageNumber, $this->_tablewidth, $this->showKeys, $this->tableDimension);
         }
         if ($this->sameWide) {
             $this->tables[$table]->width = $this->_tablewidth;
         }
     }
     $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, $eps->getFont(), $eps->getFontSize(), $master_field, $rel['foreign_table'], $rel['foreign_field'], $this->tableDimension);
                 }
             }
         }
     }
     if ($seen_a_relation) {
         $this->_drawRelations($this->showColor);
     }
     $this->_drawTables($this->showColor);
     $eps->endEpsDoc();
     $eps->showOutput($db . '-' . $this->pageNumber);
     exit;
 }