"Project Uploads", header => "Project Uploads", data => array( array("Date", str_replace(" ", " / ", $datetime)), array("Timezone", ucfirst($customer['tz'])), array("MTinfo", strtoupper((is_ReleaseCandidate() ? $_SESSION[$_PAGE_INFO['id']]['release_dir'] : VERSION))), array("User", getUser($user['id']))))); // Download file download_document_header($file['mimetype'], $file['filename'], "write_file", "pdf_attachement_" . $file['id']); download_document_data($file['document'], "write_file", "pdf_attachement_" . $file['id']); // Display upload info report_data(array(value => array(_("Upload") . " " . _("info")), border => array("LRBT"), bold => array(1), align => array("L"), styling_options => array(array('cell' => "fillcolor={rgb 0.78 0.80 0.78}")), font_size => array(11), cell_width => array(180), check_page_end => 1, ishtml => array(array(type => "bookmark", data => _("Upload") . " " . _("info"), parent => 0, bold => 1)), nr_lines => 1)); report_data(array(value => array("Filename",$file['filename']), border => array("LRBT","LRBT"), bold => array(0,0), align => array("L","L"), font_size => array(11,11), cell_width => array(60,120), check_page_end => 1, nr_lines => 1)); report_data(array(value => array("Uploaded by",getUserOrProfileName($file['gebruiker'], $file['gebruiker_tabel'])), border => array("LRBT","LRBT"), bold => array(0,0), align => array("L","L"), font_size => array(11,11), cell_width => array(60,120), check_page_end => 1, nr_lines => 1)); report_data(array(value => array(_("Upload") . " " . _("Date"), $file['datum']), border => array("LRBT","LRBT"), bold => array(0,0), align => array("L","L"), font_size => array(11,11), cell_width => array(60,120), check_page_end => 1, nr_lines => 1)); report_data(array(value => array("Project", $project['naam']), border => array("LRBT","LRBT"), bold => array(0,0), align => array("L","L"), font_size => array(11,11), cell_width => array(60,120), check_page_end => 1, nr_lines => 1)); if ((!is_null($file['latitude'])) && (!is_null($file['longitude']))) { report_data(array(value => array("GPS position", $file['latitude'] . "," . $file['longitude']), border => array("LRBT","LRBT"), bold => array(0,0), align => array("L","L"), font_size => array(11,11), cell_width => array(60,120), check_page_end => 1, ishtml => array("",array(type => "link", data => GOOGLE_MAPS . "maps?q=" . $file['latitude'] . "," . $file['longitude'], parent => 0, bold => 1)), nr_lines => 1)); } empty_line(); // Attachement report_data(array(value => array("Upload"), border => array("LRBT"), bold => array(1), align => array("L"), styling_options => array(array('cell' => "fillcolor={rgb 0.78 0.80 0.78}")), font_size => array(11), cell_width => array(180), check_page_end => 1, ishtml => array(array(type => "bookmark", data => "Upload", parent => 0, bold => 1)), nr_lines => 2)); report_data(array(value => array(" " . ucfirst(_("original") . " ". strtolower(_("File")))), border => array("LRBT"), bold => array(1), align => array("L"), font_size => array(8), cell_width => "", check_page_end => 1, ishtml => array(array(type => "attachment", data => "", filename => $_PAGE_INFO["pdf_attachement_" . $file['id']], mimetype => $file['mimetype'])))); // Is this an image? => Show screenshot if (stristr($file['mimetype'], "image") !== FALSE) { empty_line(); // Get image info if ((file_exists($_PAGE_INFO["pdf_attachement_" . $file['id']])) && (filesize($_PAGE_INFO["pdf_attachement_" . $file['id']]) > 0)) { $imagesize = getimagesize($_PAGE_INFO["pdf_attachement_" . $file['id']]); } // Get width/height $width = $imagesize[0]; $height = $imagesize[1]; // Determine max width $width = ($width > $_PAGE_INFO['PDF_WIDTH']) ? $_PAGE_INFO['PDF_WIDTH'] : $width; if ($width != $imagesize[0]) { // Determine height (keep aspect ratio) $height = $height * floatval($width/$imagesize[0]); } // Determine max height $old_height = $height; $height = ($height > ($_PAGE_INFO['PDF_HEIGHT']/2)) ? ($_PAGE_INFO['PDF_HEIGHT']/2) : $height; if ($height != $old_height) { // Determine width (keep aspect ratio) $width = $width * floatval($height/$old_height); } if ($imagesize[0] > 0) { report_data(array(value => array(_("Upload") . " " . _("screenshot") . " (" . (round(floatval($width/$imagesize[0]) * 100)) . "%)"), border => array("LRBT"), bold => array(1), align => array("L"), styling_options => array(array('cell' => "fillcolor={rgb 0.78 0.80 0.78}")), font_size => array(11), cell_width => array(180), check_page_end => 1, ishtml => array(array(type => "bookmark", data => _("Upload") . " " . _("screenshot"), parent => 0, bold => 1)), nr_lines => 1)); } empty_line(); pdf_print_image("Test", $_PAGE_INFO["pdf_attachement_" . $file['id']], round($height), round($width)); } // Get comment $comment = db_fetch_data_user_comment(array("document" => $file['id']), 1); if (is_array($comment)) { empty_line(); // Feedback header report_data(array(value => array(_("Upload") . " " . _("Comment")), border => array("LRBT"), bold => array(1), align => array("L"), styling_options => array(array('cell' => "fillcolor={rgb 0.78 0.80 0.78}")), font_size => array(11), cell_width => array(180), check_page_end => 1, ishtml => array(array(type => "bookmark", data => _("Upload") . " " . _("Comment"), parent => 0, bold => 1)), nr_lines => 10)); // Initial values $date = ""; $user = NULL; $left = TRUE; foreach($comment as $item) { // New day? if (strip_time($item['datum']) != $date) { // "Empty" line report_data(array(value => array(""), border => array("LR"), bold => array(0), align => array("L"), font_size => array(11), cell_width => array(180), nr_lines => 1, check_page_end => 0)); // Store new date $date = strip_time($item['datum']); // Display date report_data(array(value => array("",$date,""), border => array("L","LRBT", "R"), bold => array(0,1,0), align => array("C","C","C"), styling_options => array("",array('cell' => "fillcolor={rgb 0 0.62 0.94}", 'font' => "fillcolor={rgb 1 1 1}"),""), font_size => array(11,11,11), cell_width => array(70,40,70), nr_lines => 1, check_page_end => 0)); } // "Empty" line report_data(array(value => array(""), border => array("LR"), bold => array(0), align => array("L"), font_size => array(11), cell_height => 15, cell_width => array(180), check_page_end => 1)); // New user? if (is_null($user)) { $user = $item['gebruiker']; } else if ($user != $item['gebruiker']) { $left = !$left; // Update user $user = $item['gebruiker']; } // Define left/right alignment $left_addon = ($left) ? 3 : 57; $right_addon = ($left) ? 57 : 3; $optlist = ($left) ? "fillcolor={gray .90}" : "fillcolor={rgb 0.92 1 0.92}"; // Display user report_data(array(value => array("", getUserOrProfileName($item['gebruiker'], $item['gebruiker_tabel']), ""), border => array("L","LRT","R"), bold => array(0,1,0), align => array("L","L","L"), styling_options => array("",array('cell' => $optlist),""), font_size => array(11,11,11), cell_width => array($left_addon,120,$right_addon), nr_lines => 3, check_page_end => 1)); report_text(array(value => array("", $item['tekst'], ""), border => array("L","LR","R"), bold => array(0,0,0), align => array("L","L","L"), styling_options => array("",array('cell' => $optlist),""), font_size => array(11,11,11), cell_width => array($left_addon,120,$right_addon), check_page_end => 1)); report_data(array(value => array("",strip_date($file['datum']),""), border => array("L","LBR","R"), bold => array(0,0,0), align => array("L","R","L"), styling_options => array("",array('cell' => $optlist),""), font_size => array(7,7,7), cell_width => array($left_addon,120,$right_addon), nr_lines => 2, check_page_end => 1)); } // "Empty" line report_data(array(value => array(""), border => array("LRB"), bold => array(0), align => array("L"), font_size => array(11), cell_width => array(180), cell_height => 4, nr_lines => 1, check_page_end => 1)); } // Remove file (later on!) array_push($_PAGE_INFO['delete'], $_PAGE_INFO["pdf_attachement_" . $file['id']]); unset($_PAGE_INFO["pdf_attachement_" . $file['id']]); // Generate report return report_generate(); } ?>