diff --git a/php/includes/storage.php b/php/includes/storage.php index c671f0b..da140b4 100644 --- a/php/includes/storage.php +++ b/php/includes/storage.php @@ -46,6 +46,41 @@ return $result; } + public function getTopDeletions($page, $max) { + if(!$this->isConnected()) { + throw new StorageConnectionException(); + } + if($page < 1) { + $page = 1; + } + if($max < 1) { + $max = 1; + } + $q = $this->db->prepare('SELECT td.*, tq.question as question + FROM triviadelete td + INNER JOIN triviaquestion tq + ON tq.id=td.line_num + ORDER BY id DESC LIMIT :offset, :maxResults'); + $q->execute(array(':offset'=>($page-1) * $max, ':maxResults'=>$max)); + if ($q === false) { + throw new StorageSchemaException(); + } + $result = $q->fetchAll(); + return $result; + } + + public function getCountDeletions() { + if(!$this->isConnected()) { + throw new StorageConnectionException(); + } + $q = $this->db->query('SELECT count(id) FROM triviareport'); + if ($q === false) { + throw new StorageSchemaException(); + } + $result = $q->fetchColumn(); + return $result; + } + public function getTopReports($page, $max) { if(!$this->isConnected()) { throw new StorageConnectionException(); diff --git a/php/index.php b/php/index.php index 2bab2c4..8b3de83 100644 --- a/php/index.php +++ b/php/index.php @@ -66,7 +66,7 @@ try { } $storage->close(); ?> -
| Round # | @@ -98,6 +98,7 @@ try { +
|---|