[ Index ] |
|
Code source de jpGraph 2.2 |
1 <?php 2 /*======================================================================= 3 // File: DBSCHEMAEX1.PHP 4 // Description: Draw a DB schema of the DDDA architecture 5 // Created: 2002-08-25 6 // Ver: $Id: dbschemaex1.php,v 1.1 2002/08/27 20:08:57 aditus Exp $ 7 // 8 // License: This code is released under QPL 9 // Copyright (C) 2001,2002 Johan Persson 10 // Note: The actual drawing of the tables are semi-automatically 11 // but you can easily adjust the individual tables position 12 // with the 'tblposadj' array. 13 // 14 //======================================================================== 15 */ 16 include "../jpgraph.php"; 17 include "../jpgraph_canvas.php"; 18 include "../jpgraph_canvtools.php"; 19 include "../utils/misc/imgdbschema.inc"; 20 include "../utils/jpdocgen/jpdb.php"; 21 22 23 // Global callback to format the table header names 24 function FormatTblName($aName) { 25 // We want to replace any specifi references to the 26 // 'JpGraph' project with the generic '<project>' 27 return str_replace('JpGraph','<project>', $aName); 28 } 29 30 // Global callback to format each field name in the table 31 function FormatFldName($aName,$aTable) { 32 return $aName; 33 } 34 35 36 class Driver { 37 38 private $ig, $img, $iscale, $ishape; 39 private $iymax,$ixmax; 40 private $iwidth,$iheight; 41 42 function Driver() { 43 44 // Define Image size and coordinate grid space to work within 45 $this->iwidth = 600; 46 $this->iheight= 750; 47 $this->iymax = 50; 48 $this->ixmax = 55; 49 50 // Setup a basic canvas 51 $this->ig = new CanvasGraph($this->iwidth,$this->iheight,'auto'); 52 $this->img = $this->ig->img; 53 54 // Define the scale to be used 55 $this->iscale = new CanvasScale($this->ig); 56 $this->iscale->Set(0,$this->ixmax,0,$this->iymax); 57 $this->ishape = new Shape($this->ig,$this->iscale); 58 59 // A small frame around the canvas 60 $this->ig->SetMargin(2,3,2,3); 61 $this->ig->SetMarginColor("teal"); 62 $this->ig->InitFrame(); 63 64 } 65 66 function Run() { 67 68 $leftm=1.5; // Left margin (for table schemes) 69 $topm=5; // Top margin (for table schemes) 70 $tblwidth=15; // Individual table width 71 $tlo=1; // Offset for top line 72 73 // Add the background color for the project specific tables 74 $this->ishape->IndentedRectangle($leftm,$topm-1,3*$tblwidth+$tlo+6,45, 75 $tlo+2*$tblwidth+2,30,CORNER_BOTTOMLEFT, 76 'lightblue'); 77 78 // Stroke the tables (series of x,y offsets, If =-1 then use the 79 // automtic positioning 80 $tblposadj=array($tlo,0,$tblwidth+$tlo+2,0,2*$tblwidth+$tlo+4, 81 0,-1,16,-1,16); 82 $dbschema = new ImgDBSchema('jpgraph_doc','FormatTblName','FormatFldName'); 83 $dbschema->SetMargin($leftm,$topm); 84 $dbschema->SetTableWidth($tblwidth); 85 $dbschema->Stroke($this->img,$this->iscale,$tblposadj); 86 87 $tt = new CanvasRectangleText(); 88 $tt->SetFillColor(''); 89 $tt->SetColor(''); 90 $tt->SetFontColor('navy'); 91 92 // Add explanation 93 $tt->SetFont(FF_ARIAL,FS_NORMAL,12); 94 $tt->Set('Project specific tables',$tblwidth+$leftm+3,16,15); 95 $tt->Stroke($this->img,$this->iscale); 96 97 // Add title 98 $tt->SetColor(''); 99 $tt->SetFont(FF_VERDANA,FS_BOLD,26); 100 $tt->Set('DDDA - DB Schema',9,0.5,30); 101 $tt->Stroke($this->img,$this->iscale); 102 103 // Add a version and date 104 $tt->SetFillColor('yellow'); 105 $tt->SetFont(FF_FONT1,FS_NORMAL,10); 106 $tt->Set("Generated: ".date("ymd H:i",time()),1,$this->iymax*0.96,15); 107 $tt->Stroke($this->img,$this->iscale); 108 109 $this->ig->Stroke(); 110 } 111 } 112 113 $driver = new Driver(); 114 $driver->Run(); 115 116 ?> 117
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Nov 24 09:27:55 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |