【php开源代码栏目提醒】:网学会员在php开源代码频道为大家收集整理了pdf_schema.php提供大家参考,希望对大家有所帮助!
<?php
/* $Id: pdf_schema.php,v 2.25 2006/01/19 15:39:29 cybot_tm Exp $ */
// vim: expandtab sw=4 ts=4 sts=4:
/**
* Contributed by Maxime Delorme and merged by lem9
*/
/**
* Gets some core scripts
*/
require_once('./libraries/common.lib.php');
/**
* Settings for relation stuff
*/
require_once('./libraries/relation.lib.php');
require_once('./libraries/transformations.lib.php');
$cfgRelation = PMA_getRelationsParam();
/**
* Now in ./libraries/relation.lib.php we check for all tables
* that we need, but if we don't find them we are quiet about it
* so people can work without.
* This page is absolutely useless if you didn't set up your tables
* correctly, so it is a good place to see which tables we can and
* complain ;-)
*/
if (!$cfgRelation['pdfwork']) {
echo '<font color="red">' . $strError . '</font><br />' . "\n";
$url_to_goto = '<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?' . $url_query . '">';
echo sprintf($strRelationNotWorking, $url_to_goto, '</a>') . "\n";
}
/**
* Gets the "fpdf" libraries and defines the pdf font path, use unicode version for unicode.
*/
define('FPDF_FONTPATH', './libraries/fpdf/font/');
if ($charset == 'utf-8') {
define('PMA_PDF_FONT', 'FreeSans');
require_once('./libraries/fpdf/ufpdf.php');
class PMA_FPDF extends UFPDF {
};
} else {
define('PMA_PDF_FONT', 'Arial');
require_once('./libraries/fpdf/fpdf.php');
class PMA_FPDF extends FPDF {
};
}
/**
* Extends the "FPDF" class and prepares the work
*
* @access public
* @see FPDF
*/
class PMA_PDF extends PMA_FPDF {
/**
* Defines private properties
*/
var $x_min;
var $y_min;
var $l_marg = 10;
var $t_marg = 10;
var $scale;
var $title;
var $PMA_links;
var $Outlines = array();
var $def_outlines;
var $Alias ;
var $widths;
/**
* The PMA_PDF constructor
*
* This function just refers to the "FPDF" constructor: with
PHP3 a class
* must have a constructor
*
* @param string $ The page orientation (p, portrait, l or landscape)
* @param string $ The unit for sizes (pt, mm, cm or in)
* @param mixed $ The page format (A3, A4, A5, letter, legal or an array
* with page sizes)
* @access public
* @see FPDF::FPDF()
*/
function PMA_PDF($orientation = 'L', $unit = 'mm', $format = 'A4')
{
$this->Alias = array() ;
$this->FPDF($orientation, $unit, $format);
} // end of the "PMA_PDF()" method
function SetAlias($name, $value)
{
$this->Alias[$name] = $value ;
}
function _putpages()
{
if (count($this->Alias) > 0) {
$nb = $this->page;
foreach ($this->Alias AS $alias => $value) {
for ($n = 1;$n <= $nb;$n++)
$this->pages[$n] = $this->_strreplace($alias, $value, $this->pages[$n]);
}
}
parent::_putpages();
}
/**
* Sets the scaling factor, defines minimum coordinates and margins
*
* @param double $ The scaling factor
* @param double $ The minimum X coordinate
* @param double $ The minimum Y coordinate
* @param double $ The left margin
* @param double $ The top margin
* @access public
*/
function PMA_PDF_setScale($scale = 1, $x_min = 0, $y_min = 0, $l_marg = -1, $t_marg = -1)
{
$this->scale = $scale;
$this->x_min = $x_min;
$this->y_min = $y_min;
if ($this->l_marg != -1) {
$this->l_marg = $l_marg;
}
if ($this->t_marg != -1) {
$this->t_marg = $t_marg;
}
} // end of the "PMA_PDF_setScale" function
/**
* Outputs a scaled cell
*
* @param double $ The cell width
* @param double $ The cell height
* @param string $ The text to output
* @param mixed $ Wether to add borders or not
* @param integer $ Where to put the cursor once the output is done
* @param string $ Align mode
* @param integer $ Whether to fill the cell with a color or not
* @access public
* @see FPDF::Cell()
*/
function PMA_PDF_cellScale($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = 0, $link = '')
{
$h = $h / $this->scale;
$w = $w / $this->scale;
$this->Cell($w, $h, $txt, $border, $ln, $align, $fill, $link);
} // end of the "PMA_PDF_cellScale" function
/**
* Draws a scaled line
*
* @param double $ The horizontal position of the starting point
* @param double $ The vertical position of the starting point
* @param double $ The horizontal position of the ending point
* @param double $ The vertical position of the ending point
* @access public
* @see FPDF::Line()
*/
function PMA_PDF_lineScale($x1, $y1, $x2, $y2)
{
$x1 = ($x1 - $this->x_min) / $this->scale + $this->l_marg;
$y1 = ($y1 - $this->y_min) / $this->scale + $this->t_marg;
$x2 = ($x2 - $this->x_min) / $this->scale + $this->l_marg;
$y2 = ($y2 - $this->y_min) / $this->scale + $this->t_marg;
$this->Line($x1, $y1, $x2, $y2);
} // end of the "PMA_PDF_lineScale" function
/**
* Sets x and y scaled positions
*
* @param do