Pdf Schema Class: Reduce global variables + added attributes in Export Relation Schema

This commit is contained in:
Adnan
2010-07-09 15:15:49 +05:00
parent 07cee82af6
commit 79c6f847fd
2 changed files with 678 additions and 621 deletions

View File

@@ -9,8 +9,9 @@
/** /**
* This class is inherited by all schema classes * This class is inherited by all schema classes
* It contains those methods which are common in them * It contains those methods which are common in them
* it works like factory pattern
* *
* @name * @name Export Relation Schema
* @author Muhammad Adnan <hiddenpearls@gmail.com> * @author Muhammad Adnan <hiddenpearls@gmail.com>
* @copyright * @copyright
* @license * @license
@@ -18,52 +19,95 @@
class PMA_Export_Relation_Schema class PMA_Export_Relation_Schema
{ {
private $_pageTitle; // Title of the page private $_pageTitle; // Title of the page
private $_autoLayoutType; // Internal or Foreign Key Relations; //protected $sameWide;
protected $same_wide; public $showGrid;
public $showColor;
public $tableDimension;
public $sameWide;
public $withDoc;
public $showKeys;
public $orientation;
public $paper;
public $pageNumber;
public function setPageTitle($title) public function setPageNumber($value)
{ {
$this->_pageTitle=$title; $this->pageNumber = isset($value) ? $value : 1;
} }
public function setExportType($type) public function setShowGrid($value)
{ {
$this->_pageTitle=$title; $this->showGrid = (isset($value) && $value == 'on') ? 1 : 0;
} }
public function setSameWidthTables($width) public function setShowColor($value)
{ {
$this->same_wide=$width; $this->showColor = (isset($value) && $value == 'on') ? 1 : 0;
} }
public function getAllTables($db,$page_number) public function setTableDimension($value)
{ {
global $cfgRelation; $this->tableDimension = (isset($value) && $value == 'on') ? 1 : 0;
// Get All tables }
public function setAllTableSameWidth($value)
{
$this->sameWide = (isset($value) && $value == 'on') ? 1 : 0;
}
public function setWithDataDictionary($value)
{
$this->withDoc = (isset($value) && $value == 'on') ? 1 : 0;
}
public function setShowKeys($value)
{
$this->showKeys = (isset($value) && $value == 'on') ? 1 : 0;
}
public function setOrientation($value)
{
$this->orientation = (isset($value) && $value == 'P') ? 'P' : 'L';
}
public function setPaper($value)
{
$this->paper = isset($value) ? $value : 'A4';
}
public function setPageTitle($title)
{
$this->_pageTitle=$title;
}
public function setExportType($value)
{
$this->exportType=$value;
}
public function getAllTables($db,$pageNumber)
{
global $cfgRelation;
// Get All tables
$tab_sql = 'SELECT table_name FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) $tab_sql = 'SELECT table_name FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND pdf_page_number = ' . $page_number; . ' AND pdf_page_number = ' . $pageNumber;
// echo $tab_sql; // echo $tab_sql;
$tab_rs = PMA_query_as_controluser($tab_sql, null, PMA_DBI_QUERY_STORE); $tab_rs = PMA_query_as_controluser($tab_sql, null, PMA_DBI_QUERY_STORE);
if (!$tab_rs || !PMA_DBI_num_rows($tab_rs) > 0) { if (!$tab_rs || !PMA_DBI_num_rows($tab_rs) > 0) {
$this->_die('',__('No tables')); $this->_die('',__('No tables'));
} while ($curr_table = @PMA_DBI_fetch_assoc($tab_rs)) { }
while ($curr_table = @PMA_DBI_fetch_assoc($tab_rs)) {
$alltables[] = PMA_sqlAddslashes($curr_table['table_name']); $alltables[] = PMA_sqlAddslashes($curr_table['table_name']);
} }
return $alltables; return $alltables;
} }
public function initTable() /**
{
}
/**
* Displays an error message * Displays an error message
*/ */
function _die($type = '',$error_message = '') function dieSchema($type = '',$error_message = '')
{ {
global $db; global $db;
@@ -82,6 +126,6 @@ class PMA_Export_Relation_Schema
echo "\n"; echo "\n";
require_once './libraries/footer.inc.php'; require_once './libraries/footer.inc.php';
} // end of the "PMA_PDF_die()" function }
} }
?> ?>

File diff suppressed because it is too large Load Diff