UPGRADE NOTE:
Do not edit or add to this file if you wish to upgrade AbanteCart to newer
versions in the future. If you wish to customize AbanteCart for your
needs please refer to http://www.AbanteCart.com for more information.
------------------------------------------------------------------------------*/
if (! defined ( 'DIR_CORE' )) {
header ( 'Location: static_pages/' );
}
//Possibly legacy and only for old template. Remove in 1.2
function renderStoreMenu( $menu, $level = 0 ){
$menu = (array)$menu;
$result = '';
if ( $level ) $result .= "
\r\n";
return $result;
}
//New menu tree builder (1.2+)
function buildStoreFrontMenuTree( $menu_array, $level = 0 ){
$menu_array = (array)$menu_array;
if (!$menu_array) {
return '';
}
$result = '';
//for submenus build new UL node
if ( $level > 0 ) $result .= "\r\n";
return $result;
}
function renderAdminMenu( $menu, $level = 0, $current_rt = ''){
$result = '';
if ( $level ) $result .= "\r\n";
foreach( $menu as $item ) {
$id = ( empty($item['id']) ? '' : ' id="menu_'.$item['id'].'" ' ); // li ID
$class = $level != 0 ? empty($item['children']) ? '' : ' class="parent" ' : ' class="top" '; //a class
$href = empty($item['href']) ? '' : ' href="'.$item['href'].'" '; //a href
$onclick = empty($item['onclick']) ? '' : ' onclick="'.$item['onclick'].'" '; //a href
$child_class = "level$level ";
if ( !empty($item['children']) ) $child_class .= 'nav-parent ';
if ( $item['rt'] && $current_rt == $item['rt'] ) $child_class .= 'active ';
if ( $child_class ) $child_class = ' class="'.$child_class.'"';
$result .= '- ';
$result .= '';
//check icon rl type html, image or none.
if ( is_html( $item['icon'] ) ) {
$result .= $item['icon'];
} else if ($item['icon']) {
$result .= '';
} else {
$result .= ' ';
}
$result .= '';
//if children build inner clild trees
if ( !empty($item['children']) ) $result .= "\r\n" . renderAdminMenu($item['children'], $level+1, $current_rt);
$result .= "
\r\n";
}
if ( $level ) $result .= "
\r\n";
return $result;
}