1
|
<?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
|
|