Adding some fixes in the user list to PDF see BT#2741

skala
Julio Montoya 13 years ago
parent a9836db3fa
commit 37cb1bc68d
  1. 4
      main/inc/lib/export.lib.inc.php
  2. 12
      main/inc/lib/pdf.lib.php
  3. 5
      main/user/user.php

@ -147,7 +147,7 @@ class Export {
return $string;
}
public static function export_table_pdf($data, $file_name = 'export', $header, $description) {
public static function export_table_pdf($data, $file_name = 'export', $header, $description, $params = array()) {
$headers = $data[0];
unset($data[0]);
$html = '';
@ -184,7 +184,7 @@ class Export {
$css_file = api_get_path(TO_SYS, WEB_CSS_PATH).'/print.css';
$css = file_exists($css_file) ? @file_get_contents($css_file) : '';
$pdf = new PDF();
$pdf = new PDF('A4', 'P', $params);
$pdf->set_custom_header($headers_in_pdf);
$pdf->content_to_pdf($html, $css, $file_name, api_get_course_id());
exit;

@ -23,16 +23,22 @@ class PDF {
* @param string format A4 A4-L see http://mpdf1.com/manual/index.php?tid=184&searchstring=format
* @param string orientation "P" = Portrait "L" = Landscape
*/
public function __construct($page_format ='A4', $orientation = 'P') {
public function __construct($page_format ='A4', $orientation = 'P', $params = array()) {
/* More info @ http://mpdf1.com/manual/index.php?tid=184&searchstring=mPDF
* mPDF ([ string $mode [, mixed $format [, float $default_font_size [, string $default_font [, float $margin_left , float $margin_right , float $margin_top , float $margin_bottom , float $margin_header , float $margin_footer [, string $orientation ]]]]]])
*/
if(!in_array($orientation,array('P','L'))) {
if (!in_array($orientation, array('P','L'))) {
$orientation = 'P';
}
//$this->pdf = $pdf = new mPDF('UTF-8', $page_format, '', '', 30, 20, 27, 25, 16, 13, $orientation);
//left, right, top, bottom, margin_header, margin footer
$this->pdf = $pdf = new mPDF('UTF-8', $page_format, '', '', 15, 15, 20, 15, 8, 8, $orientation);
$params['left'] = isset($params['left']) ? $params['left'] : 15;
$params['right'] = isset($params['right']) ? $params['right'] :15;
$params['top'] = isset($params['top']) ? $params['top'] : 20;
$params['bottom'] = isset($params['bottom']) ? $params['bottom'] : 15;
$this->pdf = $pdf = new mPDF('UTF-8', $page_format, '', '', $params['left'], $params['right'], $params['top'], $params['bottom'], 8, 8, $orientation);
}
/**

@ -225,8 +225,9 @@ if (api_is_allowed_to_edit(null, true)) {
}
$description .= '<tr><td>'.get_lang('Date').': </td><td class="highlight">'.api_convert_and_format_date(time(), DATE_TIME_FORMAT_LONG).'</td>';
$description .= '</table>';
Export::export_table_pdf($a_users, get_lang('UserList'), $header, $description);
$params = array();
//$params = array('top'=>'50');
Export::export_table_pdf($a_users, get_lang('UserList'), $header, $description, $params);
exit;
}
}

Loading…
Cancel
Save