User Schema + pdf Relation Schema Class: Improved documentation

This commit is contained in:
Adnan
2010-07-15 00:59:30 +05:00
parent 2ca3d4d8f4
commit 4adc0c15cd
2 changed files with 78 additions and 17 deletions

View File

@@ -483,7 +483,8 @@ class PMA_PDF extends TCPDF
* Draws tables schema * Draws tables schema
* *
*/ */
class Table_Stats { class Table_Stats
{
/** /**
* Defines properties * Defines properties
*/ */
@@ -1084,7 +1085,7 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
if (empty($filename)) { if (empty($filename)) {
$filename = $pageNumber . '.pdf'; $filename = $pageNumber . '.pdf';
} }
$pdf->Output($db . '_' . $filename, 'I'); // destination: Inline $pdf->Output($db . '_' . $filename, 'D'); // destination: download
} }
public function dataDictionaryDoc($alltables) public function dataDictionaryDoc($alltables)
@@ -1206,6 +1207,7 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
} else { } else {
$have_rel = false; $have_rel = false;
} // end if } // end if
/** /**
* Displays the comments of the table if MySQL >= 3.23 * Displays the comments of the table if MySQL >= 3.23
*/ */

View File

@@ -60,7 +60,7 @@ class PMA_User_Schema
case 'edcoord': case 'edcoord':
$this->choosenPage = $_POST['chpage']; $this->choosenPage = $_POST['chpage'];
$this->c_table_rows = $_POST['c_table_rows']; $this->c_table_rows = $_POST['c_table_rows'];
$this->editCoordinates($db, $cfgRelation); $this->_editCoordinates($db, $cfgRelation);
break; break;
case 'deleteCrap': case 'deleteCrap':
$this->_deleteTableRows($delrow,$cfgRelation,$db,$this->choosenPage); $this->_deleteTableRows($delrow,$cfgRelation,$db,$this->choosenPage);
@@ -77,9 +77,10 @@ class PMA_User_Schema
/** /**
* shows/displays the HTML FORM to create the page * shows/displays the HTML FORM to create the page
* *
* @param string db name of the selected database
* @return void
* @access public * @access public
*/ */
public function createPage($db) public function createPage($db)
{ {
?> ?>
@@ -127,9 +128,9 @@ class PMA_User_Schema
* shows/displays the created page names in a drop down list * shows/displays the created page names in a drop down list
* User can select any page number and edit it using dashboard etc * User can select any page number and edit it using dashboard etc
* *
* @return void
* @access public * @access public
*/ */
public function selectPage() public function selectPage()
{ {
global $db,$table,$query_default_option,$cfgRelation; global $db,$table,$query_default_option,$cfgRelation;
@@ -181,8 +182,9 @@ class PMA_User_Schema
* A dashboard is displayed to AutoLayout the position of tables * A dashboard is displayed to AutoLayout the position of tables
* users can drag n drop the tables and change their positions * users can drag n drop the tables and change their positions
* *
* @return void
* @access public
*/ */
public function showTableDashBoard() public function showTableDashBoard()
{ {
global $db,$cfgRelation,$table,$cfg,$with_field_names; global $db,$cfgRelation,$table,$cfg,$with_field_names;
@@ -325,6 +327,9 @@ class PMA_User_Schema
* show Export relational schema generation options * show Export relational schema generation options
* user can select export type of his own choice * user can select export type of his own choice
* and the attributes related to it * and the attributes related to it
*
* @return void
* @access public
*/ */
public function displaySchemaGenerationOptions() public function displaySchemaGenerationOptions()
@@ -413,7 +418,11 @@ class PMA_User_Schema
/** /**
* Check if there are tables that need to be deleted in dashboard, * Check if there are tables that need to be deleted in dashboard,
* if there are, ask the user for allowance * if there are, ask the user for allowance
* @param string $chpage selected page *
* @param string db name of database selected
* @param integer chpage selected page
* @param array tabExist
* @return void
* @access private * @access private
*/ */
private function _deleteTables($db, $chpage, $tabExist) private function _deleteTables($db, $chpage, $tabExist)
@@ -449,8 +458,10 @@ class PMA_User_Schema
/** /**
* Check if there are tables that need to be deleted in dashboard, * Check if there are tables that need to be deleted in dashboard,
* if there are, ask the user for allowance * if there are, ask the user for allowance
*
* @return void
* @access private
*/ */
private function _displayScratchboardTables($array_sh_page,$draginit,$reset_draginit) private function _displayScratchboardTables($array_sh_page,$draginit,$reset_draginit)
{ {
global $with_field_names,$cfg,$db; global $with_field_names,$cfg,$db;
@@ -515,9 +526,13 @@ class PMA_User_Schema
/** /**
* delete the table rows with table co-ordinates * delete the table rows with table co-ordinates
* *
* @param int delrow delete selected table from list of tables
* @param array cfgRelation relation settings
* @param string db database name
* @param integer chpage selected page for adding relations etc
* @return void
* @access private * @access private
*/ */
private function _deleteTableRows($delrow,$cfgRelation,$db,$chpage) private function _deleteTableRows($delrow,$cfgRelation,$db,$chpage)
{ {
foreach ($delrow as $current_row) { foreach ($delrow as $current_row) {
@@ -534,9 +549,9 @@ class PMA_User_Schema
* get all the export options and verify * get all the export options and verify
* call and include the appropriate Schema Class depending on $export_type * call and include the appropriate Schema Class depending on $export_type
* *
* @return void
* @access private * @access private
*/ */
private function _processExportSchema() private function _processExportSchema()
{ {
/** /**
@@ -555,6 +570,15 @@ class PMA_User_Schema
$obj_schema = eval("new PMA_".ucfirst($export_type)."_Relation_Schema();"); $obj_schema = eval("new PMA_".ucfirst($export_type)."_Relation_Schema();");
} }
/**
* delete X and Y coordinates
*
* @param string db The database name
* @param array cfgRelation relation settings
* @param integer choosePage selected page for adding relations etc
* @return void
* @access private
*/
public function deleteCoordinates($db, $cfgRelation, $choosePage, $query_default_option) public function deleteCoordinates($db, $cfgRelation, $choosePage, $query_default_option)
{ {
$query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) $query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
@@ -563,6 +587,15 @@ class PMA_User_Schema
PMA_query_as_controluser($query, FALSE, $query_default_option); PMA_query_as_controluser($query, FALSE, $query_default_option);
} }
/**
* delete pages
*
* @param string db The database name
* @param array cfgRelation relation settings
* @param integer choosePage selected page for adding relations etc
* @return void
* @access private
*/
public function deletePages($db, $cfgRelation, $choosePage, $query_default_option) public function deletePages($db, $cfgRelation, $choosePage, $query_default_option)
{ {
$query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages']) $query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
@@ -571,6 +604,15 @@ class PMA_User_Schema
PMA_query_as_controluser($query, FALSE, $query_default_option); PMA_query_as_controluser($query, FALSE, $query_default_option);
} }
/**
* process internal and foreign key relations
*
* @param string db The database name
* @param array cfgRelation relation settings
* @param integer pageNumber document number/Id
* @return void
* @access private
*/
public function processRelations($db, $pageNumber, $cfgRelation, $query_default_option) public function processRelations($db, $pageNumber, $cfgRelation, $query_default_option)
{ {
/* /*
@@ -662,7 +704,16 @@ class PMA_User_Schema
$this->choosenPage = $pageNumber; $this->choosenPage = $pageNumber;
} }
/**
* Add X and Y coordinates for a table
*
* @param string db The database name
* @param array cfgRelation relation settings
* @param integer pageNumber document number/Id
* @param array all_tables A list of all tables involved
* @return void
* @access private
*/
public function addRelationCoordinates($all_tables,$pageNumber,$db, $cfgRelation,$query_default_option) public function addRelationCoordinates($all_tables,$pageNumber,$db, $cfgRelation,$query_default_option)
{ {
/* /*
@@ -711,7 +762,15 @@ class PMA_User_Schema
} }
} }
public function editCoordinates($db, $cfgRelation) /**
* update X and Y coordinates for a table
*
* @param string db The database name
* @param array cfgRelation relation settings
* @return void
* @access private
*/
private function _editCoordinates($db, $cfgRelation)
{ {
for ($i = 0; $i < $this->c_table_rows; $i++) { for ($i = 0; $i < $this->c_table_rows; $i++) {
$arrvalue = 'c_table_' . $i; $arrvalue = 'c_table_' . $i;