diff --git a/public_html/classes/render-adminlte.class.php b/public_html/classes/render-adminlte.class.php index 414026a9e216b7c3c788c875af3ae86d9302c528..960687a9e9fce3d9d557fb12590de2f87af7ff12 100755 --- a/public_html/classes/render-adminlte.class.php +++ b/public_html/classes/render-adminlte.class.php @@ -354,6 +354,47 @@ class renderadminlte { // ---------------------------------------------------------------------- + + /** + * return a alert box + * https://adminlte.io/themes/v3/pages/UI/general.html + * @param type $aOptions hash with keys for all options + * - type - one of [none]|danger|info|primary|success|warning + * - dismissible - if dismissible - one of true|false; default: false + * - title + * - text + * @return string + */ + public function getAlert($aOptions){ + foreach (array('type','dismissible', 'title', 'text') as $sKey){ + if(!isset($aOptions[$sKey])){ + $aOptions[$sKey]=false; + } + $this->_checkValue($sKey, $aOptions[$sKey]); + } + $aAlertIcons=[ + 'danger'=>'icon fas fa-ban', + 'info'=>'icon fas fa-info', + 'warning'=>'icon fas fa-exclamation-triangle', + 'success'=>'icon fas fa-check', + ]; + + $aElement=[ + 'class'=>'alert' + . ($aOptions['type'] ? ' alert-'.$aOptions['type'] : '') + . ($aOptions['dismissible'] ? ' alert-dismissible' : '') + , + 'label'=>'' + . ($aOptions['dismissible'] ? '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>' : '') + . $this->_oHtml->getTag('h5', [], + (isset($aAlertIcons[$aOptions['type']]) ? '<i class=""></i> ' : '') + .$aOptions['text'] + ) + ]; + + return $this->_oHtml->getTag('div', $aElement); + } + /** * get html code for a badge * @@ -472,11 +513,11 @@ class renderadminlte { $this->_checkValue($sKey, $aOptions[$sKey]); } - // css class prefixes + // css class prefixes based on "variant" value $aVariants=[ - 'default' => 'card-', - 'outline' => 'card-outline card-', - 'filled' => 'bg-', + 'default' => 'card-', + 'outline' => 'card-outline card-', + 'fill' => 'bg-', 'gradient' => 'bg-gradient-', ]; @@ -498,7 +539,6 @@ class renderadminlte { // merge all return $this->addWrapper('div', ['class'=>$sClass], $sCardHeader.$sCardBody.$sCardFooter); - } @@ -546,7 +586,7 @@ class renderadminlte { * - text * @return string */ - public function getAlert($aOptions){ + public function MIGRATED__getAlert($aOptions){ foreach (array('type','dismissible', 'title', 'text') as $sKey){ if(!isset($aOptions[$sKey])){ $aOptions[$sKey]=false;