mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 20:00:37 +02:00
More admin links cleanup and moving of arrays to e_navigation class
This commit is contained in:
@@ -161,9 +161,14 @@ if(!defined("ADLINK_COLS"))
|
||||
define("ADLINK_COLS",5);
|
||||
}
|
||||
|
||||
|
||||
// DEPRECATED
|
||||
function render_links($link, $title, $description, $perms, $icon = FALSE, $mode = FALSE)
|
||||
{
|
||||
|
||||
return e107::getNav()->renderAdminButton($link, $title, $description, $perms, $icon, $mode);
|
||||
|
||||
|
||||
/*
|
||||
global $td,$tp;
|
||||
$text = '';
|
||||
if (getperms($perms))
|
||||
@@ -230,6 +235,8 @@ function render_links($link, $title, $description, $perms, $icon = FALSE, $mode
|
||||
}
|
||||
}
|
||||
return $text;
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -248,32 +255,9 @@ function render_clean()
|
||||
}
|
||||
|
||||
|
||||
$newarray = asortbyindex($array_functions, 1);
|
||||
$array_functions_assoc = convert_core_icons($newarray);
|
||||
|
||||
|
||||
|
||||
function convert_core_icons($newarray) // Put core button array in the same format as plugin button array.
|
||||
{
|
||||
foreach($newarray as $key=>$val)
|
||||
{
|
||||
if(varset($val[0]))
|
||||
{
|
||||
$key = "e-".basename($val[0],".php");
|
||||
$val['icon'] = $val[5];
|
||||
$val['icon_32'] = $val[6];
|
||||
$val['title'] = $val[1];
|
||||
$val['link'] = $val[0];
|
||||
$val['caption'] = $val['2'];
|
||||
$val['perms'] = $val['3'];
|
||||
$array_functions_assoc[$key] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
return $array_functions_assoc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
require_once(e_ADMIN.'includes/'.$pref['adminstyle'].'.php');
|
||||
|
||||
|
@@ -35,7 +35,7 @@ if($_GET['mode'] == "e_advanced"){
|
||||
// $selection = array(21,11,17,24,5,19,7,27,28,25);
|
||||
foreach($selection as $id)
|
||||
{
|
||||
$buts .= render_links($newarray[$id][0],$newarray[$id][1],$newarray[$id][2],$newarray[$id][3],$newarray[$id][6],'beginner');
|
||||
$buts .= e107::renderAdminButton($newarray[$id][0],$newarray[$id][1],$newarray[$id][2],$newarray[$id][3],$newarray[$id][6],'beginner');
|
||||
}
|
||||
|
||||
$text .= $buts;
|
||||
|
@@ -24,7 +24,7 @@ $text = "<div style='text-align:center'>
|
||||
|
||||
while (list($key, $funcinfo) = each($newarray))
|
||||
{
|
||||
$text .= render_links($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[5], 'adminb');
|
||||
$text .= e107::renderAdminButton($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[5], 'adminb');
|
||||
}
|
||||
|
||||
$text .= "<tr>
|
||||
|
@@ -36,7 +36,7 @@ foreach ($admin_cat['id'] as $cat_key => $cat_id)
|
||||
{
|
||||
if ($funcinfo[4] == $cat_key)
|
||||
{
|
||||
$text_rend = render_links($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[5], 'default');
|
||||
$text_rend = e107::renderAdminButton($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[5], 'default');
|
||||
if ($text_rend)
|
||||
{
|
||||
$text_check = TRUE;
|
||||
@@ -47,7 +47,7 @@ foreach ($admin_cat['id'] as $cat_key => $cat_id)
|
||||
}
|
||||
else
|
||||
{
|
||||
$text_rend = render_links(e_ADMIN."plugin.php", ADLAN_98, ADLAN_99, "Z", E_16_PLUGMANAGER, 'default');
|
||||
$text_rend = e107::renderAdminButton(e_ADMIN."plugin.php", ADLAN_98, ADLAN_99, "Z", E_16_PLUGMANAGER, 'default');
|
||||
|
||||
$xml = e107::getXml();
|
||||
$xml->filter = array('@attributes' => FALSE,'administration' => FALSE); // .. and they're all going to need the same filter
|
||||
@@ -94,7 +94,7 @@ foreach ($admin_cat['id'] as $cat_key => $cat_id)
|
||||
ksort($plugin_array, SORT_STRING);
|
||||
foreach ($plugin_array as $plug_key => $plug_value)
|
||||
{
|
||||
$text_cat .= render_links($plug_value['link'], $plug_value['title'], $plug_value['caption'], $plug_value['perms'], $plug_value['icon'], 'default');
|
||||
$text_cat .= e107::renderAdminButton($plug_value['link'], $plug_value['title'], $plug_value['caption'], $plug_value['perms'], $plug_value['icon'], 'default');
|
||||
}
|
||||
}
|
||||
$text_cat .= render_clean();
|
||||
|
@@ -23,7 +23,7 @@ $buts = "";
|
||||
|
||||
while (list($key, $funcinfo) = each($newarray))
|
||||
{
|
||||
$buts .= render_links($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[6], "classis");
|
||||
$buts .= e107::renderAdminButton($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[6], "classis");
|
||||
}
|
||||
if($buts != "")
|
||||
{
|
||||
|
@@ -23,7 +23,7 @@ $text = "<div style='text-align:center'>
|
||||
<table style='".ADMIN_WIDTH."'>";
|
||||
$buts = "";
|
||||
while (list($key, $funcinfo) = each($newarray)) {
|
||||
$buts .= render_links($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[5], 'default');
|
||||
$buts .= e107::renderAdminButton($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[5], 'default');
|
||||
}
|
||||
$text .= $buts;
|
||||
while ($td <= 5) {
|
||||
|
@@ -24,7 +24,7 @@ $text = "<div style='text-align:center'>
|
||||
<table style='".ADMIN_WIDTH."'>";
|
||||
|
||||
while (list($key, $funcinfo) = each($newarray)) {
|
||||
$buts .= render_links($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[5], 'default');
|
||||
$buts .= e107::renderAdminButton($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[5], 'default');
|
||||
}
|
||||
$text .= $buts;
|
||||
|
||||
|
@@ -43,6 +43,8 @@ if (isset($_POST['submit-mye107']) || varset($_POST['submit-mymenus']))
|
||||
{
|
||||
$user_pref['core-infopanel-mye107'] = $pref['core-infopanel-default'];
|
||||
}
|
||||
|
||||
$array_functions_assoc = e107::getNav()->adminLinks('assoc');
|
||||
|
||||
$iconlist = array_merge($array_functions_assoc, e107::getNav()->pluginLinks(E_16_PLUGMANAGER, "array"));
|
||||
|
||||
@@ -62,7 +64,7 @@ if (isset($_POST['submit-mye107']) || varset($_POST['submit-mymenus']))
|
||||
{
|
||||
if (!vartrue($user_pref['core-infopanel-mye107']) || in_array($key, $user_pref['core-infopanel-mye107']))
|
||||
{
|
||||
$mainPanel .= render_links($val['link'], $val['title'], $val['caption'], $val['perms'], $val['icon_32'], "div-icon-only");
|
||||
$mainPanel .= e107::getNav()->renderAdminButton($val['link'], $val['title'], $val['caption'], $val['perms'], $val['icon_32'], "div-icon-only");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -49,7 +49,7 @@ foreach ($admin_cat['id'] as $cat_key => $cat_id)
|
||||
{
|
||||
if ($funcinfo[4] == $cat_key)
|
||||
{
|
||||
$text_rend = render_links($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[6], 'classis');
|
||||
$text_rend = e107::renderAdminButton($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[6], 'classis');
|
||||
if ($text_rend)
|
||||
{
|
||||
$text_check = TRUE;
|
||||
|
@@ -617,11 +617,11 @@ class e_navigation
|
||||
|
||||
}
|
||||
|
||||
|
||||
function adminLinks($sub=false)
|
||||
// Previously $array_functions variable.
|
||||
function adminLinks($mode=false)
|
||||
{
|
||||
|
||||
if($sub==true)
|
||||
if($mode=='sub')
|
||||
{
|
||||
|
||||
//FIXME array structure suitable for e_admin_menu - see shortcodes/admin_navigation.php
|
||||
@@ -694,19 +694,45 @@ class e_navigation
|
||||
38 => array(e_ADMIN.'comment.php', LAN_COMMENTMAN, LAN_COMMENTMAN, 'B', 5, E_16_COMMENT, E_32_COMMENT)
|
||||
);
|
||||
|
||||
if($mode == 'assoc')
|
||||
{
|
||||
$newarray = asortbyindex($array_functions, 1);
|
||||
$array_functions_assoc = $this->convert_core_icons($newarray);
|
||||
return $array_functions_assoc;
|
||||
}
|
||||
|
||||
return $array_functions;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function convert_core_icons($newarray) // Put core button array in the same format as plugin button array.
|
||||
{
|
||||
foreach($newarray as $key=>$val)
|
||||
{
|
||||
if(varset($val[0]))
|
||||
{
|
||||
$key = "e-".basename($val[0],".php");
|
||||
$val['icon'] = $val[5];
|
||||
$val['icon_32'] = $val[6];
|
||||
$val['title'] = $val[1];
|
||||
$val['link'] = $val[0];
|
||||
$val['caption'] = $val['2'];
|
||||
$val['perms'] = $val['3'];
|
||||
$array_functions_assoc[$key] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
return $array_functions_assoc;
|
||||
}
|
||||
|
||||
// Function renders all the plugin links according to the required icon size and layout style
|
||||
// - common to the various admin layouts such as infopanel, classis etc.
|
||||
function pluginLinks($iconSize = E_16_PLUGMANAGER, $linkStyle = 'adminb')
|
||||
{
|
||||
|
||||
global $sql, $tp;
|
||||
|
||||
$sql = e107::getDb();
|
||||
$tp = e107::getParser();
|
||||
|
||||
|
||||
$plug_id = array();
|
||||
$plugin_array = array();
|
||||
@@ -1041,6 +1067,96 @@ class e_navigation
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Previously admin.php -> render_links();
|
||||
function renderAdminButton($link, $title, $description, $perms, $icon = FALSE, $mode = FALSE)
|
||||
{
|
||||
global $td,$tp;
|
||||
$tp = e107::getParser();
|
||||
|
||||
|
||||
|
||||
$text = '';
|
||||
if (getperms($perms))
|
||||
{
|
||||
$description = strip_tags($description);
|
||||
if ($mode == 'adminb')
|
||||
{
|
||||
$text = "<tr><td class='forumheader3'>
|
||||
<div class='td' style='text-align:left; vertical-align:top; width:100%'
|
||||
onmouseover=\"eover(this, 'forumheader5')\" onmouseout=\"eover(this, 'td')\" onclick=\"document.location.href='".$link."'\">
|
||||
".$icon." <b>".$title."</b> ".($description ? "[ <span class='field-help'>".$description."</span> ]" : "")."</div></td></tr>";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if($mode != "div" && $mode != 'div-icon-only')
|
||||
{
|
||||
if ($td == (ADLINK_COLS+1))
|
||||
{
|
||||
$text .= '</tr>';
|
||||
$td = 1;
|
||||
}
|
||||
if ($td == 1)
|
||||
{
|
||||
$text .= '<tr>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch ($mode)
|
||||
{
|
||||
case 'default':
|
||||
$text .= "<td class='td' style='text-align:left; vertical-align:top; width:20%; white-space:nowrap'
|
||||
onmouseover=\"eover(this, 'forumheader5')\" onmouseout=\"eover(this, 'td')\" onclick=\"document.location.href='".$link."'\">".$icon." ".$tp->toHTML($title,FALSE,"defs, emotes_off")."</td>";
|
||||
break;
|
||||
|
||||
case 'classis':
|
||||
$text .= "<td style='text-align:center; vertical-align:top; width:20%'><a class='core-mainpanel-link-icon' href='".$link."' title='{$description}'>".$icon."</a><br />
|
||||
<a class='core-mainpanel-link-text' href='".$link."' title='{$description}'><b>".$tp->toHTML($title,FALSE,"defs, emotes_off")."</b></a><br /><br /></td>";
|
||||
break;
|
||||
|
||||
case 'beginner':
|
||||
$text .= "<td style='text-align:center; vertical-align:top; width:20%' ><a class='core-mainpanel-link-icon' href='".$link."' >".$icon."</a>
|
||||
<div style='padding:5px'>
|
||||
<a class='core-mainpanel-link-text' href='".$link."' title='".$description."'><b>".$tp->toHTML($title,FALSE,"defs, emotes_off")."</b></a></div><br /><br /><br /></td>";
|
||||
break;
|
||||
|
||||
case 'div':
|
||||
$text .= "<div class='core-mainpanel-block'><a class='core-mainpanel-link-icon e-tip' href='".$link."' title='{$description}'>".$icon."</a><br />
|
||||
<a class='core-mainpanel-link-text e-tip' href='".$link."' title='{$description}'>".$tp->toHTML($title,FALSE,"defs, emotes_off")."</a>
|
||||
</div>";
|
||||
break;
|
||||
|
||||
case 'div-icon-only':
|
||||
$text .= "<div class='core-mainpanel-block'><a class='core-mainpanel-link-icon e-tip' href='".$link."' title='{$description}'>".$icon."</a></div>";
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$td++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "no Perms";
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function frontend() //TODO equivalent for front-end sitelinks etc.
|
||||
|
Reference in New Issue
Block a user