diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2014-08-22 17:17:01 +0200 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2014-08-22 17:17:01 +0200 |
| commit | f7ecfa21088175bc236b1136c1a4b2aa2488f37c (patch) | |
| tree | 2cdc3b15ef8d8e6fed4f9692464d3d0811eced6c /controller | |
| parent | 92943b3dbac9db26d95500e129bd70475c376b1e (diff) | |
| download | grauphel-f7ecfa21088175bc236b1136c1a4b2aa2488f37c.tar.gz grauphel-f7ecfa21088175bc236b1136c1a4b2aa2488f37c.zip | |
show some statistics on the index page
Diffstat (limited to 'controller')
| -rw-r--r-- | controller/guicontroller.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/controller/guicontroller.php b/controller/guicontroller.php index 06ea681..2c05750 100644 --- a/controller/guicontroller.php +++ b/controller/guicontroller.php @@ -61,6 +61,7 @@ class GuiController extends Controller $res = new TemplateResponse('grauphel', 'index'); $res->setParams(array('apiurl' => $this->getApiUrl())); $this->addNavigation($res); + $this->addStats($res); return $res; } @@ -74,6 +75,26 @@ class GuiController extends Controller $res->setParams($params); } + protected function addStats(TemplateResponse $res) + { + if ($this->user === null) { + return; + } + + $username = $this->user->getUid(); + $notes = new \OCA\Grauphel\Lib\NoteStorage($this->urlGen); + $tokens = new \OCA\Grauphel\Lib\TokenStorage(); + + $nav = new \OCP\Template('grauphel', 'indexStats', ''); + $nav->assign('notes', count($notes->loadNotesOverview($username))); + $nav->assign('syncrev', $notes->loadSyncData($username)->latestSyncRevision); + $nav->assign('tokens', count($tokens->loadForUser($username, 'access'))); + + $params = $res->getParams(); + $params['stats'] = $nav; + $res->setParams($params); + } + protected function checkDeps() { if (!class_exists('OAuthProvider')) { |
