We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -19,69 +19,69 @@ |
||
19 | 19 | */ |
20 | 20 | class tx_dlf_hacks { |
21 | 21 | |
22 | - /** |
|
23 | - * Hook for the __construct() method of dlf/common/class.tx_dlf_document.php |
|
24 | - * When using Kitodo.Production the record identifier is saved only in MODS, but not |
|
25 | - * in METS. To get it anyway, we have to do some magic. |
|
26 | - * |
|
27 | - * @access public |
|
28 | - * |
|
29 | - * @param SimpleXMLElement &$xml: The XML object |
|
30 | - * @param mixed $record_id: The record identifier |
|
31 | - * |
|
32 | - * @return void |
|
33 | - */ |
|
34 | - public function construct_postProcessRecordId(SimpleXMLElement &$xml, &$record_id) { |
|
22 | + /** |
|
23 | + * Hook for the __construct() method of dlf/common/class.tx_dlf_document.php |
|
24 | + * When using Kitodo.Production the record identifier is saved only in MODS, but not |
|
25 | + * in METS. To get it anyway, we have to do some magic. |
|
26 | + * |
|
27 | + * @access public |
|
28 | + * |
|
29 | + * @param SimpleXMLElement &$xml: The XML object |
|
30 | + * @param mixed $record_id: The record identifier |
|
31 | + * |
|
32 | + * @return void |
|
33 | + */ |
|
34 | + public function construct_postProcessRecordId(SimpleXMLElement &$xml, &$record_id) { |
|
35 | 35 | |
36 | - if (!$record_id) { |
|
36 | + if (!$record_id) { |
|
37 | 37 | |
38 | - $xml->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3'); |
|
38 | + $xml->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3'); |
|
39 | 39 | |
40 | - // Get all logical structure nodes with metadata, but without associated METS-Pointers. |
|
41 | - if (($divs = $xml->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]'))) { |
|
40 | + // Get all logical structure nodes with metadata, but without associated METS-Pointers. |
|
41 | + if (($divs = $xml->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]'))) { |
|
42 | 42 | |
43 | - $smLinks = $xml->xpath('//mets:structLink/mets:smLink'); |
|
43 | + $smLinks = $xml->xpath('//mets:structLink/mets:smLink'); |
|
44 | 44 | |
45 | - if ($smLinks) { |
|
45 | + if ($smLinks) { |
|
46 | 46 | |
47 | - foreach ($smLinks as $smLink) { |
|
47 | + foreach ($smLinks as $smLink) { |
|
48 | 48 | |
49 | - $links[(string) $smLink->attributes('http://www.w3.org/1999/xlink')->from][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->to; |
|
49 | + $links[(string) $smLink->attributes('http://www.w3.org/1999/xlink')->from][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->to; |
|
50 | 50 | |
51 | - } |
|
51 | + } |
|
52 | 52 | |
53 | - foreach ($divs as $div) { |
|
53 | + foreach ($divs as $div) { |
|
54 | 54 | |
55 | - if (!empty($links[(string) $div['ID']])) { |
|
55 | + if (!empty($links[(string) $div['ID']])) { |
|
56 | 56 | |
57 | - $id = (string) $div['DMDID']; |
|
57 | + $id = (string) $div['DMDID']; |
|
58 | 58 | |
59 | - break; |
|
59 | + break; |
|
60 | 60 | |
61 | - } |
|
61 | + } |
|
62 | 62 | |
63 | - } |
|
63 | + } |
|
64 | 64 | |
65 | - } |
|
65 | + } |
|
66 | 66 | |
67 | - if (empty($id)) { |
|
67 | + if (empty($id)) { |
|
68 | 68 | |
69 | - $id = (string) $divs[0]['DMDID']; |
|
69 | + $id = (string) $divs[0]['DMDID']; |
|
70 | 70 | |
71 | - } |
|
71 | + } |
|
72 | 72 | |
73 | - $recordIds = $xml->xpath('//mets:dmdSec[@ID="'.$id.'"]//mods:mods/mods:recordInfo/mods:recordIdentifier'); |
|
73 | + $recordIds = $xml->xpath('//mets:dmdSec[@ID="'.$id.'"]//mods:mods/mods:recordInfo/mods:recordIdentifier'); |
|
74 | 74 | |
75 | - if (!empty($recordIds[0])) { |
|
75 | + if (!empty($recordIds[0])) { |
|
76 | 76 | |
77 | - $record_id = (string) $recordIds[0]; |
|
77 | + $record_id = (string) $recordIds[0]; |
|
78 | 78 | |
79 | - } |
|
79 | + } |
|
80 | 80 | |
81 | - } |
|
81 | + } |
|
82 | 82 | |
83 | - } |
|
83 | + } |
|
84 | 84 | |
85 | - } |
|
85 | + } |
|
86 | 86 | |
87 | 87 | } |
@@ -165,46 +165,46 @@ |
||
165 | 165 | // Register modules. |
166 | 166 | if (TYPO3_MODE == 'BE') { |
167 | 167 | |
168 | - // Add modules after "web". |
|
169 | - if (!isset($TBE_MODULES['txdlfmodules'])) { |
|
168 | + // Add modules after "web". |
|
169 | + if (!isset($TBE_MODULES['txdlfmodules'])) { |
|
170 | 170 | |
171 | - $modules = array(); |
|
171 | + $modules = array(); |
|
172 | 172 | |
173 | - foreach($TBE_MODULES as $key => $val) { |
|
173 | + foreach($TBE_MODULES as $key => $val) { |
|
174 | 174 | |
175 | - if ($key == 'web') { |
|
175 | + if ($key == 'web') { |
|
176 | 176 | |
177 | - $modules[$key] = $val; |
|
177 | + $modules[$key] = $val; |
|
178 | 178 | |
179 | - $modules['txdlfmodules'] = ''; |
|
179 | + $modules['txdlfmodules'] = ''; |
|
180 | 180 | |
181 | - } else { |
|
181 | + } else { |
|
182 | 182 | |
183 | - $modules[$key] = $val; |
|
183 | + $modules[$key] = $val; |
|
184 | 184 | |
185 | - } |
|
185 | + } |
|
186 | 186 | |
187 | - } |
|
187 | + } |
|
188 | 188 | |
189 | - $TBE_MODULES = $modules; |
|
189 | + $TBE_MODULES = $modules; |
|
190 | 190 | |
191 | - unset($modules); |
|
191 | + unset($modules); |
|
192 | 192 | |
193 | - } |
|
193 | + } |
|
194 | 194 | |
195 | - // Main "dlf" module. |
|
196 | - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule('txdlfmodules', '', '', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY).'modules/'); |
|
195 | + // Main "dlf" module. |
|
196 | + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule('txdlfmodules', '', '', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY).'modules/'); |
|
197 | 197 | |
198 | - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addNavigationComponent('txdlfmodules', 'typo3-pagetree'); |
|
198 | + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addNavigationComponent('txdlfmodules', 'typo3-pagetree'); |
|
199 | 199 | |
200 | - // Module "indexing". |
|
201 | - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule('txdlfmodules', 'txdlfindexing', '', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY).'modules/indexing/'); |
|
200 | + // Module "indexing". |
|
201 | + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule('txdlfmodules', 'txdlfindexing', '', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY).'modules/indexing/'); |
|
202 | 202 | |
203 | - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('_MOD_txdlfmodules_txdlfindexing','EXT:dlf/modules/indexing/locallang_mod.xml'); |
|
203 | + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('_MOD_txdlfmodules_txdlfindexing','EXT:dlf/modules/indexing/locallang_mod.xml'); |
|
204 | 204 | |
205 | - // Module "newclient". |
|
206 | - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule('txdlfmodules', 'txdlfnewclient', '', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY).'modules/newclient/'); |
|
205 | + // Module "newclient". |
|
206 | + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule('txdlfmodules', 'txdlfnewclient', '', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY).'modules/newclient/'); |
|
207 | 207 | |
208 | - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('_MOD_txdlfmodules_txdlfnewclient','EXT:dlf/modules/newclient/locallang_mod.xml'); |
|
208 | + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('_MOD_txdlfmodules_txdlfnewclient','EXT:dlf/modules/newclient/locallang_mod.xml'); |
|
209 | 209 | |
210 | 210 | } |
@@ -20,689 +20,689 @@ |
||
20 | 20 | */ |
21 | 21 | class tx_dlf_listview extends tx_dlf_plugin { |
22 | 22 | |
23 | - public $scriptRelPath = 'plugins/listview/class.tx_dlf_listview.php'; |
|
23 | + public $scriptRelPath = 'plugins/listview/class.tx_dlf_listview.php'; |
|
24 | 24 | |
25 | - /** |
|
26 | - * This holds the list |
|
27 | - * |
|
28 | - * @var tx_dlf_list |
|
29 | - * @access protected |
|
30 | - */ |
|
31 | - protected $list; |
|
25 | + /** |
|
26 | + * This holds the list |
|
27 | + * |
|
28 | + * @var tx_dlf_list |
|
29 | + * @access protected |
|
30 | + */ |
|
31 | + protected $list; |
|
32 | 32 | |
33 | - /** |
|
34 | - * Array of sorted metadata |
|
35 | - * |
|
36 | - * @var array |
|
37 | - * @access protected |
|
38 | - */ |
|
39 | - protected $metadata = array (); |
|
33 | + /** |
|
34 | + * Array of sorted metadata |
|
35 | + * |
|
36 | + * @var array |
|
37 | + * @access protected |
|
38 | + */ |
|
39 | + protected $metadata = array (); |
|
40 | 40 | |
41 | - /** |
|
42 | - * Array of sortable metadata |
|
43 | - * |
|
44 | - * @var array |
|
45 | - * @access protected |
|
46 | - */ |
|
47 | - protected $sortables = array (); |
|
41 | + /** |
|
42 | + * Array of sortable metadata |
|
43 | + * |
|
44 | + * @var array |
|
45 | + * @access protected |
|
46 | + */ |
|
47 | + protected $sortables = array (); |
|
48 | 48 | |
49 | - /** |
|
50 | - * Renders the page browser |
|
51 | - * |
|
52 | - * @access protected |
|
53 | - * |
|
54 | - * @return string The rendered page browser ready for output |
|
55 | - */ |
|
56 | - protected function getPageBrowser() { |
|
49 | + /** |
|
50 | + * Renders the page browser |
|
51 | + * |
|
52 | + * @access protected |
|
53 | + * |
|
54 | + * @return string The rendered page browser ready for output |
|
55 | + */ |
|
56 | + protected function getPageBrowser() { |
|
57 | 57 | |
58 | - // Get overall number of pages. |
|
59 | - $maxPages = intval(ceil(count($this->list) / $this->conf['limit'])); |
|
58 | + // Get overall number of pages. |
|
59 | + $maxPages = intval(ceil(count($this->list) / $this->conf['limit'])); |
|
60 | 60 | |
61 | - // Return empty pagebrowser if there is just one page. |
|
62 | - if ($maxPages < 2) { |
|
61 | + // Return empty pagebrowser if there is just one page. |
|
62 | + if ($maxPages < 2) { |
|
63 | 63 | |
64 | - return ''; |
|
64 | + return ''; |
|
65 | 65 | |
66 | - } |
|
66 | + } |
|
67 | 67 | |
68 | - // Get separator. |
|
69 | - $separator = $this->pi_getLL('separator', ' - ', TRUE); |
|
68 | + // Get separator. |
|
69 | + $separator = $this->pi_getLL('separator', ' - ', TRUE); |
|
70 | 70 | |
71 | - // Add link to previous page. |
|
72 | - if ($this->piVars['pointer'] > 0) { |
|
71 | + // Add link to previous page. |
|
72 | + if ($this->piVars['pointer'] > 0) { |
|
73 | 73 | |
74 | - $output = $this->pi_linkTP_keepPIvars($this->pi_getLL('prevPage', '<', TRUE), array ('pointer' => $this->piVars['pointer'] - 1), TRUE).$separator; |
|
74 | + $output = $this->pi_linkTP_keepPIvars($this->pi_getLL('prevPage', '<', TRUE), array ('pointer' => $this->piVars['pointer'] - 1), TRUE).$separator; |
|
75 | 75 | |
76 | - } else { |
|
76 | + } else { |
|
77 | 77 | |
78 | - $output = $this->pi_getLL('prevPage', '<', TRUE).$separator; |
|
78 | + $output = $this->pi_getLL('prevPage', '<', TRUE).$separator; |
|
79 | 79 | |
80 | - } |
|
80 | + } |
|
81 | 81 | |
82 | - $i = 0; |
|
82 | + $i = 0; |
|
83 | 83 | |
84 | - $skip = NULL; |
|
84 | + $skip = NULL; |
|
85 | 85 | |
86 | - // Add links to pages. |
|
87 | - while ($i < $maxPages) { |
|
86 | + // Add links to pages. |
|
87 | + while ($i < $maxPages) { |
|
88 | 88 | |
89 | - if ($i < 3 || ($i > $this->piVars['pointer'] - 3 && $i < $this->piVars['pointer'] + 3) || $i > $maxPages - 4) { |
|
89 | + if ($i < 3 || ($i > $this->piVars['pointer'] - 3 && $i < $this->piVars['pointer'] + 3) || $i > $maxPages - 4) { |
|
90 | 90 | |
91 | - if ($this->piVars['pointer'] != $i) { |
|
91 | + if ($this->piVars['pointer'] != $i) { |
|
92 | 92 | |
93 | - $output .= $this->pi_linkTP_keepPIvars(sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1), array ('pointer' => $i), TRUE).$separator; |
|
93 | + $output .= $this->pi_linkTP_keepPIvars(sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1), array ('pointer' => $i), TRUE).$separator; |
|
94 | 94 | |
95 | - } else { |
|
95 | + } else { |
|
96 | 96 | |
97 | - $output .= sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1).$separator; |
|
97 | + $output .= sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1).$separator; |
|
98 | 98 | |
99 | - } |
|
99 | + } |
|
100 | 100 | |
101 | - $skip = TRUE; |
|
101 | + $skip = TRUE; |
|
102 | 102 | |
103 | - } elseif ($skip === TRUE) { |
|
103 | + } elseif ($skip === TRUE) { |
|
104 | 104 | |
105 | - $output .= $this->pi_getLL('skip', '...', TRUE).$separator; |
|
105 | + $output .= $this->pi_getLL('skip', '...', TRUE).$separator; |
|
106 | 106 | |
107 | - $skip = FALSE; |
|
107 | + $skip = FALSE; |
|
108 | 108 | |
109 | - } |
|
109 | + } |
|
110 | 110 | |
111 | - $i++; |
|
111 | + $i++; |
|
112 | 112 | |
113 | - } |
|
113 | + } |
|
114 | 114 | |
115 | - // Add link to next page. |
|
116 | - if ($this->piVars['pointer'] < $maxPages - 1) { |
|
115 | + // Add link to next page. |
|
116 | + if ($this->piVars['pointer'] < $maxPages - 1) { |
|
117 | 117 | |
118 | - $output .= $this->pi_linkTP_keepPIvars($this->pi_getLL('nextPage', '>', TRUE), array ('pointer' => $this->piVars['pointer'] + 1), TRUE); |
|
118 | + $output .= $this->pi_linkTP_keepPIvars($this->pi_getLL('nextPage', '>', TRUE), array ('pointer' => $this->piVars['pointer'] + 1), TRUE); |
|
119 | 119 | |
120 | - } else { |
|
120 | + } else { |
|
121 | 121 | |
122 | - $output .= $this->pi_getLL('nextPage', '>', TRUE); |
|
122 | + $output .= $this->pi_getLL('nextPage', '>', TRUE); |
|
123 | 123 | |
124 | - } |
|
124 | + } |
|
125 | 125 | |
126 | - return $output; |
|
126 | + return $output; |
|
127 | 127 | |
128 | - } |
|
128 | + } |
|
129 | 129 | |
130 | - /** |
|
131 | - * Renders one entry of the list |
|
132 | - * |
|
133 | - * @access protected |
|
134 | - * |
|
135 | - * @param integer $number: The number of the entry |
|
136 | - * @param string $template: Parsed template subpart |
|
137 | - * |
|
138 | - * @return string The rendered entry ready for output |
|
139 | - */ |
|
140 | - protected function getEntry($number, $template) { |
|
130 | + /** |
|
131 | + * Renders one entry of the list |
|
132 | + * |
|
133 | + * @access protected |
|
134 | + * |
|
135 | + * @param integer $number: The number of the entry |
|
136 | + * @param string $template: Parsed template subpart |
|
137 | + * |
|
138 | + * @return string The rendered entry ready for output |
|
139 | + */ |
|
140 | + protected function getEntry($number, $template) { |
|
141 | 141 | |
142 | - $markerArray['###NUMBER###'] = $number + 1; |
|
142 | + $markerArray['###NUMBER###'] = $number + 1; |
|
143 | 143 | |
144 | - $markerArray['###METADATA###'] = ''; |
|
144 | + $markerArray['###METADATA###'] = ''; |
|
145 | 145 | |
146 | - $markerArray['###THUMBNAIL###'] = ''; |
|
146 | + $markerArray['###THUMBNAIL###'] = ''; |
|
147 | 147 | |
148 | - $markerArray['###PREVIEW###'] = ''; |
|
148 | + $markerArray['###PREVIEW###'] = ''; |
|
149 | 149 | |
150 | - $subpart = ''; |
|
150 | + $subpart = ''; |
|
151 | 151 | |
152 | - $imgAlt = ''; |
|
152 | + $imgAlt = ''; |
|
153 | 153 | |
154 | - $metadata = $this->list[$number]['metadata']; |
|
154 | + $metadata = $this->list[$number]['metadata']; |
|
155 | 155 | |
156 | - foreach ($this->metadata as $index_name => $metaConf) { |
|
156 | + foreach ($this->metadata as $index_name => $metaConf) { |
|
157 | 157 | |
158 | - $parsedValue = ''; |
|
158 | + $parsedValue = ''; |
|
159 | 159 | |
160 | - $fieldwrap = $this->parseTS($metaConf['wrap']); |
|
160 | + $fieldwrap = $this->parseTS($metaConf['wrap']); |
|
161 | 161 | |
162 | - do { |
|
162 | + do { |
|
163 | 163 | |
164 | - $value = @array_shift($metadata[$index_name]); |
|
164 | + $value = @array_shift($metadata[$index_name]); |
|
165 | 165 | |
166 | - // Link title to pageview. |
|
167 | - if ($index_name == 'title') { |
|
166 | + // Link title to pageview. |
|
167 | + if ($index_name == 'title') { |
|
168 | 168 | |
169 | - // Get title of parent document if needed. |
|
170 | - if (empty($value) && $this->conf['getTitle']) { |
|
169 | + // Get title of parent document if needed. |
|
170 | + if (empty($value) && $this->conf['getTitle']) { |
|
171 | 171 | |
172 | - $superiorTitle = tx_dlf_document::getTitle($this->list[$number]['uid'], TRUE); |
|
172 | + $superiorTitle = tx_dlf_document::getTitle($this->list[$number]['uid'], TRUE); |
|
173 | 173 | |
174 | - if (!empty($superiorTitle)) { |
|
174 | + if (!empty($superiorTitle)) { |
|
175 | 175 | |
176 | - $value = '['.$superiorTitle.']'; |
|
176 | + $value = '['.$superiorTitle.']'; |
|
177 | 177 | |
178 | - } |
|
178 | + } |
|
179 | 179 | |
180 | - } |
|
180 | + } |
|
181 | 181 | |
182 | - // Set fake title if still not present. |
|
183 | - if (empty($value)) { |
|
182 | + // Set fake title if still not present. |
|
183 | + if (empty($value)) { |
|
184 | 184 | |
185 | - $value = $this->pi_getLL('noTitle'); |
|
185 | + $value = $this->pi_getLL('noTitle'); |
|
186 | 186 | |
187 | - } |
|
187 | + } |
|
188 | 188 | |
189 | - $imgAlt = htmlspecialchars($value); |
|
189 | + $imgAlt = htmlspecialchars($value); |
|
190 | 190 | |
191 | - $additionalParams = array ( |
|
192 | - 'id' => $this->list[$number]['uid'], |
|
193 | - 'page' => $this->list[$number]['page'] |
|
194 | - ); |
|
191 | + $additionalParams = array ( |
|
192 | + 'id' => $this->list[$number]['uid'], |
|
193 | + 'page' => $this->list[$number]['page'] |
|
194 | + ); |
|
195 | 195 | |
196 | - if(!empty($this->piVars['logicalPage'])) { |
|
196 | + if(!empty($this->piVars['logicalPage'])) { |
|
197 | 197 | |
198 | - $additionalParams['logicalPage'] = $this->piVars['logicalPage']; |
|
198 | + $additionalParams['logicalPage'] = $this->piVars['logicalPage']; |
|
199 | 199 | |
200 | - } |
|
200 | + } |
|
201 | 201 | |
202 | - $conf = array ( |
|
203 | - 'useCacheHash' => 1, |
|
204 | - 'parameter' => $this->conf['targetPid'], |
|
205 | - 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE) |
|
206 | - ); |
|
202 | + $conf = array ( |
|
203 | + 'useCacheHash' => 1, |
|
204 | + 'parameter' => $this->conf['targetPid'], |
|
205 | + 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE) |
|
206 | + ); |
|
207 | 207 | |
208 | - $value = $this->cObj->typoLink(htmlspecialchars($value), $conf); |
|
208 | + $value = $this->cObj->typoLink(htmlspecialchars($value), $conf); |
|
209 | 209 | |
210 | - // Translate name of holding library. |
|
211 | - } elseif ($index_name == 'owner' && !empty($value)) { |
|
210 | + // Translate name of holding library. |
|
211 | + } elseif ($index_name == 'owner' && !empty($value)) { |
|
212 | 212 | |
213 | - $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages'])); |
|
213 | + $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages'])); |
|
214 | 214 | |
215 | - // Translate document type. |
|
216 | - } elseif ($index_name == 'type' && !empty($value)) { |
|
215 | + // Translate document type. |
|
216 | + } elseif ($index_name == 'type' && !empty($value)) { |
|
217 | 217 | |
218 | - $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages'])); |
|
218 | + $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages'])); |
|
219 | 219 | |
220 | - // Translate ISO 639 language code. |
|
221 | - } elseif ($index_name == 'language' && !empty($value)) { |
|
220 | + // Translate ISO 639 language code. |
|
221 | + } elseif ($index_name == 'language' && !empty($value)) { |
|
222 | 222 | |
223 | - $value = htmlspecialchars(tx_dlf_helper::getLanguageName($value)); |
|
223 | + $value = htmlspecialchars(tx_dlf_helper::getLanguageName($value)); |
|
224 | 224 | |
225 | - } elseif (!empty($value)) { |
|
225 | + } elseif (!empty($value)) { |
|
226 | 226 | |
227 | - $value = htmlspecialchars($value); |
|
227 | + $value = htmlspecialchars($value); |
|
228 | 228 | |
229 | - } |
|
229 | + } |
|
230 | 230 | |
231 | - $value = $this->cObj->stdWrap($value, $fieldwrap['value.']); |
|
231 | + $value = $this->cObj->stdWrap($value, $fieldwrap['value.']); |
|
232 | 232 | |
233 | - if (!empty($value)) { |
|
233 | + if (!empty($value)) { |
|
234 | 234 | |
235 | - $parsedValue .= $value; |
|
235 | + $parsedValue .= $value; |
|
236 | 236 | |
237 | - } |
|
237 | + } |
|
238 | 238 | |
239 | - } while (count($metadata[$index_name])); |
|
239 | + } while (count($metadata[$index_name])); |
|
240 | 240 | |
241 | - if (!empty($parsedValue)) { |
|
241 | + if (!empty($parsedValue)) { |
|
242 | 242 | |
243 | - $field = $this->cObj->stdWrap(htmlspecialchars($metaConf['label']), $fieldwrap['key.']); |
|
243 | + $field = $this->cObj->stdWrap(htmlspecialchars($metaConf['label']), $fieldwrap['key.']); |
|
244 | 244 | |
245 | - $field .= $parsedValue; |
|
245 | + $field .= $parsedValue; |
|
246 | 246 | |
247 | - $markerArray['###METADATA###'] .= $this->cObj->stdWrap($field, $fieldwrap['all.']); |
|
247 | + $markerArray['###METADATA###'] .= $this->cObj->stdWrap($field, $fieldwrap['all.']); |
|
248 | 248 | |
249 | - } |
|
249 | + } |
|
250 | 250 | |
251 | - } |
|
251 | + } |
|
252 | 252 | |
253 | - // Add thumbnail. |
|
254 | - if (!empty($this->list[$number]['thumbnail'])) { |
|
253 | + // Add thumbnail. |
|
254 | + if (!empty($this->list[$number]['thumbnail'])) { |
|
255 | 255 | |
256 | - $markerArray['###THUMBNAIL###'] = '<img alt="'.$imgAlt.'" src="'.$this->list[$number]['thumbnail'].'" />'; |
|
256 | + $markerArray['###THUMBNAIL###'] = '<img alt="'.$imgAlt.'" src="'.$this->list[$number]['thumbnail'].'" />'; |
|
257 | 257 | |
258 | - } |
|
258 | + } |
|
259 | 259 | |
260 | - // Add preview. |
|
261 | - if (!empty($this->list[$number]['preview'])) { |
|
260 | + // Add preview. |
|
261 | + if (!empty($this->list[$number]['preview'])) { |
|
262 | 262 | |
263 | - $markerArray['###PREVIEW###'] = $this->list[$number]['preview']; |
|
263 | + $markerArray['###PREVIEW###'] = $this->list[$number]['preview']; |
|
264 | 264 | |
265 | - } |
|
265 | + } |
|
266 | 266 | |
267 | - if (!empty($this->list[$number]['subparts'])) { |
|
267 | + if (!empty($this->list[$number]['subparts'])) { |
|
268 | 268 | |
269 | - $subpart = $this->getSubEntries($number, $template); |
|
269 | + $subpart = $this->getSubEntries($number, $template); |
|
270 | 270 | |
271 | - } |
|
271 | + } |
|
272 | 272 | |
273 | - // basket button |
|
274 | - $markerArray['###BASKETBUTTON###'] = ''; |
|
273 | + // basket button |
|
274 | + $markerArray['###BASKETBUTTON###'] = ''; |
|
275 | 275 | |
276 | - if (!empty($this->conf['basketButton']) && !empty($this->conf['targetBasket'])) { |
|
276 | + if (!empty($this->conf['basketButton']) && !empty($this->conf['targetBasket'])) { |
|
277 | 277 | |
278 | - $additionalParams = array ('id' => $this->list[$number]['uid'], 'startpage' => $this->list[$number]['page'], 'addToBasket' => 'list'); |
|
278 | + $additionalParams = array ('id' => $this->list[$number]['uid'], 'startpage' => $this->list[$number]['page'], 'addToBasket' => 'list'); |
|
279 | 279 | |
280 | - $conf = array ( |
|
281 | - 'useCacheHash' => 1, |
|
282 | - 'parameter' => $this->conf['targetBasket'], |
|
283 | - 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE) |
|
284 | - ); |
|
280 | + $conf = array ( |
|
281 | + 'useCacheHash' => 1, |
|
282 | + 'parameter' => $this->conf['targetBasket'], |
|
283 | + 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE) |
|
284 | + ); |
|
285 | 285 | |
286 | - $link = $this->cObj->typoLink($this->pi_getLL('addBasket', '', TRUE), $conf); |
|
286 | + $link = $this->cObj->typoLink($this->pi_getLL('addBasket', '', TRUE), $conf); |
|
287 | 287 | |
288 | - $markerArray['###BASKETBUTTON###'] = $link; |
|
288 | + $markerArray['###BASKETBUTTON###'] = $link; |
|
289 | 289 | |
290 | - } |
|
290 | + } |
|
291 | 291 | |
292 | - return $this->cObj->substituteMarkerArray($this->cObj->substituteSubpart($template['entry'], '###SUBTEMPLATE###', $subpart, TRUE), $markerArray); |
|
292 | + return $this->cObj->substituteMarkerArray($this->cObj->substituteSubpart($template['entry'], '###SUBTEMPLATE###', $subpart, TRUE), $markerArray); |
|
293 | 293 | |
294 | - } |
|
294 | + } |
|
295 | 295 | |
296 | - /** |
|
297 | - * Renders sorting dialog |
|
298 | - * |
|
299 | - * @access protected |
|
300 | - * |
|
301 | - * @return string The rendered sorting dialog ready for output |
|
302 | - */ |
|
303 | - protected function getSortingForm() { |
|
296 | + /** |
|
297 | + * Renders sorting dialog |
|
298 | + * |
|
299 | + * @access protected |
|
300 | + * |
|
301 | + * @return string The rendered sorting dialog ready for output |
|
302 | + */ |
|
303 | + protected function getSortingForm() { |
|
304 | 304 | |
305 | - // Return nothing if there are no sortable metadata fields. |
|
306 | - if (!count($this->sortables)) { |
|
305 | + // Return nothing if there are no sortable metadata fields. |
|
306 | + if (!count($this->sortables)) { |
|
307 | 307 | |
308 | - return ''; |
|
308 | + return ''; |
|
309 | 309 | |
310 | - } |
|
310 | + } |
|
311 | 311 | |
312 | - // Set class prefix. |
|
313 | - $prefix = str_replace('_', '-', get_class($this)); |
|
312 | + // Set class prefix. |
|
313 | + $prefix = str_replace('_', '-', get_class($this)); |
|
314 | 314 | |
315 | - // Configure @action URL for form. |
|
316 | - $linkConf = array ( |
|
317 | - 'parameter' => $GLOBALS['TSFE']->id, |
|
318 | - 'forceAbsoluteUrl' => 1 |
|
319 | - ); |
|
315 | + // Configure @action URL for form. |
|
316 | + $linkConf = array ( |
|
317 | + 'parameter' => $GLOBALS['TSFE']->id, |
|
318 | + 'forceAbsoluteUrl' => 1 |
|
319 | + ); |
|
320 | 320 | |
321 | - if(!empty($this->piVars['logicalPage'])) { |
|
321 | + if(!empty($this->piVars['logicalPage'])) { |
|
322 | 322 | |
323 | - $linkConf['additionalParams'] = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId,array('logicalPage' => $this->piVars['logicalPage']), '', TRUE, FALSE); |
|
323 | + $linkConf['additionalParams'] = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId,array('logicalPage' => $this->piVars['logicalPage']), '', TRUE, FALSE); |
|
324 | 324 | |
325 | - } |
|
325 | + } |
|
326 | 326 | |
327 | - // Build HTML form. |
|
328 | - $sorting = '<form action="'.$this->cObj->typoLink_URL($linkConf).'" method="get"><div><input type="hidden" name="id" value="'.$GLOBALS['TSFE']->id.'" />'; |
|
327 | + // Build HTML form. |
|
328 | + $sorting = '<form action="'.$this->cObj->typoLink_URL($linkConf).'" method="get"><div><input type="hidden" name="id" value="'.$GLOBALS['TSFE']->id.'" />'; |
|
329 | 329 | |
330 | - foreach ($this->piVars as $piVar => $value) { |
|
330 | + foreach ($this->piVars as $piVar => $value) { |
|
331 | 331 | |
332 | - if ($piVar != 'order' && $piVar != 'DATA' && !empty($value)) { |
|
332 | + if ($piVar != 'order' && $piVar != 'DATA' && !empty($value)) { |
|
333 | 333 | |
334 | - $sorting .= '<input type="hidden" name="'.$this->prefixId.'['.$piVar.']" value="'.$value.'" />'; |
|
334 | + $sorting .= '<input type="hidden" name="'.$this->prefixId.'['.$piVar.']" value="'.$value.'" />'; |
|
335 | 335 | |
336 | - } |
|
336 | + } |
|
337 | 337 | |
338 | - } |
|
338 | + } |
|
339 | 339 | |
340 | - // Select sort field. |
|
341 | - $uniqId = uniqid($prefix.'-'); |
|
340 | + // Select sort field. |
|
341 | + $uniqId = uniqid($prefix.'-'); |
|
342 | 342 | |
343 | - $sorting .= '<label for="'.$uniqId.'">'.$this->pi_getLL('orderBy', '', TRUE).'</label><select id="'.$uniqId.'" name="'.$this->prefixId.'[order]" onchange="javascript:this.form.submit();">'; |
|
343 | + $sorting .= '<label for="'.$uniqId.'">'.$this->pi_getLL('orderBy', '', TRUE).'</label><select id="'.$uniqId.'" name="'.$this->prefixId.'[order]" onchange="javascript:this.form.submit();">'; |
|
344 | 344 | |
345 | - // Add relevance sorting if this is a search result list. |
|
346 | - if ($this->list->metadata['options']['source'] == 'search') { |
|
345 | + // Add relevance sorting if this is a search result list. |
|
346 | + if ($this->list->metadata['options']['source'] == 'search') { |
|
347 | 347 | |
348 | - $sorting .= '<option value="relevance"'.(($this->list->metadata['options']['order'] == 'relevance') ? ' selected="selected"' : '').'>'.$this->pi_getLL('relevance', '', TRUE).'</option>'; |
|
348 | + $sorting .= '<option value="relevance"'.(($this->list->metadata['options']['order'] == 'relevance') ? ' selected="selected"' : '').'>'.$this->pi_getLL('relevance', '', TRUE).'</option>'; |
|
349 | 349 | |
350 | - } |
|
350 | + } |
|
351 | 351 | |
352 | - foreach ($this->sortables as $index_name => $label) { |
|
352 | + foreach ($this->sortables as $index_name => $label) { |
|
353 | 353 | |
354 | - $sorting .= '<option value="'.$index_name.'"'.(($this->list->metadata['options']['order'] == $index_name) ? ' selected="selected"' : '').'>'.htmlspecialchars($label).'</option>'; |
|
354 | + $sorting .= '<option value="'.$index_name.'"'.(($this->list->metadata['options']['order'] == $index_name) ? ' selected="selected"' : '').'>'.htmlspecialchars($label).'</option>'; |
|
355 | 355 | |
356 | - } |
|
356 | + } |
|
357 | 357 | |
358 | - $sorting .= '</select>'; |
|
358 | + $sorting .= '</select>'; |
|
359 | 359 | |
360 | - // Select sort direction. |
|
361 | - $uniqId = uniqid($prefix.'-'); |
|
360 | + // Select sort direction. |
|
361 | + $uniqId = uniqid($prefix.'-'); |
|
362 | 362 | |
363 | - $sorting .= '<label for="'.$uniqId.'">'.$this->pi_getLL('direction', '', TRUE).'</label><select id="'.$uniqId.'" name="'.$this->prefixId.'[asc]" onchange="javascript:this.form.submit();">'; |
|
363 | + $sorting .= '<label for="'.$uniqId.'">'.$this->pi_getLL('direction', '', TRUE).'</label><select id="'.$uniqId.'" name="'.$this->prefixId.'[asc]" onchange="javascript:this.form.submit();">'; |
|
364 | 364 | |
365 | - $sorting .= '<option value="1" '.($this->list->metadata['options']['order.asc'] ? ' selected="selected"' : '').'>'.$this->pi_getLL('direction.asc', '', TRUE).'</option>'; |
|
365 | + $sorting .= '<option value="1" '.($this->list->metadata['options']['order.asc'] ? ' selected="selected"' : '').'>'.$this->pi_getLL('direction.asc', '', TRUE).'</option>'; |
|
366 | 366 | |
367 | - $sorting .= '<option value="0" '.(!$this->list->metadata['options']['order.asc'] ? ' selected="selected"' : '').'>'.$this->pi_getLL('direction.desc', '', TRUE).'</option>'; |
|
367 | + $sorting .= '<option value="0" '.(!$this->list->metadata['options']['order.asc'] ? ' selected="selected"' : '').'>'.$this->pi_getLL('direction.desc', '', TRUE).'</option>'; |
|
368 | 368 | |
369 | - $sorting .= '</select></div></form>'; |
|
369 | + $sorting .= '</select></div></form>'; |
|
370 | 370 | |
371 | - return $sorting; |
|
371 | + return $sorting; |
|
372 | 372 | |
373 | - } |
|
373 | + } |
|
374 | 374 | |
375 | - /** |
|
376 | - * Renders all sub-entries of one entry |
|
377 | - * |
|
378 | - * @access protected |
|
379 | - * |
|
380 | - * @param integer $number: The number of the entry |
|
381 | - * @param string $template: Parsed template subpart |
|
382 | - * |
|
383 | - * @return string The rendered entries ready for output |
|
384 | - */ |
|
385 | - protected function getSubEntries($number, $template) { |
|
375 | + /** |
|
376 | + * Renders all sub-entries of one entry |
|
377 | + * |
|
378 | + * @access protected |
|
379 | + * |
|
380 | + * @param integer $number: The number of the entry |
|
381 | + * @param string $template: Parsed template subpart |
|
382 | + * |
|
383 | + * @return string The rendered entries ready for output |
|
384 | + */ |
|
385 | + protected function getSubEntries($number, $template) { |
|
386 | 386 | |
387 | - $content = ''; |
|
387 | + $content = ''; |
|
388 | 388 | |
389 | - foreach ($this->list[$number]['subparts'] as $subpart) { |
|
389 | + foreach ($this->list[$number]['subparts'] as $subpart) { |
|
390 | 390 | |
391 | - $markerArray['###SUBMETADATA###'] = ''; |
|
391 | + $markerArray['###SUBMETADATA###'] = ''; |
|
392 | 392 | |
393 | - $markerArray['###SUBTHUMBNAIL###'] = ''; |
|
393 | + $markerArray['###SUBTHUMBNAIL###'] = ''; |
|
394 | 394 | |
395 | - $markerArray['###SUBPREVIEW###'] = ''; |
|
395 | + $markerArray['###SUBPREVIEW###'] = ''; |
|
396 | 396 | |
397 | - $imgAlt = ''; |
|
397 | + $imgAlt = ''; |
|
398 | 398 | |
399 | - foreach ($this->metadata as $index_name => $metaConf) { |
|
399 | + foreach ($this->metadata as $index_name => $metaConf) { |
|
400 | 400 | |
401 | - $parsedValue = ''; |
|
401 | + $parsedValue = ''; |
|
402 | 402 | |
403 | - $fieldwrap = $this->parseTS($metaConf['wrap']); |
|
403 | + $fieldwrap = $this->parseTS($metaConf['wrap']); |
|
404 | 404 | |
405 | - do { |
|
405 | + do { |
|
406 | 406 | |
407 | - $value = @array_shift($subpart['metadata'][$index_name]); |
|
407 | + $value = @array_shift($subpart['metadata'][$index_name]); |
|
408 | 408 | |
409 | - // Link title to pageview. |
|
410 | - if ($index_name == 'title') { |
|
409 | + // Link title to pageview. |
|
410 | + if ($index_name == 'title') { |
|
411 | 411 | |
412 | - // Get title of parent document if needed. |
|
413 | - if (empty($value) && $this->conf['getTitle']) { |
|
412 | + // Get title of parent document if needed. |
|
413 | + if (empty($value) && $this->conf['getTitle']) { |
|
414 | 414 | |
415 | - $superiorTitle = tx_dlf_document::getTitle($subpart['uid'], TRUE); |
|
415 | + $superiorTitle = tx_dlf_document::getTitle($subpart['uid'], TRUE); |
|
416 | 416 | |
417 | - if (!empty($superiorTitle)) { |
|
417 | + if (!empty($superiorTitle)) { |
|
418 | 418 | |
419 | - $value = '['.$superiorTitle.']'; |
|
419 | + $value = '['.$superiorTitle.']'; |
|
420 | 420 | |
421 | - } |
|
421 | + } |
|
422 | 422 | |
423 | - } |
|
423 | + } |
|
424 | 424 | |
425 | - // Set fake title if still not present. |
|
426 | - if (empty($value)) { |
|
425 | + // Set fake title if still not present. |
|
426 | + if (empty($value)) { |
|
427 | 427 | |
428 | - $value = $this->pi_getLL('noTitle'); |
|
428 | + $value = $this->pi_getLL('noTitle'); |
|
429 | 429 | |
430 | - } |
|
430 | + } |
|
431 | 431 | |
432 | - $imgAlt = htmlspecialchars($value); |
|
432 | + $imgAlt = htmlspecialchars($value); |
|
433 | 433 | |
434 | - $additionalParams = array ( |
|
435 | - 'id' => $subpart['uid'], |
|
436 | - 'page' => $subpart['page'], |
|
437 | - 'highlight_word' => preg_replace('/\s\s+/', ';', $this->list->metadata['searchString']) |
|
438 | - ); |
|
434 | + $additionalParams = array ( |
|
435 | + 'id' => $subpart['uid'], |
|
436 | + 'page' => $subpart['page'], |
|
437 | + 'highlight_word' => preg_replace('/\s\s+/', ';', $this->list->metadata['searchString']) |
|
438 | + ); |
|
439 | 439 | |
440 | - if(!empty($this->piVars['logicalPage'])) { |
|
440 | + if(!empty($this->piVars['logicalPage'])) { |
|
441 | 441 | |
442 | - $additionalParams['logicalPage'] = $this->piVars['logicalPage']; |
|
442 | + $additionalParams['logicalPage'] = $this->piVars['logicalPage']; |
|
443 | 443 | |
444 | - } |
|
444 | + } |
|
445 | 445 | |
446 | - $conf = array ( |
|
447 | - // we don't want cHash in case of search parameters |
|
448 | - 'useCacheHash' => empty($this->list->metadata['searchString']) ? 1 : 0, |
|
449 | - 'parameter' => $this->conf['targetPid'], |
|
450 | - 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE) |
|
451 | - ); |
|
446 | + $conf = array ( |
|
447 | + // we don't want cHash in case of search parameters |
|
448 | + 'useCacheHash' => empty($this->list->metadata['searchString']) ? 1 : 0, |
|
449 | + 'parameter' => $this->conf['targetPid'], |
|
450 | + 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE) |
|
451 | + ); |
|
452 | 452 | |
453 | - $value = $this->cObj->typoLink(htmlspecialchars($value), $conf); |
|
453 | + $value = $this->cObj->typoLink(htmlspecialchars($value), $conf); |
|
454 | 454 | |
455 | - // Translate name of holding library. |
|
456 | - } elseif ($index_name == 'owner' && !empty($value)) { |
|
455 | + // Translate name of holding library. |
|
456 | + } elseif ($index_name == 'owner' && !empty($value)) { |
|
457 | 457 | |
458 | - $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages'])); |
|
458 | + $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages'])); |
|
459 | 459 | |
460 | - // Translate document type. |
|
461 | - } elseif ($index_name == 'type' && !empty($value)) { |
|
460 | + // Translate document type. |
|
461 | + } elseif ($index_name == 'type' && !empty($value)) { |
|
462 | 462 | |
463 | - $_value = $value; |
|
463 | + $_value = $value; |
|
464 | 464 | |
465 | - $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages'])); |
|
465 | + $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages'])); |
|
466 | 466 | |
467 | - // Add page number for single pages. |
|
468 | - if ($_value == 'page') { |
|
467 | + // Add page number for single pages. |
|
468 | + if ($_value == 'page') { |
|
469 | 469 | |
470 | - $value .= ' '.intval($subpart['page']); |
|
470 | + $value .= ' '.intval($subpart['page']); |
|
471 | 471 | |
472 | - } |
|
472 | + } |
|
473 | 473 | |
474 | - // Translate ISO 639 language code. |
|
475 | - } elseif ($index_name == 'language' && !empty($value)) { |
|
474 | + // Translate ISO 639 language code. |
|
475 | + } elseif ($index_name == 'language' && !empty($value)) { |
|
476 | 476 | |
477 | - $value = htmlspecialchars(tx_dlf_helper::getLanguageName($value)); |
|
477 | + $value = htmlspecialchars(tx_dlf_helper::getLanguageName($value)); |
|
478 | 478 | |
479 | - } elseif (!empty($value)) { |
|
479 | + } elseif (!empty($value)) { |
|
480 | 480 | |
481 | - $value = htmlspecialchars($value); |
|
481 | + $value = htmlspecialchars($value); |
|
482 | 482 | |
483 | - } |
|
483 | + } |
|
484 | 484 | |
485 | - $value = $this->cObj->stdWrap($value, $fieldwrap['value.']); |
|
485 | + $value = $this->cObj->stdWrap($value, $fieldwrap['value.']); |
|
486 | 486 | |
487 | - if (!empty($value)) { |
|
487 | + if (!empty($value)) { |
|
488 | 488 | |
489 | - $parsedValue .= $value; |
|
489 | + $parsedValue .= $value; |
|
490 | 490 | |
491 | - } |
|
491 | + } |
|
492 | 492 | |
493 | - } while (count($subpart['metadata'][$index_name])); |
|
493 | + } while (count($subpart['metadata'][$index_name])); |
|
494 | 494 | |
495 | - if (!empty($parsedValue)) { |
|
495 | + if (!empty($parsedValue)) { |
|
496 | 496 | |
497 | - $field = $this->cObj->stdWrap(htmlspecialchars($metaConf['label']), $fieldwrap['key.']); |
|
497 | + $field = $this->cObj->stdWrap(htmlspecialchars($metaConf['label']), $fieldwrap['key.']); |
|
498 | 498 | |
499 | - $field .= $parsedValue; |
|
499 | + $field .= $parsedValue; |
|
500 | 500 | |
501 | - $markerArray['###SUBMETADATA###'] .= $this->cObj->stdWrap($field, $fieldwrap['all.']); |
|
501 | + $markerArray['###SUBMETADATA###'] .= $this->cObj->stdWrap($field, $fieldwrap['all.']); |
|
502 | 502 | |
503 | - } |
|
503 | + } |
|
504 | 504 | |
505 | - } |
|
505 | + } |
|
506 | 506 | |
507 | - // Add thumbnail. |
|
508 | - if (!empty($subpart['thumbnail'])) { |
|
507 | + // Add thumbnail. |
|
508 | + if (!empty($subpart['thumbnail'])) { |
|
509 | 509 | |
510 | - $markerArray['###SUBTHUMBNAIL###'] = '<img alt="'.$imgAlt.'" src="'.$subpart['thumbnail'].'" />'; |
|
510 | + $markerArray['###SUBTHUMBNAIL###'] = '<img alt="'.$imgAlt.'" src="'.$subpart['thumbnail'].'" />'; |
|
511 | 511 | |
512 | - } |
|
512 | + } |
|
513 | 513 | |
514 | - // Add preview. |
|
515 | - if (!empty($subpart['preview'])) { |
|
514 | + // Add preview. |
|
515 | + if (!empty($subpart['preview'])) { |
|
516 | 516 | |
517 | - $markerArray['###SUBPREVIEW###'] = $subpart['preview']; |
|
517 | + $markerArray['###SUBPREVIEW###'] = $subpart['preview']; |
|
518 | 518 | |
519 | - } |
|
519 | + } |
|
520 | 520 | |
521 | - // basket button |
|
522 | - $markerArray['###SUBBASKETBUTTON###'] = ''; |
|
521 | + // basket button |
|
522 | + $markerArray['###SUBBASKETBUTTON###'] = ''; |
|
523 | 523 | |
524 | - if (!empty($this->conf['basketButton']) && !empty($this->conf['targetBasket'])) { |
|
524 | + if (!empty($this->conf['basketButton']) && !empty($this->conf['targetBasket'])) { |
|
525 | 525 | |
526 | - $additionalParams = array ('id' => $this->list[$number]['uid'], 'startpage' => $subpart['page'], 'endpage' => $subpart['page'], 'logId' => $subpart['sid'], 'addToBasket' => 'subentry'); |
|
526 | + $additionalParams = array ('id' => $this->list[$number]['uid'], 'startpage' => $subpart['page'], 'endpage' => $subpart['page'], 'logId' => $subpart['sid'], 'addToBasket' => 'subentry'); |
|
527 | 527 | |
528 | - $conf = array ( |
|
529 | - 'useCacheHash' => 1, |
|
530 | - 'parameter' => $this->conf['targetBasket'], |
|
531 | - 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE) |
|
532 | - ); |
|
528 | + $conf = array ( |
|
529 | + 'useCacheHash' => 1, |
|
530 | + 'parameter' => $this->conf['targetBasket'], |
|
531 | + 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE) |
|
532 | + ); |
|
533 | 533 | |
534 | - $link = $this->cObj->typoLink($this->pi_getLL('addBasket', '', TRUE), $conf); |
|
534 | + $link = $this->cObj->typoLink($this->pi_getLL('addBasket', '', TRUE), $conf); |
|
535 | 535 | |
536 | - $markerArray['###SUBBASKETBUTTON###'] = $link; |
|
536 | + $markerArray['###SUBBASKETBUTTON###'] = $link; |
|
537 | 537 | |
538 | - } |
|
538 | + } |
|
539 | 539 | |
540 | - $content .= $this->cObj->substituteMarkerArray($template['subentry'], $markerArray); |
|
540 | + $content .= $this->cObj->substituteMarkerArray($template['subentry'], $markerArray); |
|
541 | 541 | |
542 | - } |
|
542 | + } |
|
543 | 543 | |
544 | - return $this->cObj->substituteSubpart($this->cObj->getSubpart($this->template, '###SUBTEMPLATE###'), '###SUBENTRY###', $content, TRUE); |
|
544 | + return $this->cObj->substituteSubpart($this->cObj->getSubpart($this->template, '###SUBTEMPLATE###'), '###SUBENTRY###', $content, TRUE); |
|
545 | 545 | |
546 | - } |
|
546 | + } |
|
547 | 547 | |
548 | - /** |
|
549 | - * Get metadata configuration from database |
|
550 | - * |
|
551 | - * @access protected |
|
552 | - * |
|
553 | - * @return void |
|
554 | - */ |
|
555 | - protected function loadConfig() { |
|
548 | + /** |
|
549 | + * Get metadata configuration from database |
|
550 | + * |
|
551 | + * @access protected |
|
552 | + * |
|
553 | + * @return void |
|
554 | + */ |
|
555 | + protected function loadConfig() { |
|
556 | 556 | |
557 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
558 | - 'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.wrap AS wrap,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.is_sortable AS is_sortable', |
|
559 | - 'tx_dlf_metadata', |
|
560 | - '(tx_dlf_metadata.is_listed=1 OR tx_dlf_metadata.is_sortable=1) AND tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
561 | - '', |
|
562 | - 'tx_dlf_metadata.sorting ASC', |
|
563 | - '' |
|
564 | - ); |
|
557 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
558 | + 'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.wrap AS wrap,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.is_sortable AS is_sortable', |
|
559 | + 'tx_dlf_metadata', |
|
560 | + '(tx_dlf_metadata.is_listed=1 OR tx_dlf_metadata.is_sortable=1) AND tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
561 | + '', |
|
562 | + 'tx_dlf_metadata.sorting ASC', |
|
563 | + '' |
|
564 | + ); |
|
565 | 565 | |
566 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
566 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
567 | 567 | |
568 | - if ($resArray['is_listed']) { |
|
568 | + if ($resArray['is_listed']) { |
|
569 | 569 | |
570 | - $this->metadata[$resArray['index_name']] = array ( |
|
571 | - 'wrap' => $resArray['wrap'], |
|
572 | - 'label' => tx_dlf_helper::translate($resArray['index_name'], 'tx_dlf_metadata', $this->conf['pages']) |
|
573 | - ); |
|
570 | + $this->metadata[$resArray['index_name']] = array ( |
|
571 | + 'wrap' => $resArray['wrap'], |
|
572 | + 'label' => tx_dlf_helper::translate($resArray['index_name'], 'tx_dlf_metadata', $this->conf['pages']) |
|
573 | + ); |
|
574 | 574 | |
575 | - } |
|
575 | + } |
|
576 | 576 | |
577 | - if ($resArray['is_sortable']) { |
|
577 | + if ($resArray['is_sortable']) { |
|
578 | 578 | |
579 | - $this->sortables[$resArray['index_name']] = tx_dlf_helper::translate($resArray['index_name'], 'tx_dlf_metadata', $this->conf['pages']); |
|
579 | + $this->sortables[$resArray['index_name']] = tx_dlf_helper::translate($resArray['index_name'], 'tx_dlf_metadata', $this->conf['pages']); |
|
580 | 580 | |
581 | - } |
|
581 | + } |
|
582 | 582 | |
583 | - } |
|
583 | + } |
|
584 | 584 | |
585 | - } |
|
585 | + } |
|
586 | 586 | |
587 | - /** |
|
588 | - * The main method of the PlugIn |
|
589 | - * |
|
590 | - * @access public |
|
591 | - * |
|
592 | - * @param string $content: The PlugIn content |
|
593 | - * @param array $conf: The PlugIn configuration |
|
594 | - * |
|
595 | - * @return string The content that is displayed on the website |
|
596 | - */ |
|
597 | - public function main($content, $conf) { |
|
587 | + /** |
|
588 | + * The main method of the PlugIn |
|
589 | + * |
|
590 | + * @access public |
|
591 | + * |
|
592 | + * @param string $content: The PlugIn content |
|
593 | + * @param array $conf: The PlugIn configuration |
|
594 | + * |
|
595 | + * @return string The content that is displayed on the website |
|
596 | + */ |
|
597 | + public function main($content, $conf) { |
|
598 | 598 | |
599 | - $this->init($conf); |
|
599 | + $this->init($conf); |
|
600 | 600 | |
601 | - // Don't cache the output. |
|
602 | - $this->setCache(FALSE); |
|
601 | + // Don't cache the output. |
|
602 | + $this->setCache(FALSE); |
|
603 | 603 | |
604 | - // Load the list. |
|
605 | - $this->list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
604 | + // Load the list. |
|
605 | + $this->list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
606 | 606 | |
607 | - // Sort the list if applicable. |
|
608 | - if ((!empty($this->piVars['order']) && $this->piVars['order'] != $this->list->metadata['options']['order']) |
|
609 | - || (isset($this->piVars['asc']) && $this->piVars['asc'] != $this->list->metadata['options']['order.asc'])) { |
|
607 | + // Sort the list if applicable. |
|
608 | + if ((!empty($this->piVars['order']) && $this->piVars['order'] != $this->list->metadata['options']['order']) |
|
609 | + || (isset($this->piVars['asc']) && $this->piVars['asc'] != $this->list->metadata['options']['order.asc'])) { |
|
610 | 610 | |
611 | - // Order list by given field. |
|
612 | - $this->list->sort($this->piVars['order'], (boolean) $this->piVars['asc']); |
|
611 | + // Order list by given field. |
|
612 | + $this->list->sort($this->piVars['order'], (boolean) $this->piVars['asc']); |
|
613 | 613 | |
614 | - // Update list's metadata. |
|
615 | - $listMetadata = $this->list->metadata; |
|
614 | + // Update list's metadata. |
|
615 | + $listMetadata = $this->list->metadata; |
|
616 | 616 | |
617 | - $listMetadata['options']['order'] = $this->piVars['order']; |
|
617 | + $listMetadata['options']['order'] = $this->piVars['order']; |
|
618 | 618 | |
619 | - $listMetadata['options']['order.asc'] = (boolean) $this->piVars['asc']; |
|
619 | + $listMetadata['options']['order.asc'] = (boolean) $this->piVars['asc']; |
|
620 | 620 | |
621 | - $this->list->metadata = $listMetadata; |
|
621 | + $this->list->metadata = $listMetadata; |
|
622 | 622 | |
623 | - // Save updated list. |
|
624 | - $this->list->save(); |
|
623 | + // Save updated list. |
|
624 | + $this->list->save(); |
|
625 | 625 | |
626 | - // Reset pointer. |
|
627 | - $this->piVars['pointer'] = 0; |
|
626 | + // Reset pointer. |
|
627 | + $this->piVars['pointer'] = 0; |
|
628 | 628 | |
629 | - } |
|
629 | + } |
|
630 | 630 | |
631 | - // Load template file. |
|
632 | - if (!empty($this->conf['templateFile'])) { |
|
631 | + // Load template file. |
|
632 | + if (!empty($this->conf['templateFile'])) { |
|
633 | 633 | |
634 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
634 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
635 | 635 | |
636 | - } else { |
|
636 | + } else { |
|
637 | 637 | |
638 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/listview/template.tmpl'), '###TEMPLATE###'); |
|
638 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/listview/template.tmpl'), '###TEMPLATE###'); |
|
639 | 639 | |
640 | - } |
|
640 | + } |
|
641 | 641 | |
642 | - $subpartArray['entry'] = $this->cObj->getSubpart($this->template, '###ENTRY###'); |
|
642 | + $subpartArray['entry'] = $this->cObj->getSubpart($this->template, '###ENTRY###'); |
|
643 | 643 | |
644 | - $subpartArray['subentry'] = $this->cObj->getSubpart($this->template, '###SUBENTRY###'); |
|
644 | + $subpartArray['subentry'] = $this->cObj->getSubpart($this->template, '###SUBENTRY###'); |
|
645 | 645 | |
646 | - // Set some variable defaults. |
|
647 | - if (!empty($this->piVars['pointer']) && (($this->piVars['pointer'] * $this->conf['limit']) + 1) <= count($this->list)) { |
|
646 | + // Set some variable defaults. |
|
647 | + if (!empty($this->piVars['pointer']) && (($this->piVars['pointer'] * $this->conf['limit']) + 1) <= count($this->list)) { |
|
648 | 648 | |
649 | - $this->piVars['pointer'] = max(intval($this->piVars['pointer']), 0); |
|
649 | + $this->piVars['pointer'] = max(intval($this->piVars['pointer']), 0); |
|
650 | 650 | |
651 | - } else { |
|
651 | + } else { |
|
652 | 652 | |
653 | - $this->piVars['pointer'] = 0; |
|
653 | + $this->piVars['pointer'] = 0; |
|
654 | 654 | |
655 | - } |
|
655 | + } |
|
656 | 656 | |
657 | - // Load metadata configuration. |
|
658 | - $this->loadConfig(); |
|
657 | + // Load metadata configuration. |
|
658 | + $this->loadConfig(); |
|
659 | 659 | |
660 | - for ($i = $this->piVars['pointer'] * $this->conf['limit'], $j = ($this->piVars['pointer'] + 1) * $this->conf['limit']; $i < $j; $i++) { |
|
660 | + for ($i = $this->piVars['pointer'] * $this->conf['limit'], $j = ($this->piVars['pointer'] + 1) * $this->conf['limit']; $i < $j; $i++) { |
|
661 | 661 | |
662 | - if (empty($this->list[$i])) { |
|
662 | + if (empty($this->list[$i])) { |
|
663 | 663 | |
664 | - break; |
|
664 | + break; |
|
665 | 665 | |
666 | - } else { |
|
666 | + } else { |
|
667 | 667 | |
668 | - $content .= $this->getEntry($i, $subpartArray); |
|
668 | + $content .= $this->getEntry($i, $subpartArray); |
|
669 | 669 | |
670 | - } |
|
670 | + } |
|
671 | 671 | |
672 | - } |
|
672 | + } |
|
673 | 673 | |
674 | - $markerArray['###LISTTITLE###'] = $this->list->metadata['label']; |
|
674 | + $markerArray['###LISTTITLE###'] = $this->list->metadata['label']; |
|
675 | 675 | |
676 | - $markerArray['###LISTDESCRIPTION###'] = $this->list->metadata['description']; |
|
676 | + $markerArray['###LISTDESCRIPTION###'] = $this->list->metadata['description']; |
|
677 | 677 | |
678 | - if (!empty($this->list->metadata['thumbnail'])) { |
|
678 | + if (!empty($this->list->metadata['thumbnail'])) { |
|
679 | 679 | |
680 | - $markerArray['###LISTTHUMBNAIL###'] = '<img alt="" src="'.$this->list->metadata['thumbnail'].'" />'; |
|
680 | + $markerArray['###LISTTHUMBNAIL###'] = '<img alt="" src="'.$this->list->metadata['thumbnail'].'" />'; |
|
681 | 681 | |
682 | - } else { |
|
682 | + } else { |
|
683 | 683 | |
684 | - $markerArray['###LISTTHUMBNAIL###'] = ''; |
|
684 | + $markerArray['###LISTTHUMBNAIL###'] = ''; |
|
685 | 685 | |
686 | - } |
|
686 | + } |
|
687 | 687 | |
688 | - if ($i) { |
|
688 | + if ($i) { |
|
689 | 689 | |
690 | - $markerArray['###COUNT###'] = htmlspecialchars(sprintf($this->pi_getLL('count'), ($this->piVars['pointer'] * $this->conf['limit']) + 1, $i, count($this->list))); |
|
690 | + $markerArray['###COUNT###'] = htmlspecialchars(sprintf($this->pi_getLL('count'), ($this->piVars['pointer'] * $this->conf['limit']) + 1, $i, count($this->list))); |
|
691 | 691 | |
692 | - } else { |
|
692 | + } else { |
|
693 | 693 | |
694 | - $markerArray['###COUNT###'] = $this->pi_getLL('nohits', '', TRUE); |
|
694 | + $markerArray['###COUNT###'] = $this->pi_getLL('nohits', '', TRUE); |
|
695 | 695 | |
696 | - } |
|
696 | + } |
|
697 | 697 | |
698 | - $markerArray['###PAGEBROWSER###'] = $this->getPageBrowser(); |
|
698 | + $markerArray['###PAGEBROWSER###'] = $this->getPageBrowser(); |
|
699 | 699 | |
700 | - $markerArray['###SORTING###'] = $this->getSortingForm(); |
|
700 | + $markerArray['###SORTING###'] = $this->getSortingForm(); |
|
701 | 701 | |
702 | - $content = $this->cObj->substituteMarkerArray($this->cObj->substituteSubpart($this->template, '###ENTRY###', $content, TRUE), $markerArray); |
|
702 | + $content = $this->cObj->substituteMarkerArray($this->cObj->substituteSubpart($this->template, '###ENTRY###', $content, TRUE), $markerArray); |
|
703 | 703 | |
704 | - return $this->pi_wrapInBaseClass($content); |
|
704 | + return $this->pi_wrapInBaseClass($content); |
|
705 | 705 | |
706 | - } |
|
706 | + } |
|
707 | 707 | |
708 | 708 | } |
@@ -19,315 +19,315 @@ |
||
19 | 19 | */ |
20 | 20 | class tx_dlf_navigation extends tx_dlf_plugin { |
21 | 21 | |
22 | - public $scriptRelPath = 'plugins/navigation/class.tx_dlf_navigation.php'; |
|
22 | + public $scriptRelPath = 'plugins/navigation/class.tx_dlf_navigation.php'; |
|
23 | 23 | |
24 | - /** |
|
25 | - * Display a link to the list view |
|
26 | - * |
|
27 | - * @access protected |
|
28 | - * |
|
29 | - * @return string Link to the list view ready to output |
|
30 | - */ |
|
31 | - protected function getLinkToListview() { |
|
24 | + /** |
|
25 | + * Display a link to the list view |
|
26 | + * |
|
27 | + * @access protected |
|
28 | + * |
|
29 | + * @return string Link to the list view ready to output |
|
30 | + */ |
|
31 | + protected function getLinkToListview() { |
|
32 | 32 | |
33 | - if (!empty($this->conf['targetPid'])) { |
|
33 | + if (!empty($this->conf['targetPid'])) { |
|
34 | 34 | |
35 | - // Load the list. |
|
36 | - $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
35 | + // Load the list. |
|
36 | + $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
37 | 37 | |
38 | - if (count($list) > 0) { |
|
38 | + if (count($list) > 0) { |
|
39 | 39 | |
40 | - // Build typolink configuration array. |
|
41 | - $conf = array ( |
|
42 | - 'useCacheHash' => 1, |
|
43 | - 'parameter' => $this->conf['targetPid'], |
|
44 | - 'title' => $this->pi_getLL('linkToList', '', TRUE) |
|
45 | - ); |
|
40 | + // Build typolink configuration array. |
|
41 | + $conf = array ( |
|
42 | + 'useCacheHash' => 1, |
|
43 | + 'parameter' => $this->conf['targetPid'], |
|
44 | + 'title' => $this->pi_getLL('linkToList', '', TRUE) |
|
45 | + ); |
|
46 | 46 | |
47 | - return $this->cObj->typoLink($this->pi_getLL('linkToList', '', TRUE), $conf); |
|
47 | + return $this->cObj->typoLink($this->pi_getLL('linkToList', '', TRUE), $conf); |
|
48 | 48 | |
49 | - } |
|
49 | + } |
|
50 | 50 | |
51 | - } |
|
51 | + } |
|
52 | 52 | |
53 | - return ''; |
|
53 | + return ''; |
|
54 | 54 | |
55 | - } |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * Display the page selector for the page view |
|
59 | - * |
|
60 | - * @access protected |
|
61 | - * |
|
62 | - * @return string Page selector ready to output |
|
63 | - */ |
|
64 | - protected function getPageSelector() { |
|
57 | + /** |
|
58 | + * Display the page selector for the page view |
|
59 | + * |
|
60 | + * @access protected |
|
61 | + * |
|
62 | + * @return string Page selector ready to output |
|
63 | + */ |
|
64 | + protected function getPageSelector() { |
|
65 | 65 | |
66 | - // Configure @action URL for form. |
|
67 | - $linkConf = array ( |
|
68 | - 'parameter' => $GLOBALS['TSFE']->id, |
|
69 | - 'forceAbsoluteUrl' => 1 |
|
70 | - ); |
|
66 | + // Configure @action URL for form. |
|
67 | + $linkConf = array ( |
|
68 | + 'parameter' => $GLOBALS['TSFE']->id, |
|
69 | + 'forceAbsoluteUrl' => 1 |
|
70 | + ); |
|
71 | 71 | |
72 | - $output = '<form action="'.$this->cObj->typoLink_URL($linkConf).'" method="get"><div><input type="hidden" name="id" value="'.$GLOBALS['TSFE']->id.'" />'; |
|
72 | + $output = '<form action="'.$this->cObj->typoLink_URL($linkConf).'" method="get"><div><input type="hidden" name="id" value="'.$GLOBALS['TSFE']->id.'" />'; |
|
73 | 73 | |
74 | - // Add plugin variables. |
|
75 | - foreach ($this->piVars as $piVar => $value) { |
|
74 | + // Add plugin variables. |
|
75 | + foreach ($this->piVars as $piVar => $value) { |
|
76 | 76 | |
77 | - if ($piVar != 'page' && $piVars != 'DATA' && !empty($value)) { |
|
77 | + if ($piVar != 'page' && $piVars != 'DATA' && !empty($value)) { |
|
78 | 78 | |
79 | - $output .= '<input type="hidden" name="'.$this->prefixId.'['.$piVar.']" value="'.$value.'" />'; |
|
79 | + $output .= '<input type="hidden" name="'.$this->prefixId.'['.$piVar.']" value="'.$value.'" />'; |
|
80 | 80 | |
81 | - } |
|
81 | + } |
|
82 | 82 | |
83 | - } |
|
83 | + } |
|
84 | 84 | |
85 | - // Add page selector. |
|
86 | - $uniqId = uniqid(str_replace('_', '-', get_class($this)).'-'); |
|
85 | + // Add page selector. |
|
86 | + $uniqId = uniqid(str_replace('_', '-', get_class($this)).'-'); |
|
87 | 87 | |
88 | - $output .= '<label for="'.$uniqId.'">'.$this->pi_getLL('selectPage', '', TRUE).'</label><select id="'.$uniqId.'" name="'.$this->prefixId.'[page]" onchange="javascript:this.form.submit();"'.($this->doc->numPages < 1 ? ' disabled="disabled"' : '').'>'; |
|
88 | + $output .= '<label for="'.$uniqId.'">'.$this->pi_getLL('selectPage', '', TRUE).'</label><select id="'.$uniqId.'" name="'.$this->prefixId.'[page]" onchange="javascript:this.form.submit();"'.($this->doc->numPages < 1 ? ' disabled="disabled"' : '').'>'; |
|
89 | 89 | |
90 | - for ($i = 1; $i <= $this->doc->numPages; $i++) { |
|
90 | + for ($i = 1; $i <= $this->doc->numPages; $i++) { |
|
91 | 91 | |
92 | - $output .= '<option value="'.$i.'"'.($this->piVars['page'] == $i ? ' selected="selected"' : '').'>['.$i.']'.($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$i]]['orderlabel'] ? ' - '.htmlspecialchars($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$i]]['orderlabel']) : '').'</option>'; |
|
92 | + $output .= '<option value="'.$i.'"'.($this->piVars['page'] == $i ? ' selected="selected"' : '').'>['.$i.']'.($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$i]]['orderlabel'] ? ' - '.htmlspecialchars($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$i]]['orderlabel']) : '').'</option>'; |
|
93 | 93 | |
94 | - } |
|
94 | + } |
|
95 | 95 | |
96 | - $output .= '</select></div></form>'; |
|
96 | + $output .= '</select></div></form>'; |
|
97 | 97 | |
98 | - return $output; |
|
98 | + return $output; |
|
99 | 99 | |
100 | - } |
|
100 | + } |
|
101 | 101 | |
102 | - /** |
|
103 | - * The main method of the PlugIn |
|
104 | - * |
|
105 | - * @access public |
|
106 | - * |
|
107 | - * @param string $content: The PlugIn content |
|
108 | - * @param array $conf: The PlugIn configuration |
|
109 | - * |
|
110 | - * @return string The content that is displayed on the website |
|
111 | - */ |
|
112 | - public function main($content, $conf) { |
|
102 | + /** |
|
103 | + * The main method of the PlugIn |
|
104 | + * |
|
105 | + * @access public |
|
106 | + * |
|
107 | + * @param string $content: The PlugIn content |
|
108 | + * @param array $conf: The PlugIn configuration |
|
109 | + * |
|
110 | + * @return string The content that is displayed on the website |
|
111 | + */ |
|
112 | + public function main($content, $conf) { |
|
113 | 113 | |
114 | - $this->init($conf); |
|
114 | + $this->init($conf); |
|
115 | 115 | |
116 | - // Turn cache on. |
|
117 | - $this->setCache(TRUE); |
|
116 | + // Turn cache on. |
|
117 | + $this->setCache(TRUE); |
|
118 | 118 | |
119 | - // Load current document. |
|
120 | - $this->loadDocument(); |
|
119 | + // Load current document. |
|
120 | + $this->loadDocument(); |
|
121 | 121 | |
122 | - if ($this->doc === NULL) { |
|
122 | + if ($this->doc === NULL) { |
|
123 | 123 | |
124 | - // Quit without doing anything if required variables are not set. |
|
125 | - return $content; |
|
124 | + // Quit without doing anything if required variables are not set. |
|
125 | + return $content; |
|
126 | 126 | |
127 | - } else { |
|
127 | + } else { |
|
128 | 128 | |
129 | - // Set default values if not set. |
|
130 | - if ($this->doc->numPages > 0) { |
|
129 | + // Set default values if not set. |
|
130 | + if ($this->doc->numPages > 0) { |
|
131 | 131 | |
132 | - if (!empty($this->piVars['logicalPage'])) { |
|
132 | + if (!empty($this->piVars['logicalPage'])) { |
|
133 | 133 | |
134 | - $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); |
|
135 | - // The logical page parameter should not appear |
|
136 | - unset($this->piVars['logicalPage']); |
|
134 | + $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); |
|
135 | + // The logical page parameter should not appear |
|
136 | + unset($this->piVars['logicalPage']); |
|
137 | 137 | |
138 | - } |
|
138 | + } |
|
139 | 139 | |
140 | - // Set default values if not set. |
|
141 | - // $this->piVars['page'] may be integer or string (physical structure @ID) |
|
142 | - if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
140 | + // Set default values if not set. |
|
141 | + // $this->piVars['page'] may be integer or string (physical structure @ID) |
|
142 | + if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
143 | 143 | |
144 | - $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
144 | + $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
145 | 145 | |
146 | - } else { |
|
146 | + } else { |
|
147 | 147 | |
148 | - $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); |
|
148 | + $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); |
|
149 | 149 | |
150 | - } |
|
150 | + } |
|
151 | 151 | |
152 | - $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); |
|
152 | + $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); |
|
153 | 153 | |
154 | - } else { |
|
154 | + } else { |
|
155 | 155 | |
156 | - $this->piVars['page'] = 0; |
|
156 | + $this->piVars['page'] = 0; |
|
157 | 157 | |
158 | - $this->piVars['double'] = 0; |
|
158 | + $this->piVars['double'] = 0; |
|
159 | 159 | |
160 | - } |
|
160 | + } |
|
161 | 161 | |
162 | - } |
|
162 | + } |
|
163 | 163 | |
164 | - // Load template file. |
|
165 | - if (!empty($this->conf['templateFile'])) { |
|
164 | + // Load template file. |
|
165 | + if (!empty($this->conf['templateFile'])) { |
|
166 | 166 | |
167 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
167 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
168 | 168 | |
169 | - } else { |
|
169 | + } else { |
|
170 | 170 | |
171 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/navigation/template.tmpl'), '###TEMPLATE###'); |
|
171 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/navigation/template.tmpl'), '###TEMPLATE###'); |
|
172 | 172 | |
173 | - } |
|
173 | + } |
|
174 | 174 | |
175 | - // Steps for X pages backward / forward. Double page view uses double steps. |
|
176 | - $pageSteps = $this->conf['pageStep'] * ($this->piVars['double'] + 1); |
|
175 | + // Steps for X pages backward / forward. Double page view uses double steps. |
|
176 | + $pageSteps = $this->conf['pageStep'] * ($this->piVars['double'] + 1); |
|
177 | 177 | |
178 | - // Link to first page. |
|
179 | - if ($this->piVars['page'] > 1) { |
|
178 | + // Link to first page. |
|
179 | + if ($this->piVars['page'] > 1) { |
|
180 | 180 | |
181 | - $markerArray['###FIRST###'] = $this->makeLink($this->pi_getLL('firstPage', '', TRUE), array ('page' => 1)); |
|
181 | + $markerArray['###FIRST###'] = $this->makeLink($this->pi_getLL('firstPage', '', TRUE), array ('page' => 1)); |
|
182 | 182 | |
183 | - } else { |
|
183 | + } else { |
|
184 | 184 | |
185 | - $markerArray['###FIRST###'] = '<span>'.$this->pi_getLL('firstPage', '', TRUE).'</span>'; |
|
185 | + $markerArray['###FIRST###'] = '<span>'.$this->pi_getLL('firstPage', '', TRUE).'</span>'; |
|
186 | 186 | |
187 | - } |
|
187 | + } |
|
188 | 188 | |
189 | - // Link back X pages. |
|
190 | - if ($this->piVars['page'] > $pageSteps) { |
|
189 | + // Link back X pages. |
|
190 | + if ($this->piVars['page'] > $pageSteps) { |
|
191 | 191 | |
192 | - $markerArray['###BACK###'] = $this->makeLink(sprintf($this->pi_getLL('backXPages', '', TRUE), $pageSteps), array ('page' => $this->piVars['page'] - $pageSteps)); |
|
192 | + $markerArray['###BACK###'] = $this->makeLink(sprintf($this->pi_getLL('backXPages', '', TRUE), $pageSteps), array ('page' => $this->piVars['page'] - $pageSteps)); |
|
193 | 193 | |
194 | - } else { |
|
194 | + } else { |
|
195 | 195 | |
196 | - $markerArray['###BACK###'] = '<span>'.sprintf($this->pi_getLL('backXPages', '', TRUE), $pageSteps).'</span>'; |
|
196 | + $markerArray['###BACK###'] = '<span>'.sprintf($this->pi_getLL('backXPages', '', TRUE), $pageSteps).'</span>'; |
|
197 | 197 | |
198 | - } |
|
198 | + } |
|
199 | 199 | |
200 | - // Link to previous page. |
|
201 | - if ($this->piVars['page'] > (1 + $this->piVars['double'])) { |
|
200 | + // Link to previous page. |
|
201 | + if ($this->piVars['page'] > (1 + $this->piVars['double'])) { |
|
202 | 202 | |
203 | - $markerArray['###PREVIOUS###'] = $this->makeLink($this->pi_getLL('prevPage', '', TRUE), array ('page' => $this->piVars['page'] - (1 + $this->piVars['double']))); |
|
203 | + $markerArray['###PREVIOUS###'] = $this->makeLink($this->pi_getLL('prevPage', '', TRUE), array ('page' => $this->piVars['page'] - (1 + $this->piVars['double']))); |
|
204 | 204 | |
205 | - } else { |
|
205 | + } else { |
|
206 | 206 | |
207 | - $markerArray['###PREVIOUS###'] = '<span>'.$this->pi_getLL('prevPage', '', TRUE).'</span>'; |
|
207 | + $markerArray['###PREVIOUS###'] = '<span>'.$this->pi_getLL('prevPage', '', TRUE).'</span>'; |
|
208 | 208 | |
209 | - } |
|
209 | + } |
|
210 | 210 | |
211 | - // Link to next page. |
|
212 | - if ($this->piVars['page'] < ($this->doc->numPages - $this->piVars['double'])) { |
|
211 | + // Link to next page. |
|
212 | + if ($this->piVars['page'] < ($this->doc->numPages - $this->piVars['double'])) { |
|
213 | 213 | |
214 | - $markerArray['###NEXT###'] = $this->makeLink($this->pi_getLL('nextPage', '', TRUE), array ('page' => $this->piVars['page'] + (1 + $this->piVars['double']))); |
|
214 | + $markerArray['###NEXT###'] = $this->makeLink($this->pi_getLL('nextPage', '', TRUE), array ('page' => $this->piVars['page'] + (1 + $this->piVars['double']))); |
|
215 | 215 | |
216 | - } else { |
|
216 | + } else { |
|
217 | 217 | |
218 | - $markerArray['###NEXT###'] = '<span>'.$this->pi_getLL('nextPage', '', TRUE).'</span>'; |
|
218 | + $markerArray['###NEXT###'] = '<span>'.$this->pi_getLL('nextPage', '', TRUE).'</span>'; |
|
219 | 219 | |
220 | - } |
|
220 | + } |
|
221 | 221 | |
222 | - // Link forward X pages. |
|
223 | - if ($this->piVars['page'] <= ($this->doc->numPages - $pageSteps)) { |
|
222 | + // Link forward X pages. |
|
223 | + if ($this->piVars['page'] <= ($this->doc->numPages - $pageSteps)) { |
|
224 | 224 | |
225 | - $markerArray['###FORWARD###'] = $this->makeLink(sprintf($this->pi_getLL('forwardXPages', '', TRUE), $pageSteps), array ('page' => $this->piVars['page'] + $pageSteps)); |
|
225 | + $markerArray['###FORWARD###'] = $this->makeLink(sprintf($this->pi_getLL('forwardXPages', '', TRUE), $pageSteps), array ('page' => $this->piVars['page'] + $pageSteps)); |
|
226 | 226 | |
227 | - } else { |
|
227 | + } else { |
|
228 | 228 | |
229 | - $markerArray['###FORWARD###'] = '<span>'.sprintf($this->pi_getLL('forwardXPages', '', TRUE), $pageSteps).'</span>'; |
|
229 | + $markerArray['###FORWARD###'] = '<span>'.sprintf($this->pi_getLL('forwardXPages', '', TRUE), $pageSteps).'</span>'; |
|
230 | 230 | |
231 | - } |
|
231 | + } |
|
232 | 232 | |
233 | - // Link to last page. |
|
234 | - if ($this->piVars['page'] < $this->doc->numPages) { |
|
233 | + // Link to last page. |
|
234 | + if ($this->piVars['page'] < $this->doc->numPages) { |
|
235 | 235 | |
236 | - $markerArray['###LAST###'] = $this->makeLink($this->pi_getLL('lastPage', '', TRUE), array ('page' => $this->doc->numPages)); |
|
236 | + $markerArray['###LAST###'] = $this->makeLink($this->pi_getLL('lastPage', '', TRUE), array ('page' => $this->doc->numPages)); |
|
237 | 237 | |
238 | - } else { |
|
238 | + } else { |
|
239 | 239 | |
240 | - $markerArray['###LAST###'] = '<span>'.$this->pi_getLL('lastPage', '', TRUE).'</span>'; |
|
240 | + $markerArray['###LAST###'] = '<span>'.$this->pi_getLL('lastPage', '', TRUE).'</span>'; |
|
241 | 241 | |
242 | - } |
|
242 | + } |
|
243 | 243 | |
244 | - // Add double page switcher. |
|
245 | - if ($this->doc->numPages > 0) { |
|
244 | + // Add double page switcher. |
|
245 | + if ($this->doc->numPages > 0) { |
|
246 | 246 | |
247 | - if (!$this->piVars['double']) { |
|
247 | + if (!$this->piVars['double']) { |
|
248 | 248 | |
249 | - $markerArray['###DOUBLEPAGE###'] = $this->makeLink($this->pi_getLL('doublePageOn', '', TRUE), array ('double' => 1), 'class="tx-dlf-navigation-doubleOn"'); |
|
249 | + $markerArray['###DOUBLEPAGE###'] = $this->makeLink($this->pi_getLL('doublePageOn', '', TRUE), array ('double' => 1), 'class="tx-dlf-navigation-doubleOn"'); |
|
250 | 250 | |
251 | - } else { |
|
251 | + } else { |
|
252 | 252 | |
253 | - $markerArray['###DOUBLEPAGE###'] = $this->makeLink($this->pi_getLL('doublePageOff', '', TRUE), array ('double' => 0), 'class="tx-dlf-navigation-doubleOff"'); |
|
253 | + $markerArray['###DOUBLEPAGE###'] = $this->makeLink($this->pi_getLL('doublePageOff', '', TRUE), array ('double' => 0), 'class="tx-dlf-navigation-doubleOff"'); |
|
254 | 254 | |
255 | - } |
|
255 | + } |
|
256 | 256 | |
257 | - if ($this->piVars['double'] && $this->piVars['page'] < $this->doc->numPages) { |
|
257 | + if ($this->piVars['double'] && $this->piVars['page'] < $this->doc->numPages) { |
|
258 | 258 | |
259 | - $markerArray['###DOUBLEPAGE+1###'] = $this->makeLink($this->pi_getLL('doublePage+1', '', TRUE), array ('page' => $this->piVars['page'] + 1)); |
|
259 | + $markerArray['###DOUBLEPAGE+1###'] = $this->makeLink($this->pi_getLL('doublePage+1', '', TRUE), array ('page' => $this->piVars['page'] + 1)); |
|
260 | 260 | |
261 | - } else { |
|
261 | + } else { |
|
262 | 262 | |
263 | - $markerArray['###DOUBLEPAGE+1###'] = '<span>'.$this->pi_getLL('doublePage+1', '', TRUE).'</span>'; |
|
263 | + $markerArray['###DOUBLEPAGE+1###'] = '<span>'.$this->pi_getLL('doublePage+1', '', TRUE).'</span>'; |
|
264 | 264 | |
265 | - } |
|
265 | + } |
|
266 | 266 | |
267 | - } else { |
|
267 | + } else { |
|
268 | 268 | |
269 | - $markerArray['###DOUBLEPAGE###'] = '<span>'.$this->pi_getLL('doublePageOn', '', TRUE).'</span>'; |
|
269 | + $markerArray['###DOUBLEPAGE###'] = '<span>'.$this->pi_getLL('doublePageOn', '', TRUE).'</span>'; |
|
270 | 270 | |
271 | - $markerArray['###DOUBLEPAGE+1###'] = '<span>'.$this->pi_getLL('doublePage+1', '', TRUE).'</span>'; |
|
271 | + $markerArray['###DOUBLEPAGE+1###'] = '<span>'.$this->pi_getLL('doublePage+1', '', TRUE).'</span>'; |
|
272 | 272 | |
273 | - } |
|
273 | + } |
|
274 | 274 | |
275 | - // Add page selector. |
|
276 | - $markerArray['###PAGESELECT###'] = $this->getPageSelector(); |
|
275 | + // Add page selector. |
|
276 | + $markerArray['###PAGESELECT###'] = $this->getPageSelector(); |
|
277 | 277 | |
278 | - // Add link to listview if applicable. |
|
279 | - $markerArray['###LINKLISTVIEW###'] = $this->getLinkToListview(); |
|
278 | + // Add link to listview if applicable. |
|
279 | + $markerArray['###LINKLISTVIEW###'] = $this->getLinkToListview(); |
|
280 | 280 | |
281 | - // fill some language labels if available |
|
282 | - $markerArray['###ZOOM_IN###'] = $this->pi_getLL('zoom-in', '', TRUE); |
|
283 | - $markerArray['###ZOOM_OUT###'] = $this->pi_getLL('zoom-out', '', TRUE); |
|
284 | - $markerArray['###ZOOM_FULLSCREEN###'] = $this->pi_getLL('zoom-fullscreen', '', TRUE); |
|
281 | + // fill some language labels if available |
|
282 | + $markerArray['###ZOOM_IN###'] = $this->pi_getLL('zoom-in', '', TRUE); |
|
283 | + $markerArray['###ZOOM_OUT###'] = $this->pi_getLL('zoom-out', '', TRUE); |
|
284 | + $markerArray['###ZOOM_FULLSCREEN###'] = $this->pi_getLL('zoom-fullscreen', '', TRUE); |
|
285 | 285 | |
286 | - $markerArray['###ROTATE_LEFT###'] = $this->pi_getLL('rotate-left', '', TRUE); |
|
287 | - $markerArray['###ROTATE_RIGHT###'] = $this->pi_getLL('rotate-right', '', TRUE); |
|
288 | - $markerArray['###ROTATE_RESET###'] = $this->pi_getLL('rotate-reset', '', TRUE); |
|
286 | + $markerArray['###ROTATE_LEFT###'] = $this->pi_getLL('rotate-left', '', TRUE); |
|
287 | + $markerArray['###ROTATE_RIGHT###'] = $this->pi_getLL('rotate-right', '', TRUE); |
|
288 | + $markerArray['###ROTATE_RESET###'] = $this->pi_getLL('rotate-reset', '', TRUE); |
|
289 | 289 | |
290 | - $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
290 | + $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
291 | 291 | |
292 | - return $this->pi_wrapInBaseClass($content); |
|
292 | + return $this->pi_wrapInBaseClass($content); |
|
293 | 293 | |
294 | - } |
|
294 | + } |
|
295 | 295 | |
296 | - /** |
|
297 | - * Generates a navigation link |
|
298 | - * |
|
299 | - * @access protected |
|
300 | - * |
|
301 | - * @param string $label: The link's text |
|
302 | - * @param array $overrulePIvars: The new set of plugin variables |
|
303 | - * @param string $aTagParams: Additional HTML attributes for link tag |
|
304 | - * |
|
305 | - * @return string Typolink ready to output |
|
306 | - */ |
|
307 | - protected function makeLink($label, array $overrulePIvars = array (), $aTagParams = '') { |
|
296 | + /** |
|
297 | + * Generates a navigation link |
|
298 | + * |
|
299 | + * @access protected |
|
300 | + * |
|
301 | + * @param string $label: The link's text |
|
302 | + * @param array $overrulePIvars: The new set of plugin variables |
|
303 | + * @param string $aTagParams: Additional HTML attributes for link tag |
|
304 | + * |
|
305 | + * @return string Typolink ready to output |
|
306 | + */ |
|
307 | + protected function makeLink($label, array $overrulePIvars = array (), $aTagParams = '') { |
|
308 | 308 | |
309 | - // Merge plugin variables with new set of values. |
|
310 | - if (is_array($this->piVars)) { |
|
309 | + // Merge plugin variables with new set of values. |
|
310 | + if (is_array($this->piVars)) { |
|
311 | 311 | |
312 | - $piVars = $this->piVars; |
|
312 | + $piVars = $this->piVars; |
|
313 | 313 | |
314 | - unset($piVars['DATA']); |
|
314 | + unset($piVars['DATA']); |
|
315 | 315 | |
316 | - $overrulePIvars = tx_dlf_helper::array_merge_recursive_overrule($piVars, $overrulePIvars); |
|
316 | + $overrulePIvars = tx_dlf_helper::array_merge_recursive_overrule($piVars, $overrulePIvars); |
|
317 | 317 | |
318 | - } |
|
318 | + } |
|
319 | 319 | |
320 | - // Build typolink configuration array. |
|
321 | - $conf = array ( |
|
322 | - 'useCacheHash' => 1, |
|
323 | - 'parameter' => $GLOBALS['TSFE']->id, |
|
324 | - 'ATagParams' => $aTagParams, |
|
325 | - 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $overrulePIvars, '', TRUE, FALSE), |
|
326 | - 'title' => $label |
|
327 | - ); |
|
320 | + // Build typolink configuration array. |
|
321 | + $conf = array ( |
|
322 | + 'useCacheHash' => 1, |
|
323 | + 'parameter' => $GLOBALS['TSFE']->id, |
|
324 | + 'ATagParams' => $aTagParams, |
|
325 | + 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $overrulePIvars, '', TRUE, FALSE), |
|
326 | + 'title' => $label |
|
327 | + ); |
|
328 | 328 | |
329 | - return $this->cObj->typoLink($label, $conf); |
|
329 | + return $this->cObj->typoLink($label, $conf); |
|
330 | 330 | |
331 | - } |
|
331 | + } |
|
332 | 332 | |
333 | 333 | } |
@@ -19,53 +19,53 @@ discard block |
||
19 | 19 | */ |
20 | 20 | class tx_dlf_toc extends tx_dlf_plugin { |
21 | 21 | |
22 | - public $scriptRelPath = 'plugins/toc/class.tx_dlf_toc.php'; |
|
22 | + public $scriptRelPath = 'plugins/toc/class.tx_dlf_toc.php'; |
|
23 | 23 | |
24 | - /** |
|
25 | - * This holds the active entries according to the currently selected page |
|
26 | - * |
|
27 | - * @var array |
|
28 | - * @access protected |
|
29 | - */ |
|
30 | - protected $activeEntries = array (); |
|
24 | + /** |
|
25 | + * This holds the active entries according to the currently selected page |
|
26 | + * |
|
27 | + * @var array |
|
28 | + * @access protected |
|
29 | + */ |
|
30 | + protected $activeEntries = array (); |
|
31 | 31 | |
32 | - /** |
|
33 | - * This builds an array for one menu entry |
|
34 | - * |
|
35 | - * @access protected |
|
36 | - * |
|
37 | - * @param array $entry: The entry's array from tx_dlf_document->getLogicalStructure |
|
38 | - * @param boolean $recursive: Whether to include the child entries |
|
39 | - * |
|
40 | - * @return array HMENU array for menu entry |
|
41 | - */ |
|
42 | - protected function getMenuEntry(array $entry, $recursive = FALSE) { |
|
32 | + /** |
|
33 | + * This builds an array for one menu entry |
|
34 | + * |
|
35 | + * @access protected |
|
36 | + * |
|
37 | + * @param array $entry: The entry's array from tx_dlf_document->getLogicalStructure |
|
38 | + * @param boolean $recursive: Whether to include the child entries |
|
39 | + * |
|
40 | + * @return array HMENU array for menu entry |
|
41 | + */ |
|
42 | + protected function getMenuEntry(array $entry, $recursive = FALSE) { |
|
43 | 43 | |
44 | - $entryArray = array (); |
|
44 | + $entryArray = array (); |
|
45 | 45 | |
46 | - // Set "title", "volume", "type" and "pagination" from $entry array. |
|
47 | - $entryArray['title'] = $entry['label']; |
|
46 | + // Set "title", "volume", "type" and "pagination" from $entry array. |
|
47 | + $entryArray['title'] = $entry['label']; |
|
48 | 48 | |
49 | - $entryArray['volume'] = $entry['volume']; |
|
49 | + $entryArray['volume'] = $entry['volume']; |
|
50 | 50 | |
51 | - $entryArray['orderlabel'] = $entry['orderlabel']; |
|
51 | + $entryArray['orderlabel'] = $entry['orderlabel']; |
|
52 | 52 | |
53 | - $entryArray['type'] = tx_dlf_helper::translate($entry['type'], 'tx_dlf_structures', $this->conf['pages']); |
|
53 | + $entryArray['type'] = tx_dlf_helper::translate($entry['type'], 'tx_dlf_structures', $this->conf['pages']); |
|
54 | 54 | |
55 | - $entryArray['pagination'] = $entry['pagination']; |
|
55 | + $entryArray['pagination'] = $entry['pagination']; |
|
56 | 56 | |
57 | - $entryArray['_OVERRIDE_HREF'] = ''; |
|
57 | + $entryArray['_OVERRIDE_HREF'] = ''; |
|
58 | 58 | |
59 | - $entryArray['doNotLinkIt'] = 1; |
|
59 | + $entryArray['doNotLinkIt'] = 1; |
|
60 | 60 | |
61 | - $entryArray['ITEM_STATE'] = 'NO'; |
|
61 | + $entryArray['ITEM_STATE'] = 'NO'; |
|
62 | 62 | |
63 | - // Build menu links based on the $entry['points'] array. |
|
64 | - if (!empty($entry['points']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($entry['points'])) { |
|
63 | + // Build menu links based on the $entry['points'] array. |
|
64 | + if (!empty($entry['points']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($entry['points'])) { |
|
65 | 65 | |
66 | - $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('page' => $entry['points']), TRUE, FALSE, $this->conf['targetPid']); |
|
66 | + $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('page' => $entry['points']), TRUE, FALSE, $this->conf['targetPid']); |
|
67 | 67 | |
68 | - $entryArray['doNotLinkIt'] = 0; |
|
68 | + $entryArray['doNotLinkIt'] = 0; |
|
69 | 69 | |
70 | 70 | if ($this->conf['basketButton']) { |
71 | 71 | |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | |
76 | 76 | } elseif (!empty($entry['points']) && is_string($entry['points'])) { |
77 | 77 | |
78 | - $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('id' => $entry['points'], 'page' => 1), TRUE, FALSE, $this->conf['targetPid']); |
|
78 | + $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('id' => $entry['points'], 'page' => 1), TRUE, FALSE, $this->conf['targetPid']); |
|
79 | 79 | |
80 | - $entryArray['doNotLinkIt'] = 0; |
|
80 | + $entryArray['doNotLinkIt'] = 0; |
|
81 | 81 | |
82 | 82 | if ($this->conf['basketButton']) { |
83 | 83 | |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | |
88 | 88 | } elseif (!empty($entry['targetUid'])) { |
89 | 89 | |
90 | - $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('id' => $entry['targetUid'], 'page' => 1), TRUE, FALSE, $this->conf['targetPid']); |
|
90 | + $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('id' => $entry['targetUid'], 'page' => 1), TRUE, FALSE, $this->conf['targetPid']); |
|
91 | 91 | |
92 | - $entryArray['doNotLinkIt'] = 0; |
|
92 | + $entryArray['doNotLinkIt'] = 0; |
|
93 | 93 | |
94 | 94 | if ($this->conf['basketButton']) { |
95 | 95 | |
@@ -99,230 +99,230 @@ discard block |
||
99 | 99 | |
100 | 100 | } |
101 | 101 | |
102 | - // Set "ITEM_STATE" to "CUR" if this entry points to current page. |
|
103 | - if (in_array($entry['id'], $this->activeEntries)) { |
|
102 | + // Set "ITEM_STATE" to "CUR" if this entry points to current page. |
|
103 | + if (in_array($entry['id'], $this->activeEntries)) { |
|
104 | 104 | |
105 | - $entryArray['ITEM_STATE'] = 'CUR'; |
|
105 | + $entryArray['ITEM_STATE'] = 'CUR'; |
|
106 | 106 | |
107 | - } |
|
107 | + } |
|
108 | 108 | |
109 | - // Build sub-menu if available and called recursively. |
|
110 | - if ($recursive == TRUE && !empty($entry['children'])) { |
|
109 | + // Build sub-menu if available and called recursively. |
|
110 | + if ($recursive == TRUE && !empty($entry['children'])) { |
|
111 | 111 | |
112 | - // Build sub-menu only if one of the following conditions apply: |
|
113 | - // 1. "expAll" is set for menu |
|
114 | - // 2. Current menu node is in rootline |
|
115 | - // 3. Current menu node points to another file |
|
116 | - // 4. Current menu node has no corresponding images |
|
117 | - if (!empty($this->conf['menuConf.']['expAll']) || $entryArray['ITEM_STATE'] == 'CUR' || is_string($entry['points']) || empty($this->doc->smLinks['l2p'][$entry['id']])) { |
|
112 | + // Build sub-menu only if one of the following conditions apply: |
|
113 | + // 1. "expAll" is set for menu |
|
114 | + // 2. Current menu node is in rootline |
|
115 | + // 3. Current menu node points to another file |
|
116 | + // 4. Current menu node has no corresponding images |
|
117 | + if (!empty($this->conf['menuConf.']['expAll']) || $entryArray['ITEM_STATE'] == 'CUR' || is_string($entry['points']) || empty($this->doc->smLinks['l2p'][$entry['id']])) { |
|
118 | 118 | |
119 | - $entryArray['_SUB_MENU'] = array (); |
|
119 | + $entryArray['_SUB_MENU'] = array (); |
|
120 | 120 | |
121 | - foreach ($entry['children'] as $child) { |
|
121 | + foreach ($entry['children'] as $child) { |
|
122 | 122 | |
123 | - // Set "ITEM_STATE" to "ACT" if this entry points to current page and has sub-entries pointing to the same page. |
|
124 | - if (in_array($child['id'], $this->activeEntries)) { |
|
123 | + // Set "ITEM_STATE" to "ACT" if this entry points to current page and has sub-entries pointing to the same page. |
|
124 | + if (in_array($child['id'], $this->activeEntries)) { |
|
125 | 125 | |
126 | - $entryArray['ITEM_STATE'] = 'ACT'; |
|
126 | + $entryArray['ITEM_STATE'] = 'ACT'; |
|
127 | 127 | |
128 | - } |
|
128 | + } |
|
129 | 129 | |
130 | - $entryArray['_SUB_MENU'][] = $this->getMenuEntry($child, TRUE); |
|
130 | + $entryArray['_SUB_MENU'][] = $this->getMenuEntry($child, TRUE); |
|
131 | 131 | |
132 | - } |
|
132 | + } |
|
133 | 133 | |
134 | - } |
|
134 | + } |
|
135 | 135 | |
136 | - // Append "IFSUB" to "ITEM_STATE" if this entry has sub-entries. |
|
137 | - $entryArray['ITEM_STATE'] = ($entryArray['ITEM_STATE'] == 'NO' ? 'IFSUB' : $entryArray['ITEM_STATE'].'IFSUB'); |
|
136 | + // Append "IFSUB" to "ITEM_STATE" if this entry has sub-entries. |
|
137 | + $entryArray['ITEM_STATE'] = ($entryArray['ITEM_STATE'] == 'NO' ? 'IFSUB' : $entryArray['ITEM_STATE'].'IFSUB'); |
|
138 | 138 | |
139 | - } |
|
139 | + } |
|
140 | 140 | |
141 | - return $entryArray; |
|
141 | + return $entryArray; |
|
142 | 142 | |
143 | - } |
|
143 | + } |
|
144 | 144 | |
145 | - /** |
|
146 | - * The main method of the PlugIn |
|
147 | - * |
|
148 | - * @access public |
|
149 | - * |
|
150 | - * @param string $content: The PlugIn content |
|
151 | - * @param array $conf: The PlugIn configuration |
|
152 | - * |
|
153 | - * @return string The content that is displayed on the website |
|
154 | - */ |
|
155 | - public function main($content, $conf) { |
|
145 | + /** |
|
146 | + * The main method of the PlugIn |
|
147 | + * |
|
148 | + * @access public |
|
149 | + * |
|
150 | + * @param string $content: The PlugIn content |
|
151 | + * @param array $conf: The PlugIn configuration |
|
152 | + * |
|
153 | + * @return string The content that is displayed on the website |
|
154 | + */ |
|
155 | + public function main($content, $conf) { |
|
156 | 156 | |
157 | - $this->init($conf); |
|
157 | + $this->init($conf); |
|
158 | 158 | |
159 | - // Check for typoscript configuration to prevent fatal error. |
|
160 | - if (empty($this->conf['menuConf.'])) { |
|
159 | + // Check for typoscript configuration to prevent fatal error. |
|
160 | + if (empty($this->conf['menuConf.'])) { |
|
161 | 161 | |
162 | - if (TYPO3_DLOG) { |
|
162 | + if (TYPO3_DLOG) { |
|
163 | 163 | |
164 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toc->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); |
|
164 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toc->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); |
|
165 | 165 | |
166 | - } |
|
166 | + } |
|
167 | 167 | |
168 | - return $content; |
|
168 | + return $content; |
|
169 | 169 | |
170 | - } |
|
170 | + } |
|
171 | 171 | |
172 | - // Load template file. |
|
173 | - if (!empty($this->conf['templateFile'])) { |
|
172 | + // Load template file. |
|
173 | + if (!empty($this->conf['templateFile'])) { |
|
174 | 174 | |
175 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
175 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
176 | 176 | |
177 | - } else { |
|
177 | + } else { |
|
178 | 178 | |
179 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toc/template.tmpl'), '###TEMPLATE###'); |
|
179 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toc/template.tmpl'), '###TEMPLATE###'); |
|
180 | 180 | |
181 | - } |
|
181 | + } |
|
182 | 182 | |
183 | - $TSconfig = array (); |
|
183 | + $TSconfig = array (); |
|
184 | 184 | |
185 | - $TSconfig['special'] = 'userfunction'; |
|
185 | + $TSconfig['special'] = 'userfunction'; |
|
186 | 186 | |
187 | - $TSconfig['special.']['userFunc'] = 'tx_dlf_toc->makeMenuArray'; |
|
187 | + $TSconfig['special.']['userFunc'] = 'tx_dlf_toc->makeMenuArray'; |
|
188 | 188 | |
189 | - $TSconfig = tx_dlf_helper::array_merge_recursive_overrule($this->conf['menuConf.'], $TSconfig); |
|
189 | + $TSconfig = tx_dlf_helper::array_merge_recursive_overrule($this->conf['menuConf.'], $TSconfig); |
|
190 | 190 | |
191 | - $markerArray['###TOCMENU###'] = $this->cObj->HMENU($TSconfig); |
|
191 | + $markerArray['###TOCMENU###'] = $this->cObj->HMENU($TSconfig); |
|
192 | 192 | |
193 | - $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
193 | + $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
194 | 194 | |
195 | - return $this->pi_wrapInBaseClass($content); |
|
195 | + return $this->pi_wrapInBaseClass($content); |
|
196 | 196 | |
197 | - } |
|
197 | + } |
|
198 | 198 | |
199 | - /** |
|
200 | - * This builds a menu array for HMENU |
|
201 | - * |
|
202 | - * @access public |
|
203 | - * |
|
204 | - * @param string $content: The PlugIn content |
|
205 | - * @param array $conf: The PlugIn configuration |
|
206 | - * |
|
207 | - * @return array HMENU array |
|
208 | - */ |
|
209 | - public function makeMenuArray($content, $conf) { |
|
199 | + /** |
|
200 | + * This builds a menu array for HMENU |
|
201 | + * |
|
202 | + * @access public |
|
203 | + * |
|
204 | + * @param string $content: The PlugIn content |
|
205 | + * @param array $conf: The PlugIn configuration |
|
206 | + * |
|
207 | + * @return array HMENU array |
|
208 | + */ |
|
209 | + public function makeMenuArray($content, $conf) { |
|
210 | 210 | |
211 | - $this->init($conf); |
|
211 | + $this->init($conf); |
|
212 | 212 | |
213 | - // Load current document. |
|
214 | - $this->loadDocument(); |
|
213 | + // Load current document. |
|
214 | + $this->loadDocument(); |
|
215 | 215 | |
216 | - if ($this->doc === NULL) { |
|
216 | + if ($this->doc === NULL) { |
|
217 | 217 | |
218 | - // Quit without doing anything if required variables are not set. |
|
219 | - return array (); |
|
218 | + // Quit without doing anything if required variables are not set. |
|
219 | + return array (); |
|
220 | 220 | |
221 | - } else { |
|
221 | + } else { |
|
222 | 222 | |
223 | - if (!empty($this->piVars['logicalPage'])) { |
|
223 | + if (!empty($this->piVars['logicalPage'])) { |
|
224 | 224 | |
225 | - $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); |
|
226 | - // The logical page parameter should not appear again |
|
227 | - unset($this->piVars['logicalPage']); |
|
225 | + $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); |
|
226 | + // The logical page parameter should not appear again |
|
227 | + unset($this->piVars['logicalPage']); |
|
228 | 228 | |
229 | - } |
|
229 | + } |
|
230 | 230 | |
231 | - // Set default values for page if not set. |
|
232 | - // $this->piVars['page'] may be integer or string (physical structure @ID) |
|
233 | - if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
231 | + // Set default values for page if not set. |
|
232 | + // $this->piVars['page'] may be integer or string (physical structure @ID) |
|
233 | + if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
234 | 234 | |
235 | - $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
235 | + $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
236 | 236 | |
237 | - } else { |
|
237 | + } else { |
|
238 | 238 | |
239 | - $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); |
|
239 | + $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); |
|
240 | 240 | |
241 | - } |
|
241 | + } |
|
242 | 242 | |
243 | - $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); |
|
243 | + $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); |
|
244 | 244 | |
245 | - } |
|
245 | + } |
|
246 | 246 | |
247 | - $menuArray = array (); |
|
247 | + $menuArray = array (); |
|
248 | 248 | |
249 | - // Does the document have physical elements or is it an external file? |
|
250 | - if ($this->doc->physicalStructure || !\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->doc->uid)) { |
|
249 | + // Does the document have physical elements or is it an external file? |
|
250 | + if ($this->doc->physicalStructure || !\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->doc->uid)) { |
|
251 | 251 | |
252 | - // Get all logical units the current page or track is a part of. |
|
253 | - if (!empty($this->piVars['page']) && $this->doc->physicalStructure) { |
|
252 | + // Get all logical units the current page or track is a part of. |
|
253 | + if (!empty($this->piVars['page']) && $this->doc->physicalStructure) { |
|
254 | 254 | |
255 | - $this->activeEntries = array_merge((array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[0]], (array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]]); |
|
255 | + $this->activeEntries = array_merge((array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[0]], (array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]]); |
|
256 | 256 | |
257 | - if (!empty($this->piVars['double']) && $this->piVars['page'] < $this->doc->numPages) { |
|
257 | + if (!empty($this->piVars['double']) && $this->piVars['page'] < $this->doc->numPages) { |
|
258 | 258 | |
259 | - $this->activeEntries = array_merge($this->activeEntries, (array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page'] + 1]]); |
|
259 | + $this->activeEntries = array_merge($this->activeEntries, (array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page'] + 1]]); |
|
260 | 260 | |
261 | - } |
|
261 | + } |
|
262 | 262 | |
263 | - } |
|
263 | + } |
|
264 | 264 | |
265 | - // Go through table of contents and create all menu entries. |
|
266 | - foreach ($this->doc->tableOfContents as $entry) { |
|
265 | + // Go through table of contents and create all menu entries. |
|
266 | + foreach ($this->doc->tableOfContents as $entry) { |
|
267 | 267 | |
268 | - $menuArray[] = $this->getMenuEntry($entry, TRUE); |
|
268 | + $menuArray[] = $this->getMenuEntry($entry, TRUE); |
|
269 | 269 | |
270 | - } |
|
270 | + } |
|
271 | 271 | |
272 | - } else { |
|
272 | + } else { |
|
273 | 273 | |
274 | - // Go through table of contents and create top-level menu entries. |
|
275 | - foreach ($this->doc->tableOfContents as $entry) { |
|
274 | + // Go through table of contents and create top-level menu entries. |
|
275 | + foreach ($this->doc->tableOfContents as $entry) { |
|
276 | 276 | |
277 | - $menuArray[] = $this->getMenuEntry($entry, FALSE); |
|
277 | + $menuArray[] = $this->getMenuEntry($entry, FALSE); |
|
278 | 278 | |
279 | - } |
|
279 | + } |
|
280 | 280 | |
281 | - // Get all child documents from database. |
|
282 | - $whereClause = 'tx_dlf_documents.partof='.intval($this->doc->uid).' AND tx_dlf_documents.structure=tx_dlf_structures.uid AND tx_dlf_structures.pid='.$this->doc->pid.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_structures'); |
|
281 | + // Get all child documents from database. |
|
282 | + $whereClause = 'tx_dlf_documents.partof='.intval($this->doc->uid).' AND tx_dlf_documents.structure=tx_dlf_structures.uid AND tx_dlf_structures.pid='.$this->doc->pid.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_structures'); |
|
283 | 283 | |
284 | - if ($this->conf['excludeOther']) { |
|
284 | + if ($this->conf['excludeOther']) { |
|
285 | 285 | |
286 | - $whereClause .= ' AND tx_dlf_documents.pid='.intval($this->conf['pages']); |
|
286 | + $whereClause .= ' AND tx_dlf_documents.pid='.intval($this->conf['pages']); |
|
287 | 287 | |
288 | - } |
|
288 | + } |
|
289 | 289 | |
290 | - // Build table of contents from database. |
|
291 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
292 | - 'tx_dlf_documents.uid AS uid,tx_dlf_documents.title AS title,tx_dlf_documents.volume AS volume,tx_dlf_structures.index_name AS type', |
|
293 | - 'tx_dlf_documents,tx_dlf_structures', |
|
294 | - $whereClause, |
|
295 | - '', |
|
296 | - 'tx_dlf_documents.volume_sorting', |
|
297 | - '' |
|
298 | - ); |
|
290 | + // Build table of contents from database. |
|
291 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
292 | + 'tx_dlf_documents.uid AS uid,tx_dlf_documents.title AS title,tx_dlf_documents.volume AS volume,tx_dlf_structures.index_name AS type', |
|
293 | + 'tx_dlf_documents,tx_dlf_structures', |
|
294 | + $whereClause, |
|
295 | + '', |
|
296 | + 'tx_dlf_documents.volume_sorting', |
|
297 | + '' |
|
298 | + ); |
|
299 | 299 | |
300 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
300 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
301 | 301 | |
302 | - $menuArray[0]['ITEM_STATE'] = 'CURIFSUB'; |
|
302 | + $menuArray[0]['ITEM_STATE'] = 'CURIFSUB'; |
|
303 | 303 | |
304 | - $menuArray[0]['_SUB_MENU'] = array (); |
|
304 | + $menuArray[0]['_SUB_MENU'] = array (); |
|
305 | 305 | |
306 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
306 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
307 | 307 | |
308 | - $entry = array ( |
|
309 | - 'label' => $resArray['title'], |
|
310 | - 'type' => $resArray['type'], |
|
311 | - 'volume' => $resArray['volume'], |
|
312 | - 'pagination' => '', |
|
313 | - 'targetUid' => $resArray['uid'] |
|
314 | - ); |
|
308 | + $entry = array ( |
|
309 | + 'label' => $resArray['title'], |
|
310 | + 'type' => $resArray['type'], |
|
311 | + 'volume' => $resArray['volume'], |
|
312 | + 'pagination' => '', |
|
313 | + 'targetUid' => $resArray['uid'] |
|
314 | + ); |
|
315 | 315 | |
316 | - $menuArray[0]['_SUB_MENU'][] = $this->getMenuEntry($entry, FALSE); |
|
316 | + $menuArray[0]['_SUB_MENU'][] = $this->getMenuEntry($entry, FALSE); |
|
317 | 317 | |
318 | - } |
|
318 | + } |
|
319 | 319 | |
320 | - } |
|
320 | + } |
|
321 | 321 | |
322 | - } |
|
322 | + } |
|
323 | 323 | |
324 | - return $menuArray; |
|
324 | + return $menuArray; |
|
325 | 325 | |
326 | - } |
|
326 | + } |
|
327 | 327 | |
328 | 328 | } |
@@ -20,834 +20,834 @@ |
||
20 | 20 | */ |
21 | 21 | class tx_dlf_search extends tx_dlf_plugin { |
22 | 22 | |
23 | - public $scriptRelPath = 'plugins/search/class.tx_dlf_search.php'; |
|
23 | + public $scriptRelPath = 'plugins/search/class.tx_dlf_search.php'; |
|
24 | 24 | |
25 | - /** |
|
26 | - * Adds the JS files necessary for search suggestions |
|
27 | - * |
|
28 | - * @access protected |
|
29 | - * |
|
30 | - * @return void |
|
31 | - */ |
|
32 | - protected function addAutocompleteJS() { |
|
25 | + /** |
|
26 | + * Adds the JS files necessary for search suggestions |
|
27 | + * |
|
28 | + * @access protected |
|
29 | + * |
|
30 | + * @return void |
|
31 | + */ |
|
32 | + protected function addAutocompleteJS() { |
|
33 | 33 | |
34 | - // Check if there are any metadata to suggest. |
|
35 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
36 | - 'tx_dlf_metadata.*', |
|
37 | - 'tx_dlf_metadata', |
|
38 | - 'tx_dlf_metadata.index_autocomplete=1 AND tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
39 | - '', |
|
40 | - '', |
|
41 | - '1' |
|
42 | - ); |
|
34 | + // Check if there are any metadata to suggest. |
|
35 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
36 | + 'tx_dlf_metadata.*', |
|
37 | + 'tx_dlf_metadata', |
|
38 | + 'tx_dlf_metadata.index_autocomplete=1 AND tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
39 | + '', |
|
40 | + '', |
|
41 | + '1' |
|
42 | + ); |
|
43 | 43 | |
44 | 44 | |
45 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
45 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
46 | 46 | |
47 | - $GLOBALS['TSFE']->additionalHeaderData[$this->prefixId.'_search_suggest'] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/search/tx_dlf_search_suggest.js"></script>'; |
|
47 | + $GLOBALS['TSFE']->additionalHeaderData[$this->prefixId.'_search_suggest'] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/search/tx_dlf_search_suggest.js"></script>'; |
|
48 | 48 | |
49 | - } else { |
|
49 | + } else { |
|
50 | 50 | |
51 | - if (TYPO3_DLOG) { |
|
51 | + if (TYPO3_DLOG) { |
|
52 | 52 | |
53 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->addAutocompleteJS()] No metadata fields configured for search suggestions', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
53 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->addAutocompleteJS()] No metadata fields configured for search suggestions', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
54 | 54 | |
55 | - } |
|
55 | + } |
|
56 | 56 | |
57 | - } |
|
57 | + } |
|
58 | 58 | |
59 | - } |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * Adds the current collection's UID to the search form |
|
63 | - * |
|
64 | - * @access protected |
|
65 | - * |
|
66 | - * @return string HTML input fields with current document's UID and parent ID |
|
67 | - */ |
|
68 | - protected function addCurrentCollection() { |
|
61 | + /** |
|
62 | + * Adds the current collection's UID to the search form |
|
63 | + * |
|
64 | + * @access protected |
|
65 | + * |
|
66 | + * @return string HTML input fields with current document's UID and parent ID |
|
67 | + */ |
|
68 | + protected function addCurrentCollection() { |
|
69 | 69 | |
70 | - // Load current collection. |
|
71 | - $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
70 | + // Load current collection. |
|
71 | + $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
72 | 72 | |
73 | - if (!empty($list->metadata['options']['source']) && $list->metadata['options']['source'] == 'collection') { |
|
73 | + if (!empty($list->metadata['options']['source']) && $list->metadata['options']['source'] == 'collection') { |
|
74 | 74 | |
75 | - // Get collection's UID. |
|
76 | - return '<input type="hidden" name="'.$this->prefixId.'[collection]" value="'.$list->metadata['options']['select'].'" />'; |
|
75 | + // Get collection's UID. |
|
76 | + return '<input type="hidden" name="'.$this->prefixId.'[collection]" value="'.$list->metadata['options']['select'].'" />'; |
|
77 | 77 | |
78 | - } elseif (!empty($list->metadata['options']['params']['fq'])) { |
|
78 | + } elseif (!empty($list->metadata['options']['params']['fq'])) { |
|
79 | 79 | |
80 | - // Get collection's UID from search metadata. |
|
81 | - foreach ($list->metadata['options']['params']['fq'] as $id => $facet) { |
|
80 | + // Get collection's UID from search metadata. |
|
81 | + foreach ($list->metadata['options']['params']['fq'] as $id => $facet) { |
|
82 | 82 | |
83 | - $facetKeyVal = explode(':', $facet, 2); |
|
83 | + $facetKeyVal = explode(':', $facet, 2); |
|
84 | 84 | |
85 | - if ($facetKeyVal[0] == 'collection_faceting' && !strpos($facetKeyVal[1], '" OR "')) { |
|
85 | + if ($facetKeyVal[0] == 'collection_faceting' && !strpos($facetKeyVal[1], '" OR "')) { |
|
86 | 86 | |
87 | - $collectionId = tx_dlf_helper::getIdFromIndexName(trim($facetKeyVal[1], '(")'), 'tx_dlf_collections'); |
|
87 | + $collectionId = tx_dlf_helper::getIdFromIndexName(trim($facetKeyVal[1], '(")'), 'tx_dlf_collections'); |
|
88 | 88 | |
89 | - } |
|
89 | + } |
|
90 | 90 | |
91 | - } |
|
91 | + } |
|
92 | 92 | |
93 | - return '<input type="hidden" name="'.$this->prefixId.'[collection]" value="'.$collectionId.'" />'; |
|
93 | + return '<input type="hidden" name="'.$this->prefixId.'[collection]" value="'.$collectionId.'" />'; |
|
94 | 94 | |
95 | - } |
|
95 | + } |
|
96 | 96 | |
97 | - return ''; |
|
97 | + return ''; |
|
98 | 98 | |
99 | - } |
|
99 | + } |
|
100 | 100 | |
101 | - /** |
|
102 | - * Adds the current document's UID or parent ID to the search form |
|
103 | - * |
|
104 | - * @access protected |
|
105 | - * |
|
106 | - * @return string HTML input fields with current document's UID and parent ID |
|
107 | - */ |
|
108 | - protected function addCurrentDocument() { |
|
101 | + /** |
|
102 | + * Adds the current document's UID or parent ID to the search form |
|
103 | + * |
|
104 | + * @access protected |
|
105 | + * |
|
106 | + * @return string HTML input fields with current document's UID and parent ID |
|
107 | + */ |
|
108 | + protected function addCurrentDocument() { |
|
109 | 109 | |
110 | - // Load current list object. |
|
111 | - $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
110 | + // Load current list object. |
|
111 | + $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
112 | 112 | |
113 | - // Load current document. |
|
114 | - if (!empty($this->piVars['id']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['id'])) { |
|
113 | + // Load current document. |
|
114 | + if (!empty($this->piVars['id']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['id'])) { |
|
115 | 115 | |
116 | - $this->loadDocument(); |
|
116 | + $this->loadDocument(); |
|
117 | 117 | |
118 | - // Get document's UID or parent ID. |
|
119 | - if ($this->doc->ready) { |
|
118 | + // Get document's UID or parent ID. |
|
119 | + if ($this->doc->ready) { |
|
120 | 120 | |
121 | - return '<input type="hidden" name="'.$this->prefixId.'[id]" value="'.($this->doc->parentId > 0 ? $this->doc->parentId : $this->doc->uid).'" />'; |
|
121 | + return '<input type="hidden" name="'.$this->prefixId.'[id]" value="'.($this->doc->parentId > 0 ? $this->doc->parentId : $this->doc->uid).'" />'; |
|
122 | 122 | |
123 | - } |
|
123 | + } |
|
124 | 124 | |
125 | - } elseif (!empty($list->metadata['options']['params']['fq'])) { |
|
125 | + } elseif (!empty($list->metadata['options']['params']['fq'])) { |
|
126 | 126 | |
127 | - // Get document's UID from search metadata. |
|
128 | - foreach ($list->metadata['options']['params']['fq'] as $id => $facet) { |
|
127 | + // Get document's UID from search metadata. |
|
128 | + foreach ($list->metadata['options']['params']['fq'] as $id => $facet) { |
|
129 | 129 | |
130 | - $facetKeyVal = explode(':', $facet); |
|
130 | + $facetKeyVal = explode(':', $facet); |
|
131 | 131 | |
132 | - if ($facetKeyVal[0] == 'uid') { |
|
132 | + if ($facetKeyVal[0] == 'uid') { |
|
133 | 133 | |
134 | - $documentId = (int) substr($facetKeyVal[1], 1, strpos($facetKeyVal[1], ')')); |
|
134 | + $documentId = (int) substr($facetKeyVal[1], 1, strpos($facetKeyVal[1], ')')); |
|
135 | 135 | |
136 | - } |
|
136 | + } |
|
137 | 137 | |
138 | - } |
|
138 | + } |
|
139 | 139 | |
140 | - return '<input type="hidden" name="'.$this->prefixId.'[id]" value="'.$documentId.'" />'; |
|
140 | + return '<input type="hidden" name="'.$this->prefixId.'[id]" value="'.$documentId.'" />'; |
|
141 | 141 | |
142 | - } |
|
142 | + } |
|
143 | 143 | |
144 | - return ''; |
|
144 | + return ''; |
|
145 | 145 | |
146 | - } |
|
146 | + } |
|
147 | 147 | |
148 | - /** |
|
149 | - * Adds the encrypted Solr core name to the search form |
|
150 | - * |
|
151 | - * @access protected |
|
152 | - * |
|
153 | - * @return string HTML input fields with encrypted core name and hash |
|
154 | - */ |
|
155 | - protected function addEncryptedCoreName() { |
|
148 | + /** |
|
149 | + * Adds the encrypted Solr core name to the search form |
|
150 | + * |
|
151 | + * @access protected |
|
152 | + * |
|
153 | + * @return string HTML input fields with encrypted core name and hash |
|
154 | + */ |
|
155 | + protected function addEncryptedCoreName() { |
|
156 | 156 | |
157 | - // Get core name. |
|
158 | - $name = tx_dlf_helper::getIndexName($this->conf['solrcore'], 'tx_dlf_solrcores'); |
|
157 | + // Get core name. |
|
158 | + $name = tx_dlf_helper::getIndexName($this->conf['solrcore'], 'tx_dlf_solrcores'); |
|
159 | 159 | |
160 | - // Encrypt core name. |
|
161 | - if (!empty($name)) { |
|
160 | + // Encrypt core name. |
|
161 | + if (!empty($name)) { |
|
162 | 162 | |
163 | - $name = tx_dlf_helper::encrypt($name); |
|
163 | + $name = tx_dlf_helper::encrypt($name); |
|
164 | 164 | |
165 | - } |
|
165 | + } |
|
166 | 166 | |
167 | - // Add encrypted fields to search form. |
|
168 | - if (is_array($name)) { |
|
167 | + // Add encrypted fields to search form. |
|
168 | + if (is_array($name)) { |
|
169 | 169 | |
170 | - return '<input type="hidden" name="'.$this->prefixId.'[encrypted]" value="'.$name['encrypted'].'" /><input type="hidden" name="'.$this->prefixId.'[hashed]" value="'.$name['hash'].'" />'; |
|
170 | + return '<input type="hidden" name="'.$this->prefixId.'[encrypted]" value="'.$name['encrypted'].'" /><input type="hidden" name="'.$this->prefixId.'[hashed]" value="'.$name['hash'].'" />'; |
|
171 | 171 | |
172 | - } else { |
|
172 | + } else { |
|
173 | 173 | |
174 | - return ''; |
|
174 | + return ''; |
|
175 | 175 | |
176 | - } |
|
176 | + } |
|
177 | 177 | |
178 | - } |
|
178 | + } |
|
179 | 179 | |
180 | - /** |
|
181 | - * Returns the extended search form and adds the JS files necessary for extended search. |
|
182 | - * |
|
183 | - * @access protected |
|
184 | - * |
|
185 | - * @return string The extended search form or an empty string |
|
186 | - */ |
|
187 | - protected function addExtendedSearch() { |
|
180 | + /** |
|
181 | + * Returns the extended search form and adds the JS files necessary for extended search. |
|
182 | + * |
|
183 | + * @access protected |
|
184 | + * |
|
185 | + * @return string The extended search form or an empty string |
|
186 | + */ |
|
187 | + protected function addExtendedSearch() { |
|
188 | 188 | |
189 | - $extendedSearch = ''; |
|
189 | + $extendedSearch = ''; |
|
190 | 190 | |
191 | - // Quit without doing anything if no fields for extended search are selected. |
|
192 | - if (empty($this->conf['extendedSlotCount']) || empty($this->conf['extendedFields'])) { |
|
191 | + // Quit without doing anything if no fields for extended search are selected. |
|
192 | + if (empty($this->conf['extendedSlotCount']) || empty($this->conf['extendedFields'])) { |
|
193 | 193 | |
194 | - return $extendedSearch; |
|
194 | + return $extendedSearch; |
|
195 | 195 | |
196 | - } |
|
196 | + } |
|
197 | 197 | |
198 | - // Get operator options. |
|
199 | - $operatorOptions = ''; |
|
198 | + // Get operator options. |
|
199 | + $operatorOptions = ''; |
|
200 | 200 | |
201 | - foreach (array ('AND', 'OR', 'NOT') as $operator) { |
|
201 | + foreach (array ('AND', 'OR', 'NOT') as $operator) { |
|
202 | 202 | |
203 | - $operatorOptions .= '<option class="tx-dlf-search-operator-option tx-dlf-search-operator-'.$operator.'" value="'.$operator.'">'.$this->pi_getLL($operator, '', TRUE).'</option>'; |
|
203 | + $operatorOptions .= '<option class="tx-dlf-search-operator-option tx-dlf-search-operator-'.$operator.'" value="'.$operator.'">'.$this->pi_getLL($operator, '', TRUE).'</option>'; |
|
204 | 204 | |
205 | - } |
|
205 | + } |
|
206 | 206 | |
207 | - // Get field selector options. |
|
208 | - $fieldSelectorOptions = ''; |
|
207 | + // Get field selector options. |
|
208 | + $fieldSelectorOptions = ''; |
|
209 | 209 | |
210 | - $searchFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['extendedFields'], TRUE); |
|
210 | + $searchFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['extendedFields'], TRUE); |
|
211 | 211 | |
212 | - foreach ($searchFields as $searchField) { |
|
212 | + foreach ($searchFields as $searchField) { |
|
213 | 213 | |
214 | - $fieldSelectorOptions .= '<option class="tx-dlf-search-field-option tx-dlf-search-field-'.$searchField.'" value="'.$searchField.'">'.tx_dlf_helper::translate($searchField, 'tx_dlf_metadata', $this->conf['pages']).'</option>'; |
|
214 | + $fieldSelectorOptions .= '<option class="tx-dlf-search-field-option tx-dlf-search-field-'.$searchField.'" value="'.$searchField.'">'.tx_dlf_helper::translate($searchField, 'tx_dlf_metadata', $this->conf['pages']).'</option>'; |
|
215 | 215 | |
216 | - } |
|
216 | + } |
|
217 | 217 | |
218 | - for ($i = 0; $i < $this->conf['extendedSlotCount']; $i++) { |
|
218 | + for ($i = 0; $i < $this->conf['extendedSlotCount']; $i++) { |
|
219 | 219 | |
220 | - $markerArray = array ( |
|
221 | - '###EXT_SEARCH_OPERATOR###' => '<select class="tx-dlf-search-operator tx-dlf-search-operator-'.$i.'" name="'.$this->prefixId.'[extOperator]['.$i.']">'.$operatorOptions.'</select>', |
|
222 | - '###EXT_SEARCH_FIELDSELECTOR###' => '<select class="tx-dlf-search-field tx-dlf-search-field-'.$i.'" name="'.$this->prefixId.'[extField]['.$i.']">'.$fieldSelectorOptions.'</select>', |
|
223 | - '###EXT_SEARCH_FIELDQUERY###' => '<input class="tx-dlf-search-query tx-dlf-search-query-'.$i.'" type="text" name="'.$this->prefixId.'[extQuery]['.$i.']" />' |
|
224 | - ); |
|
220 | + $markerArray = array ( |
|
221 | + '###EXT_SEARCH_OPERATOR###' => '<select class="tx-dlf-search-operator tx-dlf-search-operator-'.$i.'" name="'.$this->prefixId.'[extOperator]['.$i.']">'.$operatorOptions.'</select>', |
|
222 | + '###EXT_SEARCH_FIELDSELECTOR###' => '<select class="tx-dlf-search-field tx-dlf-search-field-'.$i.'" name="'.$this->prefixId.'[extField]['.$i.']">'.$fieldSelectorOptions.'</select>', |
|
223 | + '###EXT_SEARCH_FIELDQUERY###' => '<input class="tx-dlf-search-query tx-dlf-search-query-'.$i.'" type="text" name="'.$this->prefixId.'[extQuery]['.$i.']" />' |
|
224 | + ); |
|
225 | 225 | |
226 | - $extendedSearch .= $this->cObj->substituteMarkerArray($this->cObj->getSubpart($this->template, '###EXT_SEARCH_ENTRY###'), $markerArray); |
|
226 | + $extendedSearch .= $this->cObj->substituteMarkerArray($this->cObj->getSubpart($this->template, '###EXT_SEARCH_ENTRY###'), $markerArray); |
|
227 | 227 | |
228 | - } |
|
228 | + } |
|
229 | 229 | |
230 | - return $extendedSearch; |
|
230 | + return $extendedSearch; |
|
231 | 231 | |
232 | - } |
|
232 | + } |
|
233 | 233 | |
234 | - /** |
|
235 | - * Adds the facets menu to the search form |
|
236 | - * |
|
237 | - * @access protected |
|
238 | - * |
|
239 | - * @return string HTML output of facets menu |
|
240 | - */ |
|
241 | - protected function addFacetsMenu() { |
|
234 | + /** |
|
235 | + * Adds the facets menu to the search form |
|
236 | + * |
|
237 | + * @access protected |
|
238 | + * |
|
239 | + * @return string HTML output of facets menu |
|
240 | + */ |
|
241 | + protected function addFacetsMenu() { |
|
242 | 242 | |
243 | - // Check for typoscript configuration to prevent fatal error. |
|
244 | - if (empty($this->conf['facetsConf.'])) { |
|
243 | + // Check for typoscript configuration to prevent fatal error. |
|
244 | + if (empty($this->conf['facetsConf.'])) { |
|
245 | 245 | |
246 | - if (TYPO3_DLOG) { |
|
246 | + if (TYPO3_DLOG) { |
|
247 | 247 | |
248 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->addFacetsMenu()] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
248 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->addFacetsMenu()] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
249 | 249 | |
250 | - } |
|
250 | + } |
|
251 | 251 | |
252 | - return ''; |
|
252 | + return ''; |
|
253 | 253 | |
254 | - } |
|
254 | + } |
|
255 | 255 | |
256 | - // Quit without doing anything if no facets are selected. |
|
257 | - if (empty($this->conf['facets'])) { |
|
256 | + // Quit without doing anything if no facets are selected. |
|
257 | + if (empty($this->conf['facets'])) { |
|
258 | 258 | |
259 | - return ''; |
|
259 | + return ''; |
|
260 | 260 | |
261 | - } |
|
261 | + } |
|
262 | 262 | |
263 | - // Get facets from plugin configuration. |
|
264 | - $facets = array (); |
|
263 | + // Get facets from plugin configuration. |
|
264 | + $facets = array (); |
|
265 | 265 | |
266 | - foreach (\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['facets'], TRUE) as $facet) { |
|
266 | + foreach (\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['facets'], TRUE) as $facet) { |
|
267 | 267 | |
268 | - $facets[$facet.'_faceting'] = tx_dlf_helper::translate($facet, 'tx_dlf_metadata', $this->conf['pages']); |
|
268 | + $facets[$facet.'_faceting'] = tx_dlf_helper::translate($facet, 'tx_dlf_metadata', $this->conf['pages']); |
|
269 | 269 | |
270 | - } |
|
270 | + } |
|
271 | 271 | |
272 | - // Render facets menu. |
|
273 | - $TSconfig = array (); |
|
272 | + // Render facets menu. |
|
273 | + $TSconfig = array (); |
|
274 | 274 | |
275 | - $TSconfig['special'] = 'userfunction'; |
|
275 | + $TSconfig['special'] = 'userfunction'; |
|
276 | 276 | |
277 | - $TSconfig['special.']['userFunc'] = 'tx_dlf_search->makeFacetsMenuArray'; |
|
277 | + $TSconfig['special.']['userFunc'] = 'tx_dlf_search->makeFacetsMenuArray'; |
|
278 | 278 | |
279 | - $TSconfig['special.']['facets'] = $facets; |
|
279 | + $TSconfig['special.']['facets'] = $facets; |
|
280 | 280 | |
281 | - $TSconfig['special.']['limit'] = max(intval($this->conf['limitFacets']), 1); |
|
281 | + $TSconfig['special.']['limit'] = max(intval($this->conf['limitFacets']), 1); |
|
282 | 282 | |
283 | - $TSconfig = tx_dlf_helper::array_merge_recursive_overrule($this->conf['facetsConf.'], $TSconfig); |
|
283 | + $TSconfig = tx_dlf_helper::array_merge_recursive_overrule($this->conf['facetsConf.'], $TSconfig); |
|
284 | 284 | |
285 | - return $this->cObj->HMENU($TSconfig); |
|
285 | + return $this->cObj->HMENU($TSconfig); |
|
286 | 286 | |
287 | - } |
|
287 | + } |
|
288 | 288 | |
289 | - /** |
|
290 | - * Adds the fulltext switch to the search form |
|
291 | - * |
|
292 | - * @access protected |
|
293 | - * |
|
294 | - * @param int $isFulltextSearch |
|
295 | - * |
|
296 | - * @return string HTML output of fulltext switch |
|
297 | - */ |
|
298 | - protected function addFulltextSwitch($isFulltextSearch = 0) { |
|
289 | + /** |
|
290 | + * Adds the fulltext switch to the search form |
|
291 | + * |
|
292 | + * @access protected |
|
293 | + * |
|
294 | + * @param int $isFulltextSearch |
|
295 | + * |
|
296 | + * @return string HTML output of fulltext switch |
|
297 | + */ |
|
298 | + protected function addFulltextSwitch($isFulltextSearch = 0) { |
|
299 | 299 | |
300 | - $output = ''; |
|
300 | + $output = ''; |
|
301 | 301 | |
302 | - // Check for plugin configuration. |
|
303 | - if (!empty($this->conf['fulltext'])) { |
|
302 | + // Check for plugin configuration. |
|
303 | + if (!empty($this->conf['fulltext'])) { |
|
304 | 304 | |
305 | - $output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-no" type="radio" name="' . $this->prefixId . '[fulltext]" value="0" ' . ($isFulltextSearch == 0 ? 'checked="checked"' : '') .' />'; |
|
305 | + $output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-no" type="radio" name="' . $this->prefixId . '[fulltext]" value="0" ' . ($isFulltextSearch == 0 ? 'checked="checked"' : '') .' />'; |
|
306 | 306 | |
307 | - $output .= ' <label for="tx-dlf-search-fulltext-no">' . $this->pi_getLL('label.inMetadata', '') . '</label>'; |
|
307 | + $output .= ' <label for="tx-dlf-search-fulltext-no">' . $this->pi_getLL('label.inMetadata', '') . '</label>'; |
|
308 | 308 | |
309 | - $output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-yes" type="radio" name="' . $this->prefixId . '[fulltext]" value="1" ' . ($isFulltextSearch == 1 ? 'checked="checked"' : '') .'/>'; |
|
309 | + $output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-yes" type="radio" name="' . $this->prefixId . '[fulltext]" value="1" ' . ($isFulltextSearch == 1 ? 'checked="checked"' : '') .'/>'; |
|
310 | 310 | |
311 | - $output .= ' <label for="tx-dlf-search-fulltext-yes">' . $this->pi_getLL('label.inFulltext', '') . '</label>'; |
|
311 | + $output .= ' <label for="tx-dlf-search-fulltext-yes">' . $this->pi_getLL('label.inFulltext', '') . '</label>'; |
|
312 | 312 | |
313 | - } |
|
313 | + } |
|
314 | 314 | |
315 | - return $output; |
|
315 | + return $output; |
|
316 | 316 | |
317 | - } |
|
317 | + } |
|
318 | 318 | |
319 | - /** |
|
320 | - * Adds the logical page field to the search form |
|
321 | - * |
|
322 | - * @access protected |
|
323 | - * |
|
324 | - * @return string HTML output of logical page field |
|
325 | - */ |
|
326 | - protected function addLogicalPage() { |
|
319 | + /** |
|
320 | + * Adds the logical page field to the search form |
|
321 | + * |
|
322 | + * @access protected |
|
323 | + * |
|
324 | + * @return string HTML output of logical page field |
|
325 | + */ |
|
326 | + protected function addLogicalPage() { |
|
327 | 327 | |
328 | - $output = ''; |
|
328 | + $output = ''; |
|
329 | 329 | |
330 | - // Check for plugin configuration. |
|
331 | - if (!empty($this->conf['showLogicalPageField'])) { |
|
330 | + // Check for plugin configuration. |
|
331 | + if (!empty($this->conf['showLogicalPageField'])) { |
|
332 | 332 | |
333 | - $output .= ' <label for="tx-dlf-search-logical-page">' . $this->pi_getLL('label.logicalPage', '') . ': </label>'; |
|
333 | + $output .= ' <label for="tx-dlf-search-logical-page">' . $this->pi_getLL('label.logicalPage', '') . ': </label>'; |
|
334 | 334 | |
335 | - $output .= ' <input class="tx-dlf-search-logical-page" id="tx-dlf-search-logical-page" type="text" name="' . $this->prefixId . '[logicalPage]" />'; |
|
335 | + $output .= ' <input class="tx-dlf-search-logical-page" id="tx-dlf-search-logical-page" type="text" name="' . $this->prefixId . '[logicalPage]" />'; |
|
336 | 336 | |
337 | - } |
|
337 | + } |
|
338 | 338 | |
339 | - return $output; |
|
339 | + return $output; |
|
340 | 340 | |
341 | - } |
|
341 | + } |
|
342 | 342 | |
343 | - /** |
|
344 | - * Creates an array for a HMENU entry of a facet value. |
|
345 | - * |
|
346 | - * @param string $field: The facet's index_name |
|
347 | - * @param string $value: The facet's value |
|
348 | - * @param integer $count: Number of hits for this facet |
|
349 | - * @param array $search: The parameters of the current search query |
|
350 | - * @param string &$state: The state of the parent item |
|
351 | - * |
|
352 | - * @return array The array for the facet's menu entry |
|
353 | - */ |
|
354 | - protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) { |
|
343 | + /** |
|
344 | + * Creates an array for a HMENU entry of a facet value. |
|
345 | + * |
|
346 | + * @param string $field: The facet's index_name |
|
347 | + * @param string $value: The facet's value |
|
348 | + * @param integer $count: Number of hits for this facet |
|
349 | + * @param array $search: The parameters of the current search query |
|
350 | + * @param string &$state: The state of the parent item |
|
351 | + * |
|
352 | + * @return array The array for the facet's menu entry |
|
353 | + */ |
|
354 | + protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) { |
|
355 | 355 | |
356 | - $entryArray = array(); |
|
356 | + $entryArray = array(); |
|
357 | 357 | |
358 | - // Translate value. |
|
359 | - if ($field == 'owner_faceting') { |
|
358 | + // Translate value. |
|
359 | + if ($field == 'owner_faceting') { |
|
360 | 360 | |
361 | - // Translate name of holding library. |
|
362 | - $entryArray['title'] = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages'])); |
|
361 | + // Translate name of holding library. |
|
362 | + $entryArray['title'] = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages'])); |
|
363 | 363 | |
364 | - } elseif ($field == 'type_faceting') { |
|
364 | + } elseif ($field == 'type_faceting') { |
|
365 | 365 | |
366 | - // Translate document type. |
|
367 | - $entryArray['title'] = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages'])); |
|
366 | + // Translate document type. |
|
367 | + $entryArray['title'] = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages'])); |
|
368 | 368 | |
369 | - } elseif ($field == 'collection_faceting') { |
|
369 | + } elseif ($field == 'collection_faceting') { |
|
370 | 370 | |
371 | - // Translate name of collection. |
|
372 | - $entryArray['title'] = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_collections', $this->conf['pages'])); |
|
371 | + // Translate name of collection. |
|
372 | + $entryArray['title'] = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_collections', $this->conf['pages'])); |
|
373 | 373 | |
374 | - } elseif ($field == 'language_faceting') { |
|
374 | + } elseif ($field == 'language_faceting') { |
|
375 | 375 | |
376 | - // Translate ISO 639 language code. |
|
377 | - $entryArray['title'] = htmlspecialchars(tx_dlf_helper::getLanguageName($value)); |
|
376 | + // Translate ISO 639 language code. |
|
377 | + $entryArray['title'] = htmlspecialchars(tx_dlf_helper::getLanguageName($value)); |
|
378 | 378 | |
379 | - } else { |
|
379 | + } else { |
|
380 | 380 | |
381 | - $entryArray['title'] = htmlspecialchars($value); |
|
381 | + $entryArray['title'] = htmlspecialchars($value); |
|
382 | 382 | |
383 | - } |
|
383 | + } |
|
384 | 384 | |
385 | - $entryArray['count'] = $count; |
|
385 | + $entryArray['count'] = $count; |
|
386 | 386 | |
387 | - $entryArray['doNotLinkIt'] = 0; |
|
387 | + $entryArray['doNotLinkIt'] = 0; |
|
388 | 388 | |
389 | - // Check if facet is already selected. |
|
390 | - $index = array_search($field.':("'.tx_dlf_solr::escapeQuery($value).'")', $search['params']['fq']); |
|
389 | + // Check if facet is already selected. |
|
390 | + $index = array_search($field.':("'.tx_dlf_solr::escapeQuery($value).'")', $search['params']['fq']); |
|
391 | 391 | |
392 | - if ($index !== FALSE) { |
|
392 | + if ($index !== FALSE) { |
|
393 | 393 | |
394 | - // Facet is selected, thus remove it from filter. |
|
395 | - unset($search['params']['fq'][$index]); |
|
394 | + // Facet is selected, thus remove it from filter. |
|
395 | + unset($search['params']['fq'][$index]); |
|
396 | 396 | |
397 | - $search['params']['fq'] = array_values($search['params']['fq']); |
|
397 | + $search['params']['fq'] = array_values($search['params']['fq']); |
|
398 | 398 | |
399 | - $entryArray['ITEM_STATE'] = 'CUR'; |
|
399 | + $entryArray['ITEM_STATE'] = 'CUR'; |
|
400 | 400 | |
401 | - $state = 'ACTIFSUB'; |
|
401 | + $state = 'ACTIFSUB'; |
|
402 | 402 | |
403 | - //Reset facets |
|
404 | - if ($this->conf['resetFacets']) { |
|
405 | - //remove ($count) for selected facet in template |
|
406 | - $entryArray['count'] = FALSE; |
|
407 | - //build link to delete selected facet |
|
408 | - $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('query' => $search['query'], 'fq' => $search['params']['fq'])); |
|
409 | - $entryArray['title'] = sprintf($this->pi_getLL('resetFacet', ''), $entryArray['title']); |
|
410 | - } |
|
403 | + //Reset facets |
|
404 | + if ($this->conf['resetFacets']) { |
|
405 | + //remove ($count) for selected facet in template |
|
406 | + $entryArray['count'] = FALSE; |
|
407 | + //build link to delete selected facet |
|
408 | + $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('query' => $search['query'], 'fq' => $search['params']['fq'])); |
|
409 | + $entryArray['title'] = sprintf($this->pi_getLL('resetFacet', ''), $entryArray['title']); |
|
410 | + } |
|
411 | 411 | |
412 | - } else { |
|
412 | + } else { |
|
413 | 413 | |
414 | - // Facet is not selected, thus add it to filter. |
|
415 | - $search['params']['fq'][] = $field.':("'.tx_dlf_solr::escapeQuery($value).'")'; |
|
414 | + // Facet is not selected, thus add it to filter. |
|
415 | + $search['params']['fq'][] = $field.':("'.tx_dlf_solr::escapeQuery($value).'")'; |
|
416 | 416 | |
417 | - $entryArray['ITEM_STATE'] = 'NO'; |
|
417 | + $entryArray['ITEM_STATE'] = 'NO'; |
|
418 | 418 | |
419 | - } |
|
419 | + } |
|
420 | 420 | |
421 | - $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('query' => $search['query'], 'fq' => $search['params']['fq'])); |
|
421 | + $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('query' => $search['query'], 'fq' => $search['params']['fq'])); |
|
422 | 422 | |
423 | - return $entryArray; |
|
423 | + return $entryArray; |
|
424 | 424 | |
425 | - } |
|
425 | + } |
|
426 | 426 | |
427 | - /** |
|
428 | - * The main method of the PlugIn |
|
429 | - * |
|
430 | - * @access public |
|
431 | - * |
|
432 | - * @param string $content: The PlugIn content |
|
433 | - * @param array $conf: The PlugIn configuration |
|
434 | - * |
|
435 | - * @return string The content that is displayed on the website |
|
436 | - */ |
|
437 | - public function main($content, $conf) { |
|
427 | + /** |
|
428 | + * The main method of the PlugIn |
|
429 | + * |
|
430 | + * @access public |
|
431 | + * |
|
432 | + * @param string $content: The PlugIn content |
|
433 | + * @param array $conf: The PlugIn configuration |
|
434 | + * |
|
435 | + * @return string The content that is displayed on the website |
|
436 | + */ |
|
437 | + public function main($content, $conf) { |
|
438 | 438 | |
439 | - $this->init($conf); |
|
439 | + $this->init($conf); |
|
440 | 440 | |
441 | - // Disable caching for this plugin. |
|
442 | - $this->setCache(FALSE); |
|
441 | + // Disable caching for this plugin. |
|
442 | + $this->setCache(FALSE); |
|
443 | 443 | |
444 | - // Quit without doing anything if required variables are not set. |
|
445 | - if (empty($this->conf['solrcore'])) { |
|
444 | + // Quit without doing anything if required variables are not set. |
|
445 | + if (empty($this->conf['solrcore'])) { |
|
446 | 446 | |
447 | - if (TYPO3_DLOG) { |
|
447 | + if (TYPO3_DLOG) { |
|
448 | 448 | |
449 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); |
|
449 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); |
|
450 | 450 | |
451 | - } |
|
451 | + } |
|
452 | 452 | |
453 | - return $content; |
|
453 | + return $content; |
|
454 | 454 | |
455 | - } |
|
455 | + } |
|
456 | 456 | |
457 | - if (!isset($this->piVars['query']) && empty($this->piVars['extQuery'])) { |
|
457 | + if (!isset($this->piVars['query']) && empty($this->piVars['extQuery'])) { |
|
458 | 458 | |
459 | - // Extract query and filter from last search. |
|
460 | - $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
459 | + // Extract query and filter from last search. |
|
460 | + $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
461 | 461 | |
462 | - if (!empty($list->metadata['searchString'])) { |
|
462 | + if (!empty($list->metadata['searchString'])) { |
|
463 | 463 | |
464 | - if ($list->metadata['options']['source'] == 'search') { |
|
464 | + if ($list->metadata['options']['source'] == 'search') { |
|
465 | 465 | |
466 | - $search['query'] = $list->metadata['searchString']; |
|
466 | + $search['query'] = $list->metadata['searchString']; |
|
467 | 467 | |
468 | - } |
|
468 | + } |
|
469 | 469 | |
470 | - $search['params'] = $list->metadata['options']['params']; |
|
470 | + $search['params'] = $list->metadata['options']['params']; |
|
471 | 471 | |
472 | - } |
|
472 | + } |
|
473 | 473 | |
474 | - // Add javascript for search suggestions if enabled and jQuery autocompletion is available. |
|
475 | - if (!empty($this->conf['suggest'])) { |
|
474 | + // Add javascript for search suggestions if enabled and jQuery autocompletion is available. |
|
475 | + if (!empty($this->conf['suggest'])) { |
|
476 | 476 | |
477 | - $this->addAutocompleteJS(); |
|
477 | + $this->addAutocompleteJS(); |
|
478 | 478 | |
479 | - } |
|
479 | + } |
|
480 | 480 | |
481 | - // Load template file. |
|
482 | - if (!empty($this->conf['templateFile'])) { |
|
481 | + // Load template file. |
|
482 | + if (!empty($this->conf['templateFile'])) { |
|
483 | 483 | |
484 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
484 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
485 | 485 | |
486 | - } else { |
|
486 | + } else { |
|
487 | 487 | |
488 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/search/template.tmpl'), '###TEMPLATE###'); |
|
488 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/search/template.tmpl'), '###TEMPLATE###'); |
|
489 | 489 | |
490 | - } |
|
490 | + } |
|
491 | 491 | |
492 | - // Configure @action URL for form. |
|
493 | - $linkConf = array ( |
|
494 | - 'parameter' => $GLOBALS['TSFE']->id, |
|
495 | - 'forceAbsoluteUrl' => 1 |
|
496 | - ); |
|
492 | + // Configure @action URL for form. |
|
493 | + $linkConf = array ( |
|
494 | + 'parameter' => $GLOBALS['TSFE']->id, |
|
495 | + 'forceAbsoluteUrl' => 1 |
|
496 | + ); |
|
497 | 497 | |
498 | - // Fill markers. |
|
499 | - $markerArray = array ( |
|
500 | - '###ACTION_URL###' => $this->cObj->typoLink_URL($linkConf), |
|
501 | - '###LABEL_QUERY###' => (!empty($search['query']) ? $search['query'] : $this->pi_getLL('label.query')), |
|
502 | - '###LABEL_SUBMIT###' => $this->pi_getLL('label.submit'), |
|
503 | - '###FIELD_QUERY###' => $this->prefixId.'[query]', |
|
504 | - '###QUERY###' => (!empty($search['query']) ? $search['query'] : ''), |
|
505 | - '###FULLTEXTSWITCH###' => $this->addFulltextSwitch($list->metadata['fulltextSearch']), |
|
506 | - '###FIELD_DOC###' => ($this->conf['searchIn'] == 'document' || $this->conf['searchIn'] == 'all' ? $this->addCurrentDocument() : ''), |
|
507 | - '###FIELD_COLL###' => ($this->conf['searchIn'] == 'collection' || $this->conf['searchIn'] == 'all' ? $this->addCurrentCollection() : ''), |
|
508 | - '###ADDITIONAL_INPUTS###' => $this->addEncryptedCoreName(), |
|
509 | - '###FACETS_MENU###' => $this->addFacetsMenu(), |
|
510 | - '###LOGICAL_PAGE###' => $this->addLogicalPage() |
|
511 | - ); |
|
498 | + // Fill markers. |
|
499 | + $markerArray = array ( |
|
500 | + '###ACTION_URL###' => $this->cObj->typoLink_URL($linkConf), |
|
501 | + '###LABEL_QUERY###' => (!empty($search['query']) ? $search['query'] : $this->pi_getLL('label.query')), |
|
502 | + '###LABEL_SUBMIT###' => $this->pi_getLL('label.submit'), |
|
503 | + '###FIELD_QUERY###' => $this->prefixId.'[query]', |
|
504 | + '###QUERY###' => (!empty($search['query']) ? $search['query'] : ''), |
|
505 | + '###FULLTEXTSWITCH###' => $this->addFulltextSwitch($list->metadata['fulltextSearch']), |
|
506 | + '###FIELD_DOC###' => ($this->conf['searchIn'] == 'document' || $this->conf['searchIn'] == 'all' ? $this->addCurrentDocument() : ''), |
|
507 | + '###FIELD_COLL###' => ($this->conf['searchIn'] == 'collection' || $this->conf['searchIn'] == 'all' ? $this->addCurrentCollection() : ''), |
|
508 | + '###ADDITIONAL_INPUTS###' => $this->addEncryptedCoreName(), |
|
509 | + '###FACETS_MENU###' => $this->addFacetsMenu(), |
|
510 | + '###LOGICAL_PAGE###' => $this->addLogicalPage() |
|
511 | + ); |
|
512 | 512 | |
513 | - // Get additional fields for extended search. |
|
514 | - $extendedSearch = $this->addExtendedSearch(); |
|
513 | + // Get additional fields for extended search. |
|
514 | + $extendedSearch = $this->addExtendedSearch(); |
|
515 | 515 | |
516 | - // Display search form. |
|
517 | - $content .= $this->cObj->substituteSubpart($this->cObj->substituteMarkerArray($this->template, $markerArray), '###EXT_SEARCH_ENTRY###', $extendedSearch); |
|
516 | + // Display search form. |
|
517 | + $content .= $this->cObj->substituteSubpart($this->cObj->substituteMarkerArray($this->template, $markerArray), '###EXT_SEARCH_ENTRY###', $extendedSearch); |
|
518 | 518 | |
519 | - return $this->pi_wrapInBaseClass($content); |
|
519 | + return $this->pi_wrapInBaseClass($content); |
|
520 | 520 | |
521 | - } else { |
|
521 | + } else { |
|
522 | 522 | |
523 | - // Instantiate search object. |
|
524 | - $solr = tx_dlf_solr::getInstance($this->conf['solrcore']); |
|
523 | + // Instantiate search object. |
|
524 | + $solr = tx_dlf_solr::getInstance($this->conf['solrcore']); |
|
525 | 525 | |
526 | - if (!$solr->ready) { |
|
526 | + if (!$solr->ready) { |
|
527 | 527 | |
528 | - if (TYPO3_DLOG) { |
|
528 | + if (TYPO3_DLOG) { |
|
529 | 529 | |
530 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->main('.$content.', [data])] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR, $conf); |
|
530 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->main('.$content.', [data])] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR, $conf); |
|
531 | 531 | |
532 | - } |
|
532 | + } |
|
533 | 533 | |
534 | - return $content; |
|
534 | + return $content; |
|
535 | 535 | |
536 | - } |
|
536 | + } |
|
537 | 537 | |
538 | - // Build label for result list. |
|
539 | - $label = $this->pi_getLL('search', '', TRUE); |
|
538 | + // Build label for result list. |
|
539 | + $label = $this->pi_getLL('search', '', TRUE); |
|
540 | 540 | |
541 | - if (!empty($this->piVars['query'])) { |
|
541 | + if (!empty($this->piVars['query'])) { |
|
542 | 542 | |
543 | - $label .= htmlspecialchars(sprintf($this->pi_getLL('for', ''), $this->piVars['query'])); |
|
543 | + $label .= htmlspecialchars(sprintf($this->pi_getLL('for', ''), $this->piVars['query'])); |
|
544 | 544 | |
545 | - } |
|
545 | + } |
|
546 | 546 | |
547 | - // Prepare query parameters. |
|
548 | - $params = array (); |
|
547 | + // Prepare query parameters. |
|
548 | + $params = array (); |
|
549 | 549 | |
550 | - $matches = array (); |
|
550 | + $matches = array (); |
|
551 | 551 | |
552 | - // Set search query. |
|
553 | - if ((!empty($this->conf['fulltext']) && !empty($this->piVars['fulltext'])) || preg_match('/fulltext:\((.*)\)/', $this->piVars['query'], $matches)) { |
|
552 | + // Set search query. |
|
553 | + if ((!empty($this->conf['fulltext']) && !empty($this->piVars['fulltext'])) || preg_match('/fulltext:\((.*)\)/', $this->piVars['query'], $matches)) { |
|
554 | 554 | |
555 | - // If the query already is a fulltext query e.g using the facets |
|
556 | - $this->piVars['query'] = empty($matches[1])?$this->piVars['query']:$matches[1]; |
|
555 | + // If the query already is a fulltext query e.g using the facets |
|
556 | + $this->piVars['query'] = empty($matches[1])?$this->piVars['query']:$matches[1]; |
|
557 | 557 | |
558 | - // Search in fulltext field if applicable. query must not be empty! |
|
559 | - if (!empty($this->piVars['query'])) { |
|
558 | + // Search in fulltext field if applicable. query must not be empty! |
|
559 | + if (!empty($this->piVars['query'])) { |
|
560 | 560 | |
561 | - $query = 'fulltext:('.tx_dlf_solr::escapeQuery($this->piVars['query']).')'; |
|
561 | + $query = 'fulltext:('.tx_dlf_solr::escapeQuery($this->piVars['query']).')'; |
|
562 | 562 | |
563 | - } |
|
563 | + } |
|
564 | 564 | |
565 | - // Add highlighting for fulltext. |
|
566 | - $params['hl'] = 'true'; |
|
565 | + // Add highlighting for fulltext. |
|
566 | + $params['hl'] = 'true'; |
|
567 | 567 | |
568 | - $params['hl.fl'] = 'fulltext'; |
|
568 | + $params['hl.fl'] = 'fulltext'; |
|
569 | 569 | |
570 | - } else { |
|
571 | - // Retain given search field if valid. |
|
572 | - $query = tx_dlf_solr::escapeQueryKeepField($this->piVars['query'], $this->conf['pages']); |
|
570 | + } else { |
|
571 | + // Retain given search field if valid. |
|
572 | + $query = tx_dlf_solr::escapeQueryKeepField($this->piVars['query'], $this->conf['pages']); |
|
573 | 573 | |
574 | - } |
|
574 | + } |
|
575 | 575 | |
576 | - // Add extended search query. |
|
577 | - if (!empty($this->piVars['extQuery']) && is_array($this->piVars['extQuery'])) { |
|
576 | + // Add extended search query. |
|
577 | + if (!empty($this->piVars['extQuery']) && is_array($this->piVars['extQuery'])) { |
|
578 | 578 | |
579 | - $allowedOperators = array('AND', 'OR', 'NOT'); |
|
579 | + $allowedOperators = array('AND', 'OR', 'NOT'); |
|
580 | 580 | |
581 | - $allowedFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['extendedFields'], TRUE); |
|
581 | + $allowedFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['extendedFields'], TRUE); |
|
582 | 582 | |
583 | - for ($i = 0; $i < count($this->piVars['extQuery']); $i++) { |
|
583 | + for ($i = 0; $i < count($this->piVars['extQuery']); $i++) { |
|
584 | 584 | |
585 | - if (!empty($this->piVars['extQuery'][$i])) { |
|
585 | + if (!empty($this->piVars['extQuery'][$i])) { |
|
586 | 586 | |
587 | - if (in_array($this->piVars['extOperator'][$i], $allowedOperators) && in_array($this->piVars['extField'][$i], $allowedFields)) { |
|
587 | + if (in_array($this->piVars['extOperator'][$i], $allowedOperators) && in_array($this->piVars['extField'][$i], $allowedFields)) { |
|
588 | 588 | |
589 | - if (!empty($query)) { |
|
589 | + if (!empty($query)) { |
|
590 | 590 | |
591 | - $query .= ' '.$this->piVars['extOperator'][$i].' '; |
|
591 | + $query .= ' '.$this->piVars['extOperator'][$i].' '; |
|
592 | 592 | |
593 | - } |
|
593 | + } |
|
594 | 594 | |
595 | - $query .= tx_dlf_indexing::getIndexFieldName($this->piVars['extField'][$i], $this->conf['pages']).':('.tx_dlf_solr::escapeQuery($this->piVars['extQuery'][$i]).')'; |
|
595 | + $query .= tx_dlf_indexing::getIndexFieldName($this->piVars['extField'][$i], $this->conf['pages']).':('.tx_dlf_solr::escapeQuery($this->piVars['extQuery'][$i]).')'; |
|
596 | 596 | |
597 | - } |
|
597 | + } |
|
598 | 598 | |
599 | - } |
|
599 | + } |
|
600 | 600 | |
601 | - } |
|
601 | + } |
|
602 | 602 | |
603 | - } |
|
603 | + } |
|
604 | 604 | |
605 | - // Add filter query for faceting. |
|
606 | - if (!empty($this->piVars['fq'])) { |
|
605 | + // Add filter query for faceting. |
|
606 | + if (!empty($this->piVars['fq'])) { |
|
607 | 607 | |
608 | - $params['fq'] = $this->piVars['fq']; |
|
608 | + $params['fq'] = $this->piVars['fq']; |
|
609 | 609 | |
610 | - } |
|
610 | + } |
|
611 | 611 | |
612 | - // Add filter query for in-document searching. |
|
613 | - if ($this->conf['searchIn'] == 'document' || $this->conf['searchIn'] == 'all') { |
|
612 | + // Add filter query for in-document searching. |
|
613 | + if ($this->conf['searchIn'] == 'document' || $this->conf['searchIn'] == 'all') { |
|
614 | 614 | |
615 | - if (!empty($this->piVars['id']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['id'])) { |
|
615 | + if (!empty($this->piVars['id']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['id'])) { |
|
616 | 616 | |
617 | - $params['fq'][] = 'uid:('.$this->piVars['id'].') OR partof:('.$this->piVars['id'].')'; |
|
617 | + $params['fq'][] = 'uid:('.$this->piVars['id'].') OR partof:('.$this->piVars['id'].')'; |
|
618 | 618 | |
619 | - $label .= htmlspecialchars(sprintf($this->pi_getLL('in', ''), tx_dlf_document::getTitle($this->piVars['id']))); |
|
619 | + $label .= htmlspecialchars(sprintf($this->pi_getLL('in', ''), tx_dlf_document::getTitle($this->piVars['id']))); |
|
620 | 620 | |
621 | - } |
|
621 | + } |
|
622 | 622 | |
623 | - } |
|
623 | + } |
|
624 | 624 | |
625 | - // Add filter query for in-collection searching. |
|
626 | - if ($this->conf['searchIn'] == 'collection' || $this->conf['searchIn'] == 'all') { |
|
625 | + // Add filter query for in-collection searching. |
|
626 | + if ($this->conf['searchIn'] == 'collection' || $this->conf['searchIn'] == 'all') { |
|
627 | 627 | |
628 | - if (!empty($this->piVars['collection']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['collection'])) { |
|
628 | + if (!empty($this->piVars['collection']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['collection'])) { |
|
629 | 629 | |
630 | - $index_name = tx_dlf_helper::getIndexName($this->piVars['collection'], 'tx_dlf_collections', $this->conf['pages']); |
|
630 | + $index_name = tx_dlf_helper::getIndexName($this->piVars['collection'], 'tx_dlf_collections', $this->conf['pages']); |
|
631 | 631 | |
632 | - $params['fq'][] = 'collection_faceting:("'.tx_dlf_solr::escapeQuery($index_name).'")'; |
|
632 | + $params['fq'][] = 'collection_faceting:("'.tx_dlf_solr::escapeQuery($index_name).'")'; |
|
633 | 633 | |
634 | - $label .= sprintf($this->pi_getLL('in', '', TRUE), tx_dlf_helper::translate($index_name, 'tx_dlf_collections', $this->conf['pages'])); |
|
634 | + $label .= sprintf($this->pi_getLL('in', '', TRUE), tx_dlf_helper::translate($index_name, 'tx_dlf_collections', $this->conf['pages'])); |
|
635 | 635 | |
636 | - } |
|
636 | + } |
|
637 | 637 | |
638 | - } |
|
638 | + } |
|
639 | 639 | |
640 | - // Add filter query for collection restrictions. |
|
641 | - if ($this->conf['collections']) { |
|
640 | + // Add filter query for collection restrictions. |
|
641 | + if ($this->conf['collections']) { |
|
642 | 642 | |
643 | - $collIds = explode(',', $this->conf['collections']); |
|
643 | + $collIds = explode(',', $this->conf['collections']); |
|
644 | 644 | |
645 | - $collIndexNames = array (); |
|
645 | + $collIndexNames = array (); |
|
646 | 646 | |
647 | - foreach ($collIds as $collId) { |
|
647 | + foreach ($collIds as $collId) { |
|
648 | 648 | |
649 | - $collIndexNames[] = tx_dlf_solr::escapeQuery(tx_dlf_helper::getIndexName(intval($collId), 'tx_dlf_collections', $this->conf['pages'])); |
|
649 | + $collIndexNames[] = tx_dlf_solr::escapeQuery(tx_dlf_helper::getIndexName(intval($collId), 'tx_dlf_collections', $this->conf['pages'])); |
|
650 | 650 | |
651 | - } |
|
651 | + } |
|
652 | 652 | |
653 | - // Last value is fake and used for distinction in $this->addCurrentCollection() |
|
654 | - $params['fq'][] = 'collection_faceting:("'.implode('" OR "', $collIndexNames).'" OR "FakeValueForDistinction")'; |
|
653 | + // Last value is fake and used for distinction in $this->addCurrentCollection() |
|
654 | + $params['fq'][] = 'collection_faceting:("'.implode('" OR "', $collIndexNames).'" OR "FakeValueForDistinction")'; |
|
655 | 655 | |
656 | - } |
|
656 | + } |
|
657 | 657 | |
658 | - // Set search parameters. |
|
659 | - $solr->limit = max(intval($this->conf['limit']), 1); |
|
658 | + // Set search parameters. |
|
659 | + $solr->limit = max(intval($this->conf['limit']), 1); |
|
660 | 660 | |
661 | - $solr->cPid = $this->conf['pages']; |
|
661 | + $solr->cPid = $this->conf['pages']; |
|
662 | 662 | |
663 | - $solr->params = $params; |
|
663 | + $solr->params = $params; |
|
664 | 664 | |
665 | - // Perform search. |
|
666 | - $results = $solr->search($query); |
|
665 | + // Perform search. |
|
666 | + $results = $solr->search($query); |
|
667 | 667 | |
668 | - $results->metadata = array ( |
|
669 | - 'label' => $label, |
|
670 | - 'description' => '<p class="tx-dlf-search-numHits">'.htmlspecialchars(sprintf($this->pi_getLL('hits', ''), $solr->numberOfHits, count($results))).'</p>', |
|
671 | - 'thumbnail' => '', |
|
672 | - 'searchString' => $this->piVars['query'], |
|
673 | - 'fulltextSearch' => (!empty($this->piVars['fulltext']) ? '1' : '0'), |
|
674 | - 'options' => $results->metadata['options'] |
|
675 | - ); |
|
668 | + $results->metadata = array ( |
|
669 | + 'label' => $label, |
|
670 | + 'description' => '<p class="tx-dlf-search-numHits">'.htmlspecialchars(sprintf($this->pi_getLL('hits', ''), $solr->numberOfHits, count($results))).'</p>', |
|
671 | + 'thumbnail' => '', |
|
672 | + 'searchString' => $this->piVars['query'], |
|
673 | + 'fulltextSearch' => (!empty($this->piVars['fulltext']) ? '1' : '0'), |
|
674 | + 'options' => $results->metadata['options'] |
|
675 | + ); |
|
676 | 676 | |
677 | - $results->save(); |
|
677 | + $results->save(); |
|
678 | 678 | |
679 | - // Clean output buffer. |
|
680 | - \TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers(); |
|
679 | + // Clean output buffer. |
|
680 | + \TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers(); |
|
681 | 681 | |
682 | - $additionalParams = array(); |
|
682 | + $additionalParams = array(); |
|
683 | 683 | |
684 | - if(!empty($this->piVars['logicalPage'])) { |
|
684 | + if(!empty($this->piVars['logicalPage'])) { |
|
685 | 685 | |
686 | - $additionalParams['logicalPage'] = $this->piVars['logicalPage']; |
|
686 | + $additionalParams['logicalPage'] = $this->piVars['logicalPage']; |
|
687 | 687 | |
688 | - } |
|
688 | + } |
|
689 | 689 | |
690 | - // Jump directly to the page view, if there is only one result and it is configured |
|
691 | - if($results->count() == 1 && !empty($this->conf['showSingleResult'])) { |
|
690 | + // Jump directly to the page view, if there is only one result and it is configured |
|
691 | + if($results->count() == 1 && !empty($this->conf['showSingleResult'])) { |
|
692 | 692 | |
693 | - $linkConf['parameter'] = $this->conf['targetPidPageView']; |
|
693 | + $linkConf['parameter'] = $this->conf['targetPidPageView']; |
|
694 | 694 | |
695 | - $additionalParams['id'] = $results->current()['uid']; |
|
696 | - $additionalParams['highlight_word'] = preg_replace('/\s\s+/', ';', $results->metadata['searchString']); |
|
697 | - $additionalParams['page'] = count($results[0]['subparts']) == 1?$results[0]['subparts'][0]['page']:1; |
|
695 | + $additionalParams['id'] = $results->current()['uid']; |
|
696 | + $additionalParams['highlight_word'] = preg_replace('/\s\s+/', ';', $results->metadata['searchString']); |
|
697 | + $additionalParams['page'] = count($results[0]['subparts']) == 1?$results[0]['subparts'][0]['page']:1; |
|
698 | 698 | |
699 | - } else { |
|
699 | + } else { |
|
700 | 700 | |
701 | - // Keep some plugin variables. |
|
702 | - $linkConf['parameter'] = $this->conf['targetPid']; |
|
701 | + // Keep some plugin variables. |
|
702 | + $linkConf['parameter'] = $this->conf['targetPid']; |
|
703 | 703 | |
704 | - if (!empty($this->piVars['order'])) { |
|
704 | + if (!empty($this->piVars['order'])) { |
|
705 | 705 | |
706 | - $additionalParams['order'] = $this->piVars['order']; |
|
707 | - $additionalParams['asc'] = !empty($this->piVars['asc']) ? '1' : '0'; |
|
706 | + $additionalParams['order'] = $this->piVars['order']; |
|
707 | + $additionalParams['asc'] = !empty($this->piVars['asc']) ? '1' : '0'; |
|
708 | 708 | |
709 | - } |
|
709 | + } |
|
710 | 710 | |
711 | - } |
|
711 | + } |
|
712 | 712 | |
713 | - $linkConf['additionalParams'] = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE); |
|
713 | + $linkConf['additionalParams'] = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE); |
|
714 | 714 | |
715 | - // Send headers. |
|
716 | - header('Location: '.\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL($linkConf))); |
|
715 | + // Send headers. |
|
716 | + header('Location: '.\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL($linkConf))); |
|
717 | 717 | |
718 | - // Flush output buffer and end script processing. |
|
719 | - ob_end_flush(); |
|
718 | + // Flush output buffer and end script processing. |
|
719 | + ob_end_flush(); |
|
720 | 720 | |
721 | - exit; |
|
721 | + exit; |
|
722 | 722 | |
723 | - } |
|
723 | + } |
|
724 | 724 | |
725 | - } |
|
725 | + } |
|
726 | 726 | |
727 | - /** |
|
728 | - * This builds a menu array for HMENU |
|
729 | - * |
|
730 | - * @access public |
|
731 | - * |
|
732 | - * @param string $content: The PlugIn content |
|
733 | - * @param array $conf: The PlugIn configuration |
|
734 | - * |
|
735 | - * @return array HMENU array |
|
736 | - */ |
|
737 | - public function makeFacetsMenuArray($content, $conf) { |
|
727 | + /** |
|
728 | + * This builds a menu array for HMENU |
|
729 | + * |
|
730 | + * @access public |
|
731 | + * |
|
732 | + * @param string $content: The PlugIn content |
|
733 | + * @param array $conf: The PlugIn configuration |
|
734 | + * |
|
735 | + * @return array HMENU array |
|
736 | + */ |
|
737 | + public function makeFacetsMenuArray($content, $conf) { |
|
738 | 738 | |
739 | - $this->init($conf); |
|
739 | + $this->init($conf); |
|
740 | 740 | |
741 | - $menuArray = array (); |
|
741 | + $menuArray = array (); |
|
742 | 742 | |
743 | - // Set default value for facet search. |
|
744 | - $search = array ( |
|
745 | - 'query' => '*', |
|
746 | - 'params' => array () |
|
747 | - ); |
|
743 | + // Set default value for facet search. |
|
744 | + $search = array ( |
|
745 | + 'query' => '*', |
|
746 | + 'params' => array () |
|
747 | + ); |
|
748 | 748 | |
749 | - // Extract query and filter from last search. |
|
750 | - $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
749 | + // Extract query and filter from last search. |
|
750 | + $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
751 | 751 | |
752 | - if (!empty($list->metadata['options']['source'])) { |
|
752 | + if (!empty($list->metadata['options']['source'])) { |
|
753 | 753 | |
754 | - if ($list->metadata['options']['source'] == 'search') { |
|
754 | + if ($list->metadata['options']['source'] == 'search') { |
|
755 | 755 | |
756 | - $search['query'] = $list->metadata['options']['select']; |
|
756 | + $search['query'] = $list->metadata['options']['select']; |
|
757 | 757 | |
758 | - } |
|
758 | + } |
|
759 | 759 | |
760 | - $search['params'] = $list->metadata['options']['params']; |
|
760 | + $search['params'] = $list->metadata['options']['params']; |
|
761 | 761 | |
762 | - } |
|
762 | + } |
|
763 | 763 | |
764 | - // Get applicable facets. |
|
765 | - $solr = tx_dlf_solr::getInstance($this->conf['solrcore']); |
|
764 | + // Get applicable facets. |
|
765 | + $solr = tx_dlf_solr::getInstance($this->conf['solrcore']); |
|
766 | 766 | |
767 | - if (!$solr->ready) { |
|
767 | + if (!$solr->ready) { |
|
768 | 768 | |
769 | - if (TYPO3_DLOG) { |
|
769 | + if (TYPO3_DLOG) { |
|
770 | 770 | |
771 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->makeFacetsMenuArray('.$content.', [data])] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR, $conf); |
|
771 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->makeFacetsMenuArray('.$content.', [data])] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR, $conf); |
|
772 | 772 | |
773 | - } |
|
773 | + } |
|
774 | 774 | |
775 | - return array (); |
|
775 | + return array (); |
|
776 | 776 | |
777 | - } |
|
777 | + } |
|
778 | 778 | |
779 | - // Set needed parameters for facet search. |
|
780 | - if (empty($search['params']['fq'])) { |
|
779 | + // Set needed parameters for facet search. |
|
780 | + if (empty($search['params']['fq'])) { |
|
781 | 781 | |
782 | - $search['params']['fq'] = array (); |
|
782 | + $search['params']['fq'] = array (); |
|
783 | 783 | |
784 | - } |
|
784 | + } |
|
785 | 785 | |
786 | - $search['params']['facet'] = 'true'; |
|
786 | + $search['params']['facet'] = 'true'; |
|
787 | 787 | |
788 | - $search['params']['facet.field'] = array_keys($this->conf['facets']); |
|
788 | + $search['params']['facet.field'] = array_keys($this->conf['facets']); |
|
789 | 789 | |
790 | - //override SOLR default value for facet.limit of 100 |
|
791 | - $search['params']['facet.limit'] = $this->conf['limitFacets']; |
|
790 | + //override SOLR default value for facet.limit of 100 |
|
791 | + $search['params']['facet.limit'] = $this->conf['limitFacets']; |
|
792 | 792 | |
793 | - // Perform search. |
|
794 | - $results = $solr->service->search($search['query'], 0, $this->conf['limit'], $search['params']); |
|
793 | + // Perform search. |
|
794 | + $results = $solr->service->search($search['query'], 0, $this->conf['limit'], $search['params']); |
|
795 | 795 | |
796 | - // Process results. |
|
797 | - foreach ($results->facet_counts->facet_fields as $field => $values) { |
|
796 | + // Process results. |
|
797 | + foreach ($results->facet_counts->facet_fields as $field => $values) { |
|
798 | 798 | |
799 | - $entryArray = array (); |
|
799 | + $entryArray = array (); |
|
800 | 800 | |
801 | - $entryArray['title'] = htmlspecialchars($this->conf['facets'][$field]); |
|
801 | + $entryArray['title'] = htmlspecialchars($this->conf['facets'][$field]); |
|
802 | 802 | |
803 | - $entryArray['count'] = 0; |
|
803 | + $entryArray['count'] = 0; |
|
804 | 804 | |
805 | - $entryArray['_OVERRIDE_HREF'] = ''; |
|
805 | + $entryArray['_OVERRIDE_HREF'] = ''; |
|
806 | 806 | |
807 | - $entryArray['doNotLinkIt'] = 1; |
|
807 | + $entryArray['doNotLinkIt'] = 1; |
|
808 | 808 | |
809 | - $entryArray['ITEM_STATE'] = 'NO'; |
|
809 | + $entryArray['ITEM_STATE'] = 'NO'; |
|
810 | 810 | |
811 | - // Count number of facet values. |
|
812 | - $i = 0; |
|
811 | + // Count number of facet values. |
|
812 | + $i = 0; |
|
813 | 813 | |
814 | - foreach ($values as $value => $count) { |
|
814 | + foreach ($values as $value => $count) { |
|
815 | 815 | |
816 | - if ($count > 0) { |
|
816 | + if ($count > 0) { |
|
817 | 817 | |
818 | - $hasValue = TRUE; |
|
818 | + $hasValue = TRUE; |
|
819 | 819 | |
820 | - $entryArray['count']++; |
|
820 | + $entryArray['count']++; |
|
821 | 821 | |
822 | - if ($entryArray['ITEM_STATE'] == 'NO') { |
|
822 | + if ($entryArray['ITEM_STATE'] == 'NO') { |
|
823 | 823 | |
824 | - $entryArray['ITEM_STATE'] = 'IFSUB'; |
|
824 | + $entryArray['ITEM_STATE'] = 'IFSUB'; |
|
825 | 825 | |
826 | - } |
|
826 | + } |
|
827 | 827 | |
828 | - $entryArray['_SUB_MENU'][] = $this->getFacetsMenuEntry($field, $value, $count, $search, $entryArray['ITEM_STATE']); |
|
828 | + $entryArray['_SUB_MENU'][] = $this->getFacetsMenuEntry($field, $value, $count, $search, $entryArray['ITEM_STATE']); |
|
829 | 829 | |
830 | - if (++$i == $this->conf['limit']) { |
|
830 | + if (++$i == $this->conf['limit']) { |
|
831 | 831 | |
832 | - break; |
|
832 | + break; |
|
833 | 833 | |
834 | - } |
|
834 | + } |
|
835 | 835 | |
836 | - } else { |
|
836 | + } else { |
|
837 | 837 | |
838 | - break; |
|
838 | + break; |
|
839 | 839 | |
840 | - } |
|
840 | + } |
|
841 | 841 | |
842 | - } |
|
842 | + } |
|
843 | 843 | |
844 | - $menuArray[] = $entryArray; |
|
844 | + $menuArray[] = $entryArray; |
|
845 | 845 | |
846 | - } |
|
846 | + } |
|
847 | 847 | |
848 | - return $menuArray; |
|
848 | + return $menuArray; |
|
849 | 849 | |
850 | 850 | |
851 | - } |
|
851 | + } |
|
852 | 852 | |
853 | 853 | } |
@@ -19,69 +19,69 @@ discard block |
||
19 | 19 | */ |
20 | 20 | class tx_dlf_pageview extends tx_dlf_plugin { |
21 | 21 | |
22 | - public $scriptRelPath = 'plugins/pageview/class.tx_dlf_pageview.php'; |
|
22 | + public $scriptRelPath = 'plugins/pageview/class.tx_dlf_pageview.php'; |
|
23 | 23 | |
24 | - /** |
|
25 | - * Holds the controls to add to the map |
|
26 | - * |
|
27 | - * @var array |
|
28 | - * @access protected |
|
29 | - */ |
|
30 | - protected $controls = array (); |
|
24 | + /** |
|
25 | + * Holds the controls to add to the map |
|
26 | + * |
|
27 | + * @var array |
|
28 | + * @access protected |
|
29 | + */ |
|
30 | + protected $controls = array (); |
|
31 | 31 | |
32 | - /** |
|
33 | - * Holds the current images' URLs and MIME types |
|
34 | - * |
|
35 | - * @var array |
|
36 | - * @access protected |
|
37 | - */ |
|
38 | - protected $images = array (); |
|
32 | + /** |
|
33 | + * Holds the current images' URLs and MIME types |
|
34 | + * |
|
35 | + * @var array |
|
36 | + * @access protected |
|
37 | + */ |
|
38 | + protected $images = array (); |
|
39 | 39 | |
40 | - /** |
|
41 | - * Holds the current fulltexts' URLs |
|
42 | - * |
|
43 | - * @var array |
|
44 | - * @access protected |
|
45 | - */ |
|
46 | - protected $fulltexts = array (); |
|
40 | + /** |
|
41 | + * Holds the current fulltexts' URLs |
|
42 | + * |
|
43 | + * @var array |
|
44 | + * @access protected |
|
45 | + */ |
|
46 | + protected $fulltexts = array (); |
|
47 | 47 | |
48 | - /** |
|
49 | - * Adds Viewer javascript |
|
50 | - * |
|
51 | - * @access protected |
|
52 | - * |
|
53 | - * @return string Viewer script tags ready for output |
|
54 | - */ |
|
55 | - protected function addViewerJS() { |
|
48 | + /** |
|
49 | + * Adds Viewer javascript |
|
50 | + * |
|
51 | + * @access protected |
|
52 | + * |
|
53 | + * @return string Viewer script tags ready for output |
|
54 | + */ |
|
55 | + protected function addViewerJS() { |
|
56 | 56 | |
57 | - $output = array (); |
|
57 | + $output = array (); |
|
58 | 58 | |
59 | - // Add OpenLayers library. |
|
60 | - $output[] = '<link type="text/css" rel="stylesheet" href="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/ol3.css">'; |
|
59 | + // Add OpenLayers library. |
|
60 | + $output[] = '<link type="text/css" rel="stylesheet" href="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/ol3.css">'; |
|
61 | 61 | |
62 | - $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/glif.min.js"></script>'; |
|
62 | + $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/glif.min.js"></script>'; |
|
63 | 63 | |
64 | - $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/ol3-dlf.js"></script>'; |
|
64 | + $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/ol3-dlf.js"></script>'; |
|
65 | 65 | |
66 | - // Add viewer library. |
|
67 | - $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_utils.js"></script>'; |
|
66 | + // Add viewer library. |
|
67 | + $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_utils.js"></script>'; |
|
68 | 68 | |
69 | - $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3.js"></script>'; |
|
69 | + $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3.js"></script>'; |
|
70 | 70 | |
71 | - $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3_styles.js"></script>'; |
|
71 | + $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3_styles.js"></script>'; |
|
72 | 72 | |
73 | - $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3_source.js"></script>'; |
|
73 | + $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3_source.js"></script>'; |
|
74 | 74 | |
75 | - $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_altoparser.js"></script>'; |
|
75 | + $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_altoparser.js"></script>'; |
|
76 | 76 | |
77 | - $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview_imagemanipulation_control.js"></script>'; |
|
77 | + $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview_imagemanipulation_control.js"></script>'; |
|
78 | 78 | |
79 | - $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview_fulltext_control.js"></script>'; |
|
79 | + $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview_fulltext_control.js"></script>'; |
|
80 | 80 | |
81 | - $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview.js"></script>'; |
|
81 | + $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview.js"></script>'; |
|
82 | 82 | |
83 | - // Add viewer configuration. |
|
84 | - $output[] = ' |
|
83 | + // Add viewer configuration. |
|
84 | + $output[] = ' |
|
85 | 85 | <script id="tx-dlf-pageview-initViewer" type="text/javascript"> |
86 | 86 | window.onload = function() { |
87 | 87 | if (dlfUtils.exists(dlfViewer)) { |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | } |
97 | 97 | </script>'; |
98 | 98 | |
99 | - return implode("\n", $output); |
|
99 | + return implode("\n", $output); |
|
100 | 100 | |
101 | - } |
|
101 | + } |
|
102 | 102 | |
103 | - /** |
|
103 | + /** |
|
104 | 104 | * Adds pageview interaction (crop, magnifier and rotation) |
105 | 105 | * |
106 | 106 | * @access protected |
@@ -225,183 +225,183 @@ discard block |
||
225 | 225 | |
226 | 226 | /** |
227 | 227 | * Get image's URL and MIME type |
228 | - * |
|
229 | - * @access protected |
|
230 | - * |
|
231 | - * @param integer $page: Page number |
|
232 | - * |
|
233 | - * @return array URL and MIME type of image file |
|
234 | - */ |
|
235 | - protected function getImage($page) { |
|
228 | + * |
|
229 | + * @access protected |
|
230 | + * |
|
231 | + * @param integer $page: Page number |
|
232 | + * |
|
233 | + * @return array URL and MIME type of image file |
|
234 | + */ |
|
235 | + protected function getImage($page) { |
|
236 | 236 | |
237 | - $image = array (); |
|
237 | + $image = array (); |
|
238 | 238 | |
239 | - // Get @USE value of METS fileGrp. |
|
240 | - $fileGrps = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['fileGrps']); |
|
239 | + // Get @USE value of METS fileGrp. |
|
240 | + $fileGrps = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['fileGrps']); |
|
241 | 241 | |
242 | - while ($fileGrp = @array_pop($fileGrps)) { |
|
242 | + while ($fileGrp = @array_pop($fileGrps)) { |
|
243 | 243 | |
244 | - // Get image link. |
|
245 | - if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp])) { |
|
244 | + // Get image link. |
|
245 | + if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp])) { |
|
246 | 246 | |
247 | - $image['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]); |
|
247 | + $image['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]); |
|
248 | 248 | |
249 | - if ($this->conf['useInternalProxy']) { |
|
250 | - // Configure @action URL for form. |
|
251 | - $linkConf = array ( |
|
252 | - 'parameter' => $GLOBALS['TSFE']->id, |
|
253 | - 'additionalParams' => '&eID=tx_dlf_geturl_eid&url='.urlencode($image['url']), |
|
254 | - ); |
|
249 | + if ($this->conf['useInternalProxy']) { |
|
250 | + // Configure @action URL for form. |
|
251 | + $linkConf = array ( |
|
252 | + 'parameter' => $GLOBALS['TSFE']->id, |
|
253 | + 'additionalParams' => '&eID=tx_dlf_geturl_eid&url='.urlencode($image['url']), |
|
254 | + ); |
|
255 | 255 | |
256 | - $image['url'] = $this->cObj->typoLink_URL($linkConf); |
|
257 | - } |
|
256 | + $image['url'] = $this->cObj->typoLink_URL($linkConf); |
|
257 | + } |
|
258 | 258 | |
259 | - $image['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]); |
|
259 | + $image['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]); |
|
260 | 260 | |
261 | - break; |
|
261 | + break; |
|
262 | 262 | |
263 | - } else { |
|
263 | + } else { |
|
264 | 264 | |
265 | - if (TYPO3_DLOG) { |
|
265 | + if (TYPO3_DLOG) { |
|
266 | 266 | |
267 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pageview->getImage('.$page.')] File not found in fileGrp "'.$fileGrp.'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
267 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pageview->getImage('.$page.')] File not found in fileGrp "'.$fileGrp.'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
268 | 268 | |
269 | - } |
|
269 | + } |
|
270 | 270 | |
271 | - } |
|
271 | + } |
|
272 | 272 | |
273 | - } |
|
273 | + } |
|
274 | 274 | |
275 | - return $image; |
|
275 | + return $image; |
|
276 | 276 | |
277 | - } |
|
277 | + } |
|
278 | 278 | |
279 | - /** |
|
280 | - * Get fulltext URL and MIME type |
|
281 | - * |
|
282 | - * @access protected |
|
283 | - * |
|
284 | - * @param integer $page: Page number |
|
285 | - * |
|
286 | - * @return array URL and MIME type of fulltext file |
|
287 | - */ |
|
288 | - protected function getFulltext($page) { |
|
279 | + /** |
|
280 | + * Get fulltext URL and MIME type |
|
281 | + * |
|
282 | + * @access protected |
|
283 | + * |
|
284 | + * @param integer $page: Page number |
|
285 | + * |
|
286 | + * @return array URL and MIME type of fulltext file |
|
287 | + */ |
|
288 | + protected function getFulltext($page) { |
|
289 | 289 | |
290 | - $fulltext = array (); |
|
290 | + $fulltext = array (); |
|
291 | 291 | |
292 | - // Get fulltext link. |
|
293 | - if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']])) { |
|
292 | + // Get fulltext link. |
|
293 | + if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']])) { |
|
294 | 294 | |
295 | - $fulltext['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']]); |
|
295 | + $fulltext['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']]); |
|
296 | 296 | |
297 | - // Configure @action URL for form. |
|
298 | - $linkConf = array ( |
|
299 | - 'parameter' => $GLOBALS['TSFE']->id, |
|
300 | - 'additionalParams' => '&eID=tx_dlf_geturl_eid&url='.urlencode($fulltext['url']), |
|
301 | - ); |
|
297 | + // Configure @action URL for form. |
|
298 | + $linkConf = array ( |
|
299 | + 'parameter' => $GLOBALS['TSFE']->id, |
|
300 | + 'additionalParams' => '&eID=tx_dlf_geturl_eid&url='.urlencode($fulltext['url']), |
|
301 | + ); |
|
302 | 302 | |
303 | - $fulltext['url'] = $this->cObj->typoLink_URL($linkConf); |
|
303 | + $fulltext['url'] = $this->cObj->typoLink_URL($linkConf); |
|
304 | 304 | |
305 | - $fulltext['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']]); |
|
305 | + $fulltext['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']]); |
|
306 | 306 | |
307 | - } else { |
|
307 | + } else { |
|
308 | 308 | |
309 | - if (TYPO3_DLOG) { |
|
309 | + if (TYPO3_DLOG) { |
|
310 | 310 | |
311 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pageview->getFulltext('.$page.')] File not found in fileGrp "'.$this->conf['fileGrpFulltext'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
311 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pageview->getFulltext('.$page.')] File not found in fileGrp "'.$this->conf['fileGrpFulltext'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
312 | 312 | |
313 | - } |
|
313 | + } |
|
314 | 314 | |
315 | - } |
|
315 | + } |
|
316 | 316 | |
317 | - return $fulltext; |
|
317 | + return $fulltext; |
|
318 | 318 | |
319 | - } |
|
319 | + } |
|
320 | 320 | |
321 | - /** |
|
322 | - * The main method of the PlugIn |
|
323 | - * |
|
324 | - * @access public |
|
325 | - * |
|
326 | - * @param string $content: The PlugIn content |
|
327 | - * @param array $conf: The PlugIn configuration |
|
328 | - * |
|
329 | - * @return string The content that is displayed on the website |
|
330 | - */ |
|
331 | - public function main($content, $conf) { |
|
321 | + /** |
|
322 | + * The main method of the PlugIn |
|
323 | + * |
|
324 | + * @access public |
|
325 | + * |
|
326 | + * @param string $content: The PlugIn content |
|
327 | + * @param array $conf: The PlugIn configuration |
|
328 | + * |
|
329 | + * @return string The content that is displayed on the website |
|
330 | + */ |
|
331 | + public function main($content, $conf) { |
|
332 | 332 | |
333 | - $this->init($conf); |
|
333 | + $this->init($conf); |
|
334 | 334 | |
335 | - // Load current document. |
|
336 | - $this->loadDocument(); |
|
335 | + // Load current document. |
|
336 | + $this->loadDocument(); |
|
337 | 337 | |
338 | - if ($this->doc === NULL || $this->doc->numPages < 1) { |
|
338 | + if ($this->doc === NULL || $this->doc->numPages < 1) { |
|
339 | 339 | |
340 | - // Quit without doing anything if required variables are not set. |
|
341 | - return $content; |
|
340 | + // Quit without doing anything if required variables are not set. |
|
341 | + return $content; |
|
342 | 342 | |
343 | - } else { |
|
343 | + } else { |
|
344 | 344 | |
345 | - if (!empty($this->piVars['logicalPage'])) { |
|
345 | + if (!empty($this->piVars['logicalPage'])) { |
|
346 | 346 | |
347 | - $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); |
|
348 | - // The logical page parameter should not appear again |
|
349 | - unset($this->piVars['logicalPage']); |
|
347 | + $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); |
|
348 | + // The logical page parameter should not appear again |
|
349 | + unset($this->piVars['logicalPage']); |
|
350 | 350 | |
351 | - } |
|
351 | + } |
|
352 | 352 | |
353 | - // Set default values if not set. |
|
354 | - // $this->piVars['page'] may be integer or string (physical structure @ID) |
|
355 | - if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
353 | + // Set default values if not set. |
|
354 | + // $this->piVars['page'] may be integer or string (physical structure @ID) |
|
355 | + if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
356 | 356 | |
357 | - $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
357 | + $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
358 | 358 | |
359 | - } else { |
|
359 | + } else { |
|
360 | 360 | |
361 | - $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); |
|
361 | + $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); |
|
362 | 362 | |
363 | - } |
|
363 | + } |
|
364 | 364 | |
365 | - $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); |
|
365 | + $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); |
|
366 | 366 | |
367 | - } |
|
367 | + } |
|
368 | 368 | |
369 | - // Load template file. |
|
370 | - if (!empty($this->conf['templateFile'])) { |
|
369 | + // Load template file. |
|
370 | + if (!empty($this->conf['templateFile'])) { |
|
371 | 371 | |
372 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
372 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
373 | 373 | |
374 | - } else { |
|
374 | + } else { |
|
375 | 375 | |
376 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/pageview/template.tmpl'), '###TEMPLATE###'); |
|
376 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/pageview/template.tmpl'), '###TEMPLATE###'); |
|
377 | 377 | |
378 | - } |
|
378 | + } |
|
379 | 379 | |
380 | - // Get image data. |
|
381 | - $this->images[0] = $this->getImage($this->piVars['page']); |
|
382 | - $this->fulltexts[0] = $this->getFulltext($this->piVars['page']); |
|
380 | + // Get image data. |
|
381 | + $this->images[0] = $this->getImage($this->piVars['page']); |
|
382 | + $this->fulltexts[0] = $this->getFulltext($this->piVars['page']); |
|
383 | 383 | |
384 | - if ($this->piVars['double'] && $this->piVars['page'] < $this->doc->numPages) { |
|
384 | + if ($this->piVars['double'] && $this->piVars['page'] < $this->doc->numPages) { |
|
385 | 385 | |
386 | - $this->images[1] = $this->getImage($this->piVars['page'] + 1); |
|
387 | - $this->fulltexts[1] = $this->getFulltext($this->piVars['page'] + 1); |
|
386 | + $this->images[1] = $this->getImage($this->piVars['page'] + 1); |
|
387 | + $this->fulltexts[1] = $this->getFulltext($this->piVars['page'] + 1); |
|
388 | 388 | |
389 | - } |
|
389 | + } |
|
390 | 390 | |
391 | - // Get the controls for the map. |
|
392 | - $this->controls = explode(',', $this->conf['features']); |
|
391 | + // Get the controls for the map. |
|
392 | + $this->controls = explode(',', $this->conf['features']); |
|
393 | 393 | |
394 | - // Fill in the template markers. |
|
395 | - $markerArray = array ( |
|
396 | - '###VIEWER_JS###' => $this->addViewerJS() |
|
397 | - ); |
|
394 | + // Fill in the template markers. |
|
395 | + $markerArray = array ( |
|
396 | + '###VIEWER_JS###' => $this->addViewerJS() |
|
397 | + ); |
|
398 | 398 | |
399 | - $markerArray = array_merge($markerArray, $this->addInteraction(), $this->addBasketForm()); |
|
399 | + $markerArray = array_merge($markerArray, $this->addInteraction(), $this->addBasketForm()); |
|
400 | 400 | |
401 | 401 | $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); |
402 | 402 | |
403 | - return $this->pi_wrapInBaseClass($content); |
|
403 | + return $this->pi_wrapInBaseClass($content); |
|
404 | 404 | |
405 | - } |
|
405 | + } |
|
406 | 406 | |
407 | 407 | } |
@@ -20,271 +20,271 @@ |
||
20 | 20 | */ |
21 | 21 | class tx_dlf_pagegrid extends tx_dlf_plugin { |
22 | 22 | |
23 | - public $scriptRelPath = 'plugins/pagegrid/class.tx_dlf_pagegrid.php'; |
|
23 | + public $scriptRelPath = 'plugins/pagegrid/class.tx_dlf_pagegrid.php'; |
|
24 | 24 | |
25 | - /** |
|
26 | - * Renders entry for one page of the current document. |
|
27 | - * |
|
28 | - * @access protected |
|
29 | - * |
|
30 | - * @param integer $number: The page to render |
|
31 | - * @param string $template: Parsed template subpart |
|
32 | - * |
|
33 | - * @return string The rendered entry ready for output |
|
34 | - */ |
|
35 | - protected function getEntry($number, $template) { |
|
25 | + /** |
|
26 | + * Renders entry for one page of the current document. |
|
27 | + * |
|
28 | + * @access protected |
|
29 | + * |
|
30 | + * @param integer $number: The page to render |
|
31 | + * @param string $template: Parsed template subpart |
|
32 | + * |
|
33 | + * @return string The rendered entry ready for output |
|
34 | + */ |
|
35 | + protected function getEntry($number, $template) { |
|
36 | 36 | |
37 | - // Set current page if applicable. |
|
38 | - if (!empty($this->piVars['page']) && $this->piVars['page'] == $number) { |
|
37 | + // Set current page if applicable. |
|
38 | + if (!empty($this->piVars['page']) && $this->piVars['page'] == $number) { |
|
39 | 39 | |
40 | - $markerArray['###STATE###'] = 'cur'; |
|
40 | + $markerArray['###STATE###'] = 'cur'; |
|
41 | 41 | |
42 | - } else { |
|
42 | + } else { |
|
43 | 43 | |
44 | - $markerArray['###STATE###'] = 'no'; |
|
44 | + $markerArray['###STATE###'] = 'no'; |
|
45 | 45 | |
46 | - } |
|
46 | + } |
|
47 | 47 | |
48 | - // Set page number. |
|
49 | - $markerArray['###NUMBER###'] = $number; |
|
48 | + // Set page number. |
|
49 | + $markerArray['###NUMBER###'] = $number; |
|
50 | 50 | |
51 | - // Set pagination. |
|
52 | - $markerArray['###PAGINATION###'] = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$number]]['orderlabel']; |
|
51 | + // Set pagination. |
|
52 | + $markerArray['###PAGINATION###'] = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$number]]['orderlabel']; |
|
53 | 53 | |
54 | - // Get thumbnail or placeholder. |
|
55 | - if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$number]]['files'][$this->conf['fileGrpThumbs']])) { |
|
54 | + // Get thumbnail or placeholder. |
|
55 | + if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$number]]['files'][$this->conf['fileGrpThumbs']])) { |
|
56 | 56 | |
57 | - $thumbnailFile = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$number]]['files'][$this->conf['fileGrpThumbs']]); |
|
57 | + $thumbnailFile = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$number]]['files'][$this->conf['fileGrpThumbs']]); |
|
58 | 58 | |
59 | - } elseif (!empty($this->conf['placeholder'])) { |
|
59 | + } elseif (!empty($this->conf['placeholder'])) { |
|
60 | 60 | |
61 | - $thumbnailFile = $GLOBALS['TSFE']->tmpl->getFileName($this->conf['placeholder']); |
|
61 | + $thumbnailFile = $GLOBALS['TSFE']->tmpl->getFileName($this->conf['placeholder']); |
|
62 | 62 | |
63 | - } else { |
|
63 | + } else { |
|
64 | 64 | |
65 | - $thumbnailFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pagegrid/placeholder.jpg'; |
|
65 | + $thumbnailFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pagegrid/placeholder.jpg'; |
|
66 | 66 | |
67 | - } |
|
67 | + } |
|
68 | 68 | |
69 | - $thumbnail = '<img alt="'.$markerArray['###PAGINATION###'].'" src="'.$thumbnailFile.'" />'; |
|
69 | + $thumbnail = '<img alt="'.$markerArray['###PAGINATION###'].'" src="'.$thumbnailFile.'" />'; |
|
70 | 70 | |
71 | - // Get new plugin variables for typolink. |
|
72 | - $piVars = $this->piVars; |
|
71 | + // Get new plugin variables for typolink. |
|
72 | + $piVars = $this->piVars; |
|
73 | 73 | |
74 | - // Unset no longer needed plugin variables. |
|
75 | - // unset($piVars['pagegrid']) is for DFG Viewer compatibility! |
|
76 | - unset($piVars['pointer'], $piVars['DATA'], $piVars['pagegrid']); |
|
74 | + // Unset no longer needed plugin variables. |
|
75 | + // unset($piVars['pagegrid']) is for DFG Viewer compatibility! |
|
76 | + unset($piVars['pointer'], $piVars['DATA'], $piVars['pagegrid']); |
|
77 | 77 | |
78 | - $piVars['page'] = $number; |
|
78 | + $piVars['page'] = $number; |
|
79 | 79 | |
80 | - $linkConf = array ( |
|
81 | - 'useCacheHash' => 1, |
|
82 | - 'parameter' => $this->conf['targetPid'], |
|
83 | - 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $piVars, '', TRUE, FALSE), |
|
84 | - 'title' => $markerArray['###PAGINATION###'] |
|
85 | - ); |
|
80 | + $linkConf = array ( |
|
81 | + 'useCacheHash' => 1, |
|
82 | + 'parameter' => $this->conf['targetPid'], |
|
83 | + 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $piVars, '', TRUE, FALSE), |
|
84 | + 'title' => $markerArray['###PAGINATION###'] |
|
85 | + ); |
|
86 | 86 | |
87 | - $markerArray['###THUMBNAIL###'] = $this->cObj->typoLink($thumbnail, $linkConf); |
|
87 | + $markerArray['###THUMBNAIL###'] = $this->cObj->typoLink($thumbnail, $linkConf); |
|
88 | 88 | |
89 | - return $this->cObj->substituteMarkerArray($template, $markerArray); |
|
89 | + return $this->cObj->substituteMarkerArray($template, $markerArray); |
|
90 | 90 | |
91 | - } |
|
91 | + } |
|
92 | 92 | |
93 | - /** |
|
94 | - * Renders the page browser |
|
95 | - * |
|
96 | - * @access protected |
|
97 | - * |
|
98 | - * @return string The rendered page browser ready for output |
|
99 | - */ |
|
100 | - protected function getPageBrowser() { |
|
93 | + /** |
|
94 | + * Renders the page browser |
|
95 | + * |
|
96 | + * @access protected |
|
97 | + * |
|
98 | + * @return string The rendered page browser ready for output |
|
99 | + */ |
|
100 | + protected function getPageBrowser() { |
|
101 | 101 | |
102 | - // Get overall number of pages. |
|
103 | - $maxPages = intval(ceil($this->doc->numPages / $this->conf['limit'])); |
|
102 | + // Get overall number of pages. |
|
103 | + $maxPages = intval(ceil($this->doc->numPages / $this->conf['limit'])); |
|
104 | 104 | |
105 | - // Return empty pagebrowser if there is just one page. |
|
106 | - if ($maxPages < 2) { |
|
105 | + // Return empty pagebrowser if there is just one page. |
|
106 | + if ($maxPages < 2) { |
|
107 | 107 | |
108 | - return ''; |
|
108 | + return ''; |
|
109 | 109 | |
110 | - } |
|
110 | + } |
|
111 | 111 | |
112 | - // Get separator. |
|
113 | - $separator = $this->pi_getLL('separator', ' - ', TRUE); |
|
112 | + // Get separator. |
|
113 | + $separator = $this->pi_getLL('separator', ' - ', TRUE); |
|
114 | 114 | |
115 | - // Add link to previous page. |
|
116 | - if ($this->piVars['pointer'] > 0) { |
|
115 | + // Add link to previous page. |
|
116 | + if ($this->piVars['pointer'] > 0) { |
|
117 | 117 | |
118 | - $output = $this->pi_linkTP_keepPIvars($this->pi_getLL('prevPage', '<', TRUE), array ('pointer' => $this->piVars['pointer'] - 1, 'page' => (($this->piVars['pointer'] - 1) * $this->conf['limit']) + 1), TRUE).$separator; |
|
118 | + $output = $this->pi_linkTP_keepPIvars($this->pi_getLL('prevPage', '<', TRUE), array ('pointer' => $this->piVars['pointer'] - 1, 'page' => (($this->piVars['pointer'] - 1) * $this->conf['limit']) + 1), TRUE).$separator; |
|
119 | 119 | |
120 | - } else { |
|
120 | + } else { |
|
121 | 121 | |
122 | - $output = $this->pi_getLL('prevPage', '<', TRUE).$separator; |
|
122 | + $output = $this->pi_getLL('prevPage', '<', TRUE).$separator; |
|
123 | 123 | |
124 | - } |
|
124 | + } |
|
125 | 125 | |
126 | - $i = 0; |
|
126 | + $i = 0; |
|
127 | 127 | |
128 | - // Add links to pages. |
|
129 | - while ($i < $maxPages) { |
|
128 | + // Add links to pages. |
|
129 | + while ($i < $maxPages) { |
|
130 | 130 | |
131 | - if ($i < 3 || ($i > $this->piVars['pointer'] - 3 && $i < $this->piVars['pointer'] + 3) || $i > $maxPages - 4) { |
|
131 | + if ($i < 3 || ($i > $this->piVars['pointer'] - 3 && $i < $this->piVars['pointer'] + 3) || $i > $maxPages - 4) { |
|
132 | 132 | |
133 | - if ($this->piVars['pointer'] != $i) { |
|
133 | + if ($this->piVars['pointer'] != $i) { |
|
134 | 134 | |
135 | - $output .= $this->pi_linkTP_keepPIvars(sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1), array ('pointer' => $i, 'page' => ($i * $this->conf['limit']) + 1), TRUE).$separator; |
|
135 | + $output .= $this->pi_linkTP_keepPIvars(sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1), array ('pointer' => $i, 'page' => ($i * $this->conf['limit']) + 1), TRUE).$separator; |
|
136 | 136 | |
137 | - } else { |
|
137 | + } else { |
|
138 | 138 | |
139 | - $output .= sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1).$separator; |
|
139 | + $output .= sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1).$separator; |
|
140 | 140 | |
141 | - } |
|
141 | + } |
|
142 | 142 | |
143 | - $skip = TRUE; |
|
143 | + $skip = TRUE; |
|
144 | 144 | |
145 | - } elseif ($skip == TRUE) { |
|
145 | + } elseif ($skip == TRUE) { |
|
146 | 146 | |
147 | - $output .= $this->pi_getLL('skip', '...', TRUE).$separator; |
|
147 | + $output .= $this->pi_getLL('skip', '...', TRUE).$separator; |
|
148 | 148 | |
149 | - $skip = FALSE; |
|
149 | + $skip = FALSE; |
|
150 | 150 | |
151 | - } |
|
151 | + } |
|
152 | 152 | |
153 | - $i++; |
|
153 | + $i++; |
|
154 | 154 | |
155 | - } |
|
155 | + } |
|
156 | 156 | |
157 | - // Add link to next page. |
|
158 | - if ($this->piVars['pointer'] < $maxPages - 1) { |
|
157 | + // Add link to next page. |
|
158 | + if ($this->piVars['pointer'] < $maxPages - 1) { |
|
159 | 159 | |
160 | - $output .= $this->pi_linkTP_keepPIvars($this->pi_getLL('nextPage', '>', TRUE), array ('pointer' => $this->piVars['pointer'] + 1, 'page' => ($this->piVars['pointer'] + 1) * $this->conf['limit'] + 1), TRUE); |
|
160 | + $output .= $this->pi_linkTP_keepPIvars($this->pi_getLL('nextPage', '>', TRUE), array ('pointer' => $this->piVars['pointer'] + 1, 'page' => ($this->piVars['pointer'] + 1) * $this->conf['limit'] + 1), TRUE); |
|
161 | 161 | |
162 | - } else { |
|
162 | + } else { |
|
163 | 163 | |
164 | - $output .= $this->pi_getLL('nextPage', '>', TRUE); |
|
164 | + $output .= $this->pi_getLL('nextPage', '>', TRUE); |
|
165 | 165 | |
166 | - } |
|
166 | + } |
|
167 | 167 | |
168 | - return $output; |
|
168 | + return $output; |
|
169 | 169 | |
170 | - } |
|
170 | + } |
|
171 | 171 | |
172 | - /** |
|
173 | - * The main method of the PlugIn |
|
174 | - * |
|
175 | - * @access public |
|
176 | - * |
|
177 | - * @param string $content: The PlugIn content |
|
178 | - * @param array $conf: The PlugIn configuration |
|
179 | - * |
|
180 | - * @return string The content that is displayed on the website |
|
181 | - */ |
|
182 | - public function main($content, $conf) { |
|
172 | + /** |
|
173 | + * The main method of the PlugIn |
|
174 | + * |
|
175 | + * @access public |
|
176 | + * |
|
177 | + * @param string $content: The PlugIn content |
|
178 | + * @param array $conf: The PlugIn configuration |
|
179 | + * |
|
180 | + * @return string The content that is displayed on the website |
|
181 | + */ |
|
182 | + public function main($content, $conf) { |
|
183 | 183 | |
184 | - $this->init($conf); |
|
184 | + $this->init($conf); |
|
185 | 185 | |
186 | - $this->loadDocument(); |
|
186 | + $this->loadDocument(); |
|
187 | 187 | |
188 | - if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpThumbs'])) { |
|
188 | + if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpThumbs'])) { |
|
189 | 189 | |
190 | - // Quit without doing anything if required variables are not set. |
|
191 | - return $content; |
|
190 | + // Quit without doing anything if required variables are not set. |
|
191 | + return $content; |
|
192 | 192 | |
193 | - } else { |
|
193 | + } else { |
|
194 | 194 | |
195 | - // Set default values for page if not set. |
|
196 | - $this->piVars['pointer'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['pointer'], 0, $this->doc->numPages, 0); |
|
195 | + // Set default values for page if not set. |
|
196 | + $this->piVars['pointer'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['pointer'], 0, $this->doc->numPages, 0); |
|
197 | 197 | |
198 | - } |
|
198 | + } |
|
199 | 199 | |
200 | - // Load template file. |
|
201 | - if (!empty($this->conf['templateFile'])) { |
|
200 | + // Load template file. |
|
201 | + if (!empty($this->conf['templateFile'])) { |
|
202 | 202 | |
203 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
203 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
204 | 204 | |
205 | - } else { |
|
205 | + } else { |
|
206 | 206 | |
207 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/pagegrid/template.tmpl'), '###TEMPLATE###'); |
|
207 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/pagegrid/template.tmpl'), '###TEMPLATE###'); |
|
208 | 208 | |
209 | - } |
|
209 | + } |
|
210 | 210 | |
211 | - $entryTemplate = $this->cObj->getSubpart($this->template, '###ENTRY###'); |
|
211 | + $entryTemplate = $this->cObj->getSubpart($this->template, '###ENTRY###'); |
|
212 | 212 | |
213 | - if (empty($entryTemplate)) { |
|
213 | + if (empty($entryTemplate)) { |
|
214 | 214 | |
215 | - if (TYPO3_DLOG) { |
|
215 | + if (TYPO3_DLOG) { |
|
216 | 216 | |
217 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pagegrid->main('.$content.', [data])] No template subpart for list entry found', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); |
|
217 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pagegrid->main('.$content.', [data])] No template subpart for list entry found', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); |
|
218 | 218 | |
219 | - } |
|
219 | + } |
|
220 | 220 | |
221 | - // Quit without doing anything if required variables are not set. |
|
222 | - return $content; |
|
221 | + // Quit without doing anything if required variables are not set. |
|
222 | + return $content; |
|
223 | 223 | |
224 | - } |
|
224 | + } |
|
225 | 225 | |
226 | - if (!empty($this->piVars['logicalPage'])) { |
|
226 | + if (!empty($this->piVars['logicalPage'])) { |
|
227 | 227 | |
228 | - $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); |
|
229 | - // The logical page parameter should not appear |
|
230 | - unset($this->piVars['logicalPage']); |
|
228 | + $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); |
|
229 | + // The logical page parameter should not appear |
|
230 | + unset($this->piVars['logicalPage']); |
|
231 | 231 | |
232 | - } |
|
232 | + } |
|
233 | 233 | |
234 | - // Set some variable defaults. |
|
235 | - // $this->piVars['page'] may be integer or string (physical structure @ID) |
|
236 | - if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
234 | + // Set some variable defaults. |
|
235 | + // $this->piVars['page'] may be integer or string (physical structure @ID) |
|
236 | + if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
237 | 237 | |
238 | - $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
238 | + $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
239 | 239 | |
240 | - } else { |
|
240 | + } else { |
|
241 | 241 | |
242 | - $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); |
|
242 | + $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); |
|
243 | 243 | |
244 | - } |
|
244 | + } |
|
245 | 245 | |
246 | - if (!empty($this->piVars['page'])) { |
|
246 | + if (!empty($this->piVars['page'])) { |
|
247 | 247 | |
248 | - $this->piVars['pointer'] = intval(floor(($this->piVars['page'] - 1) / $this->conf['limit'])); |
|
248 | + $this->piVars['pointer'] = intval(floor(($this->piVars['page'] - 1) / $this->conf['limit'])); |
|
249 | 249 | |
250 | - } |
|
250 | + } |
|
251 | 251 | |
252 | - if (!empty($this->piVars['pointer']) && (($this->piVars['pointer'] * $this->conf['limit']) + 1) <= $this->doc->numPages) { |
|
252 | + if (!empty($this->piVars['pointer']) && (($this->piVars['pointer'] * $this->conf['limit']) + 1) <= $this->doc->numPages) { |
|
253 | 253 | |
254 | - $this->piVars['pointer'] = max(intval($this->piVars['pointer']), 0); |
|
254 | + $this->piVars['pointer'] = max(intval($this->piVars['pointer']), 0); |
|
255 | 255 | |
256 | - } else { |
|
256 | + } else { |
|
257 | 257 | |
258 | - $this->piVars['pointer'] = 0; |
|
258 | + $this->piVars['pointer'] = 0; |
|
259 | 259 | |
260 | - } |
|
260 | + } |
|
261 | 261 | |
262 | - // Iterate through visible page set and display thumbnails. |
|
263 | - for ($i = $this->piVars['pointer'] * $this->conf['limit'], $j = ($this->piVars['pointer'] + 1) * $this->conf['limit']; $i < $j; $i++) { |
|
262 | + // Iterate through visible page set and display thumbnails. |
|
263 | + for ($i = $this->piVars['pointer'] * $this->conf['limit'], $j = ($this->piVars['pointer'] + 1) * $this->conf['limit']; $i < $j; $i++) { |
|
264 | 264 | |
265 | - // +1 because page counting starts at 1. |
|
266 | - $number = $i + 1; |
|
265 | + // +1 because page counting starts at 1. |
|
266 | + $number = $i + 1; |
|
267 | 267 | |
268 | - if ($number > $this->doc->numPages) { |
|
268 | + if ($number > $this->doc->numPages) { |
|
269 | 269 | |
270 | - break; |
|
270 | + break; |
|
271 | 271 | |
272 | - } else { |
|
272 | + } else { |
|
273 | 273 | |
274 | - $content .= $this->getEntry($number, $entryTemplate); |
|
274 | + $content .= $this->getEntry($number, $entryTemplate); |
|
275 | 275 | |
276 | - } |
|
276 | + } |
|
277 | 277 | |
278 | - } |
|
278 | + } |
|
279 | 279 | |
280 | - // Render page browser. |
|
281 | - $markerArray['###PAGEBROWSER###'] = $this->getPageBrowser(); |
|
280 | + // Render page browser. |
|
281 | + $markerArray['###PAGEBROWSER###'] = $this->getPageBrowser(); |
|
282 | 282 | |
283 | - // Merge everything with template. |
|
284 | - $content = $this->cObj->substituteMarkerArray($this->cObj->substituteSubpart($this->template, '###ENTRY###', $content, TRUE), $markerArray); |
|
283 | + // Merge everything with template. |
|
284 | + $content = $this->cObj->substituteMarkerArray($this->cObj->substituteSubpart($this->template, '###ENTRY###', $content, TRUE), $markerArray); |
|
285 | 285 | |
286 | - return $this->pi_wrapInBaseClass($content); |
|
286 | + return $this->pi_wrapInBaseClass($content); |
|
287 | 287 | |
288 | - } |
|
288 | + } |
|
289 | 289 | |
290 | 290 | } |
@@ -20,182 +20,182 @@ |
||
20 | 20 | */ |
21 | 21 | class tx_dlf_toolsPdf extends tx_dlf_plugin { |
22 | 22 | |
23 | - public $scriptRelPath = 'plugins/toolbox/tools/pdf/class.tx_dlf_toolsPdf.php'; |
|
23 | + public $scriptRelPath = 'plugins/toolbox/tools/pdf/class.tx_dlf_toolsPdf.php'; |
|
24 | 24 | |
25 | - /** |
|
26 | - * The main method of the PlugIn |
|
27 | - * |
|
28 | - * @access public |
|
29 | - * |
|
30 | - * @param string $content: The PlugIn content |
|
31 | - * @param array $conf: The PlugIn configuration |
|
32 | - * |
|
33 | - * @return string The content that is displayed on the website |
|
34 | - */ |
|
35 | - public function main($content, $conf) { |
|
25 | + /** |
|
26 | + * The main method of the PlugIn |
|
27 | + * |
|
28 | + * @access public |
|
29 | + * |
|
30 | + * @param string $content: The PlugIn content |
|
31 | + * @param array $conf: The PlugIn configuration |
|
32 | + * |
|
33 | + * @return string The content that is displayed on the website |
|
34 | + */ |
|
35 | + public function main($content, $conf) { |
|
36 | 36 | |
37 | - $this->init($conf); |
|
37 | + $this->init($conf); |
|
38 | 38 | |
39 | - // Merge configuration with conf array of toolbox. |
|
40 | - $this->conf = tx_dlf_helper::array_merge_recursive_overrule($this->cObj->data['conf'], $this->conf); |
|
39 | + // Merge configuration with conf array of toolbox. |
|
40 | + $this->conf = tx_dlf_helper::array_merge_recursive_overrule($this->cObj->data['conf'], $this->conf); |
|
41 | 41 | |
42 | - // Load current document. |
|
43 | - $this->loadDocument(); |
|
42 | + // Load current document. |
|
43 | + $this->loadDocument(); |
|
44 | 44 | |
45 | - if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpDownload'])) { |
|
45 | + if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpDownload'])) { |
|
46 | 46 | |
47 | - // Quit without doing anything if required variables are not set. |
|
48 | - return $content; |
|
47 | + // Quit without doing anything if required variables are not set. |
|
48 | + return $content; |
|
49 | 49 | |
50 | - } else { |
|
50 | + } else { |
|
51 | 51 | |
52 | - if (!empty($this->piVars['logicalPage'])) { |
|
52 | + if (!empty($this->piVars['logicalPage'])) { |
|
53 | 53 | |
54 | - $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); |
|
55 | - // The logical page parameter should not appear again |
|
56 | - unset($this->piVars['logicalPage']); |
|
54 | + $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); |
|
55 | + // The logical page parameter should not appear again |
|
56 | + unset($this->piVars['logicalPage']); |
|
57 | 57 | |
58 | - } |
|
58 | + } |
|
59 | 59 | |
60 | - // Set default values if not set. |
|
61 | - // $this->piVars['page'] may be integer or string (physical structure @ID) |
|
62 | - if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
60 | + // Set default values if not set. |
|
61 | + // $this->piVars['page'] may be integer or string (physical structure @ID) |
|
62 | + if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
63 | 63 | |
64 | - $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
64 | + $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
65 | 65 | |
66 | - } else { |
|
66 | + } else { |
|
67 | 67 | |
68 | - $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); |
|
68 | + $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); |
|
69 | 69 | |
70 | - } |
|
70 | + } |
|
71 | 71 | |
72 | - $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); |
|
72 | + $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); |
|
73 | 73 | |
74 | - } |
|
74 | + } |
|
75 | 75 | |
76 | - // Load template file. |
|
77 | - if (!empty($this->conf['toolTemplateFile'])) { |
|
76 | + // Load template file. |
|
77 | + if (!empty($this->conf['toolTemplateFile'])) { |
|
78 | 78 | |
79 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###'); |
|
79 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###'); |
|
80 | 80 | |
81 | - } else { |
|
81 | + } else { |
|
82 | 82 | |
83 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/pdf/template.tmpl'), '###TEMPLATE###'); |
|
83 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/pdf/template.tmpl'), '###TEMPLATE###'); |
|
84 | 84 | |
85 | - } |
|
85 | + } |
|
86 | 86 | |
87 | - // Get single page downloads. |
|
88 | - $markerArray['###PAGE###'] = $this->getPageLink(); |
|
87 | + // Get single page downloads. |
|
88 | + $markerArray['###PAGE###'] = $this->getPageLink(); |
|
89 | 89 | |
90 | - // Get work download. |
|
91 | - $markerArray['###WORK###'] = $this->getWorkLink(); |
|
90 | + // Get work download. |
|
91 | + $markerArray['###WORK###'] = $this->getWorkLink(); |
|
92 | 92 | |
93 | - $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
93 | + $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
94 | 94 | |
95 | - return $this->pi_wrapInBaseClass($content); |
|
95 | + return $this->pi_wrapInBaseClass($content); |
|
96 | 96 | |
97 | - } |
|
97 | + } |
|
98 | 98 | |
99 | - /** |
|
100 | - * Get page's download link |
|
101 | - * |
|
102 | - * @access protected |
|
103 | - * |
|
104 | - * @return string Link to downloadable page |
|
105 | - */ |
|
106 | - protected function getPageLink() { |
|
99 | + /** |
|
100 | + * Get page's download link |
|
101 | + * |
|
102 | + * @access protected |
|
103 | + * |
|
104 | + * @return string Link to downloadable page |
|
105 | + */ |
|
106 | + protected function getPageLink() { |
|
107 | 107 | |
108 | - $page1Link = ''; |
|
109 | - $page2Link = ''; |
|
110 | - $pageNumber = $this->piVars['page']; |
|
108 | + $page1Link = ''; |
|
109 | + $page2Link = ''; |
|
110 | + $pageNumber = $this->piVars['page']; |
|
111 | 111 | |
112 | - // Get image link. |
|
113 | - $details = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$pageNumber]]; |
|
114 | - $file = $details['files'][$this->conf['fileGrpDownload']]; |
|
115 | - if (!empty($file)) { |
|
116 | - $page1Link = $this->doc->getFileLocation($file); |
|
117 | - } |
|
112 | + // Get image link. |
|
113 | + $details = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$pageNumber]]; |
|
114 | + $file = $details['files'][$this->conf['fileGrpDownload']]; |
|
115 | + if (!empty($file)) { |
|
116 | + $page1Link = $this->doc->getFileLocation($file); |
|
117 | + } |
|
118 | 118 | |
119 | - // Get second page, too, if double page view is activated. |
|
120 | - if ($this->piVars['double'] && $pageNumber < $this->doc->numPages) { |
|
121 | - $details = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$pageNumber + 1]]; |
|
122 | - $file = $details['files'][$this->conf['fileGrpDownload']]; |
|
123 | - if (!empty($file)) { |
|
124 | - $page2Link = $this->doc->getFileLocation($file); |
|
125 | - } |
|
126 | - } |
|
119 | + // Get second page, too, if double page view is activated. |
|
120 | + if ($this->piVars['double'] && $pageNumber < $this->doc->numPages) { |
|
121 | + $details = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$pageNumber + 1]]; |
|
122 | + $file = $details['files'][$this->conf['fileGrpDownload']]; |
|
123 | + if (!empty($file)) { |
|
124 | + $page2Link = $this->doc->getFileLocation($file); |
|
125 | + } |
|
126 | + } |
|
127 | 127 | |
128 | - if (TYPO3_DLOG && empty($page1Link) && empty($page2Link)) { |
|
129 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsPdf->getPageLink()] ' . |
|
130 | - 'File not found in fileGrp "' . |
|
131 | - $this->conf['fileGrpDownload'] . '"', |
|
132 | - $this->extKey, |
|
133 | - SYSLOG_SEVERITY_WARNING); |
|
134 | - } |
|
128 | + if (TYPO3_DLOG && empty($page1Link) && empty($page2Link)) { |
|
129 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsPdf->getPageLink()] ' . |
|
130 | + 'File not found in fileGrp "' . |
|
131 | + $this->conf['fileGrpDownload'] . '"', |
|
132 | + $this->extKey, |
|
133 | + SYSLOG_SEVERITY_WARNING); |
|
134 | + } |
|
135 | 135 | |
136 | - // Wrap URLs with HTML. |
|
137 | - if (!empty($page1Link)) { |
|
138 | - if ($this->piVars['double']) { |
|
139 | - $page1Link = $this->cObj->typoLink($this->pi_getLL('leftPage', ''), |
|
140 | - array('parameter' => $page1Link, 'title' => $this->pi_getLL('leftPage', ''))); |
|
141 | - } else { |
|
142 | - $page1Link = $this->cObj->typoLink($this->pi_getLL('singlePage', ''), |
|
143 | - array('parameter' => $page1Link, 'title' => $this->pi_getLL('singlePage', ''))); |
|
144 | - } |
|
145 | - } |
|
146 | - if (!empty($page2Link)) { |
|
147 | - $page2Link = $this->cObj->typoLink($this->pi_getLL('rightPage', ''), |
|
148 | - array('parameter' => $page2Link, 'title' => $this->pi_getLL('rightPage', ''))); |
|
149 | - } |
|
136 | + // Wrap URLs with HTML. |
|
137 | + if (!empty($page1Link)) { |
|
138 | + if ($this->piVars['double']) { |
|
139 | + $page1Link = $this->cObj->typoLink($this->pi_getLL('leftPage', ''), |
|
140 | + array('parameter' => $page1Link, 'title' => $this->pi_getLL('leftPage', ''))); |
|
141 | + } else { |
|
142 | + $page1Link = $this->cObj->typoLink($this->pi_getLL('singlePage', ''), |
|
143 | + array('parameter' => $page1Link, 'title' => $this->pi_getLL('singlePage', ''))); |
|
144 | + } |
|
145 | + } |
|
146 | + if (!empty($page2Link)) { |
|
147 | + $page2Link = $this->cObj->typoLink($this->pi_getLL('rightPage', ''), |
|
148 | + array('parameter' => $page2Link, 'title' => $this->pi_getLL('rightPage', ''))); |
|
149 | + } |
|
150 | 150 | |
151 | - return $page1Link . $page2Link; |
|
152 | - } |
|
151 | + return $page1Link . $page2Link; |
|
152 | + } |
|
153 | 153 | |
154 | - /** |
|
155 | - * Get work's download link |
|
156 | - * |
|
157 | - * @access protected |
|
158 | - * |
|
159 | - * @return string Link to downloadable work |
|
160 | - */ |
|
161 | - protected function getWorkLink() { |
|
154 | + /** |
|
155 | + * Get work's download link |
|
156 | + * |
|
157 | + * @access protected |
|
158 | + * |
|
159 | + * @return string Link to downloadable work |
|
160 | + */ |
|
161 | + protected function getWorkLink() { |
|
162 | 162 | |
163 | - $workLink = ''; |
|
163 | + $workLink = ''; |
|
164 | 164 | |
165 | - // Get work link. |
|
166 | - if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[0]]['files'][$this->conf['fileGrpDownload']])) { |
|
165 | + // Get work link. |
|
166 | + if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[0]]['files'][$this->conf['fileGrpDownload']])) { |
|
167 | 167 | |
168 | - $workLink = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[0]]['files'][$this->conf['fileGrpDownload']]); |
|
168 | + $workLink = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[0]]['files'][$this->conf['fileGrpDownload']]); |
|
169 | 169 | |
170 | - } else { |
|
170 | + } else { |
|
171 | 171 | |
172 | - $details = $this->doc->getLogicalStructure($this->doc->toplevelId); |
|
172 | + $details = $this->doc->getLogicalStructure($this->doc->toplevelId); |
|
173 | 173 | |
174 | - if (!empty($details['files'][$this->conf['fileGrpDownload']])) { |
|
174 | + if (!empty($details['files'][$this->conf['fileGrpDownload']])) { |
|
175 | 175 | |
176 | - $workLink = $this->doc->getFileLocation($details['files'][$this->conf['fileGrpDownload']]); |
|
176 | + $workLink = $this->doc->getFileLocation($details['files'][$this->conf['fileGrpDownload']]); |
|
177 | 177 | |
178 | - } |
|
178 | + } |
|
179 | 179 | |
180 | - } |
|
180 | + } |
|
181 | 181 | |
182 | - // Wrap URLs with HTML. |
|
183 | - if (!empty($workLink)) { |
|
182 | + // Wrap URLs with HTML. |
|
183 | + if (!empty($workLink)) { |
|
184 | 184 | |
185 | - $workLink = $this->cObj->typoLink($this->pi_getLL('work', ''), array ('parameter' => $workLink, 'title' => $this->pi_getLL('work', ''))); |
|
185 | + $workLink = $this->cObj->typoLink($this->pi_getLL('work', ''), array ('parameter' => $workLink, 'title' => $this->pi_getLL('work', ''))); |
|
186 | 186 | |
187 | - } else { |
|
187 | + } else { |
|
188 | 188 | |
189 | - if (TYPO3_DLOG) { |
|
189 | + if (TYPO3_DLOG) { |
|
190 | 190 | |
191 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsPdf->getWorkLink()] File not found in fileGrp "'.$this->conf['fileGrpDownload'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
191 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsPdf->getWorkLink()] File not found in fileGrp "'.$this->conf['fileGrpDownload'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
192 | 192 | |
193 | - } |
|
193 | + } |
|
194 | 194 | |
195 | - } |
|
195 | + } |
|
196 | 196 | |
197 | - return $workLink; |
|
197 | + return $workLink; |
|
198 | 198 | |
199 | - } |
|
199 | + } |
|
200 | 200 | |
201 | 201 | } |