diff --git a/public_html/classes/render-adminlte.class.php b/public_html/classes/render-adminlte.class.php index 33b9876a8883a206acce0deb7beb17968b598bc9..7de7e35ed0e6ce4e8477b025fef7e585627e488e 100755 --- a/public_html/classes/render-adminlte.class.php +++ b/public_html/classes/render-adminlte.class.php @@ -119,6 +119,14 @@ class renderadminlte { return true; } + /** + * helper function: a shortcut for $this->_oHtml->getTag + * @param string $sTag name of html tag + * @param array $aAttributes array of its attributes + */ + protected function _tag($sTag, $aAttributes){ + return $this->_oHtml->getTag($sTag, $aAttributes); + } // ---------------------------------------------------------------------- // // PUBLIC FUNCTIONS AdminLTE 3.2 @@ -147,7 +155,7 @@ class renderadminlte { */ public function addWrapper($sTag, $aOptions, $sContent){ $aOptions['label']=$sContent; - return $this->_oHtml->getTag($sTag, $aOptions)."\n"; + return $this->_tag($sTag, $aOptions)."\n"; } // ---------------------------------------------------------------------- @@ -189,7 +197,7 @@ class renderadminlte { ]); unset($aLink['children']); // remove from html attributes to draw } - $sReturn=$this->_oHtml->getTag('a', $aLink)."\n"; + $sReturn=$this->_tag('a', $aLink)."\n"; if($aChildren){ $iLevel++; $sReturn.=$this->addWrapper( @@ -284,7 +292,7 @@ class renderadminlte { $aLink['label']=$this->addWrapper('p', [], $aLink['label']); $sReturn.=$this->addWrapper( 'li', ['class'=>$aLiClass], - $this->_oHtml->getTag('a', $aLink).$sSubmenu + $this->_tag('a', $aLink).$sSubmenu )."\n"; } return $sReturn; @@ -378,6 +386,7 @@ 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 @@ -401,7 +410,7 @@ class renderadminlte { , 'label'=>'' . ($aOptions['dismissible'] ? '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>' : '') - . $this->_oHtml->getTag('h5', [ + . $this->_tag('h5', [ 'label'=> '' .(isset($aAlertIcons[$aOptions['type']]) ? '<i class="'.$aAlertIcons[$aOptions['type']].'"></i> ' : '') .$aOptions['title'] @@ -409,7 +418,7 @@ class renderadminlte { .$aOptions['text'] ]; - return $this->_oHtml->getTag('div', $aElement); + return $this->_tag('div', $aElement); } /** @@ -443,13 +452,14 @@ class renderadminlte { $aElement['title']=$aOptions['title']; $aElement['label']=$aOptions['text']; - return $this->_oHtml->getTag('span', $aElement); + return $this->_tag('span', $aElement); } /** * Get a button. * You can use any other key that are not named here. Those keys will be rendered * as additional html attributes without modification. + * https://adminlte.io/themes/v3/pages/UI/buttons.html * * <button type="button" class="btn btn-block btn-default">Default</button> * @param type $aOptions hash with keys for all options @@ -470,11 +480,12 @@ class renderadminlte { ; $aElement['label']=$aOptions['text'] ? $aOptions['text'] : ' '; unset($aElement['_infos']); - return $this->_oHtml->getTag('button', $aElement); + return $this->_tag('button', $aElement); } /** * get a callout (box with coloered left border; has type, title + text) + * https://adminlte.io/themes/v3/pages/UI/general.html * * @param type $aOptions hash with keys for all options * >> styling @@ -495,13 +506,14 @@ class renderadminlte { return $this->addWrapper( 'div', ['class'=>$sClass], - ($aOptions['title'] ? $this->_oHtml->getTag('h5', ['label'=>$aOptions['title']]) : '') - .($aOptions['text'] ? $this->_oHtml->getTag('p', ['label'=>$aOptions['text']]) : '') + ($aOptions['title'] ? $this->_tag('h5', ['label'=>$aOptions['title']]) : '') + .($aOptions['text'] ? $this->_tag('p', ['label'=>$aOptions['text']]) : '') ); } /** * get a card + * https://adminlte.io/docs/3.2/components/cards.html * * @param type $aOptions hash with keys for all options * >> styling @@ -538,21 +550,19 @@ class renderadminlte { // build parts of the card $sCardHeader=$this->addWrapper('div', ['class'=>'card-header'], - $this->_oHtml->getTag('h3', ['class'=>'card-title', 'label'=>$aOptions['title']]) - . ($aOptions['tools'] ? $this->_oHtml->getTag('div', ['class'=>'card-tools', 'label'=>$aOptions['tools']]) : '') + $this->_tag('h3', ['class'=>'card-title', 'label'=>$aOptions['title']]) + . ($aOptions['tools'] ? $this->_tag('div', ['class'=>'card-tools', 'label'=>$aOptions['tools']]) : '') ); - $sCardBody=$this->_oHtml->getTag('div', ['class'=>'card-body', 'label'=>$aOptions['text']]); - $sCardFooter=$aOptions['footer'] ? $this->_oHtml->getTag('div', ['class'=>'card-footer', 'label'=>$aOptions['footer']]) : ''; + $sCardBody=$this->_tag('div', ['class'=>'card-body', 'label'=>$aOptions['text']]); + $sCardFooter=$aOptions['footer'] ? $this->_tag('div', ['class'=>'card-footer', 'label'=>$aOptions['footer']]) : ''; // merge all return $this->addWrapper('div', ['class'=>$sClass], $sCardHeader.$sCardBody.$sCardFooter); } - - - + @@ -752,12 +762,12 @@ class renderadminlte { public function getMenuItem($aOptions, $aLinkOptions){ - $sLabel=$this->_oHtml->getTag('a', $aLinkOptions); + $sLabel=$this->_tag('a', $aLinkOptions); // TODO // if subelements then add them to $sLabel with recursion - return $this->_oHtml->getTag('li', array( + return $this->_tag('li', array( 'class'=>'treeview', 'label'=>$sLabel, ));