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

Improved infopanel dashboard integration with e_dashboard addon. Charts now supports additional types.

This commit is contained in:
Cameron 2017-04-07 16:31:22 -07:00
parent abb7f66dd7
commit ca1fd4c40c
4 changed files with 80 additions and 54 deletions

View File

@ -140,18 +140,18 @@ class adminstyle_flexpanel extends adminstyle_infopanel
// "Help" box.
$tp->parseTemplate("{SETSTYLE=flexpanel}");
$ns->setStyle('flexpanel');
$ns->setUniqueId('core-infopanel_help');
$info = $this->getMenuPosition('core-infopanel_help');
$panels[$info['area']][$info['weight']] .= $tp->parseTemplate('{ADMIN_HELP}', true, $admin_sc);
// "Latest" box.
$tp->parseTemplate("{SETSTYLE=flexpanel}");
$ns->setStyle('flexpanel');
$info = $this->getMenuPosition('e-latest-list');
$panels[$info['area']][$info['weight']] .= $tp->parseTemplate('{ADMIN_LATEST=infopanel}', true, $admin_sc);
// "Status" box.
$tp->parseTemplate("{SETSTYLE=flexpanel}");
$ns->setStyle('flexpanel');
$info = $this->getMenuPosition('e-status-list');
$panels[$info['area']][$info['weight']] .= $tp->parseTemplate('{ADMIN_STATUS=infopanel}', true, $admin_sc);
@ -179,7 +179,7 @@ class adminstyle_flexpanel extends adminstyle_infopanel
);
$user_pref['core-infopanel-mye107'] = $defArray;
}
$tp->parseTemplate("{SETSTYLE=flexpanel}");
$ns->setStyle('flexpanel');
$mainPanel = "<div id='core-infopanel_mye107'>";
$mainPanel .= "<div class='left'>";
foreach($this->iconlist as $key => $val)
@ -191,7 +191,7 @@ class adminstyle_flexpanel extends adminstyle_infopanel
}
$mainPanel .= "</div></div>";
// Rendering the saved configuration.
$tp->parseTemplate("{SETSTYLE=flexpanel}");
$ns->setStyle('flexpanel');
$caption = $tp->lanVars(LAN_CONTROL_PANEL, ucwords(USERNAME));
$ns->setUniqueId('core-infopanel_mye107');
$coreInfoPanelMyE107 = $ns->tablerender($caption, $mainPanel, "core-infopanel_mye107", true);
@ -204,7 +204,7 @@ class adminstyle_flexpanel extends adminstyle_infopanel
$newsTabs['coreFeed'] = array('caption' => LAN_GENERAL, 'text' => "<div id='e-adminfeed' style='min-height:300px'></div><div class='right'><a rel='external' href='" . ADMINFEEDMORE . "'>" . LAN_MORE . "</a></div>");
$newsTabs['pluginFeed'] = array('caption' => LAN_PLUGIN, 'text' => "<div id='e-adminfeed-plugin'></div>");
$newsTabs['themeFeed'] = array('caption' => LAN_THEMES, 'text' => "<div id='e-adminfeed-theme'></div>");
$tp->parseTemplate("{SETSTYLE=flexpanel}");
$ns->setStyle('flexpanel');
$ns->setUniqueId('core-infopanel_news');
$coreInfoPanelNews = $ns->tablerender(LAN_LATEST_e107_NEWS, e107::getForm()->tabs($newsTabs, array('active' => 'coreFeed')), "core-infopanel_news", true);
$info = $this->getMenuPosition('core-infopanel_news');
@ -212,7 +212,7 @@ class adminstyle_flexpanel extends adminstyle_infopanel
// --------------------- Website Status ---------------------------
$tp->parseTemplate("{SETSTYLE=flexpanel}");
$ns->setStyle('flexpanel');
$ns->setUniqueId('core-infopanel_website_status');
$coreInfoPanelWebsiteStatus = $ns->tablerender(LAN_WEBSITE_STATUS, $this->renderWebsiteStatus(), "core-infopanel_website_status", true);
$info = $this->getMenuPosition('core-infopanel_website_status');
@ -224,7 +224,7 @@ class adminstyle_flexpanel extends adminstyle_infopanel
// --------------------- Add-on updates ---------------------------
$tp->parseTemplate("{SETSTYLE=flexpanel}");
$ns->setStyle('flexpanel');
$ns->setUniqueId('e-addon-updates');
$addonUpdates = $tp->parseTemplate("{ADMIN_ADDON_UPDATES}", true, $admin_sc);
$info = $this->getMenuPosition('e-addon-updates');
@ -234,7 +234,7 @@ class adminstyle_flexpanel extends adminstyle_infopanel
// --------------------- User Selected Menus ----------------------
if(varset($user_pref['core-infopanel-menus']))
{
$tp->parseTemplate("{SETSTYLE=flexpanel}");
$ns->setStyle('flexpanel');
foreach($user_pref['core-infopanel-menus'] as $val)
{
// Custom menu.

View File

@ -192,7 +192,7 @@ class adminstyle_infopanel
// "<form method='post' action='".e_SELF."?".e_QUERY."'>";
$tp->parseTemplate("{SETSTYLE=core-infopanel}");
// Personalized Panel
// Rendering the saved configuration.
@ -238,6 +238,9 @@ class adminstyle_infopanel
</div>";
$caption = $tp->lanVars(LAN_CONTROL_PANEL, ucwords(USERNAME));
$text3 = $this->renderAddonDashboards();
$text = $ns->tablerender($caption, $mainPanel, "core-infopanel_mye107",true);
@ -261,7 +264,9 @@ class adminstyle_infopanel
$text2 .= $ns->tablerender(LAN_WEBSITE_STATUS, $this->renderWebsiteStatus(),"",true);
$text3 .= $ns->tablerender(LAN_WEBSITE_STATUS, $this->renderWebsiteStatus(),"",true);
// $text .= $ns->tablerender(ADLAN_LAT_1,$tp->parseTemplate("{ADMIN_LATEST=norender}"),"core-infopanel_latest",true);
@ -326,7 +331,17 @@ class adminstyle_infopanel
// $ns->tablerender(ADLAN_47." ".ADMINNAME, $emessage->render().$text);
echo $mes->render().'
<!-- INFOPANEL -->
<div class="row">
<div class="span6 col-md-12">
'.$text3.'
</div>
</div>
<div class="row">
<div class="span6 col-md-6">
'.$text.'
@ -359,10 +374,10 @@ class adminstyle_infopanel
{
return $this->renderStats('log');
}
elseif(e107::isInstalled('awstats'))
/* elseif(e107::isInstalled('awstats'))
{
return $this->renderStats('awstats');
}
}*/
else
{
return $this->renderStats('demo');
@ -374,53 +389,60 @@ class adminstyle_infopanel
function renderWebsiteStatus()
{
$tp = e107::getParser();
/*
// Settings button if needed.
<div class="tab-header">
<span class="pull-right">
<span class="options">
<div class="btn-group">
<a class="dropdown-toggle" data-toggle="dropdown"><i class="icon-cog"></i></a>
<ul class="dropdown-menu black-box-dropdown dropdown-left">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div>
</span>
</span>
</div>
*/
$tab = array();
$tab['e-stats'] = array('caption'=>$tp->toGlyph('fa-signal').' '.LAN_STATS, 'text'=>$this->renderChart());
$tab['e-online'] = array('caption'=>$tp->toGlyph('fa-user').' '.LAN_ONLINE.' ('.$this->renderOnlineUsers('count').')', 'text'=>$this->renderOnlineUsers());
if($plugs = e107::getAddonConfig('e_dashboard',null, 'chart'))
{
foreach($plugs as $plug => $val)
{
foreach($val as $item)
{
if(!empty($item))
{
$tab[] = $item;
}
}
}
}
return e107::getForm()->tabs($tab);
}
function renderAddonDashboards()
{
$panel = array();
$ns = e107::getRender();
$text = '';
if($plugs = e107::getAddonConfig('e_dashboard',null, 'chart'))
{
foreach($plugs as $plug => $val)
{
foreach($val as $k=>$item)
{
if(!empty($item))
{
// $var[] = $item;
$renderMode = 'plug-infopanel-'.$plug;
if(isset($item[$k]['text']))
{
foreach ($item as $key => $v) // make sure the ids are unique.
{
$newkey = eHelper::dasherize($plug.'-'.$k.'-'.$key);
$item[$newkey] = $v;
unset($item[$key]);
}
$t = e107::getForm()->tabs($item);
$cap = defset('LAN_PLUGIN_'.strtoupper($plug).'_NAME', ucfirst($plug));
$text .= $ns->tablerender($cap, $t, $renderMode, true);
}
else
{
$text .= $ns->tablerender($item['caption'], $item['text'], $renderMode, true);
}
}
}
}
}
return $text;
}
function renderOnlineUsers($data=false)
@ -749,7 +771,7 @@ class adminstyle_infopanel
private function getStats($type)
{
/*
if(file_exists(e_PLUGIN."awstats/awstats.graph.php"))
{
@ -764,7 +786,7 @@ class adminstyle_infopanel
// return;
}
if($type == 'demo')
*/ if($type == 'demo')
{
$data = array();

View File

@ -419,13 +419,17 @@ class e_chart
{
case 'bar':
//
$js .= "var chart = new google.visualization.BarChart(document.getElementById('".$id."')); ";
break;
case 'column':
$js .= "var chart = new google.visualization.ColumnChart(document.getElementById('".$id."')); ";
break;
case 'geo':
$js .= "var chart = new google.visualization.GeoChart(document.getElementById('".$id."')); ";
break;
case 'polar':
//TODO

View File

@ -1800,7 +1800,7 @@ class e107
*/
public static function getChart()
{
return self::getSingleton('e_chart', true);
return self::getObject('e_chart', null, true);
}