From: rohieb Date: Sun, 7 Sep 2008 14:29:11 +0000 (+0200) Subject: heading for reported errors is only shown if there are already reported errors X-Git-Tag: REL_8.09.13~8 X-Git-Url: https://git.rohieb.name/iserv-mod-error-reporter.git/commitdiff_plain/da360e8ea671f0d37287dd044693caffadd82304 heading for reported errors is only shown if there are already reported errors --- 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";