1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
* @file
|
4 |
|
|
* The page number plugin for PDF page display.
|
5 |
|
|
*
|
6 |
|
|
* This plugin is used to add the page number to a PDF display.
|
7 |
|
|
*
|
8 |
|
|
*/
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
/**
|
12 |
|
|
* Plugin class that holds the functionality for the
|
13 |
|
|
* page number in a PDF display.
|
14 |
|
|
*
|
15 |
|
|
*/
|
16 |
|
|
class views_pdf_handler_page_number extends views_handler_field {
|
17 |
|
|
|
18 |
|
|
/**
|
19 |
|
|
* This method is used to query data. In our case
|
20 |
|
|
* we want that no data is queried.
|
21 |
|
|
*
|
22 |
|
|
*/
|
23 |
|
|
function query() {
|
24 |
|
|
// Override parent::query() and don't alter query.
|
25 |
|
|
$this->field_alias = 'pdf_page_number_' . $this->position;
|
26 |
|
|
}
|
27 |
|
|
|
28 |
|
|
/**
|
29 |
|
|
* This method adds a page number to the display, if it is a PDF display.
|
30 |
|
|
* Therefore the PDF class is used.
|
31 |
|
|
*/
|
32 |
|
|
function render($values) {
|
33 |
|
|
|
34 |
|
|
if (isset($this->view->pdf) && is_object($this->view->pdf)) {
|
35 |
|
|
return $this->view->pdf->getPage();
|
36 |
|
|
}
|
37 |
|
|
else {
|
38 |
|
|
return '';
|
39 |
|
|
}
|
40 |
|
|
|
41 |
|
|
}
|
42 |
|
|
|
43 |
|
|
/**
|
44 |
|
|
* We dont want to use advanced rendering.
|
45 |
|
|
*/
|
46 |
|
|
function allow_advanced_render() {
|
47 |
|
|
return FALSE;
|
48 |
|
|
}
|
49 |
|
|
} |