From bf1149e921158001f60619d4a80552bec445ff0a Mon Sep 17 00:00:00 2001 From: Luca Date: Tue, 8 Mar 2022 17:00:26 +0100 Subject: [PATCH] Badge count per record plugin --- include/top.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/include/top.php b/include/top.php index 6cf5eb920..2c674f86d 100755 --- a/include/top.php +++ b/include/top.php @@ -502,12 +502,28 @@ if (Auth::check()) { '; // Tab dei plugin - $plugins = $dbo->fetchArray('SELECT id, title FROM zz_plugins WHERE idmodule_to='.prepare($id_module)." AND position='tab' AND enabled = 1 ORDER BY zz_plugins.order DESC"); + $plugins = $dbo->fetchArray('SELECT id, title, options, options2 FROM zz_plugins WHERE idmodule_to='.prepare($id_module)." AND position='tab' AND enabled = 1 ORDER BY zz_plugins.order DESC"); foreach ($plugins as $plugin) { + + + //Badge count per record plugin + $count = 0; + if (!empty($plugin['options2'])){ + $opt = json_decode($plugin['options2'], true); + }else{ + $opt = json_decode($plugin['options'], true); + } + + if (!empty($opt)){ + $q = str_replace('|id_parent|', $id_record, $opt['main_query'][0]['query']); + $count = $dbo->fetchNum($q); + } + echo '
  • '.$plugin['title'].' + '.($count>0 ? $count: '').'
  • '; }