Dia Schema Class: download fileName added + improved documentation
This commit is contained in:
@@ -27,6 +27,14 @@ class PMA_DIA extends XMLWriter
|
|||||||
public $font;
|
public $font;
|
||||||
public $fontSize;
|
public $fontSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The "PMA_DIA" constructor
|
||||||
|
*
|
||||||
|
* Upon instantiation This starts writing the Dia XML document
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @see PMA_DIA,Table_Stats,Relation_Stats
|
||||||
|
*/
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
$this->openMemory();
|
$this->openMemory();
|
||||||
@@ -44,6 +52,24 @@ class PMA_DIA extends XMLWriter
|
|||||||
$this->startDocument('1.0','UTF-8');
|
$this->startDocument('1.0','UTF-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts Dia Document
|
||||||
|
*
|
||||||
|
* dia document starts by first initializing dia:diagram tag
|
||||||
|
* then dia:diagramdata contains all the attributes that needed
|
||||||
|
* to define the document, then finally a Layer starts which
|
||||||
|
* holds all the objects.
|
||||||
|
*
|
||||||
|
* @param string paper The size of the paper/document
|
||||||
|
* @param float topMargin top margin of the paper/document in cm
|
||||||
|
* @param float bottomMargin bottom margin of the paper/document in cm
|
||||||
|
* @param float leftMargin left margin of the paper/document in cm
|
||||||
|
* @param float rightMargin right margin of the paper/document in cm
|
||||||
|
* @param string portrait document will be portrait or landscape
|
||||||
|
* @return void
|
||||||
|
* @access public
|
||||||
|
* @see XMLWriter::startElement(),XMLWriter::writeAttribute(),XMLWriter::writeRaw()
|
||||||
|
*/
|
||||||
function startDiaDoc($paper,$topMargin,$bottomMargin,$leftMargin,$rightMargin,$portrait)
|
function startDiaDoc($paper,$topMargin,$bottomMargin,$leftMargin,$rightMargin,$portrait)
|
||||||
{
|
{
|
||||||
if($portrait == 'P'){
|
if($portrait == 'P'){
|
||||||
@@ -123,20 +149,35 @@ class PMA_DIA extends XMLWriter
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ends Dia Document
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @access public
|
||||||
|
* @see XMLWriter::endElement(),XMLWriter::endDocument()
|
||||||
|
*/
|
||||||
function endDiaDoc()
|
function endDiaDoc()
|
||||||
{
|
{
|
||||||
$this->endElement();
|
$this->endElement();
|
||||||
$this->endDocument();
|
$this->endDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
function showOutput()
|
/**
|
||||||
|
* Output Dia Document for download
|
||||||
|
*
|
||||||
|
* @param string fileName name of the dia document
|
||||||
|
* @return void
|
||||||
|
* @access public
|
||||||
|
* @see XMLWriter::flush()
|
||||||
|
*/
|
||||||
|
function showOutput($fileName)
|
||||||
{
|
{
|
||||||
if(ob_end_clean()){
|
if(ob_end_clean()){
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
//ob_start();
|
//ob_start();
|
||||||
}
|
}
|
||||||
//header('Content-type: text/xml');
|
//header('Content-type: text/xml');
|
||||||
header('Content-Disposition: attachment; filename="downloaded.dia"');
|
header('Content-Disposition: attachment; filename="'.$fileName.'.dia"');
|
||||||
$output = $this->flush();
|
$output = $this->flush();
|
||||||
print $output;
|
print $output;
|
||||||
}
|
}
|
||||||
@@ -618,6 +659,15 @@ class PMA_Dia_Relation_Schema extends PMA_Export_Relation_Schema
|
|||||||
private $_rightMargin = 2.8222000598907471;
|
private $_rightMargin = 2.8222000598907471;
|
||||||
public static $objectId = 0;
|
public static $objectId = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The "PMA_Dia_Relation_Schema" constructor
|
||||||
|
*
|
||||||
|
* Upon instantiation This outputs the Dia XML document
|
||||||
|
* that user can download
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @see PMA_DIA,Table_Stats,Relation_Stats
|
||||||
|
*/
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
global $dia,$db;
|
global $dia,$db;
|
||||||
@@ -662,7 +712,7 @@ class PMA_Dia_Relation_Schema extends PMA_Export_Relation_Schema
|
|||||||
$this->_drawRelations($this->showColor);
|
$this->_drawRelations($this->showColor);
|
||||||
}
|
}
|
||||||
$dia->endDiaDoc();
|
$dia->endDiaDoc();
|
||||||
$dia->showOutput();
|
$dia->showOutput($db.'-'.$this->pageNumber);
|
||||||
exit();
|
exit();
|
||||||
print '<pre>';
|
print '<pre>';
|
||||||
print_r(get_object_vars($dia));
|
print_r(get_object_vars($dia));
|
||||||
|
Reference in New Issue
Block a user