Skip to content

Commit

Permalink
Support collection of custom stats in admin stats module
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Babker committed Jun 19, 2016
1 parent b982eec commit f321fe2
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions administrator/modules/mod_stats_admin/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,26 @@ public static function getStats(&$params)
$rows[$i]->title = JText::_('MOD_STATS_ARTICLES_VIEW_HITS');
$rows[$i]->icon = 'eye';
$rows[$i]->data = number_format($hits + $increase, 0, JText::_('DECIMALS_SEPARATOR'), JText::_('THOUSANDS_SEPARATOR'));
$i++;
}
}

// Include additional data defined by published system plugins
JPluginHelper::importPlugin('system');

$app = JFactory::getApplication();
$arrays = (array) $app->triggerEvent('onGetStats', array('mod_stats_admin'));

foreach ($arrays as $row)
{
// We only add a row if the title and data are given
if (isset($row['title']) && isset($row['data']))
{
$rows[$i] = new stdClass;
$rows[$i]->title = $row['title'];
$rows[$i]->icon = isset($row['icon']) ? $row['icon'] : 'info';
$rows[$i]->data = $row['data'];
$i++;
}
}

Expand Down

0 comments on commit f321fe2

Please sign in to comment.