1<?php 2include_once DOKU_PLUGIN."bez/models/report.php"; 3include_once DOKU_PLUGIN."bez/models/entities.php"; 4 5/*jeżeli nie mamy tokenu generujemy nowy i przekierowujemy*/ 6$toko = new Tokens(); 7if (!isset($_GET['t']) || ! $toko->check(trim($_GET['t']), $ID)) 8 header('Location: '.$uri.'?'.$_SERVER['QUERY_STRING'].'&t='.$toko->get($ID)); 9 10if (!$helper->user_viewer()) { 11 $errors[] = $bezlang['error_issues']; 12 $controller->preventDefault(); 13} 14 15$repo = new Report(); 16$ento = new Entities(); 17 18$value = array('entity' => '-all', 'year' => '-all', 'month' => '-all'); 19if (count($_POST) > 0) { 20 $filters = $repo->validate_filters($_POST); 21 22 $query_uri = ''; 23 foreach ($filters as $k => $v) 24 if ($v != '-all') 25 $query_uri .= ':'.urlencode($k).':'.urlencode($v); 26 27 header('Location: ?id=bez:report'.$query_uri); 28} 29 30/*rekordy parzyste to nagłówki, nieparzyste to ich wartości.*/ 31/*np. status:1:type:2:podmiot:PCA*/ 32for ($i = 0; $i < count($params); $i += 2) 33 $value[urldecode($params[$i])] = urldecode($params[$i+1]); 34 35$template['entities'] = $ento->get_list(); 36 37$template['uri'] = $uri; 38$template['hidden'] = array(); 39if (isset($value['year'])) 40 $template['hidden']['year'] = $value['year']; 41if (isset($value['month'])) 42 $template['hidden']['month'] = $value['month']; 43 44$template['report'] = $repo->report($value); 45 46$template['title'] = $bezlang['report'].($value['year'] != '-all' ? ' '.$value['year'] : ''). 47 ($value['month'] != '-all' ? '/'.($value['month'] > 10 ? $value['month'] : '0'.$value['month']) : ''); 48 49$template['uri'] = $uri.'?'.$_SERVER['QUERY_STRING']; 50