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

tabbed content, hide left navigation

parent a68c3cc1
Branches
No related tags found
1 merge request!14Update renderer class
......@@ -582,6 +582,10 @@ class renderadminlte {
if($aLink['label']=='-'){
return '<div class="dropdown-divider"></div>';
}
// special menu entry: hamburger menu item (label is "=")
if($aLink['label']=='='){
return '<li class="nav-item"><a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a></li>';
}
$aChildren=isset($aLink['children']) && is_array($aLink['children']) && count($aLink['children']) ? $aLink['children'] : false;
......@@ -665,7 +669,7 @@ class renderadminlte {
* @return string
*/
public function getTopNavigation($aNavItems, $aUlOptions=['class'=>'navbar-nav']){
array_unshift($aNavItems, ['class'=>'nav-link', 'data-widget'=>'pushmenu', 'href'=>'#', 'role'=>'button', 'label'=>'<i class="fa-solid fa-bars"></i>']);
// array_unshift($aNavItems, ['class'=>'nav-link', 'data-widget'=>'pushmenu', 'href'=>'#', 'role'=>'button', 'label'=>'<i class="fa-solid fa-bars"></i>']);
return $this->addWrapper('ul', $aUlOptions, $this->getNavItems($aNavItems));
}
......@@ -1224,6 +1228,11 @@ class renderadminlte {
return $this->_tag('div', ['class'=>$sClass], $sContent.$sIcon.$sFooter);
}
// ----------------------------------------------------------------------
//
// PUBLIC FUNCTIONS :: CONTENT - FORM
//
// ----------------------------------------------------------------------
public function getHorizontalFormElement($sInput, $sLabel=false, $sId=false){
......@@ -1345,4 +1354,66 @@ class renderadminlte {
}
// ----------------------------------------------------------------------
//
// PUBLIC FUNCTIONS :: CONTENT - TABBED CONTENT
//
// ----------------------------------------------------------------------
/**
* return a box with tabbed content
* @param array $aOptions hash with keys for all options
* - tabs {array} key=tab label; value=content
* @retunr string|array
*/
public function getTabbedContent($aOptions, $asArray=false){
static $iTabCounter;
if( ! isset($aOptions['tabs']) || ! is_array($aOptions['tabs']) ){
return false;
}
static $iTabCounter;
if (!isset($iTabCounter)){
$iTabCounter=1;
} else {
$iTabCounter++;
}
$id='tab-content-'.$iTabCounter;
$iCounter=0;
$sTabs='';
$sContent='';
foreach($aOptions['tabs'] as $sLabel => $sTabContent){
$iCounter++;
$sTabId=$id.'-tabitem-'.$iCounter.'-tab';
$sContentId=$id.'-tabitem-'.$iCounter.'-content';
$sTabs.=$this->_tag('li', ['class'=>'nav-item'],
$this->_tag('a', [
'class'=>'nav-link'.($iCounter==1 ? ' active' : '' ),
'id'=>$sTabId,
'data-toggle'=>'tab',
'href'=>'#'.$sContentId,
'role'=>'tab',
'aria-controls'=>'custom-tabs-one-profile',
'aria-selected'=>($iCounter==1 ? true : false ),
],
$sLabel)
);
$sContent.=$this->_tag('div', [
'class'=>'tab-pane fade'.($iCounter==1 ? ' active show' : ''),
'id'=>$sContentId,
'role'=>'tabpanel',
'aria-labelledby'=>$sTabId,
], $sTabContent);
}
$sTabs=$this->_tag('ul', ['class'=>'nav nav-tabs', 'role'=>'tablist'], $sTabs);
$sContent=$this->_tag('div', ['class'=>'tab-content'], $sContent);
return $asArray
? ['tabs'=>$sTabs, 'content'=>$sContent]
: $sTabs . $sContent
;
}
}
<?php
// icons: https://fontawesome.com/v5/search?o=r&m=free
// icons: https://fontawesome.com/v6/search?o=r&m=free
return [
['label'=>'='],
['href'=>'/index.php', 'label'=>'MyHome' , 'icon'=>'fa-solid fa-home', 'class'=>'bg-gray'],
['href'=>'#', 'label'=>'Contact' ],
['href'=>'#', 'label'=>'Help',
......
......@@ -3,6 +3,7 @@
// icons: https://fontawesome.com/v5/search?o=r&m=free
return [
['label'=>'='],
['href'=>'/index.php', 'label'=>'MyHome' , 'icon'=>'fa-solid fa-home', 'class'=>'bg-gray'],
['href'=>'#', 'label'=>'Contact' ],
['href'=>'#', 'label'=>'Help',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment