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('8d', '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$this->tpl->set('causes',
21        $this->model->thread_commentFactory->
22        get_from_thread($thread, array('type' => 'cause'))->fetchAll());
23$this->tpl->set('risks',
24    $this->model->thread_commentFactory->
25    get_from_thread($thread, array('type' => 'risk'))->fetchAll());
26$this->tpl->set('opportunities',
27                $this->model->thread_commentFactory->
28                get_from_thread($thread, array('type' => 'opportunity'))->fetchAll());
29$tasks = $this->model->taskFactory->get_by_type($thread);
30$this->tpl->set('8d_tasks', $tasks);
31