From 92943b3dbac9db26d95500e129bd70475c376b1e Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Fri, 22 Aug 2014 16:57:14 +0200 Subject: [PATCH] add sidebar --- controller/guicontroller.php | 34 +++++++++++++++++++++++----------- templates/appnavigation.php | 18 ++++++++++++++++++ templates/index.php | 6 +++--- 3 files changed, 44 insertions(+), 14 deletions(-) create mode 100644 templates/appnavigation.php diff --git a/controller/guicontroller.php b/controller/guicontroller.php index 313bf69..06ea681 100644 --- a/controller/guicontroller.php +++ b/controller/guicontroller.php @@ -59,25 +59,37 @@ class GuiController extends Controller $this->checkDeps(); $res = new TemplateResponse('grauphel', 'index'); - $res->setParams( - array( - //we need to remove the trailing / for tomdroid - 'apiurl' => rtrim( - $this->urlGen->getAbsoluteURL( - $this->urlGen->linkToRoute('grauphel.gui.index') - ), - '/' - ) - ) - ); + $res->setParams(array('apiurl' => $this->getApiUrl())); + $this->addNavigation($res); return $res; } + protected function addNavigation(TemplateResponse $res) + { + $nav = new \OCP\Template('grauphel', 'appnavigation', ''); + $nav->assign('apiurl', $this->getApiUrl()); + + $params = $res->getParams(); + $params['appNavigation'] = $nav; + $res->setParams($params); + } + protected function checkDeps() { if (!class_exists('OAuthProvider')) { throw new \Exception('PHP extension "oauth" is required'); } } + + protected function getApiUrl() + { + //we need to remove the trailing / for tomdroid and conboy + return rtrim( + $this->urlGen->getAbsoluteURL( + $this->urlGen->linkToRoute('grauphel.gui.index') + ), + '/' + ); + } } ?> diff --git a/templates/appnavigation.php b/templates/appnavigation.php new file mode 100644 index 0000000..19854f1 --- /dev/null +++ b/templates/appnavigation.php @@ -0,0 +1,18 @@ +
+ + +
+
+ +
+ +
+
diff --git a/templates/index.php b/templates/index.php index a0ddbb3..7b7c6a6 100644 --- a/templates/index.php +++ b/templates/index.php @@ -1,6 +1,5 @@ -
-
-
+ +printPage(); ?>
@@ -10,4 +9,5 @@

+
-- 2.30.2