Skip to content
Snippets Groups Projects
Commit 13e4c6ae authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

add getAlert()

parent b3f7269b
No related branches found
No related tags found
No related merge requests found
...@@ -354,6 +354,47 @@ class renderadminlte { ...@@ -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 * get html code for a badge
* *
...@@ -472,11 +513,11 @@ class renderadminlte { ...@@ -472,11 +513,11 @@ class renderadminlte {
$this->_checkValue($sKey, $aOptions[$sKey]); $this->_checkValue($sKey, $aOptions[$sKey]);
} }
// css class prefixes // css class prefixes based on "variant" value
$aVariants=[ $aVariants=[
'default' => 'card-', 'default' => 'card-',
'outline' => 'card-outline card-', 'outline' => 'card-outline card-',
'filled' => 'bg-', 'fill' => 'bg-',
'gradient' => 'bg-gradient-', 'gradient' => 'bg-gradient-',
]; ];
...@@ -498,7 +539,6 @@ class renderadminlte { ...@@ -498,7 +539,6 @@ class renderadminlte {
// merge all // merge all
return $this->addWrapper('div', ['class'=>$sClass], $sCardHeader.$sCardBody.$sCardFooter); return $this->addWrapper('div', ['class'=>$sClass], $sCardHeader.$sCardBody.$sCardFooter);
} }
...@@ -546,7 +586,7 @@ class renderadminlte { ...@@ -546,7 +586,7 @@ class renderadminlte {
* - text * - text
* @return string * @return string
*/ */
public function getAlert($aOptions){ public function MIGRATED__getAlert($aOptions){
foreach (array('type','dismissible', 'title', 'text') as $sKey){ foreach (array('type','dismissible', 'title', 'text') as $sKey){
if(!isset($aOptions[$sKey])){ if(!isset($aOptions[$sKey])){
$aOptions[$sKey]=false; $aOptions[$sKey]=false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment