xref: /plugin/bez/ctl/8d.php (revision 6f38077355681f273cc9db672efab6fff436baea)
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: ' . $this->url() . '&t=' . $token);
10}
11
12if ($this->model->get_level() < BEZ_AUTH_VIEWER) {
13    throw new bez\meta\PermissionDeniedException();
14}
15
16/** @var bez\mdl\Thread $thread */
17$thread = $this->model->threadFactory->get_one($this->get_param('id'));
18$this->tpl->set('thread', $thread);
19$this->tpl->set('causes_real',
20        $this->model->thread_commentFactory->get_from_thread($thread, array('type' => 'cause_real'))->fetchAll());
21$this->tpl->set('causes_potential',
22    $this->model->thread_commentFactory->get_from_thread($thread, array('type' => 'cause_potential'))->fetchAll());
23$tasks = $this->model->taskFactory->get_by_type($thread);
24$this->tpl->set('8d_tasks', $tasks);
25