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