1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
* @file
|
4 |
|
|
* Install the views module
|
5 |
|
|
*/
|
6 |
|
|
|
7 |
|
|
/**
|
8 |
|
|
* Implements hook_requirements().
|
9 |
|
|
*/
|
10 |
|
|
function views_pdf_requirements($phase) {
|
11 |
|
|
$requirements = array();
|
12 |
|
|
|
13 |
|
|
// Ensure translations don't break at install time.
|
14 |
|
|
$t = get_t();
|
15 |
|
|
|
16 |
|
|
// Report Drupal version.
|
17 |
|
|
if ($phase == 'runtime') {
|
18 |
|
|
$path_tcpdf = views_pdf_get_library('tcpdf');
|
19 |
|
|
$path_fpdi = views_pdf_get_library('fpdi');
|
20 |
|
|
|
21 |
|
|
$requirements['views_pdf_tcpdf'] = array(
|
22 |
|
|
'title' => $t('Views PDF - TCPDF'),
|
23 |
|
|
'value' => $t('Not present'),
|
24 |
|
|
'description' => $t('The TCPDF library is used for the Views PDF. Please download it and place it in this location: @location.', array('@location' => $path_tcpdf)),
|
25 |
|
|
'severity' => REQUIREMENT_ERROR,
|
26 |
|
|
);
|
27 |
|
|
|
28 |
|
|
$requirements['views_pdf_fpdi'] = array(
|
29 |
|
|
'title' => $t('Views PDF - FPDI'),
|
30 |
|
|
'value' => $t('Not present'),
|
31 |
|
|
'description' => $t('The FPDI library is used for the Views PDF. Please download it and place it in this location: @location.', array('@location' => $path_fpdi)),
|
32 |
|
|
'severity' => REQUIREMENT_ERROR,
|
33 |
|
|
);
|
34 |
|
|
|
35 |
|
|
$requirements['views_pdf_fpdi_tpl'] = array(
|
36 |
|
|
'title' => $t('Views PDF - FPDI Template File'),
|
37 |
|
|
'value' => $t('Not present'),
|
38 |
|
|
'description' => $t('The FPDI library requires to install the FPDI template file to incoporate with TCPDF. Please place the file in to this location: @location.', array('@location' => $path_fpdi . '/fpdf_tpl.php')),
|
39 |
|
|
'severity' => REQUIREMENT_ERROR,
|
40 |
|
|
);
|
41 |
|
|
|
42 |
|
|
if (file_exists($path_tcpdf)) {
|
43 |
|
|
$requirements['views_pdf_tcpdf']['severity'] = REQUIREMENT_OK;
|
44 |
|
|
$requirements['views_pdf_tcpdf']['value'] = $t('Present');
|
45 |
|
|
unset($requirements['views_pdf_tcpdf']['description']);
|
46 |
|
|
}
|
47 |
|
|
if (file_exists($path_fpdi)) {
|
48 |
|
|
$requirements['views_pdf_fpdi']['severity'] = REQUIREMENT_OK;
|
49 |
|
|
$requirements['views_pdf_fpdi']['value'] = $t('Present');
|
50 |
|
|
unset($requirements['views_pdf_fpdi']['description']);
|
51 |
|
|
}
|
52 |
|
|
if (file_exists($path_fpdi . '/fpdf_tpl.php')) {
|
53 |
|
|
$requirements['views_pdf_fpdi_tpl']['severity'] = REQUIREMENT_OK;
|
54 |
|
|
$requirements['views_pdf_fpdi_tpl']['value'] = $t('Present');
|
55 |
|
|
unset($requirements['views_pdf_fpdi_tpl']['description']);
|
56 |
|
|
}
|
57 |
|
|
}
|
58 |
|
|
|
59 |
|
|
return $requirements;
|
60 |
|
|
}
|
61 |
|
|
|
62 |
ad751d46
|
Assos Assos
|
/**
|
63 |
99781f3b
|
Assos Assos
|
* The previous update to version 7.x-1.6 contained a faulty views_pdf_update_7000() function that
|
64 |
|
|
* created a faulty views display object for some pdf displays (i.e. pdf display with the default "Display a specified number of items | 10" pager )
|
65 |
|
|
* This resulted in a display_option['pager'] NULL array element, which broke the pdf display.
|
66 |
|
|
*
|
67 |
|
|
* This new update replaces the views_pdf_update_7000() function and fixes the faulty array element
|
68 |
|
|
* It is recommended that users avoid 7.x-1.6 and update to 7.x-1.7 version
|
69 |
ad751d46
|
Assos Assos
|
*/
|
70 |
99781f3b
|
Assos Assos
|
function views_pdf_update_7101() {
|
71 |
ad751d46
|
Assos Assos
|
$views = views_get_all_views();
|
72 |
|
|
|
73 |
|
|
foreach ($views as $key => $view) {
|
74 |
99781f3b
|
Assos Assos
|
foreach ($view->display as $key => $display) {
|
75 |
ad751d46
|
Assos Assos
|
if($display->display_plugin == 'pdf') {
|
76 |
99781f3b
|
Assos Assos
|
if(isset($display->display_options['pager'])) {
|
77 |
|
|
if (!isset($display->display_options['defaults']['pager'])) {
|
78 |
|
|
$display->display_options['defaults']['pager'] = FALSE;
|
79 |
|
|
}
|
80 |
|
|
if (!isset($display->display_options['defaults']['pager_options'])) {
|
81 |
|
|
$display->display_options['defaults']['pager_options'] = FALSE;
|
82 |
|
|
}
|
83 |
ad751d46
|
Assos Assos
|
}
|
84 |
|
|
}
|
85 |
|
|
}
|
86 |
|
|
views_save_view($view);
|
87 |
|
|
}
|
88 |
|
|
} |