]> git.joonet.de Git - adminer.git/commitdiff
New plugin: Display row numbers in select (fix #1106)
authorJakub Vrana <jakub@vrana.cz>
Thu, 19 Jun 2025 07:34:55 +0000 (09:34 +0200)
committerJakub Vrana <jakub@vrana.cz>
Thu, 19 Jun 2025 07:35:01 +0000 (09:35 +0200)
CHANGELOG.md
plugins/row-numbers.php [new file with mode: 0644]

index 168a8959e6cc8097075cb0189b8d736ad2cb17dc..dd7bc56a08c1e093d46da3cd57ef12349ea084a2 100644 (file)
@@ -13,6 +13,7 @@
 - PostgreSQL 11-: Avoid duplicate oid in table status (bug #1089)
 - Elasticsearch: Support dropping aliases
 - Plugins: Methods processList() and killProcess()
+- New plugin: Display row numbers in select (bug #1106)
 
 ## Adminer 5.3.0 (released 2025-05-04)
 - Align numeric functions right
diff --git a/plugins/row-numbers.php b/plugins/row-numbers.php
new file mode 100644 (file)
index 0000000..64cf4dc
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+
+/** Display row numbers in select
+* @link https://www.adminer.org/plugins/#use
+* @author Jakub Vrana, https://www.vrana.cz/
+* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
+*/
+class AdminerRowNumbers extends Adminer\Plugin {
+
+       function backwardKeys($table, $tableName) {
+               return array(1);
+       }
+
+       function backwardKeysPrint($backwardKeys, $row) {
+               static $n = $_GET["page"] * Adminer\adminer()->selectLimitProcess();
+               $n++;
+               echo "$n.\n";
+       }
+
+       protected $translations = array(
+               'cs' => array('' => 'Zobrazí čísla řádek ve výpisu'),
+       );
+}