xref: /plugin/bez/ctl/8d.php (revision 9fa666385d9e587824d1393ce3c427a2eaa60a79)
1f2f5b3feSghi<?php
2*9fa66638SSzymon Olewniczak/** @var action_plugin_bez $this */
3*9fa66638SSzymon Olewniczak
4*9fa66638SSzymon Olewniczakuse \dokuwiki\plugin\bez;
5e8fc7594Sghi
6e8827d73SSzymon Olewniczak//if we don't have a token, generate a new one and redirect
7*9fa66638SSzymon Olewniczakif (!isset($_GET['t']) && $this->model->authentication_tokenFactory->can_create_token()) {
8*9fa66638SSzymon Olewniczak    $token = $this->model->authentication_tokenFactory->create_token($this->id());
9e8827d73SSzymon Olewniczak    header('Location: ' . $this->url() . '&t=' . $token);
100a8ec76dSSzymon Olewniczak}
11f2f5b3feSghi
12*9fa66638SSzymon Olewniczakif ($this->model->get_level() < BEZ_AUTH_VIEWER) {
13*9fa66638SSzymon Olewniczak    throw new bez\meta\PermissionDeniedException();
14*9fa66638SSzymon Olewniczak}
15*9fa66638SSzymon Olewniczak
16e8827d73SSzymon Olewniczak/** @var bez\mdl\Thread $thread */
17e8827d73SSzymon Olewniczak$thread = $this->model->threadFactory->get_one($this->get_param('id'));
18e8827d73SSzymon Olewniczak$this->tpl->set('thread', $thread);
19e8827d73SSzymon Olewniczak$this->tpl->set('causes_real',
20e8827d73SSzymon Olewniczak        $this->model->thread_commentFactory->get_from_thread($thread, array('type' => 'cause_real'))->fetchAll());
21e8827d73SSzymon Olewniczak$this->tpl->set('causes_potential',
22e8827d73SSzymon Olewniczak    $this->model->thread_commentFactory->get_from_thread($thread, array('type' => 'cause_potential'))->fetchAll());
23e8827d73SSzymon Olewniczak$tasks = $this->model->taskFactory->get_by_type($thread);
24e8827d73SSzymon Olewniczak$this->tpl->set('8d_tasks', $tasks);
25