aboutsummaryrefslogtreecommitdiff
path: root/controller
diff options
context:
space:
mode:
Diffstat (limited to 'controller')
-rw-r--r--controller/guicontroller.php21
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')) {