diff options
author | mattpiwik <matthieu.aubry@gmail.com> | 2008-12-17 20:31:24 +0300 |
---|---|---|
committer | mattpiwik <matthieu.aubry@gmail.com> | 2008-12-17 20:31:24 +0300 |
commit | 812e3fd2c17e556c69842175e6c2df7817b4ebc6 (patch) | |
tree | 93d3fc40a4aadc1b90a674abc3b17e7dac78a45a /plugins/Live/Controller.php | |
parent | 10d00a91016b959c51388508ff3782476120d15c (diff) |
- commiting dev version of Live! plugin
git-svn-id: http://dev.piwik.org/svn/trunk@840 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'plugins/Live/Controller.php')
-rw-r--r-- | plugins/Live/Controller.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/plugins/Live/Controller.php b/plugins/Live/Controller.php new file mode 100644 index 0000000000..3ae91836e3 --- /dev/null +++ b/plugins/Live/Controller.php @@ -0,0 +1,37 @@ +<?php +require_once 'Live/API.php'; + +//TODO +Piwik_AddWidget('Live', 'widget', 'Live Visitors!'); + +class Piwik_Live_Controller extends Piwik_Controller +{ + function widget() + { + echo "Live Visitors!"; + } + + function getLastVisits($fetch = false) + { + $view = new Piwik_View('Live/templates/lastVisits.tpl'); + $idSite = Piwik_Common::getRequestVar('idSite', null, 'int'); + $limit = 10; + $api = new Piwik_API_Request("method=Live.getLastVisits&idSite=$idSite&limit=$limit&format=php&serialize=0&disable_generic_filters=1"); + $view->visitors = $api->process(); + $rendered = $view->render($fetch); + + if($fetch) + { + return $rendered; + } + echo $rendered; + } + + function index() + { + $view = new Piwik_View('Live/templates/index.tpl'); + $this->setGeneralVariablesView($view); + $view->visitors = $this->getLastVisits($fetch = true); + echo $view->render(); + } +} |