heading for reported errors is only shown if there are already reported errors
authorrohieb <devnull@localhost>
Sun, 7 Sep 2008 14:29:11 +0000 (16:29 +0200)
committerrohieb <devnull@localhost>
Sun, 7 Sep 2008 14:29:11 +0000 (16:29 +0200)
inc/class_erErrorReportManager.inc
src/index.php

index 1536159..b3fd64d 100644 (file)
@@ -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 <tt>null</tt>. Call getLastError() to get more information.
index f02af6c..725a98d 100644 (file)
@@ -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("<p>%s</p>", _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("<p>%s</p>", _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 "<p />\n";
This page took 0.03482 seconds and 4 git commands to generate.