1<?php 2include_once DOKU_PLUGIN."bez/models/tasks.php"; 3include_once DOKU_PLUGIN."bez/models/taskactions.php"; 4include_once DOKU_PLUGIN."bez/models/taskstates.php"; 5include_once DOKU_PLUGIN."bez/models/users.php"; 6include_once DOKU_PLUGIN."bez/models/issues.php"; 7 8if (!$helper->user_viewer()) { 9 $errors[] = $bezlang['error_issues']; 10 $controller->preventDefault(); 11} 12 13$tasko = new Tasks(); 14$taskao = new Taskactions(); 15$taskso = new Taskstates(); 16$usro = new Users(); 17$isso = new Issues(); 18 19if (count($_POST) > 0) { 20 $filters = $tasko->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='.$this->id('tasks').$query_uri); 28} 29 30/*rekordy parzyste to nagłówki, nieparzyste to ich wartości.*/ 31/*np. status:1:type:2:podmiot:PCA*/ 32$value = array('issue' => '-all', 'action' => '-all', 'state' => '-all', 'executor' => '-all', 'year' => '-all'); 33for ($i = 0; $i < count($params); $i += 2) 34 $value[urldecode($params[$i])] = urldecode($params[$i+1]); 35 36 37$template['uri'] = $uri; 38 39$template['issues'] = $isso->get_ids(); 40$template['actions'] = $taskao->get(); 41$template['states'] = $taskso->get(); 42$template['executors'] = $usro->get(); 43$template['years'] = $tasko->get_years(); 44 45$tasks = $tasko->get_filtered($value); 46$template['tasks'] = $tasks; 47 48$template['tasks_stats']['total'] = count($tasks); 49 50$tcost = 0; 51foreach ($tasks as $task) { 52 $tcost += (int)$task['cost']; 53} 54$template['tasks_stats']['totalcost'] = $tcost; 55 56 57