Add parameter to tx_dlf_helper::whereClause() to ignore hidden flag

This commit is contained in:
Sebastian Meyer 2012-08-01 15:05:47 +02:00
parent 59cf74c713
commit db56975194
2 changed files with 14 additions and 4 deletions

View File

@ -686,7 +686,7 @@ class tx_dlf_document {
$_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.xpath AS xpath,tx_dlf_metadata.xpath_sorting AS xpath_sorting,tx_dlf_metadata.is_sortable AS is_sortable,tx_dlf_metadata.default_value AS default_value',
'tx_dlf_metadata,tx_dlf_formats',
'tx_dlf_metadata.pid='.$cPid.' AND ((tx_dlf_metadata.encoded=tx_dlf_formats.uid AND tx_dlf_formats.type='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->dmdSec[$_dmdId]['type'], 'tx_dlf_formats').') OR tx_dlf_metadata.encoded=0)'.tx_dlf_helper::whereClause('tx_dlf_metadata').tx_dlf_helper::whereClause('tx_dlf_formats'),
'tx_dlf_metadata.pid='.$cPid.' AND ((tx_dlf_metadata.encoded=tx_dlf_formats.uid AND tx_dlf_formats.type='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->dmdSec[$_dmdId]['type'], 'tx_dlf_formats').') OR tx_dlf_metadata.encoded=0)'.tx_dlf_helper::whereClause('tx_dlf_metadata', TRUE).tx_dlf_helper::whereClause('tx_dlf_formats'),
'',
'',
''

View File

@ -798,10 +798,11 @@ class tx_dlf_helper {
* @access public
*
* @param string $table: Table name as defined in TCA
* @param boolean $showHidden: Ignore the hidden flag?
*
* @return string Additional WHERE clause
*/
public static function whereClause($table) {
public static function whereClause($table, $showHidden = FALSE) {
if (TYPO3_MODE === 'FE') {
@ -812,10 +813,19 @@ class tx_dlf_helper {
}
// Should we ignore the record's hidden flag?
$ignoreHide = -1;
if ($showHidden) {
$ignoreHide = 1;
}
// $GLOBALS['TSFE']->sys_page is not always available in frontend.
if (is_object($GLOBALS['TSFE']->sys_page)) {
return $GLOBALS['TSFE']->sys_page->enableFields($table);
return $GLOBALS['TSFE']->sys_page->enableFields($table, $ignoreHide);
} else {
@ -823,7 +833,7 @@ class tx_dlf_helper {
$GLOBALS['TSFE']->includeTCA();
return $t3lib_pageSelect->enableFields($table);
return $t3lib_pageSelect->enableFields($table, $ignoreHide);
}