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