From 770566783b17f9fbaed1f6204c25256f6a6715fe Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 20 Dec 2006 01:45:21 +0000 Subject: [PATCH] Added the debug output to the Printer system --- PrinterRootElementPage.php | 78 ++++++++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 29 deletions(-) diff --git a/PrinterRootElementPage.php b/PrinterRootElementPage.php index a576754..a3c85a8 100644 --- a/PrinterRootElementPage.php +++ b/PrinterRootElementPage.php @@ -116,37 +116,21 @@ class BSPrinterRootElementPage extends BSPrinterRootElement */ public function paint() { - echo("\n"); - echo("language['langcode'] . "\" lang=\"" . $this->language['langcode'] . "\" dir=\"" . $this->language['direction'] . "\">\n"); - echo("\n\t" . sprintf(_('%1$s - %2$s'), BSRegister::GetApplication(), $this->title) . ""); - echo("\n\t"); - echo("\n\tstylesheet . "\" />"); - // echo $this->code; - echo("\n\n\n"); + echo "\n"; + echo "language['langcode'] . "\" lang=\"" . $this->language['langcode'] . "\" dir=\"" . $this->language['direction'] . "\">\n"; + echo "\n\t" . sprintf(_('%1$s - %2$s'), BSRegister::GetApplication(), $this->title) . ""; + echo "\n\t"; + echo "\n\tstylesheet . "\" />"; + echo "\n\n\n"; - if (BSRegister::GetType('PrinterNavigation') AND (!defined('ISSO_PRINTER_NO_NAVIGATION') OR (defined('ISSO_PRINTER_NO_NAVIGATION') AND constant('ISSO_PRINTER_NO_NAVIGATION') != true))) + if (BSRegister::GetType('PrinterNavigation') AND (!defined('ISSO_PRINTER_NO_NAVIGATION') OR !constant('ISSO_PRINTER_NO_NAVIGATION'))) { echo BSRegister::GetType('PrinterNavigation')->generate_header_html(); } - echo($this->_paintChildren()); + echo $this->_paintChildren(); - if (BSRegister::GetDebug() AND isset($_GET['query'])) - { - ob_clean(); - ob_end_clean(); - - if (is_array($this->registry->modules[ISSO_DB_LAYER]->history)) - { - foreach ($this->registry->modules[ISSO_DB_LAYER]->history AS $query) - { - echo $this->registry->modules[ISSO_DB_LAYER]->construct_query_debug($query); - } - } - exit; - } - - if (BSRegister::GetType('PrinterNavigation') AND (!defined('ISSO_PRINTER_NO_NAVIGATION') OR (defined('ISSO_PRINTER_NO_NAVIGATION') AND constant('ISSO_PRINTER_NO_NAVIGATION') != true))) + if (BSRegister::GetType('PrinterNavigation') AND (!defined('ISSO_PRINTER_NO_NAVIGATION') OR !constant('ISSO_PRINTER_NO_NAVIGATION'))) { echo BSRegister::GetType('PrinterNavigation')->generate_footer_html(); } @@ -155,13 +139,49 @@ class BSPrinterRootElementPage extends BSPrinterRootElement if (!defined('ISSO_PRINTER_HIDE_SETUP')) { - echo("\n$copyright"); - //echo $this->registry->construct_debug_block(false); + echo "\n$copyright"; + + echo "\n\n\n"; + + if (BSRegister::GetDebug()) + { + if (defined('SVN') AND preg_match('#^\$Id:?#', constant('SVN'))) + { + echo preg_replace('#\$' . 'Id: (.+?) ([0-9].+?) [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.+?) (.+?) \$#', "\n
\n" . '
\1 — r\2
', constant('SVN')); + } + + if (defined('ISSO_MT_START')) + { + echo "\n
Executed in " . round(BSFunctions::FetchMicrotimeDiff(ISSO_MT_START), 10) . ' seconds
'; + } + + echo "\n
" . BSRegister::GetDebugList() . "
\n"; + + if (BSRegister::GetType('Db')) + { + $queries = BSRegister::GetType('Db')->getHistory(); + + $table = new BSPrinterRootElementTable(); + $head = new BSPrinterTableElement(); + $head->addChild(new BSPrinterLabelElement('Query Debug')); + $head->setCssClass('thead'); + $table->addHeadingChild($head); + + foreach ($queries AS $query) + { + $tr = new BSPrinterTableElement(); + $tr->addChild(new BSPrinterLabelElement("\n\t\t\t" . $query['query'] . "\n\n\t\t\t
(" . $query['time'] . ")
\n\n\t\t")); + $table->addChild($tr); + } + + $table->setWidth('30%'); + + echo $table->paint(); + } + } } echo("\n\n\n"); - - // exit; } } -- 2.22.5