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