Révision 11b63505
Ajouté par Assos Assos il y a plus de 9 ans
drupal7/sites/all/modules/views_pdf/field_plugins/views_pdf_handler_page_break.inc | ||
---|---|---|
14 | 14 |
*/ |
15 | 15 |
class views_pdf_handler_page_break extends views_handler_field { |
16 | 16 |
|
17 |
protected $countRecords = 0; |
|
18 |
|
|
19 | 17 |
/** |
20 | 18 |
* This method is used to query data. In our case |
21 | 19 |
* we want that no data is queried. |
... | ... | |
63 | 61 |
} |
64 | 62 |
|
65 | 63 |
/** |
66 |
* This method renders the page break. It uses the PDF class to |
|
67 |
* add a page break. |
|
64 |
* This method renders the page break. |
|
65 |
* |
|
66 |
* Various settings from options form are taken into an account before |
|
67 |
* deciding whether to add pagebreak or not. |
|
68 | 68 |
*/ |
69 | 69 |
function render($values) { |
70 |
if (isset($this->view->pdf) && is_object($this->view->pdf)) {
|
|
71 |
if ($this->options['last_row'] == TRUE && ($this->countRecords + 1 >= $this->view->total_rows)) {
|
|
72 |
return '';
|
|
73 |
}
|
|
70 |
// Row index starts from 0 so substract 1 one from result count.
|
|
71 |
$last_row = $this->view->row_index == count($this->view->result) - 1;
|
|
72 |
// Calculate if 'every_nth' rule matches for this row.
|
|
73 |
$add_pagebreak = ($this->view->row_index + 1) % $this->options['every_nth'] == 0;
|
|
74 | 74 |
|
75 |
$this->countRecords++; |
|
76 |
if ($this->countRecords == $this->view->total_rows + 1) { |
|
77 |
$this->countRecords = 1; |
|
78 |
} |
|
79 |
|
|
80 |
$output = ''; |
|
81 |
if ($this->countRecords % $this->options['every_nth'] == 0) { |
|
82 |
$output .= '<br pagebreak="true" />'; |
|
83 |
} |
|
84 |
else { |
|
85 |
$output .= ''; |
|
86 |
} |
|
87 |
return $output; |
|
75 |
// Last row setting takes priority over 'every_nth' rule if we're infact |
|
76 |
// rendering last row. |
|
77 |
if (($this->options['last_row'] == FALSE || !$last_row) && $add_pagebreak) { |
|
78 |
return '<br pagebreak="true" />'; |
|
88 | 79 |
} |
80 |
|
|
81 |
return ''; |
|
89 | 82 |
} |
90 | 83 |
|
91 | 84 |
/** |
drupal7/sites/all/modules/views_pdf/modules/views_append/views_append.info | ||
---|---|---|
7 | 7 |
files[] = views_append_handler_append_view.inc |
8 | 8 |
|
9 | 9 |
|
10 |
; Information added by packaging script on 2013-11-18
|
|
11 |
version = "7.x-1.3"
|
|
10 |
; Information added by Drupal.org packaging script on 2014-10-30
|
|
11 |
version = "7.x-1.4"
|
|
12 | 12 |
core = "7.x" |
13 | 13 |
project = "views_pdf" |
14 |
datestamp = "1384819110"
|
|
14 |
datestamp = "1414683531"
|
|
15 | 15 |
|
drupal7/sites/all/modules/views_pdf/modules/views_view_field/views_view_field.info | ||
---|---|---|
7 | 7 |
files[] = views_view_field_handler_include_view.inc |
8 | 8 |
|
9 | 9 |
|
10 |
; Information added by packaging script on 2013-11-18
|
|
11 |
version = "7.x-1.3"
|
|
10 |
; Information added by Drupal.org packaging script on 2014-10-30
|
|
11 |
version = "7.x-1.4"
|
|
12 | 12 |
core = "7.x" |
13 | 13 |
project = "views_pdf" |
14 |
datestamp = "1384819110"
|
|
14 |
datestamp = "1414683531"
|
|
15 | 15 |
|
drupal7/sites/all/modules/views_pdf/modules/views_view_field/views_view_field_handler_include_view.inc | ||
---|---|---|
145 | 145 |
$view = views_get_view($view_name); |
146 | 146 |
|
147 | 147 |
// look for a display named pdf_X. |
148 |
$pdf_display = NULL; |
|
148 | 149 |
foreach($view->display as $display) { |
149 | 150 |
if (preg_match('/^pdf_/', $display->id)) { |
150 | 151 |
// found a PDF display so break out of loop. |
drupal7/sites/all/modules/views_pdf/views_pdf.info | ||
---|---|---|
15 | 15 |
files[] = field_plugins/views_pdf_handler_page_number.inc |
16 | 16 |
files[] = field_plugins/views_pdf_handler_page_break.inc |
17 | 17 |
|
18 |
; Information added by packaging script on 2013-11-18
|
|
19 |
version = "7.x-1.3"
|
|
18 |
; Information added by Drupal.org packaging script on 2014-10-30
|
|
19 |
version = "7.x-1.4"
|
|
20 | 20 |
core = "7.x" |
21 | 21 |
project = "views_pdf" |
22 |
datestamp = "1384819110"
|
|
22 |
datestamp = "1414683531"
|
|
23 | 23 |
|
drupal7/sites/all/modules/views_pdf/views_pdf_plugin_display.inc | ||
---|---|---|
120 | 120 |
|
121 | 121 |
if (empty($path_to_store_pdf)) { |
122 | 122 |
$path_to_store_pdf = $this->view->get_title(); |
123 |
$this->view->pdf->SetTitle($this->view->get_title()); |
|
123 | 124 |
} |
124 | 125 |
|
125 | 126 |
if (!preg_match('/\.pdf$/', $path_to_store_pdf)) { |
drupal7/sites/all/modules/views_pdf/views_pdf_template.php | ||
---|---|---|
14 | 14 |
* Get the depending classes. |
15 | 15 |
*/ |
16 | 16 |
require_once views_pdf_get_library('tcpdf') . '/tcpdf.php'; |
17 |
require_once views_pdf_get_library('fpdi') . '/fpdi2tcpdf_bridge.php'; |
|
17 |
|
|
18 |
if (file_exists(views_pdf_get_library('fpdi') . '/fpdi_bridge.php')) { |
|
19 |
require_once views_pdf_get_library('fpdi') . '/fpdi_bridge.php'; |
|
20 |
} |
|
21 |
else { |
|
22 |
require_once views_pdf_get_library('fpdi') . '/fpdi2tcpdf_bridge.php'; |
|
23 |
} |
|
24 |
|
|
18 | 25 |
require_once views_pdf_get_library('fpdi') . '/fpdi.php'; |
19 | 26 |
|
20 | 27 |
|
... | ... | |
194 | 201 |
/** |
195 | 202 |
* Parse color input into an array. |
196 | 203 |
* |
197 |
* @param string $color Color entered by the user |
|
198 |
* @return array color as an array |
|
204 |
* @param string $color |
|
205 |
* Color entered by the user |
|
206 |
* |
|
207 |
* @return array |
|
208 |
* Color as an array |
|
199 | 209 |
*/ |
200 | 210 |
public function parseColor($color) { |
201 | 211 |
$color = trim($color, ', '); |
... | ... | |
400 | 410 |
$pageDim = $this->getPageDimensions(); |
401 | 411 |
|
402 | 412 |
// Render the content if it is not already: |
403 |
if (is_object($view) && $key != NULL && isset($view->field[$key]) && is_object($view->field[$key])) { |
|
413 |
if (is_object($view) && $key != NULL && isset($view->field[$key]) && is_object($view->field[$key]) && !is_string($row)) {
|
|
404 | 414 |
$content = $view->field[$key]->theme($row); |
405 | 415 |
} |
406 | 416 |
elseif (is_string($row)) { |
... | ... | |
523 | 533 |
} |
524 | 534 |
|
525 | 535 |
// Write the content of a field to the pdf file: |
526 |
$this->MultiCell($w, $h, $prefix . $content, $border, $align, $fill, $ln, $x, $y, $reseth, $stretch, $ishtml, $autopadding, $maxh, $valign, $fitcell); |
|
536 |
if (!empty($content)) { |
|
537 |
$this->MultiCell($w, $h, $prefix . $content, $border, $align, $fill, $ln, $x, $y, $reseth, $stretch, $ishtml, $autopadding, $maxh, $valign, $fitcell); |
|
538 |
} |
|
539 |
else { |
|
540 |
$this->MultiCell($w, $h, $prefix, $border, $align, $fill, $ln, $x, $y, $reseth, $stretch, $ishtml, $autopadding, $maxh, $valign, $fitcell); |
|
541 |
} |
|
527 | 542 |
|
528 | 543 |
// Reset font to default. |
529 | 544 |
$this->SetFont($this->defaultFontFamily, implode('', $this->defaultFontStyle), $this->defaultFontSize); |
... | ... | |
692 | 707 |
$this->SetX($x); |
693 | 708 |
$this->setPage($page); |
694 | 709 |
|
695 |
$this->renderRow($x, $y, $column->options['label'], $headerOptions); |
|
710 |
$this->renderRow($x, $y, $column->options['label'], $headerOptions, $view, $id, FALSE);
|
|
696 | 711 |
$x += $headerOptions['position']['width']; |
697 | 712 |
} |
698 | 713 |
|
Formats disponibles : Unified diff
Weekly update of contrib modules