1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-27 16:20:13 +02:00

Flexpanel and infopanel behavior now depends on "Apply dashboard preferences to all administrators" setting.

This commit is contained in:
lonalore
2016-11-11 13:44:20 +01:00
parent 6306963fd0
commit 106e186cb7
6 changed files with 198 additions and 99 deletions

View File

@@ -31,45 +31,78 @@ class adminstyle_infopanel
function __construct()
{
// e107::js('core','zrssfeed/jquery.zrssfeed.min.js'); // http://www.zazar.net/developers/jquery/zrssfeed/
$code = "
jQuery(function($){
$('#e-adminfeed').load('".e_ADMIN."admin.php?mode=core&type=feed');
$('#e-adminfeed-plugin').load('".e_ADMIN."admin.php?mode=addons&type=plugin');
$('#e-adminfeed-theme').load('".e_ADMIN."admin.php?mode=addons&type=theme');
});
";
global $user_pref; // quick fix.
$pref = e107::getPref();
";
e107::js('inline',$code,'jquery');
if (isset($_POST['submit-mye107']) || varset($_POST['submit-mymenus']))
{
$user_pref['core-infopanel-mye107'] = $_POST['e-mye107'];
$user_pref['core-infopanel-menus'] = $_POST['e-mymenus'];
save_prefs('user');
$this->savePref('core-infopanel-mye107', $_POST['e-mye107']);
$this->savePref('core-infopanel-menus', $_POST['e-mymenus']);
}
// $array_functions_assoc = e107::getNav()->adminLinks('assoc');
// $this->iconlist = array_merge($array_functions_assoc, e107::getNav()->pluginLinks(E_16_PLUGMANAGER, "array"));
$this->iconlist = e107::getNav()->adminLinks();
}
/**
* Save preferences.
*
* @param $key
* @param $value
*/
public function savePref($key, $value)
{
// Get "Apply dashboard preferences to all administrators" setting.
$adminPref = e107::getConfig()->get('adminpref', 0);
// If "Apply dashboard preferences to all administrators" is checked.
// Save as $pref.
if($adminPref == 1)
{
e107::getConfig()
->setPosted($key, $value)
->save();
}
// Save as $user_pref.
else
{
e107::getUser()
->getConfig()
->set($key, $value)
->save();
}
}
/**
* Get preferences.
*
* @return mixed
*/
public function getUserPref()
{
// Get "Apply dashboard preferences to all administrators" setting.
$adminPref = e107::getConfig()->get('adminpref', 0);
// If "Apply dashboard preferences to all administrators" is checked.
// Get $pref.
if($adminPref == 1)
{
$user_pref = e107::getPref();
}
// Get $user_pref.
else
{
$user_pref = e107::getUser()->getPref();
}
return $user_pref;
}
/**
* Allow to get Icon List.
@@ -79,7 +112,6 @@ class adminstyle_infopanel
return $this->iconlist;
}
function render()
{
$tp = e107::getParser();
@@ -129,33 +161,32 @@ class adminstyle_infopanel
';
*/
//TODO LANs throughout.
global $style, $user_pref;
$user_pref = $this->getUserPref();
// ---------------------- Start Panel --------------------------------
// $text = "<div >";
if (getperms('0') && !vartrue($user_pref['core-infopanel-mye107'])) // Set default icons.
if(empty(varset($user_pref['core-infopanel-mye107'], array()))) // 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'] = vartrue($pref['core-infopanel-default'],$defArray);
$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;
}
@@ -314,7 +345,7 @@ class adminstyle_infopanel
}
else
{
echo $frm->open('infopanel','post',e_SELF);
echo $frm->open('infopanel','post', e_SELF);
echo $this->render_infopanel_options(true);
echo $frm->close();
}
@@ -616,11 +647,32 @@ class adminstyle_infopanel
{
$frm = e107::getForm();
global $user_pref;
$user_pref = $this->getUserPref();
$text = "<div style='padding-left:20px'>";
if(empty(varset($user_pref['core-infopanel-mye107'], array()))) // 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;
}
foreach ($this->iconlist as $key=>$icon)
@@ -634,7 +686,7 @@ class adminstyle_infopanel
}
}
if (is_array($pluglist))
if (isset($pluglist) && is_array($pluglist))
{
foreach ($pluglist as $key=>$icon)
{
@@ -661,7 +713,7 @@ class adminstyle_infopanel
}
$frm = e107::getForm();
global $user_pref;
$user_pref = $this->getUserPref();
$text = "<div style='padding-left:20px'>";