1
0
mirror of https://github.com/e107inc/e107.git synced 2025-06-05 02:15:13 +02:00

Optimized Admin Control Panel code.

This commit is contained in:
Cameron 2019-01-15 08:55:34 -08:00
parent f727660ed9
commit 8c9e6f1370
3 changed files with 60 additions and 40 deletions

View File

@ -174,31 +174,16 @@ class adminstyle_flexpanel extends adminstyle_infopanel
$myE107 = varset($user_pref['core-infopanel-mye107'], array());
if(empty($myE107)) // Set default icons.
{
$defArray = array(
0 => 'e-administrator',
1 => 'e-cpage',
2 => 'e-frontpage',
3 => 'e-mailout',
4 => 'e-image',
5 => 'e-menus',
6 => 'e-meta',
7 => 'e-newspost',
8 => 'e-plugin',
9 => 'e-prefs',
10 => 'e-links',
11 => 'e-theme',
12 => 'e-userclass2',
13 => 'e-users',
14 => 'e-wmessage'
);
$user_pref['core-infopanel-mye107'] = $defArray;
$user_pref['core-infopanel-mye107'] = e107::getNav()->getDefaultAdminPanelArray();
}
$ns->setStyle('flexpanel');
$mainPanel = "<div id='core-infopanel_mye107'>";
$mainPanel .= "<div class='left'>";
foreach($this->iconlist as $key => $val)
{
if(empty($myE107) || in_array($key, $user_pref['core-infopanel-mye107']))
if(in_array($key, $user_pref['core-infopanel-mye107']))
{
$mainPanel .= e107::getNav()->renderAdminButton($val['link'], $val['title'], $val['caption'], $val['perms'], $val['icon_32'], "div");
}

View File

@ -229,28 +229,10 @@ class adminstyle_infopanel
$myE107 = varset($user_pref['core-infopanel-mye107'], array());
if(empty($myE107)) // Set default icons.
{
$defArray = array(
0 => 'e-administrator',
1 => 'e-cpage',
2 => 'e-frontpage',
3 => 'e-mailout',
4 => 'e-image',
5 => 'e-menus',
6 => 'e-meta',
7 => 'e-newspost',
8 => 'e-plugin',
9 => 'e-prefs',
10 => 'e-links',
11 => 'e-theme',
12 => 'e-userclass2',
13 => 'e-users',
14 => 'e-wmessage'
);
$user_pref['core-infopanel-mye107'] = $defArray;
$user_pref['core-infopanel-mye107'] = e107::getNav()->getDefaultAdminPanelArray();
}
// "<form method='post' action='".e_SELF."?".e_QUERY."'>";
$tp->parseTemplate("{SETSTYLE=core-infopanel}");
@ -266,7 +248,7 @@ class adminstyle_infopanel
foreach ($this->iconlist as $key=>$val)
{
if (empty($myE107) || in_array($key, $user_pref['core-infopanel-mye107']))
if (in_array($key, $user_pref['core-infopanel-mye107']))
{
$mainPanel .= e107::getNav()->renderAdminButton($val['link'], $val['title'], $val['caption'], $val['perms'], $val['icon_32'], "div");
}

View File

@ -945,6 +945,59 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; }
}
/**
* Return the default array of icon identifiers for the admin "Control Panel". (infopanel and flexpanel)
* @return array
*/
public function getDefaultAdminPanelArray()
{
$iconlist = $this->adminLinks();
$defArray = array();
$exclude = array (
'e-administrator',
'e-updateadmin',
'e-banlist',
'e-cache',
'e-comment',
'e-credits',
'e-db',
'e-docs',
'e-emoticon',
'e-users_extended',
'e-fileinspector',
'e-language',
'e-ugflag',
'e-notify',
'e-phpinfo',
'e-upload',
'e-cron',
'e-search',
'e-admin_log',
'e-eurl'
);
$count = 0;
foreach($iconlist as $k=>$v)
{
if($count === 20)
{
break;
}
if(!in_array($k,$exclude))
{
$defArray[] = $k;
$count++;
}
}
return $defArray;
}
private function convert_core_icons($newarray) // Put core button array in the same format as plugin button array.