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 | } |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | * |
| 32 | 32 | * @return void |
| 33 | 33 | */ |
| 34 | - public function construct_postProcessRecordId(SimpleXMLElement &$xml, &$record_id) { |
|
| 34 | + public function construct_postProcessRecordId(SimpleXMLElement & $xml, &$record_id) { |
|
| 35 | 35 | |
| 36 | 36 | if (!$record_id) { |
| 37 | 37 | |
@@ -19,433 +19,433 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class tx_dlf_tcemain { |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * Field post-processing hook for the process_datamap() method. |
|
| 24 | - * |
|
| 25 | - * @access public |
|
| 26 | - * |
|
| 27 | - * @param string $status: 'new' or 'update' |
|
| 28 | - * @param string $table: The destination table |
|
| 29 | - * @param integer $id: The uid of the record |
|
| 30 | - * @param array &$fieldArray: Array of field values |
|
| 31 | - * @param \TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object |
|
| 32 | - * |
|
| 33 | - * @return void |
|
| 34 | - */ |
|
| 35 | - public function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray, $pObj) { |
|
| 22 | + /** |
|
| 23 | + * Field post-processing hook for the process_datamap() method. |
|
| 24 | + * |
|
| 25 | + * @access public |
|
| 26 | + * |
|
| 27 | + * @param string $status: 'new' or 'update' |
|
| 28 | + * @param string $table: The destination table |
|
| 29 | + * @param integer $id: The uid of the record |
|
| 30 | + * @param array &$fieldArray: Array of field values |
|
| 31 | + * @param \TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object |
|
| 32 | + * |
|
| 33 | + * @return void |
|
| 34 | + */ |
|
| 35 | + public function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray, $pObj) { |
|
| 36 | 36 | |
| 37 | - if ($status == 'new') { |
|
| 37 | + if ($status == 'new') { |
|
| 38 | 38 | |
| 39 | - switch ($table) { |
|
| 39 | + switch ($table) { |
|
| 40 | 40 | |
| 41 | - // Field post-processing for table "tx_dlf_documents". |
|
| 42 | - case 'tx_dlf_documents': |
|
| 41 | + // Field post-processing for table "tx_dlf_documents". |
|
| 42 | + case 'tx_dlf_documents': |
|
| 43 | 43 | |
| 44 | - // Set sorting field if empty. |
|
| 45 | - if (empty($fieldArray['title_sorting']) && !empty($fieldArray['title'])) { |
|
| 44 | + // Set sorting field if empty. |
|
| 45 | + if (empty($fieldArray['title_sorting']) && !empty($fieldArray['title'])) { |
|
| 46 | 46 | |
| 47 | - $fieldArray['title_sorting'] = $fieldArray['title']; |
|
| 47 | + $fieldArray['title_sorting'] = $fieldArray['title']; |
|
| 48 | 48 | |
| 49 | - } |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - break; |
|
| 51 | + break; |
|
| 52 | 52 | |
| 53 | - // Field post-processing for table "tx_dlf_metadata". |
|
| 54 | - case 'tx_dlf_metadata': |
|
| 53 | + // Field post-processing for table "tx_dlf_metadata". |
|
| 54 | + case 'tx_dlf_metadata': |
|
| 55 | 55 | |
| 56 | - // Store field in index if it should appear in lists. |
|
| 57 | - if (!empty($fieldArray['is_listed'])) { |
|
| 56 | + // Store field in index if it should appear in lists. |
|
| 57 | + if (!empty($fieldArray['is_listed'])) { |
|
| 58 | 58 | |
| 59 | - $fieldArray['index_stored'] = 1; |
|
| 59 | + $fieldArray['index_stored'] = 1; |
|
| 60 | 60 | |
| 61 | - } |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - // Index field in index if it should be used for auto-completion. |
|
| 64 | - if (!empty($fieldArray['index_autocomplete'])) { |
|
| 63 | + // Index field in index if it should be used for auto-completion. |
|
| 64 | + if (!empty($fieldArray['index_autocomplete'])) { |
|
| 65 | 65 | |
| 66 | - $fieldArray['index_indexed'] = 1; |
|
| 66 | + $fieldArray['index_indexed'] = 1; |
|
| 67 | 67 | |
| 68 | - } |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - // Field post-processing for tables "tx_dlf_metadata", "tx_dlf_collections", "tx_dlf_libraries" and "tx_dlf_structures". |
|
| 71 | - case 'tx_dlf_collections': |
|
| 72 | - case 'tx_dlf_libraries': |
|
| 73 | - case 'tx_dlf_structures': |
|
| 70 | + // Field post-processing for tables "tx_dlf_metadata", "tx_dlf_collections", "tx_dlf_libraries" and "tx_dlf_structures". |
|
| 71 | + case 'tx_dlf_collections': |
|
| 72 | + case 'tx_dlf_libraries': |
|
| 73 | + case 'tx_dlf_structures': |
|
| 74 | 74 | |
| 75 | - // Set label as index name if empty. |
|
| 76 | - if (empty($fieldArray['index_name']) && !empty($fieldArray['label'])) { |
|
| 75 | + // Set label as index name if empty. |
|
| 76 | + if (empty($fieldArray['index_name']) && !empty($fieldArray['label'])) { |
|
| 77 | 77 | |
| 78 | - $fieldArray['index_name'] = $fieldArray['label']; |
|
| 78 | + $fieldArray['index_name'] = $fieldArray['label']; |
|
| 79 | 79 | |
| 80 | - } |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - // Set index name as label if empty. |
|
| 83 | - if (empty($fieldArray['label']) && !empty($fieldArray['index_name'])) { |
|
| 82 | + // Set index name as label if empty. |
|
| 83 | + if (empty($fieldArray['label']) && !empty($fieldArray['index_name'])) { |
|
| 84 | 84 | |
| 85 | - $fieldArray['label'] = $fieldArray['index_name']; |
|
| 85 | + $fieldArray['label'] = $fieldArray['index_name']; |
|
| 86 | 86 | |
| 87 | - } |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - // Ensure that index names don't get mixed up with sorting values. |
|
| 90 | - if (substr($fieldArray['index_name'], -8) == '_sorting') { |
|
| 89 | + // Ensure that index names don't get mixed up with sorting values. |
|
| 90 | + if (substr($fieldArray['index_name'], -8) == '_sorting') { |
|
| 91 | 91 | |
| 92 | - $fieldArray['index_name'] .= '0'; |
|
| 92 | + $fieldArray['index_name'] .= '0'; |
|
| 93 | 93 | |
| 94 | - } |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - break; |
|
| 96 | + break; |
|
| 97 | 97 | |
| 98 | - // Field post-processing for table "tx_dlf_solrcores". |
|
| 99 | - case 'tx_dlf_solrcores': |
|
| 98 | + // Field post-processing for table "tx_dlf_solrcores". |
|
| 99 | + case 'tx_dlf_solrcores': |
|
| 100 | 100 | |
| 101 | - // Get number of existing cores. |
|
| 102 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 103 | - '*', |
|
| 104 | - 'tx_dlf_solrcores', |
|
| 105 | - '', |
|
| 106 | - '', |
|
| 107 | - '', |
|
| 108 | - '' |
|
| 109 | - ); |
|
| 101 | + // Get number of existing cores. |
|
| 102 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 103 | + '*', |
|
| 104 | + 'tx_dlf_solrcores', |
|
| 105 | + '', |
|
| 106 | + '', |
|
| 107 | + '', |
|
| 108 | + '' |
|
| 109 | + ); |
|
| 110 | 110 | |
| 111 | - // Get first unused core number. |
|
| 112 | - $coreNumber = tx_dlf_solr::solrGetCoreNumber($GLOBALS['TYPO3_DB']->sql_num_rows($result)); |
|
| 111 | + // Get first unused core number. |
|
| 112 | + $coreNumber = tx_dlf_solr::solrGetCoreNumber($GLOBALS['TYPO3_DB']->sql_num_rows($result)); |
|
| 113 | 113 | |
| 114 | - // Get Solr credentials. |
|
| 115 | - $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']); |
|
| 114 | + // Get Solr credentials. |
|
| 115 | + $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']); |
|
| 116 | 116 | |
| 117 | - // Prepend username and password to hostname. |
|
| 118 | - if ($conf['solrUser'] && $conf['solrPass']) { |
|
| 117 | + // Prepend username and password to hostname. |
|
| 118 | + if ($conf['solrUser'] && $conf['solrPass']) { |
|
| 119 | 119 | |
| 120 | - $host = $conf['solrUser'].':'.$conf['solrPass'].'@'.($conf['solrHost'] ? $conf['solrHost'] : 'localhost'); |
|
| 120 | + $host = $conf['solrUser'].':'.$conf['solrPass'].'@'.($conf['solrHost'] ? $conf['solrHost'] : 'localhost'); |
|
| 121 | 121 | |
| 122 | - } else { |
|
| 122 | + } else { |
|
| 123 | 123 | |
| 124 | - $host = ($conf['solrHost'] ? $conf['solrHost'] : 'localhost'); |
|
| 124 | + $host = ($conf['solrHost'] ? $conf['solrHost'] : 'localhost'); |
|
| 125 | 125 | |
| 126 | - } |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | - // Set port if not set. |
|
| 129 | - $port = (intval($conf['solrPort']) > 0 ? intval($conf['solrPort']) : 8180); |
|
| 128 | + // Set port if not set. |
|
| 129 | + $port = (intval($conf['solrPort']) > 0 ? intval($conf['solrPort']) : 8180); |
|
| 130 | 130 | |
| 131 | - // Trim path and append trailing slash. |
|
| 132 | - $path = (trim($conf['solrPath'], '/') ? trim($conf['solrPath'], '/').'/' : ''); |
|
| 131 | + // Trim path and append trailing slash. |
|
| 132 | + $path = (trim($conf['solrPath'], '/') ? trim($conf['solrPath'], '/').'/' : ''); |
|
| 133 | 133 | |
| 134 | - $context = stream_context_create(array ( |
|
| 135 | - 'http' => array ( |
|
| 136 | - 'method' => 'GET', |
|
| 137 | - 'user_agent' => ($conf['useragent'] ? $conf['useragent'] : ini_get('user_agent')) |
|
| 138 | - ) |
|
| 139 | - )); |
|
| 134 | + $context = stream_context_create(array ( |
|
| 135 | + 'http' => array ( |
|
| 136 | + 'method' => 'GET', |
|
| 137 | + 'user_agent' => ($conf['useragent'] ? $conf['useragent'] : ini_get('user_agent')) |
|
| 138 | + ) |
|
| 139 | + )); |
|
| 140 | 140 | |
| 141 | - // Build request for adding new Solr core. |
|
| 142 | - // @see http://wiki.apache.org/solr/CoreAdmin |
|
| 143 | - $url = 'http://'.$host.':'.$port.'/'.$path.'admin/cores?wt=xml&action=CREATE&name=dlfCore'.$coreNumber.'&instanceDir=.&dataDir=dlfCore'.$coreNumber; |
|
| 141 | + // Build request for adding new Solr core. |
|
| 142 | + // @see http://wiki.apache.org/solr/CoreAdmin |
|
| 143 | + $url = 'http://'.$host.':'.$port.'/'.$path.'admin/cores?wt=xml&action=CREATE&name=dlfCore'.$coreNumber.'&instanceDir=.&dataDir=dlfCore'.$coreNumber; |
|
| 144 | 144 | |
| 145 | - $response = @simplexml_load_string(file_get_contents($url, FALSE, $context)); |
|
| 145 | + $response = @simplexml_load_string(file_get_contents($url, FALSE, $context)); |
|
| 146 | 146 | |
| 147 | - // Process response. |
|
| 148 | - if ($response) { |
|
| 147 | + // Process response. |
|
| 148 | + if ($response) { |
|
| 149 | 149 | |
| 150 | - $status = $response->xpath('//lst[@name="responseHeader"]/int[@name="status"]'); |
|
| 150 | + $status = $response->xpath('//lst[@name="responseHeader"]/int[@name="status"]'); |
|
| 151 | 151 | |
| 152 | - if ($status && $status[0] == 0) { |
|
| 152 | + if ($status && $status[0] == 0) { |
|
| 153 | 153 | |
| 154 | - $fieldArray['index_name'] = 'dlfCore'.$coreNumber; |
|
| 154 | + $fieldArray['index_name'] = 'dlfCore'.$coreNumber; |
|
| 155 | 155 | |
| 156 | - return; |
|
| 156 | + return; |
|
| 157 | 157 | |
| 158 | - } |
|
| 158 | + } |
|
| 159 | 159 | |
| 160 | - } |
|
| 160 | + } |
|
| 161 | 161 | |
| 162 | - if (TYPO3_DLOG) { |
|
| 162 | + if (TYPO3_DLOG) { |
|
| 163 | 163 | |
| 164 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processDatamap_postProcessFieldArray('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Could not create new Apache Solr core "dlfCore'.$coreNumber.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $fieldArray); |
|
| 164 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processDatamap_postProcessFieldArray('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Could not create new Apache Solr core "dlfCore'.$coreNumber.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $fieldArray); |
|
| 165 | 165 | |
| 166 | - } |
|
| 166 | + } |
|
| 167 | 167 | |
| 168 | - // Solr core could not be created, thus unset field array. |
|
| 169 | - $fieldArray = array (); |
|
| 168 | + // Solr core could not be created, thus unset field array. |
|
| 169 | + $fieldArray = array (); |
|
| 170 | 170 | |
| 171 | - break; |
|
| 171 | + break; |
|
| 172 | 172 | |
| 173 | - } |
|
| 173 | + } |
|
| 174 | 174 | |
| 175 | - } elseif ($status == 'update') { |
|
| 175 | + } elseif ($status == 'update') { |
|
| 176 | 176 | |
| 177 | - switch ($table) { |
|
| 177 | + switch ($table) { |
|
| 178 | 178 | |
| 179 | - // Field post-processing for table "tx_dlf_metadata". |
|
| 180 | - case 'tx_dlf_metadata': |
|
| 179 | + // Field post-processing for table "tx_dlf_metadata". |
|
| 180 | + case 'tx_dlf_metadata': |
|
| 181 | 181 | |
| 182 | - // Store field in index if it should appear in lists. |
|
| 183 | - if (!empty($fieldArray['is_listed'])) { |
|
| 182 | + // Store field in index if it should appear in lists. |
|
| 183 | + if (!empty($fieldArray['is_listed'])) { |
|
| 184 | 184 | |
| 185 | - $fieldArray['index_stored'] = 1; |
|
| 185 | + $fieldArray['index_stored'] = 1; |
|
| 186 | 186 | |
| 187 | - } |
|
| 187 | + } |
|
| 188 | 188 | |
| 189 | - if (isset($fieldArray['index_stored']) && $fieldArray['index_stored'] == 0 && !isset($fieldArray['is_listed'])) { |
|
| 189 | + if (isset($fieldArray['index_stored']) && $fieldArray['index_stored'] == 0 && !isset($fieldArray['is_listed'])) { |
|
| 190 | 190 | |
| 191 | - // Get current configuration. |
|
| 192 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 193 | - $table.'.is_listed AS is_listed', |
|
| 194 | - $table, |
|
| 195 | - $table.'.uid='.intval($id).tx_dlf_helper::whereClause($table), |
|
| 196 | - '', |
|
| 197 | - '', |
|
| 198 | - '1' |
|
| 199 | - ); |
|
| 191 | + // Get current configuration. |
|
| 192 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 193 | + $table.'.is_listed AS is_listed', |
|
| 194 | + $table, |
|
| 195 | + $table.'.uid='.intval($id).tx_dlf_helper::whereClause($table), |
|
| 196 | + '', |
|
| 197 | + '', |
|
| 198 | + '1' |
|
| 199 | + ); |
|
| 200 | 200 | |
| 201 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 201 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 202 | 202 | |
| 203 | - // Reset storing to current. |
|
| 204 | - list ($fieldArray['index_stored']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
| 203 | + // Reset storing to current. |
|
| 204 | + list ($fieldArray['index_stored']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
| 205 | 205 | |
| 206 | - } |
|
| 206 | + } |
|
| 207 | 207 | |
| 208 | - } |
|
| 208 | + } |
|
| 209 | 209 | |
| 210 | - // Index field in index if it should be used for auto-completion. |
|
| 211 | - if (!empty($fieldArray['index_autocomplete'])) { |
|
| 210 | + // Index field in index if it should be used for auto-completion. |
|
| 211 | + if (!empty($fieldArray['index_autocomplete'])) { |
|
| 212 | 212 | |
| 213 | - $fieldArray['index_indexed'] = 1; |
|
| 213 | + $fieldArray['index_indexed'] = 1; |
|
| 214 | 214 | |
| 215 | - } |
|
| 215 | + } |
|
| 216 | 216 | |
| 217 | - if (isset($fieldArray['index_indexed']) && $fieldArray['index_indexed'] == 0 && !isset($fieldArray['index_autocomplete'])) { |
|
| 217 | + if (isset($fieldArray['index_indexed']) && $fieldArray['index_indexed'] == 0 && !isset($fieldArray['index_autocomplete'])) { |
|
| 218 | 218 | |
| 219 | - // Get current configuration. |
|
| 220 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 221 | - $table.'.index_autocomplete AS index_autocomplete', |
|
| 222 | - $table, |
|
| 223 | - $table.'.uid='.intval($id).tx_dlf_helper::whereClause($table), |
|
| 224 | - '', |
|
| 225 | - '', |
|
| 226 | - '1' |
|
| 227 | - ); |
|
| 219 | + // Get current configuration. |
|
| 220 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 221 | + $table.'.index_autocomplete AS index_autocomplete', |
|
| 222 | + $table, |
|
| 223 | + $table.'.uid='.intval($id).tx_dlf_helper::whereClause($table), |
|
| 224 | + '', |
|
| 225 | + '', |
|
| 226 | + '1' |
|
| 227 | + ); |
|
| 228 | 228 | |
| 229 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 229 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 230 | 230 | |
| 231 | - // Reset indexing to current. |
|
| 232 | - list ($fieldArray['index_indexed']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
| 231 | + // Reset indexing to current. |
|
| 232 | + list ($fieldArray['index_indexed']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
| 233 | 233 | |
| 234 | - } |
|
| 234 | + } |
|
| 235 | 235 | |
| 236 | - } |
|
| 236 | + } |
|
| 237 | 237 | |
| 238 | - // Field post-processing for tables "tx_dlf_metadata" and "tx_dlf_structures". |
|
| 239 | - case 'tx_dlf_structures': |
|
| 238 | + // Field post-processing for tables "tx_dlf_metadata" and "tx_dlf_structures". |
|
| 239 | + case 'tx_dlf_structures': |
|
| 240 | 240 | |
| 241 | - // The index name should not be changed in production. |
|
| 242 | - if (isset($fieldArray['index_name'])) { |
|
| 241 | + // The index name should not be changed in production. |
|
| 242 | + if (isset($fieldArray['index_name'])) { |
|
| 243 | 243 | |
| 244 | - if (count($fieldArray) < 2) { |
|
| 244 | + if (count($fieldArray) < 2) { |
|
| 245 | 245 | |
| 246 | - // Unset the whole field array. |
|
| 247 | - $fieldArray = array (); |
|
| 246 | + // Unset the whole field array. |
|
| 247 | + $fieldArray = array (); |
|
| 248 | 248 | |
| 249 | - } else { |
|
| 249 | + } else { |
|
| 250 | 250 | |
| 251 | - // Get current index name. |
|
| 252 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 253 | - $table.'.index_name AS index_name', |
|
| 254 | - $table, |
|
| 255 | - $table.'.uid='.intval($id).tx_dlf_helper::whereClause($table), |
|
| 256 | - '', |
|
| 257 | - '', |
|
| 258 | - '1' |
|
| 259 | - ); |
|
| 251 | + // Get current index name. |
|
| 252 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 253 | + $table.'.index_name AS index_name', |
|
| 254 | + $table, |
|
| 255 | + $table.'.uid='.intval($id).tx_dlf_helper::whereClause($table), |
|
| 256 | + '', |
|
| 257 | + '', |
|
| 258 | + '1' |
|
| 259 | + ); |
|
| 260 | 260 | |
| 261 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 261 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 262 | 262 | |
| 263 | - // Reset index name to current. |
|
| 264 | - list ($fieldArray['index_name']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
| 263 | + // Reset index name to current. |
|
| 264 | + list ($fieldArray['index_name']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
| 265 | 265 | |
| 266 | - } |
|
| 266 | + } |
|
| 267 | 267 | |
| 268 | - } |
|
| 268 | + } |
|
| 269 | 269 | |
| 270 | - if (TYPO3_DLOG) { |
|
| 270 | + if (TYPO3_DLOG) { |
|
| 271 | 271 | |
| 272 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processDatamap_postProcessFieldArray('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Prevented change of "index_name" for UID "'.$id.'" in table "'.$table.'"', $this->extKey, SYSLOG_SEVERITY_NOTICE, $fieldArray); |
|
| 272 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processDatamap_postProcessFieldArray('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Prevented change of "index_name" for UID "'.$id.'" in table "'.$table.'"', $this->extKey, SYSLOG_SEVERITY_NOTICE, $fieldArray); |
|
| 273 | 273 | |
| 274 | - } |
|
| 274 | + } |
|
| 275 | 275 | |
| 276 | - } |
|
| 276 | + } |
|
| 277 | 277 | |
| 278 | - break; |
|
| 278 | + break; |
|
| 279 | 279 | |
| 280 | - } |
|
| 280 | + } |
|
| 281 | 281 | |
| 282 | - } |
|
| 282 | + } |
|
| 283 | 283 | |
| 284 | - } |
|
| 284 | + } |
|
| 285 | 285 | |
| 286 | - /** |
|
| 287 | - * After database operations hook for the process_datamap() method. |
|
| 288 | - * |
|
| 289 | - * @access public |
|
| 290 | - * |
|
| 291 | - * @param string $status: 'new' or 'update' |
|
| 292 | - * @param string $table: The destination table |
|
| 293 | - * @param integer $id: The uid of the record |
|
| 294 | - * @param array &$fieldArray: Array of field values |
|
| 295 | - * @param \TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object |
|
| 296 | - * |
|
| 297 | - * @return void |
|
| 298 | - */ |
|
| 299 | - public function processDatamap_afterDatabaseOperations($status, $table, $id, &$fieldArray, $pObj) { |
|
| 286 | + /** |
|
| 287 | + * After database operations hook for the process_datamap() method. |
|
| 288 | + * |
|
| 289 | + * @access public |
|
| 290 | + * |
|
| 291 | + * @param string $status: 'new' or 'update' |
|
| 292 | + * @param string $table: The destination table |
|
| 293 | + * @param integer $id: The uid of the record |
|
| 294 | + * @param array &$fieldArray: Array of field values |
|
| 295 | + * @param \TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object |
|
| 296 | + * |
|
| 297 | + * @return void |
|
| 298 | + */ |
|
| 299 | + public function processDatamap_afterDatabaseOperations($status, $table, $id, &$fieldArray, $pObj) { |
|
| 300 | 300 | |
| 301 | - if ($status == 'update') { |
|
| 301 | + if ($status == 'update') { |
|
| 302 | 302 | |
| 303 | - switch ($table) { |
|
| 303 | + switch ($table) { |
|
| 304 | 304 | |
| 305 | - // After database operations for table "tx_dlf_documents". |
|
| 306 | - case 'tx_dlf_documents': |
|
| 305 | + // After database operations for table "tx_dlf_documents". |
|
| 306 | + case 'tx_dlf_documents': |
|
| 307 | 307 | |
| 308 | - // Delete/reindex document in Solr according to "hidden" status in database. |
|
| 309 | - if (isset($fieldArray['hidden'])) { |
|
| 308 | + // Delete/reindex document in Solr according to "hidden" status in database. |
|
| 309 | + if (isset($fieldArray['hidden'])) { |
|
| 310 | 310 | |
| 311 | - // Get Solr core. |
|
| 312 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 313 | - 'tx_dlf_solrcores.uid', |
|
| 314 | - 'tx_dlf_solrcores,tx_dlf_documents', |
|
| 315 | - 'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.intval($id).tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
|
| 316 | - '', |
|
| 317 | - '', |
|
| 318 | - '1' |
|
| 319 | - ); |
|
| 311 | + // Get Solr core. |
|
| 312 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 313 | + 'tx_dlf_solrcores.uid', |
|
| 314 | + 'tx_dlf_solrcores,tx_dlf_documents', |
|
| 315 | + 'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.intval($id).tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
|
| 316 | + '', |
|
| 317 | + '', |
|
| 318 | + '1' |
|
| 319 | + ); |
|
| 320 | 320 | |
| 321 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 321 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 322 | 322 | |
| 323 | - list ($core) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
| 323 | + list ($core) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
| 324 | 324 | |
| 325 | - if ($fieldArray['hidden']) { |
|
| 325 | + if ($fieldArray['hidden']) { |
|
| 326 | 326 | |
| 327 | - // Establish Solr connection. |
|
| 328 | - if ($solr = tx_dlf_solr::getInstance($core)) { |
|
| 327 | + // Establish Solr connection. |
|
| 328 | + if ($solr = tx_dlf_solr::getInstance($core)) { |
|
| 329 | 329 | |
| 330 | - // Delete Solr document. |
|
| 331 | - $solr->service->deleteByQuery('uid:'.$id); |
|
| 330 | + // Delete Solr document. |
|
| 331 | + $solr->service->deleteByQuery('uid:'.$id); |
|
| 332 | 332 | |
| 333 | - $solr->service->commit(); |
|
| 333 | + $solr->service->commit(); |
|
| 334 | 334 | |
| 335 | - } |
|
| 335 | + } |
|
| 336 | 336 | |
| 337 | - } else { |
|
| 337 | + } else { |
|
| 338 | 338 | |
| 339 | - // Reindex document. |
|
| 340 | - $doc =& tx_dlf_document::getInstance($id); |
|
| 339 | + // Reindex document. |
|
| 340 | + $doc =& tx_dlf_document::getInstance($id); |
|
| 341 | 341 | |
| 342 | - if ($doc->ready) { |
|
| 342 | + if ($doc->ready) { |
|
| 343 | 343 | |
| 344 | - $doc->save($doc->pid, $core); |
|
| 344 | + $doc->save($doc->pid, $core); |
|
| 345 | 345 | |
| 346 | - } else { |
|
| 346 | + } else { |
|
| 347 | 347 | |
| 348 | - if (TYPO3_DLOG) { |
|
| 348 | + if (TYPO3_DLOG) { |
|
| 349 | 349 | |
| 350 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processDatamap_afterDatabaseOperations('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Failed to re-index document with UID "'.$id.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $fieldArray); |
|
| 350 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processDatamap_afterDatabaseOperations('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Failed to re-index document with UID "'.$id.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $fieldArray); |
|
| 351 | 351 | |
| 352 | - } |
|
| 352 | + } |
|
| 353 | 353 | |
| 354 | - } |
|
| 354 | + } |
|
| 355 | 355 | |
| 356 | - } |
|
| 356 | + } |
|
| 357 | 357 | |
| 358 | - } |
|
| 358 | + } |
|
| 359 | 359 | |
| 360 | - } |
|
| 360 | + } |
|
| 361 | 361 | |
| 362 | - break; |
|
| 362 | + break; |
|
| 363 | 363 | |
| 364 | - } |
|
| 364 | + } |
|
| 365 | 365 | |
| 366 | - } |
|
| 366 | + } |
|
| 367 | 367 | |
| 368 | - } |
|
| 368 | + } |
|
| 369 | 369 | |
| 370 | - /** |
|
| 371 | - * Post-processing hook for the process_cmdmap() method. |
|
| 372 | - * |
|
| 373 | - * @access public |
|
| 374 | - * |
|
| 375 | - * @param string $command: 'move', 'copy', 'localize', 'inlineLocalizeSynchronize', 'delete' or 'undelete' |
|
| 376 | - * @param string $table: The destination table |
|
| 377 | - * @param integer $id: The uid of the record |
|
| 378 | - * @param mixed $value: The value for the command |
|
| 379 | - * @param \TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object |
|
| 380 | - * |
|
| 381 | - * @return void |
|
| 382 | - */ |
|
| 383 | - public function processCmdmap_postProcess($command, $table, $id, $value, $pObj) { |
|
| 370 | + /** |
|
| 371 | + * Post-processing hook for the process_cmdmap() method. |
|
| 372 | + * |
|
| 373 | + * @access public |
|
| 374 | + * |
|
| 375 | + * @param string $command: 'move', 'copy', 'localize', 'inlineLocalizeSynchronize', 'delete' or 'undelete' |
|
| 376 | + * @param string $table: The destination table |
|
| 377 | + * @param integer $id: The uid of the record |
|
| 378 | + * @param mixed $value: The value for the command |
|
| 379 | + * @param \TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object |
|
| 380 | + * |
|
| 381 | + * @return void |
|
| 382 | + */ |
|
| 383 | + public function processCmdmap_postProcess($command, $table, $id, $value, $pObj) { |
|
| 384 | 384 | |
| 385 | - if (in_array($command, array ('move', 'delete', 'undelete')) && $table == 'tx_dlf_documents') { |
|
| 385 | + if (in_array($command, array ('move', 'delete', 'undelete')) && $table == 'tx_dlf_documents') { |
|
| 386 | 386 | |
| 387 | - // Get Solr core. |
|
| 388 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 389 | - 'tx_dlf_solrcores.uid', |
|
| 390 | - 'tx_dlf_solrcores,tx_dlf_documents', |
|
| 391 | - 'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.intval($id).tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
|
| 392 | - '', |
|
| 393 | - '', |
|
| 394 | - '1' |
|
| 395 | - ); |
|
| 387 | + // Get Solr core. |
|
| 388 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 389 | + 'tx_dlf_solrcores.uid', |
|
| 390 | + 'tx_dlf_solrcores,tx_dlf_documents', |
|
| 391 | + 'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.intval($id).tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
|
| 392 | + '', |
|
| 393 | + '', |
|
| 394 | + '1' |
|
| 395 | + ); |
|
| 396 | 396 | |
| 397 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 397 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
| 398 | 398 | |
| 399 | - list ($core) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
| 399 | + list ($core) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
| 400 | 400 | |
| 401 | - switch ($command) { |
|
| 401 | + switch ($command) { |
|
| 402 | 402 | |
| 403 | - case 'move': |
|
| 404 | - case 'delete': |
|
| 403 | + case 'move': |
|
| 404 | + case 'delete': |
|
| 405 | 405 | |
| 406 | - // Establish Solr connection. |
|
| 407 | - if ($solr = tx_dlf_solr::getInstance($core)) { |
|
| 406 | + // Establish Solr connection. |
|
| 407 | + if ($solr = tx_dlf_solr::getInstance($core)) { |
|
| 408 | 408 | |
| 409 | - // Delete Solr document. |
|
| 410 | - $solr->service->deleteByQuery('uid:'.$id); |
|
| 409 | + // Delete Solr document. |
|
| 410 | + $solr->service->deleteByQuery('uid:'.$id); |
|
| 411 | 411 | |
| 412 | - $solr->service->commit(); |
|
| 412 | + $solr->service->commit(); |
|
| 413 | 413 | |
| 414 | - if ($command == 'delete') { |
|
| 414 | + if ($command == 'delete') { |
|
| 415 | 415 | |
| 416 | - break; |
|
| 416 | + break; |
|
| 417 | 417 | |
| 418 | - } |
|
| 418 | + } |
|
| 419 | 419 | |
| 420 | - } |
|
| 420 | + } |
|
| 421 | 421 | |
| 422 | - case 'undelete': |
|
| 422 | + case 'undelete': |
|
| 423 | 423 | |
| 424 | - // Reindex document. |
|
| 425 | - $doc =& tx_dlf_document::getInstance($id); |
|
| 424 | + // Reindex document. |
|
| 425 | + $doc =& tx_dlf_document::getInstance($id); |
|
| 426 | 426 | |
| 427 | - if ($doc->ready) { |
|
| 427 | + if ($doc->ready) { |
|
| 428 | 428 | |
| 429 | - $doc->save($doc->pid, $core); |
|
| 429 | + $doc->save($doc->pid, $core); |
|
| 430 | 430 | |
| 431 | - } else { |
|
| 431 | + } else { |
|
| 432 | 432 | |
| 433 | - if (TYPO3_DLOG) { |
|
| 433 | + if (TYPO3_DLOG) { |
|
| 434 | 434 | |
| 435 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processCmdmap_postProcess('.$command.', '.$table.', '.$id.', '.$value.', ['.get_class($pObj).'])] Failed to re-index document with UID "'.$id.'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
|
| 435 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processCmdmap_postProcess('.$command.', '.$table.', '.$id.', '.$value.', ['.get_class($pObj).'])] Failed to re-index document with UID "'.$id.'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
|
| 436 | 436 | |
| 437 | - } |
|
| 437 | + } |
|
| 438 | 438 | |
| 439 | - } |
|
| 439 | + } |
|
| 440 | 440 | |
| 441 | - break; |
|
| 441 | + break; |
|
| 442 | 442 | |
| 443 | - } |
|
| 443 | + } |
|
| 444 | 444 | |
| 445 | - } |
|
| 445 | + } |
|
| 446 | 446 | |
| 447 | - } |
|
| 447 | + } |
|
| 448 | 448 | |
| 449 | - } |
|
| 449 | + } |
|
| 450 | 450 | |
| 451 | 451 | } |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | } else { |
| 338 | 338 | |
| 339 | 339 | // Reindex document. |
| 340 | - $doc =& tx_dlf_document::getInstance($id); |
|
| 340 | + $doc = & tx_dlf_document::getInstance($id); |
|
| 341 | 341 | |
| 342 | 342 | if ($doc->ready) { |
| 343 | 343 | |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | case 'undelete': |
| 423 | 423 | |
| 424 | 424 | // Reindex document. |
| 425 | - $doc =& tx_dlf_document::getInstance($id); |
|
| 425 | + $doc = & tx_dlf_document::getInstance($id); |
|
| 426 | 426 | |
| 427 | 427 | if ($doc->ready) { |
| 428 | 428 | |
@@ -19,393 +19,393 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class tx_dlf_tceforms { |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * Helper to display document's thumbnail for table "tx_dlf_documents" |
|
| 24 | - * |
|
| 25 | - * @access public |
|
| 26 | - * |
|
| 27 | - * @param array &$params: An array with parameters |
|
| 28 | - * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
| 29 | - * |
|
| 30 | - * @return string HTML <img> tag for thumbnail |
|
| 31 | - */ |
|
| 32 | - public function displayThumbnail(&$params, &$pObj) { |
|
| 22 | + /** |
|
| 23 | + * Helper to display document's thumbnail for table "tx_dlf_documents" |
|
| 24 | + * |
|
| 25 | + * @access public |
|
| 26 | + * |
|
| 27 | + * @param array &$params: An array with parameters |
|
| 28 | + * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
| 29 | + * |
|
| 30 | + * @return string HTML <img> tag for thumbnail |
|
| 31 | + */ |
|
| 32 | + public function displayThumbnail(&$params, &$pObj) { |
|
| 33 | 33 | |
| 34 | - $output = '<div style="padding:5px; background-color:#000000;">'; |
|
| 34 | + $output = '<div style="padding:5px; background-color:#000000;">'; |
|
| 35 | 35 | |
| 36 | - // Simulate TCA field type "passthrough". |
|
| 37 | - $output .= '<input type="hidden" name="'.$params['itemFormElName'].'" value="'.$params['itemFormElValue'].'" />'; |
|
| 36 | + // Simulate TCA field type "passthrough". |
|
| 37 | + $output .= '<input type="hidden" name="'.$params['itemFormElName'].'" value="'.$params['itemFormElValue'].'" />'; |
|
| 38 | 38 | |
| 39 | - if (!empty($params['itemFormElValue'])) { |
|
| 39 | + if (!empty($params['itemFormElValue'])) { |
|
| 40 | 40 | |
| 41 | - $output .= '<img alt="" src="'.$params['itemFormElValue'].'" />'; |
|
| 41 | + $output .= '<img alt="" src="'.$params['itemFormElValue'].'" />'; |
|
| 42 | 42 | |
| 43 | - } |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - $output .= '</div>'; |
|
| 45 | + $output .= '</div>'; |
|
| 46 | 46 | |
| 47 | - return $output; |
|
| 47 | + return $output; |
|
| 48 | 48 | |
| 49 | - } |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * Helper to get flexform's items array for plugin "tx_dlf_collection" |
|
| 53 | - * |
|
| 54 | - * @access public |
|
| 55 | - * |
|
| 56 | - * @param array &$params: An array with parameters |
|
| 57 | - * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
| 58 | - * |
|
| 59 | - * @return void |
|
| 60 | - */ |
|
| 61 | - public function itemsProcFunc_collectionList(&$params, &$pObj) { |
|
| 51 | + /** |
|
| 52 | + * Helper to get flexform's items array for plugin "tx_dlf_collection" |
|
| 53 | + * |
|
| 54 | + * @access public |
|
| 55 | + * |
|
| 56 | + * @param array &$params: An array with parameters |
|
| 57 | + * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
| 58 | + * |
|
| 59 | + * @return void |
|
| 60 | + */ |
|
| 61 | + public function itemsProcFunc_collectionList(&$params, &$pObj) { |
|
| 62 | 62 | |
| 63 | - // the access to pi_flexform data has changed in TYPO3 7.6 |
|
| 64 | - if (version_compare(TYPO3_version, '7.6', '<')) { |
|
| 63 | + // the access to pi_flexform data has changed in TYPO3 7.6 |
|
| 64 | + if (version_compare(TYPO3_version, '7.6', '<')) { |
|
| 65 | 65 | |
| 66 | - if ($params['row']['pi_flexform']) { |
|
| 66 | + if ($params['row']['pi_flexform']) { |
|
| 67 | 67 | |
| 68 | - $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); |
|
| 68 | + $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); |
|
| 69 | 69 | |
| 70 | - $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; |
|
| 70 | + $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; |
|
| 71 | 71 | |
| 72 | - } |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - } else { |
|
| 74 | + } else { |
|
| 75 | 75 | |
| 76 | - $pages = $params['row']['pages']; |
|
| 76 | + $pages = $params['row']['pages']; |
|
| 77 | 77 | |
| 78 | - } |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - if (!empty($pages)) { |
|
| 80 | + if (!empty($pages)) { |
|
| 81 | 81 | |
| 82 | - // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. |
|
| 83 | - // i.e. instead of "18" it reads "pages_18|Title" |
|
| 84 | - if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { |
|
| 82 | + // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. |
|
| 83 | + // i.e. instead of "18" it reads "pages_18|Title" |
|
| 84 | + if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { |
|
| 85 | 85 | |
| 86 | - $parts = explode('|', $pages); |
|
| 86 | + $parts = explode('|', $pages); |
|
| 87 | 87 | |
| 88 | - $pages = array_pop(explode('_', $parts[0])); |
|
| 88 | + $pages = array_pop(explode('_', $parts[0])); |
|
| 89 | 89 | |
| 90 | - } |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - if ($pages > 0) { |
|
| 92 | + if ($pages > 0) { |
|
| 93 | 93 | |
| 94 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 95 | - 'label,uid', |
|
| 96 | - 'tx_dlf_collections', |
|
| 97 | - 'pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
| 98 | - '', |
|
| 99 | - 'label', |
|
| 100 | - '' |
|
| 101 | - ); |
|
| 94 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 95 | + 'label,uid', |
|
| 96 | + 'tx_dlf_collections', |
|
| 97 | + 'pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
| 98 | + '', |
|
| 99 | + 'label', |
|
| 100 | + '' |
|
| 101 | + ); |
|
| 102 | 102 | |
| 103 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
| 103 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
| 104 | 104 | |
| 105 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { |
|
| 105 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { |
|
| 106 | 106 | |
| 107 | - $params['items'][] = $resArray; |
|
| 107 | + $params['items'][] = $resArray; |
|
| 108 | 108 | |
| 109 | - } |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | - } |
|
| 111 | + } |
|
| 112 | 112 | |
| 113 | - } |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - } |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - } |
|
| 117 | + } |
|
| 118 | 118 | |
| 119 | - /** |
|
| 120 | - * Helper to get flexform's items array for plugin "tx_dlf_search" |
|
| 121 | - * |
|
| 122 | - * @access public |
|
| 123 | - * |
|
| 124 | - * @param array &$params: An array with parameters |
|
| 125 | - * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
| 126 | - * |
|
| 127 | - * @return void |
|
| 128 | - */ |
|
| 129 | - public function itemsProcFunc_extendedSearchList(&$params, &$pObj) { |
|
| 119 | + /** |
|
| 120 | + * Helper to get flexform's items array for plugin "tx_dlf_search" |
|
| 121 | + * |
|
| 122 | + * @access public |
|
| 123 | + * |
|
| 124 | + * @param array &$params: An array with parameters |
|
| 125 | + * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
| 126 | + * |
|
| 127 | + * @return void |
|
| 128 | + */ |
|
| 129 | + public function itemsProcFunc_extendedSearchList(&$params, &$pObj) { |
|
| 130 | 130 | |
| 131 | - // the access to pi_flexform data has changed in TYPO3 7.6 |
|
| 132 | - if (version_compare(TYPO3_version, '7.6', '<')) { |
|
| 131 | + // the access to pi_flexform data has changed in TYPO3 7.6 |
|
| 132 | + if (version_compare(TYPO3_version, '7.6', '<')) { |
|
| 133 | 133 | |
| 134 | - if ($params['row']['pi_flexform']) { |
|
| 134 | + if ($params['row']['pi_flexform']) { |
|
| 135 | 135 | |
| 136 | - $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); |
|
| 136 | + $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); |
|
| 137 | 137 | |
| 138 | - $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; |
|
| 138 | + $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; |
|
| 139 | 139 | |
| 140 | - } |
|
| 140 | + } |
|
| 141 | 141 | |
| 142 | - } else { |
|
| 142 | + } else { |
|
| 143 | 143 | |
| 144 | - $pages = $params['row']['pages']; |
|
| 144 | + $pages = $params['row']['pages']; |
|
| 145 | 145 | |
| 146 | - } |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | - if (!empty($pages)) { |
|
| 148 | + if (!empty($pages)) { |
|
| 149 | 149 | |
| 150 | - // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. |
|
| 151 | - // i.e. instead of "18" it reads "pages_18|Title" |
|
| 152 | - if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { |
|
| 150 | + // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. |
|
| 151 | + // i.e. instead of "18" it reads "pages_18|Title" |
|
| 152 | + if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { |
|
| 153 | 153 | |
| 154 | - $_parts = explode('|', $pages); |
|
| 154 | + $_parts = explode('|', $pages); |
|
| 155 | 155 | |
| 156 | - $pages = array_pop(explode('_', $_parts[0])); |
|
| 156 | + $pages = array_pop(explode('_', $_parts[0])); |
|
| 157 | 157 | |
| 158 | - } |
|
| 158 | + } |
|
| 159 | 159 | |
| 160 | - if ($pages > 0) { |
|
| 160 | + if ($pages > 0) { |
|
| 161 | 161 | |
| 162 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 163 | - 'label,index_name', |
|
| 164 | - 'tx_dlf_metadata', |
|
| 165 | - 'index_indexed=1 AND pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
| 166 | - '', |
|
| 167 | - 'sorting', |
|
| 168 | - '' |
|
| 169 | - ); |
|
| 162 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 163 | + 'label,index_name', |
|
| 164 | + 'tx_dlf_metadata', |
|
| 165 | + 'index_indexed=1 AND pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
| 166 | + '', |
|
| 167 | + 'sorting', |
|
| 168 | + '' |
|
| 169 | + ); |
|
| 170 | 170 | |
| 171 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
| 171 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
| 172 | 172 | |
| 173 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { |
|
| 173 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { |
|
| 174 | 174 | |
| 175 | - $params['items'][] = $resArray; |
|
| 175 | + $params['items'][] = $resArray; |
|
| 176 | 176 | |
| 177 | - } |
|
| 177 | + } |
|
| 178 | 178 | |
| 179 | - } |
|
| 179 | + } |
|
| 180 | 180 | |
| 181 | - } |
|
| 181 | + } |
|
| 182 | 182 | |
| 183 | - } |
|
| 183 | + } |
|
| 184 | 184 | |
| 185 | - } |
|
| 185 | + } |
|
| 186 | 186 | |
| 187 | - /** |
|
| 188 | - * Helper to get flexform's items array for plugin "tx_dlf_search" |
|
| 189 | - * |
|
| 190 | - * @access public |
|
| 191 | - * |
|
| 192 | - * @param array &$params: An array with parameters |
|
| 193 | - * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
| 194 | - * |
|
| 195 | - * @return void |
|
| 196 | - */ |
|
| 197 | - public function itemsProcFunc_facetsList(&$params, &$pObj) { |
|
| 187 | + /** |
|
| 188 | + * Helper to get flexform's items array for plugin "tx_dlf_search" |
|
| 189 | + * |
|
| 190 | + * @access public |
|
| 191 | + * |
|
| 192 | + * @param array &$params: An array with parameters |
|
| 193 | + * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
| 194 | + * |
|
| 195 | + * @return void |
|
| 196 | + */ |
|
| 197 | + public function itemsProcFunc_facetsList(&$params, &$pObj) { |
|
| 198 | 198 | |
| 199 | - // the access to pi_flexform data has changed in TYPO3 7.6 |
|
| 200 | - if (version_compare(TYPO3_version, '7.6', '<')) { |
|
| 199 | + // the access to pi_flexform data has changed in TYPO3 7.6 |
|
| 200 | + if (version_compare(TYPO3_version, '7.6', '<')) { |
|
| 201 | 201 | |
| 202 | - if ($params['row']['pi_flexform']) { |
|
| 202 | + if ($params['row']['pi_flexform']) { |
|
| 203 | 203 | |
| 204 | - $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); |
|
| 204 | + $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); |
|
| 205 | 205 | |
| 206 | - $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; |
|
| 206 | + $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; |
|
| 207 | 207 | |
| 208 | - } |
|
| 208 | + } |
|
| 209 | 209 | |
| 210 | - } else { |
|
| 210 | + } else { |
|
| 211 | 211 | |
| 212 | - $pages = $params['row']['pages']; |
|
| 212 | + $pages = $params['row']['pages']; |
|
| 213 | 213 | |
| 214 | - } |
|
| 214 | + } |
|
| 215 | 215 | |
| 216 | - if (!empty($pages)) { |
|
| 216 | + if (!empty($pages)) { |
|
| 217 | 217 | |
| 218 | - // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. |
|
| 219 | - // i.e. instead of "18" it reads "pages_18|Title" |
|
| 220 | - if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { |
|
| 218 | + // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. |
|
| 219 | + // i.e. instead of "18" it reads "pages_18|Title" |
|
| 220 | + if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { |
|
| 221 | 221 | |
| 222 | - $_parts = explode('|', $pages); |
|
| 222 | + $_parts = explode('|', $pages); |
|
| 223 | 223 | |
| 224 | - $pages = array_pop(explode('_', $_parts[0])); |
|
| 224 | + $pages = array_pop(explode('_', $_parts[0])); |
|
| 225 | 225 | |
| 226 | - } |
|
| 226 | + } |
|
| 227 | 227 | |
| 228 | - if ($pages > 0) { |
|
| 228 | + if ($pages > 0) { |
|
| 229 | 229 | |
| 230 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 231 | - 'label,index_name', |
|
| 232 | - 'tx_dlf_metadata', |
|
| 233 | - 'is_facet=1 AND pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
| 234 | - '', |
|
| 235 | - 'sorting', |
|
| 236 | - '' |
|
| 237 | - ); |
|
| 230 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 231 | + 'label,index_name', |
|
| 232 | + 'tx_dlf_metadata', |
|
| 233 | + 'is_facet=1 AND pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
| 234 | + '', |
|
| 235 | + 'sorting', |
|
| 236 | + '' |
|
| 237 | + ); |
|
| 238 | 238 | |
| 239 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
| 239 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
| 240 | 240 | |
| 241 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { |
|
| 241 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { |
|
| 242 | 242 | |
| 243 | - $params['items'][] = $resArray; |
|
| 243 | + $params['items'][] = $resArray; |
|
| 244 | 244 | |
| 245 | - } |
|
| 245 | + } |
|
| 246 | 246 | |
| 247 | - } |
|
| 247 | + } |
|
| 248 | 248 | |
| 249 | - } |
|
| 249 | + } |
|
| 250 | 250 | |
| 251 | - } |
|
| 251 | + } |
|
| 252 | 252 | |
| 253 | - } |
|
| 253 | + } |
|
| 254 | 254 | |
| 255 | - /** |
|
| 256 | - * Helper to get flexform's items array for plugin "tx_dlf_oai" |
|
| 257 | - * |
|
| 258 | - * @access public |
|
| 259 | - * |
|
| 260 | - * @param array &$params: An array with parameters |
|
| 261 | - * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
| 262 | - * |
|
| 263 | - * @return void |
|
| 264 | - */ |
|
| 265 | - public function itemsProcFunc_libraryList(&$params, &$pObj) { |
|
| 255 | + /** |
|
| 256 | + * Helper to get flexform's items array for plugin "tx_dlf_oai" |
|
| 257 | + * |
|
| 258 | + * @access public |
|
| 259 | + * |
|
| 260 | + * @param array &$params: An array with parameters |
|
| 261 | + * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
| 262 | + * |
|
| 263 | + * @return void |
|
| 264 | + */ |
|
| 265 | + public function itemsProcFunc_libraryList(&$params, &$pObj) { |
|
| 266 | 266 | |
| 267 | - // the access to pi_flexform data has changed in TYPO3 7.6 |
|
| 268 | - if (version_compare(TYPO3_version, '7.6', '<')) { |
|
| 267 | + // the access to pi_flexform data has changed in TYPO3 7.6 |
|
| 268 | + if (version_compare(TYPO3_version, '7.6', '<')) { |
|
| 269 | 269 | |
| 270 | - if ($params['row']['pi_flexform']) { |
|
| 270 | + if ($params['row']['pi_flexform']) { |
|
| 271 | 271 | |
| 272 | - $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); |
|
| 272 | + $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); |
|
| 273 | 273 | |
| 274 | - $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; |
|
| 274 | + $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; |
|
| 275 | 275 | |
| 276 | - } |
|
| 276 | + } |
|
| 277 | 277 | |
| 278 | - } else { |
|
| 278 | + } else { |
|
| 279 | 279 | |
| 280 | - $pages = $params['row']['pages']; |
|
| 280 | + $pages = $params['row']['pages']; |
|
| 281 | 281 | |
| 282 | - } |
|
| 282 | + } |
|
| 283 | 283 | |
| 284 | - if (!empty($pages)) { |
|
| 284 | + if (!empty($pages)) { |
|
| 285 | 285 | |
| 286 | - // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. |
|
| 287 | - // i.e. instead of "18" it reads "pages_18|Title" |
|
| 288 | - if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { |
|
| 286 | + // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. |
|
| 287 | + // i.e. instead of "18" it reads "pages_18|Title" |
|
| 288 | + if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { |
|
| 289 | 289 | |
| 290 | - $parts = explode('|', $pages); |
|
| 290 | + $parts = explode('|', $pages); |
|
| 291 | 291 | |
| 292 | - $pages = array_pop(explode('_', $parts[0])); |
|
| 292 | + $pages = array_pop(explode('_', $parts[0])); |
|
| 293 | 293 | |
| 294 | - } |
|
| 294 | + } |
|
| 295 | 295 | |
| 296 | - if ($pages > 0) { |
|
| 296 | + if ($pages > 0) { |
|
| 297 | 297 | |
| 298 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 299 | - 'label,uid', |
|
| 300 | - 'tx_dlf_libraries', |
|
| 301 | - 'pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_libraries'), |
|
| 302 | - '', |
|
| 303 | - 'label', |
|
| 304 | - '' |
|
| 305 | - ); |
|
| 298 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 299 | + 'label,uid', |
|
| 300 | + 'tx_dlf_libraries', |
|
| 301 | + 'pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_libraries'), |
|
| 302 | + '', |
|
| 303 | + 'label', |
|
| 304 | + '' |
|
| 305 | + ); |
|
| 306 | 306 | |
| 307 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
| 307 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
| 308 | 308 | |
| 309 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { |
|
| 309 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { |
|
| 310 | 310 | |
| 311 | - $params['items'][] = $resArray; |
|
| 311 | + $params['items'][] = $resArray; |
|
| 312 | 312 | |
| 313 | - } |
|
| 313 | + } |
|
| 314 | 314 | |
| 315 | - } |
|
| 315 | + } |
|
| 316 | 316 | |
| 317 | - } |
|
| 317 | + } |
|
| 318 | 318 | |
| 319 | - } |
|
| 319 | + } |
|
| 320 | 320 | |
| 321 | - } |
|
| 321 | + } |
|
| 322 | 322 | |
| 323 | - /** |
|
| 324 | - * Helper to get flexform's items array for plugin "tx_dlf_search" |
|
| 325 | - * |
|
| 326 | - * @access public |
|
| 327 | - * |
|
| 328 | - * @param array &$params: An array with parameters |
|
| 329 | - * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
| 330 | - * |
|
| 331 | - * @return void |
|
| 332 | - */ |
|
| 333 | - public function itemsProcFunc_solrList(&$params, &$pObj) { |
|
| 323 | + /** |
|
| 324 | + * Helper to get flexform's items array for plugin "tx_dlf_search" |
|
| 325 | + * |
|
| 326 | + * @access public |
|
| 327 | + * |
|
| 328 | + * @param array &$params: An array with parameters |
|
| 329 | + * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
| 330 | + * |
|
| 331 | + * @return void |
|
| 332 | + */ |
|
| 333 | + public function itemsProcFunc_solrList(&$params, &$pObj) { |
|
| 334 | 334 | |
| 335 | - // the access to pi_flexform data has changed in TYPO3 7.6 |
|
| 336 | - if (version_compare(TYPO3_version, '7.6', '<')) { |
|
| 335 | + // the access to pi_flexform data has changed in TYPO3 7.6 |
|
| 336 | + if (version_compare(TYPO3_version, '7.6', '<')) { |
|
| 337 | 337 | |
| 338 | - if ($params['row']['pi_flexform']) { |
|
| 338 | + if ($params['row']['pi_flexform']) { |
|
| 339 | 339 | |
| 340 | - $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); |
|
| 340 | + $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); |
|
| 341 | 341 | |
| 342 | - $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; |
|
| 342 | + $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; |
|
| 343 | 343 | |
| 344 | - } |
|
| 344 | + } |
|
| 345 | 345 | |
| 346 | - } else { |
|
| 346 | + } else { |
|
| 347 | 347 | |
| 348 | - $pages = $params['row']['pages']; |
|
| 348 | + $pages = $params['row']['pages']; |
|
| 349 | 349 | |
| 350 | - } |
|
| 350 | + } |
|
| 351 | 351 | |
| 352 | - if (!empty($pages)) { |
|
| 352 | + if (!empty($pages)) { |
|
| 353 | 353 | |
| 354 | - // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. |
|
| 355 | - // i.e. instead of "18" it reads "pages_18|Title" |
|
| 356 | - if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { |
|
| 354 | + // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. |
|
| 355 | + // i.e. instead of "18" it reads "pages_18|Title" |
|
| 356 | + if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { |
|
| 357 | 357 | |
| 358 | - $parts = explode('|', $pages); |
|
| 358 | + $parts = explode('|', $pages); |
|
| 359 | 359 | |
| 360 | - $pages = array_pop(explode('_', $parts[0])); |
|
| 360 | + $pages = array_pop(explode('_', $parts[0])); |
|
| 361 | 361 | |
| 362 | - } |
|
| 362 | + } |
|
| 363 | 363 | |
| 364 | - if ($pages > 0) { |
|
| 364 | + if ($pages > 0) { |
|
| 365 | 365 | |
| 366 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 367 | - 'label,uid', |
|
| 368 | - 'tx_dlf_solrcores', |
|
| 369 | - 'pid IN ('.intval($pages).',0)'.tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
|
| 370 | - '', |
|
| 371 | - 'label', |
|
| 372 | - '' |
|
| 373 | - ); |
|
| 366 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 367 | + 'label,uid', |
|
| 368 | + 'tx_dlf_solrcores', |
|
| 369 | + 'pid IN ('.intval($pages).',0)'.tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
|
| 370 | + '', |
|
| 371 | + 'label', |
|
| 372 | + '' |
|
| 373 | + ); |
|
| 374 | 374 | |
| 375 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
| 375 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
| 376 | 376 | |
| 377 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { |
|
| 377 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { |
|
| 378 | 378 | |
| 379 | - $params['items'][] = $resArray; |
|
| 379 | + $params['items'][] = $resArray; |
|
| 380 | 380 | |
| 381 | - } |
|
| 381 | + } |
|
| 382 | 382 | |
| 383 | - } |
|
| 383 | + } |
|
| 384 | 384 | |
| 385 | - } |
|
| 385 | + } |
|
| 386 | 386 | |
| 387 | - } |
|
| 387 | + } |
|
| 388 | 388 | |
| 389 | - } |
|
| 389 | + } |
|
| 390 | 390 | |
| 391 | - /** |
|
| 392 | - * Helper to get flexform's items array for plugin "tx_dlf_toolbox" |
|
| 393 | - * |
|
| 394 | - * @access public |
|
| 395 | - * |
|
| 396 | - * @param array &$params: An array with parameters |
|
| 397 | - * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
| 398 | - * |
|
| 399 | - * @return void |
|
| 400 | - */ |
|
| 401 | - public function itemsProcFunc_toolList(&$params, &$pObj) { |
|
| 391 | + /** |
|
| 392 | + * Helper to get flexform's items array for plugin "tx_dlf_toolbox" |
|
| 393 | + * |
|
| 394 | + * @access public |
|
| 395 | + * |
|
| 396 | + * @param array &$params: An array with parameters |
|
| 397 | + * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
|
| 398 | + * |
|
| 399 | + * @return void |
|
| 400 | + */ |
|
| 401 | + public function itemsProcFunc_toolList(&$params, &$pObj) { |
|
| 402 | 402 | |
| 403 | - foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/plugins/toolbox/tools'] as $class => $label) { |
|
| 403 | + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/plugins/toolbox/tools'] as $class => $label) { |
|
| 404 | 404 | |
| 405 | - $params['items'][] = array ($GLOBALS['LANG']->sL($label), $class); |
|
| 405 | + $params['items'][] = array ($GLOBALS['LANG']->sL($label), $class); |
|
| 406 | 406 | |
| 407 | - } |
|
| 407 | + } |
|
| 408 | 408 | |
| 409 | - } |
|
| 409 | + } |
|
| 410 | 410 | |
| 411 | 411 | } |
@@ -20,61 +20,61 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | class tx_dlf_doctype { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * This holds the current document |
|
| 25 | - * |
|
| 26 | - * @var tx_dlf_document |
|
| 27 | - * @access protected |
|
| 28 | - */ |
|
| 29 | - protected $doc; |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * This holds the extension key |
|
| 33 | - * |
|
| 34 | - * @var string |
|
| 35 | - * @access protected |
|
| 36 | - */ |
|
| 37 | - protected $extKey = 'dlf'; |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * This holds the current DLF plugin parameters |
|
| 41 | - * @see __contruct() |
|
| 42 | - * |
|
| 43 | - * @var array |
|
| 44 | - * @access protected |
|
| 45 | - */ |
|
| 46 | - protected $piVars = array (); |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * This holds the DLF parameter prefix |
|
| 50 | - * |
|
| 51 | - * @var string |
|
| 52 | - * @access protected |
|
| 53 | - */ |
|
| 54 | - protected $prefixId = 'tx_dlf'; |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * Check the current document's type. |
|
| 58 | - * |
|
| 59 | - * @access public |
|
| 60 | - * |
|
| 61 | - * @return string The type of the current document |
|
| 62 | - */ |
|
| 63 | - public function getDocType() { |
|
| 64 | - |
|
| 65 | - // Load current document. |
|
| 66 | - $this->loadDocument(); |
|
| 67 | - |
|
| 68 | - if ($this->doc === NULL) { |
|
| 69 | - |
|
| 70 | - // Quit without doing anything if document not available. |
|
| 71 | - return ''; |
|
| 72 | - |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - $toc = $this->doc->tableOfContents; |
|
| 76 | - |
|
| 77 | - /* |
|
| 23 | + /** |
|
| 24 | + * This holds the current document |
|
| 25 | + * |
|
| 26 | + * @var tx_dlf_document |
|
| 27 | + * @access protected |
|
| 28 | + */ |
|
| 29 | + protected $doc; |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * This holds the extension key |
|
| 33 | + * |
|
| 34 | + * @var string |
|
| 35 | + * @access protected |
|
| 36 | + */ |
|
| 37 | + protected $extKey = 'dlf'; |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * This holds the current DLF plugin parameters |
|
| 41 | + * @see __contruct() |
|
| 42 | + * |
|
| 43 | + * @var array |
|
| 44 | + * @access protected |
|
| 45 | + */ |
|
| 46 | + protected $piVars = array (); |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * This holds the DLF parameter prefix |
|
| 50 | + * |
|
| 51 | + * @var string |
|
| 52 | + * @access protected |
|
| 53 | + */ |
|
| 54 | + protected $prefixId = 'tx_dlf'; |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * Check the current document's type. |
|
| 58 | + * |
|
| 59 | + * @access public |
|
| 60 | + * |
|
| 61 | + * @return string The type of the current document |
|
| 62 | + */ |
|
| 63 | + public function getDocType() { |
|
| 64 | + |
|
| 65 | + // Load current document. |
|
| 66 | + $this->loadDocument(); |
|
| 67 | + |
|
| 68 | + if ($this->doc === NULL) { |
|
| 69 | + |
|
| 70 | + // Quit without doing anything if document not available. |
|
| 71 | + return ''; |
|
| 72 | + |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + $toc = $this->doc->tableOfContents; |
|
| 76 | + |
|
| 77 | + /* |
|
| 78 | 78 | * Get the document type |
| 79 | 79 | * |
| 80 | 80 | * 1. newspaper |
@@ -88,145 +88,145 @@ discard block |
||
| 88 | 88 | * - children array([0]) --> type = month |
| 89 | 89 | * - children array([0], [1], [2], ...) --> type = day --> Issue |
| 90 | 90 | */ |
| 91 | - switch ($toc[0]['type']) { |
|
| 91 | + switch ($toc[0]['type']) { |
|
| 92 | 92 | |
| 93 | - case 'newspaper': |
|
| 93 | + case 'newspaper': |
|
| 94 | 94 | |
| 95 | - $nodes_year = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]'); |
|
| 95 | + $nodes_year = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]'); |
|
| 96 | 96 | |
| 97 | - if (count($nodes_year) > 1) { |
|
| 97 | + if (count($nodes_year) > 1) { |
|
| 98 | 98 | |
| 99 | - // Multiple years means this is a newspaper's anchor file. |
|
| 100 | - return 'newspaper'; |
|
| 99 | + // Multiple years means this is a newspaper's anchor file. |
|
| 100 | + return 'newspaper'; |
|
| 101 | 101 | |
| 102 | - } else { |
|
| 102 | + } else { |
|
| 103 | 103 | |
| 104 | - $nodes_month = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]/mets:div[@TYPE="month"]'); |
|
| 104 | + $nodes_month = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]/mets:div[@TYPE="month"]'); |
|
| 105 | 105 | |
| 106 | - $nodes_day = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]/mets:div[@TYPE="month"]/mets:div[@TYPE="day"]'); |
|
| 106 | + $nodes_day = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]/mets:div[@TYPE="month"]/mets:div[@TYPE="day"]'); |
|
| 107 | 107 | |
| 108 | - $nodes_issue = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]//mets:div[@TYPE="issue"]'); |
|
| 108 | + $nodes_issue = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]//mets:div[@TYPE="issue"]'); |
|
| 109 | 109 | |
| 110 | - $nodes_issue_current = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]//mets:div[@TYPE="issue"]/@DMDID'); |
|
| 110 | + $nodes_issue_current = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]//mets:div[@TYPE="issue"]/@DMDID'); |
|
| 111 | 111 | |
| 112 | - if (count($nodes_year) == 1 && count($nodes_issue) == 0) { |
|
| 112 | + if (count($nodes_year) == 1 && count($nodes_issue) == 0) { |
|
| 113 | 113 | |
| 114 | - // It's possible to have only one year in the newspaper's anchor file. |
|
| 115 | - return 'newspaper'; |
|
| 114 | + // It's possible to have only one year in the newspaper's anchor file. |
|
| 115 | + return 'newspaper'; |
|
| 116 | 116 | |
| 117 | - } elseif (count($nodes_year) == 1 && count($nodes_month) > 1) { |
|
| 117 | + } elseif (count($nodes_year) == 1 && count($nodes_month) > 1) { |
|
| 118 | 118 | |
| 119 | - // One year, multiple months means this is a year's anchor file. |
|
| 120 | - return 'year'; |
|
| 119 | + // One year, multiple months means this is a year's anchor file. |
|
| 120 | + return 'year'; |
|
| 121 | 121 | |
| 122 | - } elseif (count($nodes_year) == 1 && count($nodes_month) == 1 && count($nodes_day) > 1) { |
|
| 122 | + } elseif (count($nodes_year) == 1 && count($nodes_month) == 1 && count($nodes_day) > 1) { |
|
| 123 | 123 | |
| 124 | - // One year, one month, one or more days means this is a year's anchor file. |
|
| 125 | - return 'year'; |
|
| 124 | + // One year, one month, one or more days means this is a year's anchor file. |
|
| 125 | + return 'year'; |
|
| 126 | 126 | |
| 127 | - } elseif (count($nodes_year) == 1 && count($nodes_month) == 1 && count($nodes_day) == 1 && count($nodes_issue_current) == 0) { |
|
| 127 | + } elseif (count($nodes_year) == 1 && count($nodes_month) == 1 && count($nodes_day) == 1 && count($nodes_issue_current) == 0) { |
|
| 128 | 128 | |
| 129 | - // One year, one month, a single day, one or more issues (but not the current one) means this is a year's anchor file. |
|
| 130 | - return 'year'; |
|
| 129 | + // One year, one month, a single day, one or more issues (but not the current one) means this is a year's anchor file. |
|
| 130 | + return 'year'; |
|
| 131 | 131 | |
| 132 | - } else { |
|
| 132 | + } else { |
|
| 133 | 133 | |
| 134 | - // In all other cases we assume it's newspaper's issue. |
|
| 135 | - return 'issue'; |
|
| 134 | + // In all other cases we assume it's newspaper's issue. |
|
| 135 | + return 'issue'; |
|
| 136 | 136 | |
| 137 | - } |
|
| 137 | + } |
|
| 138 | 138 | |
| 139 | - } |
|
| 139 | + } |
|
| 140 | 140 | |
| 141 | - break; |
|
| 141 | + break; |
|
| 142 | 142 | |
| 143 | - default: |
|
| 143 | + default: |
|
| 144 | 144 | |
| 145 | - return $toc[0]['type']; |
|
| 145 | + return $toc[0]['type']; |
|
| 146 | 146 | |
| 147 | - } |
|
| 147 | + } |
|
| 148 | 148 | |
| 149 | - } |
|
| 149 | + } |
|
| 150 | 150 | |
| 151 | - /** |
|
| 152 | - * Loads the current document into $this->doc |
|
| 153 | - * |
|
| 154 | - * @access protected |
|
| 155 | - * |
|
| 156 | - * @return void |
|
| 157 | - */ |
|
| 158 | - protected function loadDocument() { |
|
| 151 | + /** |
|
| 152 | + * Loads the current document into $this->doc |
|
| 153 | + * |
|
| 154 | + * @access protected |
|
| 155 | + * |
|
| 156 | + * @return void |
|
| 157 | + */ |
|
| 158 | + protected function loadDocument() { |
|
| 159 | 159 | |
| 160 | - // Check for required variable. |
|
| 161 | - if (!empty($this->piVars['id'])) { |
|
| 160 | + // Check for required variable. |
|
| 161 | + if (!empty($this->piVars['id'])) { |
|
| 162 | 162 | |
| 163 | - // Get instance of tx_dlf_document. |
|
| 164 | - $this->doc =& tx_dlf_document::getInstance($this->piVars['id']); |
|
| 163 | + // Get instance of tx_dlf_document. |
|
| 164 | + $this->doc =& tx_dlf_document::getInstance($this->piVars['id']); |
|
| 165 | 165 | |
| 166 | - if (!$this->doc->ready) { |
|
| 166 | + if (!$this->doc->ready) { |
|
| 167 | 167 | |
| 168 | - // Destroy the incomplete object. |
|
| 169 | - $this->doc = NULL; |
|
| 168 | + // Destroy the incomplete object. |
|
| 169 | + $this->doc = NULL; |
|
| 170 | 170 | |
| 171 | - if (TYPO3_DLOG) { |
|
| 171 | + if (TYPO3_DLOG) { |
|
| 172 | 172 | |
| 173 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_doctype->loadDocument()] Failed to load document with UID "'.$this->piVars['id'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
| 173 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_doctype->loadDocument()] Failed to load document with UID "'.$this->piVars['id'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
| 174 | 174 | |
| 175 | - } |
|
| 175 | + } |
|
| 176 | 176 | |
| 177 | - } |
|
| 177 | + } |
|
| 178 | 178 | |
| 179 | - } elseif (!empty($this->piVars['recordId'])) { |
|
| 179 | + } elseif (!empty($this->piVars['recordId'])) { |
|
| 180 | 180 | |
| 181 | - // Get UID of document with given record identifier. |
|
| 182 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 183 | - 'tx_dlf_documents.uid', |
|
| 184 | - 'tx_dlf_documents', |
|
| 185 | - 'tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['recordId'], 'tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
| 186 | - '', |
|
| 187 | - '', |
|
| 188 | - '1' |
|
| 189 | - ); |
|
| 181 | + // Get UID of document with given record identifier. |
|
| 182 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
| 183 | + 'tx_dlf_documents.uid', |
|
| 184 | + 'tx_dlf_documents', |
|
| 185 | + 'tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['recordId'], 'tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
| 186 | + '', |
|
| 187 | + '', |
|
| 188 | + '1' |
|
| 189 | + ); |
|
| 190 | 190 | |
| 191 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) == 1) { |
|
| 191 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) == 1) { |
|
| 192 | 192 | |
| 193 | - list ($this->piVars['id']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
| 193 | + list ($this->piVars['id']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
| 194 | 194 | |
| 195 | - // Set superglobal $_GET array. |
|
| 196 | - $_GET[$this->prefixId]['id'] = $this->piVars['id']; |
|
| 195 | + // Set superglobal $_GET array. |
|
| 196 | + $_GET[$this->prefixId]['id'] = $this->piVars['id']; |
|
| 197 | 197 | |
| 198 | - // Unset variable to avoid infinite looping. |
|
| 199 | - unset ($this->piVars['recordId'], $_GET[$this->prefixId]['recordId']); |
|
| 198 | + // Unset variable to avoid infinite looping. |
|
| 199 | + unset ($this->piVars['recordId'], $_GET[$this->prefixId]['recordId']); |
|
| 200 | 200 | |
| 201 | - // Try to load document. |
|
| 202 | - $this->loadDocument(); |
|
| 201 | + // Try to load document. |
|
| 202 | + $this->loadDocument(); |
|
| 203 | 203 | |
| 204 | - } else { |
|
| 204 | + } else { |
|
| 205 | 205 | |
| 206 | - if (TYPO3_DLOG) { |
|
| 206 | + if (TYPO3_DLOG) { |
|
| 207 | 207 | |
| 208 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_doctype->loadDocument()] Failed to load document with record ID "'.$this->piVars['recordId'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
| 208 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_doctype->loadDocument()] Failed to load document with record ID "'.$this->piVars['recordId'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
| 209 | 209 | |
| 210 | - } |
|
| 210 | + } |
|
| 211 | 211 | |
| 212 | - } |
|
| 212 | + } |
|
| 213 | 213 | |
| 214 | - } |
|
| 214 | + } |
|
| 215 | 215 | |
| 216 | - } |
|
| 216 | + } |
|
| 217 | 217 | |
| 218 | - /** |
|
| 219 | - * Initializes the hook by setting initial variables. |
|
| 220 | - * |
|
| 221 | - * @access public |
|
| 222 | - * |
|
| 223 | - * @return void |
|
| 224 | - */ |
|
| 225 | - public function __construct() { |
|
| 218 | + /** |
|
| 219 | + * Initializes the hook by setting initial variables. |
|
| 220 | + * |
|
| 221 | + * @access public |
|
| 222 | + * |
|
| 223 | + * @return void |
|
| 224 | + */ |
|
| 225 | + public function __construct() { |
|
| 226 | 226 | |
| 227 | - // Load current plugin parameters. |
|
| 228 | - $this->piVars = \TYPO3\CMS\Core\Utility\GeneralUtility::_GPmerged($this->prefixId); |
|
| 227 | + // Load current plugin parameters. |
|
| 228 | + $this->piVars = \TYPO3\CMS\Core\Utility\GeneralUtility::_GPmerged($this->prefixId); |
|
| 229 | 229 | |
| 230 | - } |
|
| 230 | + } |
|
| 231 | 231 | |
| 232 | 232 | } |
@@ -161,7 +161,7 @@ |
||
| 161 | 161 | if (!empty($this->piVars['id'])) { |
| 162 | 162 | |
| 163 | 163 | // Get instance of tx_dlf_document. |
| 164 | - $this->doc =& tx_dlf_document::getInstance($this->piVars['id']); |
|
| 164 | + $this->doc = & tx_dlf_document::getInstance($this->piVars['id']); |
|
| 165 | 165 | |
| 166 | 166 | if (!$this->doc->ready) { |
| 167 | 167 | |
@@ -10,32 +10,32 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | $EM_CONF[$_EXTKEY] = array( |
| 13 | - 'title' => 'Kitodo.Presentation', |
|
| 14 | - 'description' => 'Base plugins, modules, services and API of the Digital Library Framework. It is part of the community-based Kitodo Digitization Suite.', |
|
| 15 | - 'category' => 'fe', |
|
| 16 | - 'author' => 'Kitodo. Key to digital objects e.V.', |
|
| 17 | - 'author_email' => '[email protected]', |
|
| 18 | - 'author_company' => '<br /><a href="http://www.kitodo.org/" target="_blank">Kitodo.org</a><br /><a href="https://github.com/kitodo" target="_blank">Kitodo on GitHub</a>', |
|
| 19 | - 'shy' => '', |
|
| 20 | - 'priority' => '', |
|
| 21 | - 'module' => '', |
|
| 22 | - 'state' => 'stable', |
|
| 23 | - 'internal' => '', |
|
| 24 | - 'uploadfolder' => TRUE, |
|
| 25 | - 'createDirs' => '', |
|
| 26 | - 'modify_tables' => '', |
|
| 27 | - 'clearCacheOnLoad' => FALSE, |
|
| 28 | - 'lockType' => '', |
|
| 29 | - 'version' => '2.1.0', |
|
| 30 | - 'constraints' => array( |
|
| 31 | - 'depends' => array( |
|
| 32 | - 'php' => '5.3.7-', |
|
| 33 | - 'typo3' => '6.2.0-7.9.99', |
|
| 34 | - ), |
|
| 35 | - 'conflicts' => array( |
|
| 36 | - ), |
|
| 37 | - 'suggests' => array( |
|
| 38 | - ), |
|
| 39 | - ), |
|
| 40 | - '_md5_values_when_last_written' => '', |
|
| 13 | + 'title' => 'Kitodo.Presentation', |
|
| 14 | + 'description' => 'Base plugins, modules, services and API of the Digital Library Framework. It is part of the community-based Kitodo Digitization Suite.', |
|
| 15 | + 'category' => 'fe', |
|
| 16 | + 'author' => 'Kitodo. Key to digital objects e.V.', |
|
| 17 | + 'author_email' => '[email protected]', |
|
| 18 | + 'author_company' => '<br /><a href="http://www.kitodo.org/" target="_blank">Kitodo.org</a><br /><a href="https://github.com/kitodo" target="_blank">Kitodo on GitHub</a>', |
|
| 19 | + 'shy' => '', |
|
| 20 | + 'priority' => '', |
|
| 21 | + 'module' => '', |
|
| 22 | + 'state' => 'stable', |
|
| 23 | + 'internal' => '', |
|
| 24 | + 'uploadfolder' => TRUE, |
|
| 25 | + 'createDirs' => '', |
|
| 26 | + 'modify_tables' => '', |
|
| 27 | + 'clearCacheOnLoad' => FALSE, |
|
| 28 | + 'lockType' => '', |
|
| 29 | + 'version' => '2.1.0', |
|
| 30 | + 'constraints' => array( |
|
| 31 | + 'depends' => array( |
|
| 32 | + 'php' => '5.3.7-', |
|
| 33 | + 'typo3' => '6.2.0-7.9.99', |
|
| 34 | + ), |
|
| 35 | + 'conflicts' => array( |
|
| 36 | + ), |
|
| 37 | + 'suggests' => array( |
|
| 38 | + ), |
|
| 39 | + ), |
|
| 40 | + '_md5_values_when_last_written' => '', |
|
| 41 | 41 | ); |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * LICENSE.txt file that was distributed with this source code. |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -$EM_CONF[$_EXTKEY] = array( |
|
| 12 | +$EM_CONF[$_EXTKEY] = array ( |
|
| 13 | 13 | 'title' => 'Kitodo.Presentation', |
| 14 | 14 | 'description' => 'Base plugins, modules, services and API of the Digital Library Framework. It is part of the community-based Kitodo Digitization Suite.', |
| 15 | 15 | 'category' => 'fe', |
@@ -27,14 +27,14 @@ discard block |
||
| 27 | 27 | 'clearCacheOnLoad' => FALSE, |
| 28 | 28 | 'lockType' => '', |
| 29 | 29 | 'version' => '2.1.0', |
| 30 | - 'constraints' => array( |
|
| 31 | - 'depends' => array( |
|
| 30 | + 'constraints' => array ( |
|
| 31 | + 'depends' => array ( |
|
| 32 | 32 | 'php' => '5.3.7-', |
| 33 | 33 | 'typo3' => '6.2.0-7.9.99', |
| 34 | 34 | ), |
| 35 | - 'conflicts' => array( |
|
| 35 | + 'conflicts' => array ( |
|
| 36 | 36 | ), |
| 37 | - 'suggests' => array( |
|
| 37 | + 'suggests' => array ( |
|
| 38 | 38 | ), |
| 39 | 39 | ), |
| 40 | 40 | '_md5_values_when_last_written' => '', |
@@ -210,13 +210,13 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | if ($GLOBALS['TYPO3_DB']->sql_num_rows($resultMail) > 0) { |
| 212 | 212 | |
| 213 | - $mails = array(); |
|
| 213 | + $mails = array (); |
|
| 214 | 214 | |
| 215 | 215 | $mailForm = '<select name="tx_dlf[mail_action]">'; |
| 216 | 216 | |
| 217 | 217 | $mailForm .= '<option value="">'.$this->pi_getLL('chooseMail', '', TRUE).'</option>'; |
| 218 | 218 | |
| 219 | - while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultMail)){ |
|
| 219 | + while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultMail)) { |
|
| 220 | 220 | |
| 221 | 221 | $mails[] = $row; |
| 222 | 222 | |
@@ -255,13 +255,13 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | if ($GLOBALS['TYPO3_DB']->sql_num_rows($resultPrinter) > 0) { |
| 257 | 257 | |
| 258 | - $printers = array(); |
|
| 258 | + $printers = array (); |
|
| 259 | 259 | |
| 260 | 260 | $printForm = '<select name="tx_dlf[print_action]">'; |
| 261 | 261 | |
| 262 | 262 | $printForm .= '<option value="">'.$this->pi_getLL('choosePrinter', '', TRUE).'</option>'; |
| 263 | 263 | |
| 264 | - while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultPrinter)){ |
|
| 264 | + while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultPrinter)) { |
|
| 265 | 265 | |
| 266 | 266 | $printers[] = $row; |
| 267 | 267 | |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | |
| 415 | 415 | if ($page != null || $_piVars['addToBasket'] == 'list') { |
| 416 | 416 | |
| 417 | - $documentItem = array( |
|
| 417 | + $documentItem = array ( |
|
| 418 | 418 | 'id' => intval($_piVars['id']), |
| 419 | 419 | 'startpage' => intval($_piVars['startpage']), |
| 420 | 420 | 'endpage' => intval($_piVars['endpage']), |
@@ -434,12 +434,12 @@ discard block |
||
| 434 | 434 | |
| 435 | 435 | } else { |
| 436 | 436 | |
| 437 | - $items = array(); |
|
| 437 | + $items = array (); |
|
| 438 | 438 | |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | // get document instance to load further information |
| 442 | - $document = tx_dlf_document::getInstance($documentItem['id'],0); |
|
| 442 | + $document = tx_dlf_document::getInstance($documentItem['id'], 0); |
|
| 443 | 443 | |
| 444 | 444 | // set endpage for toc and subentry based on logid |
| 445 | 445 | if (($_piVars['addToBasket'] == 'subentry') OR ($_piVars['addToBasket'] == 'toc')) { |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | - $update = array('doc_ids' => json_encode($items)); |
|
| 526 | + $update = array ('doc_ids' => json_encode($items)); |
|
| 527 | 527 | |
| 528 | 528 | $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_dlf_basket', 'uid='.intval($basketData['uid']), $update); |
| 529 | 529 | |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | - return array('basketData' => $basketData, 'jsOutput' => $output); |
|
| 534 | + return array ('basketData' => $basketData, 'jsOutput' => $output); |
|
| 535 | 535 | |
| 536 | 536 | } |
| 537 | 537 | |
@@ -581,11 +581,11 @@ discard block |
||
| 581 | 581 | |
| 582 | 582 | if (empty($items)) { |
| 583 | 583 | |
| 584 | - $update = array('doc_ids' => ''); |
|
| 584 | + $update = array ('doc_ids' => ''); |
|
| 585 | 585 | |
| 586 | 586 | } else { |
| 587 | 587 | |
| 588 | - $update = array('doc_ids' => json_encode($items)); |
|
| 588 | + $update = array ('doc_ids' => json_encode($items)); |
|
| 589 | 589 | |
| 590 | 590 | } |
| 591 | 591 | |
@@ -639,7 +639,7 @@ discard block |
||
| 639 | 639 | public function getDocumentData($id, $data) { |
| 640 | 640 | |
| 641 | 641 | // get document instance to load further information |
| 642 | - $document = tx_dlf_document::getInstance($id,0); |
|
| 642 | + $document = tx_dlf_document::getInstance($id, 0); |
|
| 643 | 643 | |
| 644 | 644 | if ($document) { |
| 645 | 645 | |
@@ -714,7 +714,7 @@ discard block |
||
| 714 | 714 | |
| 715 | 715 | } |
| 716 | 716 | |
| 717 | - return array( |
|
| 717 | + return array ( |
|
| 718 | 718 | 'downloadUrl' => $downloadUrl, |
| 719 | 719 | 'downloadLink' => $downloadLink, |
| 720 | 720 | 'pageNums' => $pageNums, |
@@ -800,7 +800,7 @@ discard block |
||
| 800 | 800 | ->setFrom($from) |
| 801 | 801 | |
| 802 | 802 | // Set the To addresses with an associative array |
| 803 | - ->setTo(array($mailData['mail'] => $mailData['name'])) |
|
| 803 | + ->setTo(array ($mailData['mail'] => $mailData['name'])) |
|
| 804 | 804 | |
| 805 | 805 | ->setBody($body, 'text/html') |
| 806 | 806 | |
@@ -808,7 +808,7 @@ discard block |
||
| 808 | 808 | ; |
| 809 | 809 | |
| 810 | 810 | // protocol |
| 811 | - $insertArray = array( |
|
| 811 | + $insertArray = array ( |
|
| 812 | 812 | 'pid' => $this->conf['pages'], |
| 813 | 813 | 'file_name' => $pdfUrl, |
| 814 | 814 | 'count_pages' => $numberOfPages, |
@@ -908,7 +908,7 @@ discard block |
||
| 908 | 908 | } |
| 909 | 909 | |
| 910 | 910 | // protocol |
| 911 | - $insertArray = array( |
|
| 911 | + $insertArray = array ( |
|
| 912 | 912 | 'pid' => $this->conf['pages'], |
| 913 | 913 | 'file_name' => $pdfUrl, |
| 914 | 914 | 'count_pages' => $numberOfPages, |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | |
| 217 | 217 | $mailForm .= '<option value="">'.$this->pi_getLL('chooseMail', '', TRUE).'</option>'; |
| 218 | 218 | |
| 219 | - while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultMail)){ |
|
| 219 | + while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultMail)) { |
|
| 220 | 220 | |
| 221 | 221 | $mails[] = $row; |
| 222 | 222 | |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | $printForm .= '<option value="">'.$this->pi_getLL('choosePrinter', '', TRUE).'</option>'; |
| 263 | 263 | |
| 264 | - while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultPrinter)){ |
|
| 264 | + while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultPrinter)) { |
|
| 265 | 265 | |
| 266 | 266 | $printers[] = $row; |
| 267 | 267 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | $GLOBALS['TSFE']->fe_user->setKey('ses', 'tx_dlf_basket', ''); |
| 75 | 75 | |
| 76 | - $GLOBALS['TSFE']->fe_user->sesData_change = true; |
|
| 76 | + $GLOBALS['TSFE']->fe_user->sesData_change = TRUE; |
|
| 77 | 77 | |
| 78 | 78 | $GLOBALS['TSFE']->fe_user->storeSessionData(); |
| 79 | 79 | |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | - if ($page != null || $_piVars['addToBasket'] == 'list') { |
|
| 415 | + if ($page != NULL || $_piVars['addToBasket'] == 'list') { |
|
| 416 | 416 | |
| 417 | 417 | $documentItem = array( |
| 418 | 418 | 'id' => intval($_piVars['id']), |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | $document = tx_dlf_document::getInstance($documentItem['id'],0); |
| 443 | 443 | |
| 444 | 444 | // set endpage for toc and subentry based on logid |
| 445 | - if (($_piVars['addToBasket'] == 'subentry') OR ($_piVars['addToBasket'] == 'toc')) { |
|
| 445 | + if (($_piVars['addToBasket'] == 'subentry') or ($_piVars['addToBasket'] == 'toc')) { |
|
| 446 | 446 | |
| 447 | 447 | $smLinks = $document->smLinks; |
| 448 | 448 | |
@@ -724,7 +724,7 @@ discard block |
||
| 724 | 724 | |
| 725 | 725 | } |
| 726 | 726 | |
| 727 | - return false; |
|
| 727 | + return FALSE; |
|
| 728 | 728 | |
| 729 | 729 | } |
| 730 | 730 | |
@@ -19,61 +19,61 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class tx_dlf_validator extends tx_dlf_plugin { |
| 21 | 21 | |
| 22 | - public $scriptRelPath = 'plugins/validator/class.tx_dlf_validator.php'; |
|
| 22 | + public $scriptRelPath = 'plugins/validator/class.tx_dlf_validator.php'; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * The main method of the PlugIn |
|
| 26 | - * |
|
| 27 | - * @access public |
|
| 28 | - * |
|
| 29 | - * @param string $content: The PlugIn content |
|
| 30 | - * @param array $conf: The PlugIn configuration |
|
| 31 | - * |
|
| 32 | - * @return string The content that is displayed on the website |
|
| 33 | - */ |
|
| 34 | - public function main($content, $conf) { |
|
| 24 | + /** |
|
| 25 | + * The main method of the PlugIn |
|
| 26 | + * |
|
| 27 | + * @access public |
|
| 28 | + * |
|
| 29 | + * @param string $content: The PlugIn content |
|
| 30 | + * @param array $conf: The PlugIn configuration |
|
| 31 | + * |
|
| 32 | + * @return string The content that is displayed on the website |
|
| 33 | + */ |
|
| 34 | + public function main($content, $conf) { |
|
| 35 | 35 | |
| 36 | - $this->init($conf); |
|
| 36 | + $this->init($conf); |
|
| 37 | 37 | |
| 38 | - // Disable caching for this plugin. |
|
| 39 | - $this->setCache(FALSE); |
|
| 38 | + // Disable caching for this plugin. |
|
| 39 | + $this->setCache(FALSE); |
|
| 40 | 40 | |
| 41 | - // Load template file. |
|
| 42 | - if (!empty($this->conf['templateFile'])) { |
|
| 41 | + // Load template file. |
|
| 42 | + if (!empty($this->conf['templateFile'])) { |
|
| 43 | 43 | |
| 44 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
| 44 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
| 45 | 45 | |
| 46 | - } else { |
|
| 46 | + } else { |
|
| 47 | 47 | |
| 48 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/validator/template.tmpl'), '###TEMPLATE###'); |
|
| 48 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/validator/template.tmpl'), '###TEMPLATE###'); |
|
| 49 | 49 | |
| 50 | - } |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - // Load current document. |
|
| 53 | - $this->loadDocument(); |
|
| 52 | + // Load current document. |
|
| 53 | + $this->loadDocument(); |
|
| 54 | 54 | |
| 55 | - if ($this->doc === NULL) { |
|
| 55 | + if ($this->doc === NULL) { |
|
| 56 | 56 | |
| 57 | - // Document could not be loaded. |
|
| 58 | - // Check: |
|
| 59 | - // - if document location is valid URL |
|
| 60 | - // - if document location is reachable |
|
| 61 | - // - if document is well-formed XML |
|
| 62 | - // - if document has METS node |
|
| 57 | + // Document could not be loaded. |
|
| 58 | + // Check: |
|
| 59 | + // - if document location is valid URL |
|
| 60 | + // - if document location is reachable |
|
| 61 | + // - if document is well-formed XML |
|
| 62 | + // - if document has METS node |
|
| 63 | 63 | |
| 64 | - } else { |
|
| 64 | + } else { |
|
| 65 | 65 | |
| 66 | - // Document loaded. |
|
| 67 | - // Check: |
|
| 68 | - // - if document is valid METS document |
|
| 69 | - // - if document contains supported metadata schema |
|
| 70 | - // - if document's metadata are valid |
|
| 71 | - // - if document provides configured mandatory fields |
|
| 66 | + // Document loaded. |
|
| 67 | + // Check: |
|
| 68 | + // - if document is valid METS document |
|
| 69 | + // - if document contains supported metadata schema |
|
| 70 | + // - if document's metadata are valid |
|
| 71 | + // - if document provides configured mandatory fields |
|
| 72 | 72 | |
| 73 | - } |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - return $this->pi_wrapInBaseClass($content); |
|
| 75 | + return $this->pi_wrapInBaseClass($content); |
|
| 76 | 76 | |
| 77 | - } |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | 79 | } |
@@ -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 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | 'page' => $this->list[$number]['page'] |
| 194 | 194 | ); |
| 195 | 195 | |
| 196 | - if(!empty($this->piVars['logicalPage'])) { |
|
| 196 | + if (!empty($this->piVars['logicalPage'])) { |
|
| 197 | 197 | |
| 198 | 198 | $additionalParams['logicalPage'] = $this->piVars['logicalPage']; |
| 199 | 199 | |
@@ -318,9 +318,9 @@ discard block |
||
| 318 | 318 | 'forceAbsoluteUrl' => 1 |
| 319 | 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 | |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | 'highlight_word' => preg_replace('/\s\s+/', ';', $this->list->metadata['searchString']) |
| 438 | 438 | ); |
| 439 | 439 | |
| 440 | - if(!empty($this->piVars['logicalPage'])) { |
|
| 440 | + if (!empty($this->piVars['logicalPage'])) { |
|
| 441 | 441 | |
| 442 | 442 | $additionalParams['logicalPage'] = $this->piVars['logicalPage']; |
| 443 | 443 | |
@@ -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 | } |
@@ -131,9 +131,9 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | // Set default values if not set. |
| 133 | 133 | // $this->piVars['page'] may be integer or string (physical structure @ID) |
| 134 | - if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
| 134 | + if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
| 135 | 135 | |
| 136 | - $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); |
|
| 136 | + $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1); |
|
| 137 | 137 | |
| 138 | 138 | } else { |
| 139 | 139 | |
@@ -271,11 +271,11 @@ discard block |
||
| 271 | 271 | $markerArray['###LINKLISTVIEW###'] = $this->getLinkToListview(); |
| 272 | 272 | |
| 273 | 273 | // fill some language labels if available |
| 274 | - $markerArray['###ZOOM_IN###'] = $this->pi_getLL('zoom-in', '', TRUE); |
|
| 274 | + $markerArray['###ZOOM_IN###'] = $this->pi_getLL('zoom-in', '', TRUE); |
|
| 275 | 275 | $markerArray['###ZOOM_OUT###'] = $this->pi_getLL('zoom-out', '', TRUE); |
| 276 | 276 | $markerArray['###ZOOM_FULLSCREEN###'] = $this->pi_getLL('zoom-fullscreen', '', TRUE); |
| 277 | 277 | |
| 278 | - $markerArray['###ROTATE_LEFT###'] = $this->pi_getLL('rotate-left', '', TRUE); |
|
| 278 | + $markerArray['###ROTATE_LEFT###'] = $this->pi_getLL('rotate-left', '', TRUE); |
|
| 279 | 279 | $markerArray['###ROTATE_RIGHT###'] = $this->pi_getLL('rotate-right', '', TRUE); |
| 280 | 280 | $markerArray['###ROTATE_RESET###'] = $this->pi_getLL('rotate-reset', '', TRUE); |
| 281 | 281 | |