function attach_timeSheet($commentID, $entityID, $options) { // Begin buffering output to halt anything being sent to the web browser. ob_start(); $t = new timeSheetPrint(); $ops = query_string_to_array($options); $t->get_printable_timeSheet_file($entityID, $ops["timeSheetPrintMode"], $ops["printDesc"], $ops["format"]); // Capture the output into $str $str = (string) ob_get_clean(); $suffix = ".html"; $ops["format"] != "html" and $suffix = ".pdf"; $rtn["name"] = "timeSheet_" . $entityID . $suffix; $rtn["blob"] = $str; $rtn["size"] = strlen($str); return $rtn; }
/* * Copyright (C) 2006-2011 Alex Lance, Clancy Malcolm, Cyber IT Solutions * Pty. Ltd. * * This file is part of the allocPSA application <*****@*****.**>. * * allocPSA is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. * * allocPSA is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public * License for more details. * * You should have received a copy of the GNU Affero General Public License * along with allocPSA. If not, see <http://www.gnu.org/licenses/>. */ require_once "../alloc.php"; if (!$current_user->is_employee()) { alloc_error("You do not have permission to access time sheets", true); } $timeSheetID = $_POST["timeSheetID"] or $timeSheetID = $_GET["timeSheetID"]; $timeSheetPrintMode = $_GET["timeSheetPrintMode"]; $printDesc = $_GET["printDesc"]; $format = $_GET["format"]; $t = new timeSheetPrint(); $t->get_printable_timeSheet_file($timeSheetID, $timeSheetPrintMode, $printDesc, $format);