summaryrefslogtreecommitdiff
path: root/app/Controller/BoardViewController.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-05-28 14:05:57 -0400
committerFrederic Guillot <fred@kanboard.net>2016-05-28 14:05:57 -0400
commit8d12e2fe736a72d6ad69807ac853a7e325c8cbf3 (patch)
treeea18a49b44db9bfa55c7e09ee8c939a98b088239 /app/Controller/BoardViewController.php
parent1353929a7dbd3f2e897fa7d3ab88e959ca573f9f (diff)
Split board controller into multiple classes
Diffstat (limited to 'app/Controller/BoardViewController.php')
-rw-r--r--app/Controller/BoardViewController.php65
1 files changed, 65 insertions, 0 deletions
diff --git a/app/Controller/BoardViewController.php b/app/Controller/BoardViewController.php
new file mode 100644
index 00000000..3c96af73
--- /dev/null
+++ b/app/Controller/BoardViewController.php
@@ -0,0 +1,65 @@
+<?php
+
+namespace Kanboard\Controller;
+
+use Kanboard\Core\Controller\AccessForbiddenException;
+use Kanboard\Formatter\BoardFormatter;
+
+/**
+ * Board controller
+ *
+ * @package Kanboard\Controller
+ * @author Frederic Guillot
+ */
+class BoardViewController extends BaseController
+{
+ /**
+ * Display the public version of a board
+ * Access checked by a simple token, no user login, read only, auto-refresh
+ *
+ * @access public
+ */
+ public function readonly()
+ {
+ $token = $this->request->getStringParam('token');
+ $project = $this->project->getByToken($token);
+
+ if (empty($project)) {
+ throw AccessForbiddenException::getInstance()->withoutLayout();
+ }
+
+ $this->response->html($this->helper->layout->app('board/view_public', array(
+ 'project' => $project,
+ 'swimlanes' => $this->board->getBoard($project['id']),
+ 'title' => $project['name'],
+ 'description' => $project['description'],
+ 'no_layout' => true,
+ 'not_editable' => true,
+ 'board_public_refresh_interval' => $this->config->get('board_public_refresh_interval'),
+ 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'),
+ 'board_highlight_period' => $this->config->get('board_highlight_period'),
+ )));
+ }
+
+ /**
+ * Show a board for a given project
+ *
+ * @access public
+ */
+ public function show()
+ {
+ $project = $this->getProject();
+ $search = $this->helper->projectHeader->getSearchQuery($project);
+
+ $this->response->html($this->helper->layout->app('board/view_private', array(
+ 'project' => $project,
+ 'title' => $project['name'],
+ 'description' => $this->helper->projectHeader->getDescription($project),
+ 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'),
+ 'board_highlight_period' => $this->config->get('board_highlight_period'),
+ 'swimlanes' => $this->taskLexer
+ ->build($search)
+ ->format(BoardFormatter::getInstance($this->container)->setProjectId($project['id']))
+ )));
+ }
+}