1<?php
2/** @var action_plugin_bez $this */
3
4use \dokuwiki\plugin\bez;
5
6//if we don't have a token, generate a new one and redirect
7if (!isset($_GET['t']) && $this->model->authentication_tokenFactory->can_create_token()) {
8    $token = $this->model->authentication_tokenFactory->create_token($this->id());
9    header('Location: ' .
10           wl($this->id('kp', 'id', $this->get_param('id')), array('t' => $token), false, '&'));
11}
12
13if ($this->model->get_level() < BEZ_AUTH_VIEWER) {
14    throw new bez\meta\PermissionDeniedException();
15}
16
17/** @var bez\mdl\Thread $thread */
18$thread = $this->model->threadFactory->get_one($this->get_param('id'));
19$this->tpl->set('thread', $thread);
20
21$tasks = $this->model->taskFactory->get_with_closing_comment($thread)->fetchAll();
22$this->tpl->set('tasks', $tasks);