|
<?php
|
|
|
|
namespace Cabag\CabagPatch62\RecordList;
|
|
|
|
class DatabaseRecordList extends \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList {
|
|
/**
|
|
* Creates the HTML for a reference count for the record with the UID $uid
|
|
* in the table $tableName.
|
|
*
|
|
* @param string $tableName
|
|
* @param integer $uid
|
|
* @return string HTML of reference a link, will be empty if there are no
|
|
*/
|
|
protected function createReferenceHtml($tableName, $uid) {
|
|
|
|
$rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
|
'COUNT(*) as referenceCount',
|
|
'sys_refindex',
|
|
'ref_table = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($tableName, 'sys_refindex') .
|
|
' AND ref_uid = ' . $uid . ' AND deleted = 0'
|
|
);
|
|
|
|
return $this->generateReferenceToolTip($rows, '\'' . $tableName . '\', \'' . $uid . '\'');
|
|
}
|
|
|
|
/**
|
|
* Generates HTML code for a Reference tooltip out of
|
|
* sys_refindex records you hand over
|
|
*
|
|
* @param array $references array of records from sys_refindex table
|
|
* @param string $launchViewParameter JavaScript String, which will be passed as parameters to top.launchView
|
|
* @return string
|
|
*/
|
|
protected function generateReferenceToolTip(array $references, $launchViewParameter = '') {
|
|
|
|
if (empty($references['referenceCount'])) {
|
|
$htmlCode = '-';
|
|
} else {
|
|
$htmlCode = '<a href="#"';
|
|
if ($launchViewParameter !== '') {
|
|
$htmlCode .= ' onclick="' . htmlspecialchars(('top.launchView(' . $launchViewParameter . '); return false;')) . '"';
|
|
}
|
|
$htmlCode .= ' title="' . htmlspecialchars('Show references (' . $references['referenceCount'] . ')') . '">';
|
|
$htmlCode .= $references['referenceCount'];
|
|
$htmlCode .= '</a>';
|
|
}
|
|
return $htmlCode;
|
|
}
|
|
}
|