xref: /plugin/bez/ctl/kp.php (revision fabf14f34d1866b0b586fe614e47ef917dde7100)
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
20$tasks = $this->model->taskFactory->get_all(array('thread_id' => $thread->id))->fetchAll();
21$this->tpl->set('tasks', $tasks);