/** * @param $startDateTime integer * @param $endDateTime integer * @param $interval integer * @param $datas array * @param $fields array * @param $aggregateMethod * @return array */ function getResultsDataAvgMod($startDateTime, $endDateTime, $interval, $datas, $fields, $aggregateMethod) { $results = getResultsDataAvg($startDateTime, $endDateTime, $interval, $datas, $fields, $aggregateMethod); foreach ($results as $key => $value) { $results[$key]['UnixTimestamp'] = $value['Date']; $results[$key]['DateFormatted'] = date('Y-m-d H:i:s \\G\\M\\TO (T)', $value['Date']); unset($results[$key]['Date']); foreach (getMetricsFieldsMappingsDb2Form() as $dbFieldName => $formFieldName) { if (array_key_exists($dbFieldName, $value)) { $results[$key][mapMetricFieldDb2Form($dbFieldName)] = $value[$dbFieldName]; unset($results[$key][$dbFieldName]); } } } return $results; }
exit; } $smarty->display('report/flashGraph.tpl'); exit; } if ($_REQUEST['act'] == 'download') { $downloadData = array(); $jobTable = Doctrine_Core::getTable('WPTJob'); $flds[] = 'Job'; $flds += $fields; foreach ($jobIds as $jobId) { $job = $jobTable->find($jobId); $jobName = $job['Label']; $datas = getGraphData($jobId, $startDateTime, $endDateTime, $percentile, $trimAbove, $adjustUsing, $trimBelow, $todStartHour, $todEndHour); if ($interval > 1) { $datas = getResultsDataAvg($startDateTime, $endDateTime, $interval, $datas, $flds, $_SESSION['aggregateMethod']); } foreach ($datas as $key => $data) { $data['Date'] = date('Y/m/d,H:i:s', $data['Date']); $data['Job'] = $jobName; $downloadData[] = $data; } } $header = 'Date,Time,Job,'; $last_item = end($fieldsToDisplay); foreach ($fieldsToDisplay as $f) { $header .= $f; if ($f != $last_item) { $header .= ","; } }
exit; } $smarty->display('report/flashGraph.tpl'); exit; } if ($_REQUEST['act'] == 'download') { $downloadData = array(); $jobTable = Doctrine_Core::getTable('WPTJob'); $flds[] = 'Job'; $flds += $fields; foreach ($jobIds as $jobId) { $job = $jobTable->find($jobId); $jobName = $job['Label']; $datas = getGraphData($userId, $jobId, $startDateTime, $endDateTime, $percentile, $trimAbove, $adjustUsing, $trimBelow); if ($interval > 1) { $datas = getResultsDataAvg($startDateTime, $endDateTime, $interval, $datas, $flds); } foreach ($datas as $key => $data) { $data['Date'] = date('Y/m/d,H:i:s', $data['Date']); $data['Job'] = $jobName; $downloadData[] = $data; } } $header = 'Date,Time,Job,'; $last_item = end($fieldsToDisplay); foreach ($fieldsToDisplay as $f) { $header .= $f; if ($f != $last_item) { $header .= ","; } }