} $hrs = round($tra["hours"], 2); $hrs = number_format($hrs, 2, ",", "."); $tra["comment"] = strip_tags($tra["comment"]); $i = $i + 1; array_push($thetrack, array($tra["uname"], $tra["tname"], $tra["comment"], $tra["daystring"] . "/" . $tra["startstring"] . "-" . $tra["endstring"], $hrs)); } } $pdf->table($headers, $thetrack); $pdf->Output("project-{$id}-timetable.pdf", "D"); } elseif ($action == "userxls") { $excelFile = fopen(CL_ROOT . "/files/" . CL_CONFIG . "/ics/user-{$id}-timetrack.csv", "w"); $line = array($strproj, $strtask, $strcomment, $strday, $strstarted, $strended, $strhours); fputcsv($excelFile, $line); if (!empty($start) and !empty($end)) { $track = $tracker->getUserTrack($id, $fproject, $taski, $start, $end, false); } else { $track = $tracker->getUserTrack($id, $fproject, $taski, 0, 0, false); } if (!empty($track)) { foreach ($track as $tra) { $hrs = round($tra["hours"], 2); $hrs = str_replace(".", ",", $hrs); $myArr = array($tra["pname"], $tra["tname"], $tra["comment"], $tra["daystring"], $tra["startstring"], $tra["endstring"], $hrs); fputcsv($excelFile, $myArr); } } fclose($excelFile); $loc = $url . "files/" . CL_CONFIG . "/ics/user-{$id}-timetrack.csv"; header("Location: {$loc}"); } elseif ($action == "userpdf") {
$totaltime = str_replace(".", ",", $totaltime); $htmltable .= "<tr style=\"font-weight:bold;\"><td colspan=\"5\" align=\"right\">$totaltime</td></tr></table>"; $pdf->writeHTML($htmltable, true, 0, true, 0); $pdf->Output("project-$id-timetable.pdf", "D"); } } elseif ($action == "userxls") { $excel = new xls(CL_ROOT . "/files/" . CL_CONFIG . "/ics/user-$id-timetrack.xls"); $line = array($strproj, $strtask, $strcomment, $strday, $strstarted, $strended, $strhours); $excel->writeHeadLine($line, "128"); if (!empty($start) and !empty($end)) { $track = $tracker->getUserTrack($id, $fproject, $taski, $start, $end); } else { $track = $tracker->getUserTrack($id, $fproject, $taski, 0, 0 , 1000); } if (!empty($track)) { foreach($track as $tra) { $hrs = round($tra["hours"], 2); $hrs = str_replace(".", ",", $hrs); $myArr = array($tra["pname"], $tra["tname"], $tra["comment"], $tra["daystring"], $tra["startstring"], $tra["endstring"], $hrs); $excel->writeLine($myArr); }