From 6d878d2e40de75217aaa988256113a81b335e1a7 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch>
Date: Mon, 12 Dec 2022 11:53:35 +0100
Subject: [PATCH] update infobox: add shadow parameter

---
 public_html/classes/render-adminlte.class.php | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/public_html/classes/render-adminlte.class.php b/public_html/classes/render-adminlte.class.php
index a67afe5..fadb909 100755
--- a/public_html/classes/render-adminlte.class.php
+++ b/public_html/classes/render-adminlte.class.php
@@ -571,8 +571,12 @@ class renderadminlte {
      * https://adminlte.io/docs/3.2/components/boxes.html
      * 
      * @param type $aOptions  hash with keys for all options
+     *                        styling:
      *                          - type    - color of the box; one of [none]|danger|dark|info|primary|secondary|success|warning
-     *                          - bgcolor - background color of icon; use type OR bgcolor
+     *                          - iconbg  - background color or type of icon; use it for default type (type="")
+     *                          - shadow  - size of shadow; one of [none] (=default: between small and regular)|none|small|regular|large 
+     * 
+     *                        content
      *                          - icon    - icon class
      *                          - text    - information text
      *                          - number  - value (comes in bold text)
@@ -581,17 +585,25 @@ class renderadminlte {
      * @return string
      */
     public function getInfobox($aOptions){
-        $aOptions=$this->_ensureOptions($aOptions, ['type', 'bgcolor', 'icon', 'text', 'number', 'progressvalue', 'progresstext']);
+        $aOptions=$this->_ensureOptions($aOptions, ['type', 'bgcolor', 'shadow', 'icon', 'text', 'number', 'progressvalue', 'progresstext']);
+        $aShadows=[
+            'default'  => '',
+            'none'     => 'shadow-none',
+            'small'    => 'shadow-small',
+            'regular'  => 'shadow',
+            'large'    => 'shadow-lg',
+        ];
         // print_r($aOptions);
         $sClass='info-box'
                 .($aOptions['class'] ? ' '.$aOptions['class'] : '')
                 .($aOptions['type']  ? ' bg-'.$aOptions['type'] : '')
+                .($aOptions['shadow'] && isset($aShadows) && $aShadows[$aOptions['shadow']] ? ' '.$aShadows[$aOptions['shadow']] : '')
                 ;
         
         // build parts
         $sIcon=$aOptions['icon'] 
             ? $this->addWrapper("span", [
-                    'class'=>'info-box-icon'.($aOptions['bgcolor'] ? ' bg-'.$aOptions['bgcolor'] : '')
+                    'class'=>'info-box-icon'.($aOptions['iconbg'] ? ' bg-'.$aOptions['iconbg'] : '')
                 ], $this->_tag('i',['class'=>$aOptions['icon']])) 
             : ''
             ;
-- 
GitLab