From 4adc0c15cd1d03c51b88bbd792aea3bb1e57ed09 Mon Sep 17 00:00:00 2001 From: Adnan Date: Thu, 15 Jul 2010 00:59:30 +0500 Subject: [PATCH] User Schema + pdf Relation Schema Class: Improved documentation --- .../schema/Pdf_Relation_Schema.class.php | 6 +- libraries/schema/User_Schema.class.php | 89 +++++++++++++++---- 2 files changed, 78 insertions(+), 17 deletions(-) diff --git a/libraries/schema/Pdf_Relation_Schema.class.php b/libraries/schema/Pdf_Relation_Schema.class.php index 286c81dfc5..9b88e382e5 100644 --- a/libraries/schema/Pdf_Relation_Schema.class.php +++ b/libraries/schema/Pdf_Relation_Schema.class.php @@ -483,7 +483,8 @@ class PMA_PDF extends TCPDF * Draws tables schema * */ -class Table_Stats { +class Table_Stats +{ /** * Defines properties */ @@ -1084,7 +1085,7 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema if (empty($filename)) { $filename = $pageNumber . '.pdf'; } - $pdf->Output($db . '_' . $filename, 'I'); // destination: Inline + $pdf->Output($db . '_' . $filename, 'D'); // destination: download } public function dataDictionaryDoc($alltables) @@ -1206,6 +1207,7 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema } else { $have_rel = false; } // end if + /** * Displays the comments of the table if MySQL >= 3.23 */ diff --git a/libraries/schema/User_Schema.class.php b/libraries/schema/User_Schema.class.php index 4aae7279e2..1e4151f7bf 100644 --- a/libraries/schema/User_Schema.class.php +++ b/libraries/schema/User_Schema.class.php @@ -60,7 +60,7 @@ class PMA_User_Schema case 'edcoord': $this->choosenPage = $_POST['chpage']; $this->c_table_rows = $_POST['c_table_rows']; - $this->editCoordinates($db, $cfgRelation); + $this->_editCoordinates($db, $cfgRelation); break; case 'deleteCrap': $this->_deleteTableRows($delrow,$cfgRelation,$db,$this->choosenPage); @@ -73,13 +73,14 @@ class PMA_User_Schema } // end if (isset($do)) } - + /** * shows/displays the HTML FORM to create the page * + * @param string db name of the selected database + * @return void * @access public */ - public function createPage($db) { ?> @@ -122,14 +123,14 @@ class PMA_User_Schema '; echo "\n" . '' . "\n\n"; } // end if - + $this->_deleteTables($db, $this->choosenPage, $tabExist); } @@ -325,6 +327,9 @@ class PMA_User_Schema * show Export relational schema generation options * user can select export type of his own choice * and the attributes related to it + * + * @return void + * @access public */ public function displaySchemaGenerationOptions() @@ -413,7 +418,11 @@ class PMA_User_Schema /** * Check if there are tables that need to be deleted in dashboard, * 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 */ 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, * if there are, ask the user for allowance + * + * @return void + * @access private */ - private function _displayScratchboardTables($array_sh_page,$draginit,$reset_draginit) { global $with_field_names,$cfg,$db; @@ -514,10 +525,14 @@ class PMA_User_Schema /** * 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 */ - private function _deleteTableRows($delrow,$cfgRelation,$db,$chpage) { foreach ($delrow as $current_row) { @@ -534,9 +549,9 @@ class PMA_User_Schema * get all the export options and verify * call and include the appropriate Schema Class depending on $export_type * + * @return void * @access private */ - private function _processExportSchema() { /** @@ -555,6 +570,15 @@ class PMA_User_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) { $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); } + /** + * 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) { $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); } + /** + * 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) { /* @@ -662,7 +704,16 @@ class PMA_User_Schema $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) { /* @@ -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++) { $arrvalue = 'c_table_' . $i;