<td>$logged[username]</td> </tr>"; } } $htmltable .= "</table>"; $pdf->writeHTML($htmltable, true, 0, true, 0); $pdf->lastPage(); $pdf->Output("project-$id-log.pdf", "D"); } elseif ($action == "projectlogxls") { if (!$userpermissions["admin"]["add"]) { $template->assign("errortext", "Permission denied."); $template->display("error.tpl"); die(); } $excel = new xls(CL_ROOT . "/files/" . CL_CONFIG . "/ics/project-$id-log.xls"); $headline = array(" ", $strtext, $straction, $strdate, $struser); $excel->writeHeadLine($headline, "128"); $thelog = new mylog(); $datlog = array(); $tlog = $thelog->getProjectLog($id, 100000); $tlog = $thelog->formatdate($tlog, "d.m.y"); if (!empty($tlog)) { foreach($tlog as $logged) { if ($logged["type"] == "datei") { $logged["type"] = "file"; } elseif ($logged["type"] == "projekt") { $logged["type"] = "project"; } elseif ($logged["type"] == "track") {
<?php require_once ABSPATH . "includes/excel-2.0/Writer.php"; require_once ABSPATH . "includes/xls.php"; $workbook = new xls(); $workbook->send('sample_report.xls'); $worksheet =& $workbook->addWorksheet("sample_report"); $format_title =& $workbook->addFormat(array('Align' => 'center', 'Bold' => '1', 'Size' => '10')); $format_title_field =& $workbook->addFormat(array('Align' => 'center', 'Bold' => '1', 'Border' => '0', 'Size' => '8')); $format_text =& $workbook->addFormat(array('Border' => '0', 'Size' => '8')); $worksheet->setLandscape(); $worksheet->setPaper(1); $workbook->writeMerge($worksheet, 1, 0, 5, 1, 'Sample Report', $format_title); $col = 0; $row = 2; $cols = array(array('name' => 'Jenis', 'width' => 20), array('name' => 'Tanggal', 'width' => 20), array('name' => 'Perihal', 'width' => 70), array('name' => 'Kode', 'width' => 40), array('name' => 'Tahun', 'width' => 20)); foreach ($cols as $field) { $worksheet->writeString($row, $col, $field['name'], $format_title_field); //$worksheet->setColumn($row, $col,$field['width']+0); //$format_title_field->setTextWrap(); $col++; } $row++; $data = array(); while ($rowx = $rs->FetchNextObject()) { $data[] = array($rowx->JENIS, formatDate2($rowx->TANGGAL), $rowx->PERIHAL, $rowx->KODE, $rowx->TAHUN); } foreach ($data as $r) { $col = 0; foreach ($r as $c) { $worksheet->writeString($row, $col, $c, $format_text);
<td width=\"130\" align=\"center\">$tra[daystring] / $tra[startstring] - $tra[endstring]</td> <td width=\"40\" align=\"right\">$hrs</td> </tr>"; } $totaltime = $tracker->getTotalTrackTime($track); $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) {
function create($filename) { self::$filename = $filename . '.xls'; self::$file = self::__BOF(); self::$row = 0; }