tableId = ++DiaRelationSchema::$objectId; } /** * Displays an error when the table cannot be found. * * @return void */ protected function showMissingTableError() { ExportRelationSchema::dieSchema( $this->pageNumber, "DIA", sprintf(__('The %s table doesn\'t exist!'), $this->tableName) ); } /** * Do draw the table * * Tables are generated using object type Database - Table * primary fields are underlined in tables. Dia object * is used to generate the XML of Dia Document. Database Table * Object and their attributes are involved in the combination * of displaying Database - Table on Dia Document. * * @param boolean $showColor Whether to show color for tables text or not * if showColor is true then an array of $listOfColors * will be used to choose the random colors for tables * text we can change/add more colors to this array * * @return void * * @access public * @see Dia */ public function tableDraw($showColor) { if ($showColor) { $listOfColors = array( 'FF0000', '000099', '00FF00' ); shuffle($listOfColors); $this->tableColor = '#' . $listOfColors[0] . ''; } else { $this->tableColor = '#000000'; } $factor = 0.1; $this->diagram->startElement('dia:object'); $this->diagram->writeAttribute('type', 'Database - Table'); $this->diagram->writeAttribute('version', '0'); $this->diagram->writeAttribute('id', '' . $this->tableId . ''); $this->diagram->writeRaw( ' #' . $this->tableName . '# ## ' ); $this->diagram->startElement('dia:attribute'); $this->diagram->writeAttribute('name', 'attributes'); foreach ($this->fields as $field) { $this->diagram->writeRaw( ' #' . $field . '# ## ## ' ); unset($pm); $pm = 'false'; if (in_array($field, $this->primary)) { $pm = 'true'; } if ($field == $this->displayfield) { $pm = 'false'; } $this->diagram->writeRaw( ' ' ); } $this->diagram->endElement(); $this->diagram->endElement(); } }