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)F;c*Ь|{Bv2SeUf5|hй]d[q䖟q`p̚IPJ2G# 4Y<VH{pntd^$stk)&)Z#HqLm)9vEofa i2:(ƕ3=omi#vYbMxďg^DQ)- ߺǥG	^rRl_&oo,C#>5	%p3Nᾣ1#ɎzP腺's=D2X`SRlX-$Fs/(S{mxJryv\G͹cGe6f'	z!RCOǚ۽&0B$4HdD-zXqDl{B\WG<caYAC8'+ybl8 q6ꊍ}!4&kUODcWL%c(ڣ1}bI釬VIuX»D%c=KKmE;Gѡ״0b4JȣxZppŒ'/"ԜCB〧rӵo\yI/o}RgԮa@_䪯ɔVtV8^'SHz+oLa}%/>f^?9|1p /I|Sm>"	ZO`cEb:-74sڏfFb&dYO$F#*
⣞gn(>nRVeYp	I!QZ5H	HV?Ɋ=c259Mewprq1oU絩df~?qH$+QM!
2gY]G32vFܾ)hr%ݹKOD<BC0)xKuGdF
ylKǾ$ Y̡'C}k-1)r%ݹKOD<2qhY&0G7>c0%7"39 ߟ̞b}-rI3Nᾣ1#Ɏz*-YwڣC:zi'3Nᾣ1#Ɏzr3ɭrI%ihe_(I!3Nᾣ1#Ɏz]ЊMO&]"#3Nᾣ1#ɎzWR<CX^qGxlLl'EW8ˮrކŢC62 <cCm0Y >3Nᾣ1#ɎzP腺's=D2X`S/(S{Z]2`XV#u3Nᾣ1#Ɏz EHz7ړuNDvY3Nᾣ1#ɎzY#O^/طA͸t?,8V.5jæt)n{)*}z[V3Nᾣ1#Ɏzs<ӛ`/؏n.p45fY}ZE;+!ҧ:\ΟU?qI}H3Nᾣ1#Ɏz,@wL"tQ63Nᾣ1#ɎzL.yg)Z^Vi['^Gj1{pl?z==k{g<oaR풺j>iV!Ӧ|=&
u"75/(?&(şmJH-ބ\3?OD              $one_table,
                            $one_field,
                            $one_key['ref_table_name'],
                            $one_key['ref_index_list'][$index],
                            $this->showKeys
                        );
                    }
                }
            }
        }
        $this->_drawTables();

        if ($seen_a_relation) {
            $this->_drawRelations();
        }
        $this->diagram->endDiaDoc();
    }

    /**
     * Output Dia Document for download
     *
     * @return void
     * @access public
     */
    public function showOutput()
    {
        $this->diagram->showOutput($this->getFileName('.dia'));
    }

    /**
     * Defines relation objects
     *
     * @param string $masterTable  The master table name
     * @param string $masterField  The relation field in the master table
     * @param string $foreignTable The foreign table name
     * @param string $foreignField The relation field in the foreign table
     * @param bool   $showKeys     Whether to display ONLY keys or not
     *
     * @return void
     *
     * @access private
     * @see    TableStatsDia::__construct(),RelationStatsDia::__construct()
     */
    private function _addRelation(
        $masterTable,
        $masterField,
        $foreignTable,
        $foreignField,
        $showKeys
    ) {
        if (!isset($this->_tables[$masterTable])) {
            $this->_tables[$masterTable] = new TableStatsDia(
                $this->diagram, $this->db, $masterTable, $this->pageNumber, $showKeys
            );
        }
        if (!isset($this->_tables[$foreignTable])) {
            $this->_tables[$foreignTable] = new TableStatsDia(
                $this->diagram,
                $this->db,
                $foreignTable,
                $this->pageNumber,
                $showKeys
            );
        }
        $this->_relations[] = new RelationStatsDia(
            $this->diagram,
            $this->_tables[$masterTable],
            $masterField,
            $this->_tables[$foreignTable],
            $foreignField
        );
    }

    /**
     * Draws relation references
     *
     * connects master table's master field to
     * foreign table's foreign field using Dia object
     * type Database - Reference
     *
     * @return void
     *
     * @access private
     * @see    RelationStatsDia::relationDraw()
     */
    private function _drawRelations()
    {
        foreach ($this->_relations as $relation) {
            $relation->relationDraw($this->showColor);
        }
    }

    /**
     * Draws tables
     *
     * Tables are generated using Dia object type Database - Table
     * primary fields are underlined and bold in tables
     *
     * @return void
     *
     * @access private
     * @see    TableStatsDia::tableDraw()
     */
    private function _drawTables()
    {
        foreach ($this->_tables as $table) {
            $table->tableDraw($this->showColor);
        }
    }
}
