1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Fixed tabbed admin interface

This commit is contained in:
Cameron
2013-02-25 17:15:46 -08:00
parent b1b9468c3e
commit 34472849af
3 changed files with 181 additions and 224 deletions

View File

@@ -16,73 +16,158 @@
if (!defined('e107_INIT')) { exit; }
$mes = e107::getMessage();
new tabbed;
$admin_cat = e107::getNav()->adminCats();
$text = "<div style='text-align:center'>
<div class='admintabs' id='tab-container'>
<ul class='e-tabs' id='core-emote-tabs'>";
foreach ($admin_cat['id'] as $cat_key => $cat_id)
{
// $text .= "<li id='tab-main_".$cat_key."' ><span style='white-space:nowrap'><img class='icon S16' src='".$admin_cat['img'][$cat_key]."' alt='' style='margin-right:3px' /><a href='#core-main_".$cat_key."'>".$admin_cat['title'][$cat_key]."</a></span></li>";
$text .= "<li id='tab-main_".$cat_key."' ><a href='#core-main_".$cat_key."'>".$admin_cat['title'][$cat_key]."</a></li>";
}
$text .= "</ul>";
foreach ($admin_cat['id'] as $cat_key => $cat_id)
class tabbed
{
$text_check = FALSE;
protected $links = array();
function __construct()
{
$core = e107::getNav()->adminLinks('assoc');
$plugs = e107::getNav()->pluginLinks(E_16_PLUGMANAGER, "array");
$this->links = array_merge($core,$plugs);
require_once(e_HANDLER."admin_handler.php");
$this->links = multiarray_sort($this->links,'title'); //XXX Move this function in e107_class?
$this->render();
}
function render()
{
$ns = e107::getRender();
$mes = e107::getMessage();
$admin_cat = e107::getNav()->adminCats();
$text_cat = "<div class='adminform' id='core-main_".$cat_key."'>
<div style='border:1px solid silver;margin:10px'>
<div class='main_caption bevel'><b>".$admin_cat['title'][$cat_key]."</b></div>
<table style='width:100%'>";
$text = "<div>";
$text .= "<ul class='nav nav-tabs'>";
foreach ($admin_cat['id'] as $cat_key => $cat_id)
{
$cls = ($cat_key == 1) ? "class='active'" : "";
$text .= "<li {$cls} ><a data-toggle='tab' href='#core-main-".$cat_key."'>".$admin_cat['title'][$cat_key]."</a></li>";
}
$text .= "</ul>";
// print_a($this->links);
$text .= "<div class='tab-content adminform'>";
foreach ($admin_cat['id'] as $id => $cat_id)
{
$cls = ($id == 1) ? "active" : "";
$text .= "<div class='tab-pane {$cls} adminform' style='width:95%' id='core-main-{$id}'>".$this->renderCat($id)."</div>";
}
$text .= "</div>";
$text .= "</div>";
$ns->tablerender(ADLAN_47." ".ADMINNAME, $mes->render().$text);
}
function renderCat($cat)
{
$text = "";
foreach($this->links as $val)
{
if($val['cat'] != $cat)
{
// echo "<br />".$funcinfo['cat']." != ".$cat;
continue;
}
$text .= e107::getNav()->renderAdminButton($val['link'], $val['title'], $val['caption'], $val['perms'], $val['icon_32'], "div");
}
return $text;
}
function render2()
{
$mes = e107::getMessage();
$admin_cat = e107::getNav()->adminCats();
$text = "<div class='center'>
<ul class='nav nav-tabs'>";
foreach ($admin_cat['id'] as $cat_key => $cat_id)
{
// $text .= "<li id='tab-main_".$cat_key."' ><span style='white-space:nowrap'><img class='icon S16' src='".$admin_cat['img'][$cat_key]."' alt='' style='margin-right:3px' /><a href='#core-main_".$cat_key."'>".$admin_cat['title'][$cat_key]."</a></span></li>";
$text .= "<li id='tab-main_".$cat_key."' ><a data-toggle='tab' href='#core-main_".$cat_key."'>".$admin_cat['title'][$cat_key]."</a></li>";
}
$text .= "</ul>";
$text .= "<div id='tab-content'>";
print_a($admin_cat);
foreach ($admin_cat['id'] as $cat_key => $cat_id)
{
$text_check = FALSE;
$text_cat = "";
if ($cat_key != 5) // Note the Plugin category.
{
foreach ($newarray as $key => $funcinfo)
{
if ($funcinfo[4] == $cat_key)
{
$text_rend = e107::getNav()->renderAdminButton($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[6], 'div');
if ($text_rend)
{
$text_check = TRUE;
}
$text_cat .= $text_rend;
}
}
}
else // Plugin category.
{
$text_rend = e107::getNav()->pluginLinks(E_32_PLUGMANAGER, "div");
if ($text_rend)
{
$text_check = TRUE;
}
$text_cat .= $text_rend;
}
//$text_cat .= render_clean();
if ($text_check)
{
$text .= "<div class='tab-pane adminform' id='core-main_".$cat_key."'>\n";
$text .= " <div class='main_caption bevel'><b>".$admin_cat['title'][$cat_key]."</b></div>";
$text .= $text_cat ;
$text .= "</div><!-- End tab-pane -->";
}
}
if ($cat_key != 5) // Note the Plugin category.
{
foreach ($newarray as $key => $funcinfo)
{
if ($funcinfo[4] == $cat_key)
{
$text_rend = e107::getNav()->renderAdminButton($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[6], 'classis');
if ($text_rend)
{
$text_check = TRUE;
}
$text_cat .= $text_rend;
}
}
}
else // Plugin category.
{
$text_rend = e107::getNav()->pluginLinks(E_32_PLUGMANAGER, "classis");
if ($text_rend)
{
$text_check = TRUE;
}
$text_cat .= $text_rend;
}
$text_cat .= render_clean();
$text_cat .= "</table></div>
</div>";
if ($text_check)
{
$text .= $text_cat;
}
$text .= "</div></div>";
$ns->tablerender(ADLAN_47." ".ADMINNAME, $mes->render().$text);
}
}
$text .= "</div></div>";
$ns->tablerender(ADLAN_47." ".ADMINNAME, $mes->render().$text);
?>