xref: /plugin/bez/ctl/8d.php (revision 79fbde342dccf36c910f340a4ac7822b8cb42d56)
1f2f5b3feSghi<?php
29fa66638SSzymon Olewniczak/** @var action_plugin_bez $this */
39fa66638SSzymon Olewniczak
49fa66638SSzymon Olewniczakuse \dokuwiki\plugin\bez;
5e8fc7594Sghi
6e8827d73SSzymon Olewniczak//if we don't have a token, generate a new one and redirect
79fa66638SSzymon Olewniczakif (!isset($_GET['t']) && $this->model->authentication_tokenFactory->can_create_token()) {
89fa66638SSzymon Olewniczak    $token = $this->model->authentication_tokenFactory->create_token($this->id());
93be16e0fSSzymon Olewniczak    header('Location: ' .
103be16e0fSSzymon Olewniczak           wl($this->id('8d', 'id', $this->get_param('id')), array('t' => $token), false, '&'));
110a8ec76dSSzymon Olewniczak}
12f2f5b3feSghi
139fa66638SSzymon Olewniczakif ($this->model->get_level() < BEZ_AUTH_VIEWER) {
149fa66638SSzymon Olewniczak    throw new bez\meta\PermissionDeniedException();
159fa66638SSzymon Olewniczak}
169fa66638SSzymon Olewniczak
17e8827d73SSzymon Olewniczak/** @var bez\mdl\Thread $thread */
18e8827d73SSzymon Olewniczak$thread = $this->model->threadFactory->get_one($this->get_param('id'));
19e8827d73SSzymon Olewniczak$this->tpl->set('thread', $thread);
20*79fbde34SSzymon Olewniczak$this->tpl->set('causes',
21*79fbde34SSzymon Olewniczak        $this->model->thread_commentFactory->
22*79fbde34SSzymon Olewniczak        get_from_thread($thread, array('type' => 'cause'))->fetchAll());
23*79fbde34SSzymon Olewniczak$this->tpl->set('risks',
24*79fbde34SSzymon Olewniczak    $this->model->thread_commentFactory->
25*79fbde34SSzymon Olewniczak    get_from_thread($thread, array('type' => 'risk'))->fetchAll());
26*79fbde34SSzymon Olewniczak$this->tpl->set('opportunities',
27*79fbde34SSzymon Olewniczak                $this->model->thread_commentFactory->
28*79fbde34SSzymon Olewniczak                get_from_thread($thread, array('type' => 'opportunity'))->fetchAll());
29e8827d73SSzymon Olewniczak$tasks = $this->model->taskFactory->get_by_type($thread);
30e8827d73SSzymon Olewniczak$this->tpl->set('8d_tasks', $tasks);
31