';
// What one are we rendering?
$context['cur_menu_id'] = isset($context['cur_menu_id']) ? $context['cur_menu_id'] + 1 : 1;
$menu_context = &$context['menu_data_' . $context['cur_menu_id']];
// For every section that appears on the sidebar...
$firstSection = true;
foreach ($menu_context['sections'] as $section)
{
// Show the section header - and pump up the line spacing for readability.
echo '
';
$firstSection = false;
}
// This is where the actual "main content" area for the admin section starts.
echo '
';
// If there are any "tabs" setup, this is the place to shown them.
if (!empty($context['tabs']) && empty($context['force_disable_tabs']))
template_generic_menu_tabs($menu_context);
}
// Part of the sidebar layer - closes off the main bit.
function template_generic_menu_sidebar_below()
{
global $context, $settings, $options;
echo '
';
}
// This contains the html for the side bar of the admin center, which is used for all admin pages.
function template_generic_menu_dropdown_above()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
// Which menu are we rendering?
$context['cur_menu_id'] = isset($context['cur_menu_id']) ? $context['cur_menu_id'] + 1 : 1;
$menu_context = &$context['menu_data_' . $context['cur_menu_id']];
echo '
';
// This is the main table - we need it so we can keep the content to the right of it.
echo '
';
// It's possible that some pages have their own tabs they wanna force...
if (!empty($context['tabs']))
template_generic_menu_tabs($menu_context);
}
// Part of the admin layer - used with admin_above to close the table started in it.
function template_generic_menu_dropdown_below()
{
global $context, $settings, $options;
echo '
';
}
// Some code for showing a tabbed view.
function template_generic_menu_tabs(&$menu_context)
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
// Handy shortcut.
$tab_context = &$menu_context['tab_data'];
echo '
';
// Exactly how many tabs do we have?
foreach ($context['tabs'] as $id => $tab)
{
// Can this not be accessed?
if (!empty($tab['disabled']))
{
$tab_context['tabs'][$id]['disabled'] = true;
continue;
}
// Did this not even exist - or do we not have a label?
if (!isset($tab_context['tabs'][$id]))
$tab_context['tabs'][$id] = array('label' => $tab['label']);
elseif (!isset($tab_context['tabs'][$id]['label']))
$tab_context['tabs'][$id]['label'] = $tab['label'];
// Has a custom URL defined in the main admin structure?
if (isset($tab['url']) && !isset($tab_context['tabs'][$id]['url']))
$tab_context['tabs'][$id]['url'] = $tab['url'];
// Any additional paramaters for the url?
if (isset($tab['add_params']) && !isset($tab_context['tabs'][$id]['add_params']))
$tab_context['tabs'][$id]['add_params'] = $tab['add_params'];
// Has it been deemed selected?
if (!empty($tab['is_selected']))
$tab_context['tabs'][$id]['is_selected'] = true;
// Does it have its own help?
if (!empty($tab['help']))
$tab_context['tabs'][$id]['help'] = $tab['help'];
// Is this the last one?
if (!empty($tab['is_last']) && !isset($tab_context['override_last']))
$tab_context['tabs'][$id]['is_last'] = true;
}
// Find the selected tab
foreach ($tab_context['tabs'] as $sa => $tab)
{
if (!empty($tab['is_selected']) || (isset($menu_context['current_subsection']) && $menu_context['current_subsection'] == $sa))
{
$selected_tab = $tab;
$tab_context['tabs'][$sa]['is_selected'] = true;
}
}
// Show an icon and/or a help item?
if (!empty($selected_tab['icon']) || !empty($tab_context['icon']) || !empty($selected_tab['help']) || !empty($tab_context['help']))
{
if (!empty($selected_tab['icon']) || !empty($tab_context['icon']))
echo '';
if (!empty($selected_tab['help']) || !empty($tab_context['help']))
echo '';
echo $tab_context['title'];
}
else
{
echo '
', $tab_context['title'];
}
echo '
';
// Shall we use the tabs?
if (!empty($settings['use_tabs']))
{
echo '
', !empty($selected_tab['description']) ? $selected_tab['description'] : $tab_context['description'], '
';
// The admin tabs.
echo '
';
}
// ...if not use the old style
else
{
echo '
';
// Print out all the items in this tab.
foreach ($tab_context['tabs'] as $sa => $tab)
{
if (!empty($tab['disabled']))
continue;
if (!empty($tab['is_selected']))
{
echo '
', $tab['label'], '';
}
else
echo '
', $tab['label'], '';
if (empty($tab['is_last']))
echo ' | ';
}
echo '
', isset($selected_tab['description']) ? $selected_tab['description'] : $tab_context['description'], '
';
}
}
?>