1<?php
2/** @var action_plugin_bez $this */
3
4use \dokuwiki\plugin\bez;
5
6if ($this->model->get_level() < BEZ_AUTH_USER) {
7    throw new bez\meta\PermissionDeniedException();
8}
9
10$period = NULL;
11if(count($_POST) > 0 && ($_POST['from'] != '' || $_POST['to'] != '')) {
12    $from = new DateTime($_POST['from']);
13    $to = new DateTime($_POST['to']);
14
15    $this->tpl->set_values(array(
16        'from' => $from->format('Y-m-d'),
17        'to' => $to->format('Y-m-d')));
18
19    $to->modify('+1 day');//add one day extra
20    $period = new DatePeriod($from, new DateInterval('P1D'), $to);
21}
22
23$this->tpl->set('thread_involvement', $this->model->threadFactory->users_involvement($period));
24$this->tpl->set('task_involvement', $this->model->taskFactory->users_involvement($period));
25$this->tpl->set('kpi', $this->model->threadFactory->kpi($period));
26$this->tpl->set('bez_activity', $this->model->threadFactory->bez_activity($period));