PMA\libraries\plugins\schema\ExportRelationSchema::__construct PHP Method

__construct() public method

Constructor.
public __construct ( string $db, object $diagram )
$db string database name
$diagram object schema diagram
    public function __construct($db, $diagram)
    {
        $this->db = $db;
        $this->diagram = $diagram;
        $this->setPageNumber($_REQUEST['page_number']);
        $this->setOffline(isset($_REQUEST['offline_export']));
    }

Usage Example

 /**
  * The "PMA\libraries\plugins\schema\svg\SvgRelationSchema" constructor
  *
  * Upon instantiation This starts writing the SVG XML document
  * user will be prompted for download as .svg extension
  *
  * @param string $db database name
  *
  * @see PMA_SVG
  */
 function __construct($db)
 {
     parent::__construct($db, new 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']));
     $this->diagram->setTitle(sprintf(__('Schema of the %s database - Page %s'), $this->db, $this->pageNumber));
     $this->diagram->SetAuthor('phpMyAdmin ' . PMA_VERSION);
     $this->diagram->setFont('Arial');
     $this->diagram->setFontSize('16px');
     $alltables = $this->getTablesFromRequest();
     foreach ($alltables as $table) {
         if (!isset($this->_tables[$table])) {
             $this->_tables[$table] = new TableStatsSvg($this->diagram, $this->db, $table, $this->diagram->getFont(), $this->diagram->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]);
     }
     $border = 15;
     $this->diagram->startSvgDoc($this->_xMax + $border, $this->_yMax + $border, $this->_xMin - $border, $this->_yMin - $border);
     $seen_a_relation = false;
     foreach ($alltables as $one_table) {
         $exist_rel = PMA_getForeigners($this->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, $this->diagram->getFont(), $this->diagram->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, $this->diagram->getFont(), $this->diagram->getFontSize(), $one_field, $one_key['ref_table_name'], $one_key['ref_index_list'][$index], $this->tableDimension);
                 }
             }
         }
     }
     if ($seen_a_relation) {
         $this->_drawRelations();
     }
     $this->_drawTables();
     $this->diagram->endSvgDoc();
 }
All Usage Examples Of PMA\libraries\plugins\schema\ExportRelationSchema::__construct