From 015f30be5b3da9e3e109d47e49cfdf4b584dadd7 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Mon, 4 May 2015 10:15:06 -0400 Subject: [PATCH] Refactor _setDisplayParts() due to excessive method length Signed-off-by: Marc Delisle --- libraries/DisplayResults.class.php | 40 ++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/libraries/DisplayResults.class.php b/libraries/DisplayResults.class.php index 8379180f4d..80d55909c2 100644 --- a/libraries/DisplayResults.class.php +++ b/libraries/DisplayResults.class.php @@ -402,6 +402,32 @@ class PMA_DisplayResults } // end of the 'setProperties()' function + + /** + * Defines the parts to display for a print view + * + * @param array $displayParts the parts to display + * + * @return array $displayParts the modified display parts + * + * @access private + * + */ + private function _setDisplayPartsForPrintView($displayParts) + { + // set all elements to false! + $displayParts['edit_lnk'] = self::NO_EDIT_OR_DELETE; // no edit link + $displayParts['del_lnk'] = self::NO_EDIT_OR_DELETE; // no delete link + $displayParts['sort_lnk'] = (string) '0'; + $displayParts['nav_bar'] = (string) '0'; + $displayParts['ins_row'] = (string) '0'; + $displayParts['bkm_form'] = (string) '0'; + $displayParts['text_btn'] = (string) '0'; + $displayParts['pview_lnk'] = (string) '0'; + + return $displayParts; + } + /** * Defines the parts to display for a SHOW statement * @@ -480,17 +506,9 @@ class PMA_DisplayResults $fields_meta = $this->__get('fields_meta'); $printview = $this->__get('printview'); - // 2. Updates the display mode - if (isset($printview) && ($printview == '1')) { - // 2.0 Print view -> set all elements to false! - $displayParts['edit_lnk'] = self::NO_EDIT_OR_DELETE; // no edit link - $displayParts['del_lnk'] = self::NO_EDIT_OR_DELETE; // no delete link - $displayParts['sort_lnk'] = (string) '0'; - $displayParts['nav_bar'] = (string) '0'; - $displayParts['ins_row'] = (string) '0'; - $displayParts['bkm_form'] = (string) '0'; - $displayParts['text_btn'] = (string) '0'; - $displayParts['pview_lnk'] = (string) '0'; + // 2. Updates the display parts + if ($printview == '1') { + $displayParts = $this->_setDisplayPartsForPrintView($displayParts); } elseif ($this->__get('is_count') || $this->__get('is_analyse') || $this->__get('is_maint') || $this->__get('is_explain')