diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2017-05-10 06:14:16 +0300 |
---|---|---|
committer | Thomas Steur <tsteur@users.noreply.github.com> | 2017-05-10 06:14:16 +0300 |
commit | 859810aeda6bcf9ad8a939a857ea97a42e0666a5 (patch) | |
tree | b2c2e7eb5066ad55811365ba5350b65058d24f53 /plugins/SegmentEditor | |
parent | c7a9367d4ecead103086728761e85d44c3d9f6bb (diff) |
Let plugins customize the system summary widget
Diffstat (limited to 'plugins/SegmentEditor')
-rw-r--r-- | plugins/SegmentEditor/SegmentEditor.php | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/plugins/SegmentEditor/SegmentEditor.php b/plugins/SegmentEditor/SegmentEditor.php index f3ea172a54..63cee53c30 100644 --- a/plugins/SegmentEditor/SegmentEditor.php +++ b/plugins/SegmentEditor/SegmentEditor.php @@ -9,7 +9,9 @@ namespace Piwik\Plugins\SegmentEditor; use Piwik\Config; -use Piwik\Db; +use Piwik\Container\StaticContainer; +use Piwik\Piwik; +use Piwik\Plugins\CoreHome\SystemSummary; /** */ @@ -26,10 +28,19 @@ class SegmentEditor extends \Piwik\Plugin 'AssetManager.getJavaScriptFiles' => 'getJsFiles', 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', 'Template.nextToCalendar' => 'getSegmentEditorHtml', + 'System.addSystemSummaryItems' => 'addSystemSummaryItems', 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys', ); } + public function addSystemSummaryItems(&$systemSummary) + { + $storedSegments = StaticContainer::get('Piwik\Plugins\SegmentEditor\Services\StoredSegmentService'); + $segments = $storedSegments->getAllSegmentsAndIgnoreVisibility(); + $numSegments = count($segments); + $systemSummary[] = new SystemSummary\Item($key = 'segments', Piwik::translate('CoreHome_SystemSummaryNSegments', $numSegments), $value = null, $url = null, $icon = 'icon-segment', $order = 6); + } + function getSegmentEditorHtml(&$out) { $selector = new SegmentSelectorControl(); |