From da360e8ea671f0d37287dd044693caffadd82304 Mon Sep 17 00:00:00 2001 From: rohieb Date: Sun, 7 Sep 2008 16:29:11 +0200 Subject: [PATCH] heading for reported errors is only shown if there are already reported errors --- inc/class_erErrorReportManager.inc | 9 +++++++++ src/index.php | 8 +++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/inc/class_erErrorReportManager.inc b/inc/class_erErrorReportManager.inc index 1536159..b3fd64d 100644 --- a/inc/class_erErrorReportManager.inc +++ b/inc/class_erErrorReportManager.inc @@ -135,6 +135,15 @@ class erErrorReportManager { * @name Quering * @{ */ + /** + * Get the number of reported errors + * @return int + */ + public function getNumErrorReports() { + $ar = pg_fetch_array(db_query("SELECT COUNT(*) AS count FROM mod_errorreporter;"), 0); + return intval($ar["count"]); + } + /** * Get all error reports in the database. * If this function fails, it returns null. Call getLastError() to get more information. diff --git a/src/index.php b/src/index.php index f02af6c..725a98d 100644 --- a/src/index.php +++ b/src/index.php @@ -122,9 +122,11 @@ if(($getAction == "submit" and $postSubmit == _("Insert"))) } // Show already existent (and visible) error reports -Title(_c("error-reporter:Reports that have already been submitted:")); -echo sprintf("

%s

", _c("error-reporter:These errors should not be resubmitted.")); -$view->printErrorReports($doc->getErrorReports(array(ER_ERM_SORT_DATE => ER_ERM_SORT_DESC))); +if($doc->getNumErrorReports() > 0) { + Title(_c("error-reporter:Reports that have already been submitted:")); + echo sprintf("

%s

", _c("error-reporter:These errors should not be resubmitted.")); + $view->printErrorReports($doc->getErrorReports(array(ER_ERM_SORT_DATE => ER_ERM_SORT_DESC))); +} // Form for submitting a new error report echo "

\n"; -- 2.20.1