|
1
|
|
|
<?php |
|
2
|
|
|
namespace Kitodo\Dlf\Hooks; |
|
3
|
|
|
|
|
4
|
|
|
/** |
|
5
|
|
|
* (c) Kitodo. Key to digital objects e.V. <[email protected]> |
|
6
|
|
|
* |
|
7
|
|
|
* This file is part of the Kitodo and TYPO3 projects. |
|
8
|
|
|
* |
|
9
|
|
|
* @license GNU General Public License version 3 or later. |
|
10
|
|
|
* For the full copyright and license information, please read the |
|
11
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
use Kitodo\Dlf\Common\Helper; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Hooks and helper for \TYPO3\CMS\Backend\Form\FormEngine |
|
18
|
|
|
* |
|
19
|
|
|
* @author Sebastian Meyer <[email protected]> |
|
20
|
|
|
* @package TYPO3 |
|
21
|
|
|
* @subpackage dlf |
|
22
|
|
|
* @access public |
|
23
|
|
|
*/ |
|
24
|
|
|
class FormEngine { |
|
25
|
|
|
/** |
|
26
|
|
|
* Helper to display document's thumbnail for table "tx_dlf_documents" |
|
27
|
|
|
* |
|
28
|
|
|
* @access public |
|
29
|
|
|
* |
|
30
|
|
|
* @param array &$params: An array with parameters |
|
31
|
|
|
* @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
|
|
|
|
|
32
|
|
|
* |
|
33
|
|
|
* @return string HTML <img> tag for thumbnail |
|
34
|
|
|
*/ |
|
35
|
|
|
public function displayThumbnail(&$params, &$pObj) { |
|
|
|
|
|
|
36
|
|
|
// Simulate TCA field type "passthrough". |
|
37
|
|
|
$output = '<input type="hidden" name="'.$params['itemFormElName'].'" value="'.$params['itemFormElValue'].'" />'; |
|
38
|
|
|
if (!empty($params['itemFormElValue'])) { |
|
39
|
|
|
$output .= '<img alt="" src="'.$params['itemFormElValue'].'" />'; |
|
40
|
|
|
} |
|
41
|
|
|
return $output; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Helper to get flexform's items array for plugin "tx_dlf_collection" |
|
46
|
|
|
* |
|
47
|
|
|
* @access public |
|
48
|
|
|
* |
|
49
|
|
|
* @param array &$params: An array with parameters |
|
50
|
|
|
* @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
51
|
|
|
* |
|
52
|
|
|
* @return void |
|
53
|
|
|
*/ |
|
54
|
|
|
public function itemsProcFunc_collectionList(&$params, &$pObj) { |
|
|
|
|
|
|
55
|
|
|
$this->itemsProcFunc_generateList( |
|
56
|
|
|
$params, |
|
57
|
|
|
'label,uid', |
|
58
|
|
|
'tx_dlf_collections', |
|
59
|
|
|
'label' |
|
60
|
|
|
); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* Helper to get flexform's items array for plugin "Search" |
|
65
|
|
|
* |
|
66
|
|
|
* @access public |
|
67
|
|
|
* |
|
68
|
|
|
* @param array &$params: An array with parameters |
|
69
|
|
|
* @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
70
|
|
|
* |
|
71
|
|
|
* @return void |
|
72
|
|
|
*/ |
|
73
|
|
|
public function itemsProcFunc_extendedSearchList(&$params, &$pObj) { |
|
|
|
|
|
|
74
|
|
|
$this->itemsProcFunc_generateList( |
|
75
|
|
|
$params, |
|
76
|
|
|
'label,index_name', |
|
77
|
|
|
'tx_dlf_metadata', |
|
78
|
|
|
'sorting', |
|
79
|
|
|
'AND index_indexed=1' |
|
80
|
|
|
); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* Helper to get flexform's items array for plugin "Search" |
|
85
|
|
|
* |
|
86
|
|
|
* @access public |
|
87
|
|
|
* |
|
88
|
|
|
* @param array &$params: An array with parameters |
|
89
|
|
|
* @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
90
|
|
|
* |
|
91
|
|
|
* @return void |
|
92
|
|
|
*/ |
|
93
|
|
|
public function itemsProcFunc_facetsList(&$params, &$pObj) { |
|
|
|
|
|
|
94
|
|
|
$this->itemsProcFunc_generateList( |
|
95
|
|
|
$params, |
|
96
|
|
|
'label,index_name', |
|
97
|
|
|
'tx_dlf_metadata', |
|
98
|
|
|
'sorting', |
|
99
|
|
|
'AND is_facet=1' |
|
100
|
|
|
); |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* Get list items from database |
|
105
|
|
|
* |
|
106
|
|
|
* @access protected |
|
107
|
|
|
* |
|
108
|
|
|
* @param array &$params: An array with parameters |
|
109
|
|
|
* @param string $fields: Comma-separated list of fields to fetch |
|
110
|
|
|
* @param string $table: Table name to fetch the items from |
|
111
|
|
|
* @param string $sorting: Field to sort items by (optionally appended by 'ASC' or 'DESC') |
|
112
|
|
|
* @param string $where: Additional WHERE clause |
|
113
|
|
|
* @param boolean $localize: Add check for localized records? |
|
114
|
|
|
* |
|
115
|
|
|
* @return void |
|
116
|
|
|
*/ |
|
117
|
|
|
protected function itemsProcFunc_generateList(&$params, $fields, $table, $sorting, $where = '', $localize = TRUE) { |
|
118
|
|
|
$pages = $params['row']['pages']; |
|
119
|
|
|
if (!empty($pages)) { |
|
120
|
|
|
if (!is_array($pages)) { |
|
121
|
|
|
$pages = [['uid' => $pages]]; |
|
122
|
|
|
} |
|
123
|
|
|
foreach ($pages as $page) { |
|
124
|
|
|
if ($page['uid'] > 0) { |
|
125
|
|
|
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
126
|
|
|
$fields, |
|
127
|
|
|
$table, |
|
128
|
|
|
'(pid='.intval($page['uid']).' '.$where.')' |
|
129
|
|
|
.($localize ? ' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)' : '') |
|
130
|
|
|
.Helper::whereClause($table), |
|
131
|
|
|
'', |
|
132
|
|
|
$sorting, |
|
133
|
|
|
'' |
|
134
|
|
|
); |
|
135
|
|
|
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
136
|
|
|
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { |
|
137
|
|
|
$params['items'][] = $resArray; |
|
138
|
|
|
} |
|
139
|
|
|
} |
|
140
|
|
|
} |
|
141
|
|
|
} |
|
142
|
|
|
} |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
/** |
|
146
|
|
|
* Helper to get flexform's items array for plugin "OaiPmh" |
|
147
|
|
|
* |
|
148
|
|
|
* @access public |
|
149
|
|
|
* |
|
150
|
|
|
* @param array &$params: An array with parameters |
|
151
|
|
|
* @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
152
|
|
|
* |
|
153
|
|
|
* @return void |
|
154
|
|
|
*/ |
|
155
|
|
|
public function itemsProcFunc_libraryList(&$params, &$pObj) { |
|
|
|
|
|
|
156
|
|
|
$this->itemsProcFunc_generateList( |
|
157
|
|
|
$params, |
|
158
|
|
|
'label,uid', |
|
159
|
|
|
'tx_dlf_libraries', |
|
160
|
|
|
'label' |
|
161
|
|
|
); |
|
162
|
|
|
} |
|
163
|
|
|
|
|
164
|
|
|
/** |
|
165
|
|
|
* Helper to get flexform's items array for plugin "Search" |
|
166
|
|
|
* |
|
167
|
|
|
* @access public |
|
168
|
|
|
* |
|
169
|
|
|
* @param array &$params: An array with parameters |
|
170
|
|
|
* @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
171
|
|
|
* |
|
172
|
|
|
* @return void |
|
173
|
|
|
*/ |
|
174
|
|
|
public function itemsProcFunc_solrList(&$params, &$pObj) { |
|
|
|
|
|
|
175
|
|
|
$this->itemsProcFunc_generateList( |
|
176
|
|
|
$params, |
|
177
|
|
|
'label,uid', |
|
178
|
|
|
'tx_dlf_solrcores', |
|
179
|
|
|
'label', |
|
180
|
|
|
'OR pid=0', |
|
181
|
|
|
FALSE |
|
182
|
|
|
); |
|
183
|
|
|
} |
|
184
|
|
|
|
|
185
|
|
|
/** |
|
186
|
|
|
* Helper to get flexform's items array for plugin "Toolbox" |
|
187
|
|
|
* |
|
188
|
|
|
* @access public |
|
189
|
|
|
* |
|
190
|
|
|
* @param array &$params: An array with parameters |
|
191
|
|
|
* @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
192
|
|
|
* |
|
193
|
|
|
* @return void |
|
194
|
|
|
*/ |
|
195
|
|
|
public function itemsProcFunc_toolList(&$params, &$pObj) { |
|
|
|
|
|
|
196
|
|
|
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'] as $class => $label) { |
|
197
|
|
|
$params['items'][] = [$GLOBALS['LANG']->sL($label), $class]; |
|
198
|
|
|
} |
|
199
|
|
|
} |
|
200
|
|
|
} |
|
201
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths