Bug #20910 » 11764_v2.diff
t3lib/class.t3lib_recordlist.php (Arbeitskopie) | ||
---|---|---|
var $pageOverlays = array(); // Contains page translation languages
|
||
var $languageIconTitles = array(); // Contains sys language icons and titles
|
||
var $translateTools; // translateTools object
|
||
/**
|
||
* constructor for t3lib_recordList
|
||
*
|
||
... | ... | |
'sys_language_uid'
|
||
);
|
||
$t8Tools = t3lib_div::makeInstance('t3lib_transl8tools');
|
||
$this->languageIconTitles = $t8Tools->getSystemLanguages($this->id, $this->backPath);
|
||
$this->languageIconTitles = $this->translateTools->getSystemLanguages($this->id, $this->backPath);
|
||
}
|
||
/**
|
t3lib/class.t3lib_transl8tools.php (Arbeitskopie) | ||
---|---|---|
* @param string Table name
|
||
* @param integer Record uid
|
||
* @param integer Language uid. If zero, then all languages are selected.
|
||
* @param array The record to be translated
|
||
* @return array Array with information. Errors will return string with message.
|
||
*/
|
||
function translationInfo($table,$uid,$sys_language_uid=0) {
|
||
function translationInfo($table, $uid, $sys_language_uid = 0, $row = NULL) {
|
||
global $TCA;
|
||
if ($TCA[$table] && $uid) {
|
||
t3lib_div::loadTCA($table);
|
||
$row = t3lib_BEfunc::getRecordWSOL($table,$uid);
|
||
if ($row === NULL) {
|
||
$row = t3lib_BEfunc::getRecordWSOL($table, $uid);
|
||
}
|
||
if (is_array($row)) {
|
||
$trTable = $this->getTranslationTable($table);
|
||
if ($trTable) {
|
||
... | ... | |
// Look for translations of this record, index by language field value:
|
||
$translationsTemp = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
'uid,'.$TCA[$trTable]['ctrl']['languageField'],
|
||
$this->selFieldList,
|
||
$trTable,
|
||
'pid='.intval($table==='pages' ? $row['uid'] : $row['pid']). // Making exception for pages of course where the translations will always be ON the page, not on the level above...
|
||
$TCA[$trTable]['ctrl']['transOrigPointerField'] . '=' . intval($uid) .
|
||
' AND pid=' . intval($table === 'pages' ? $row['uid'] : $row['pid']). // Making exception for pages of course where the translations will always be ON the page, not on the level above...
|
||
' AND '.$TCA[$trTable]['ctrl']['languageField'].(!$sys_language_uid ? '>0' : '='.intval($sys_language_uid)).
|
||
' AND '.$TCA[$trTable]['ctrl']['transOrigPointerField'].'='.intval($uid).
|
||
t3lib_BEfunc::deleteClause($trTable).
|
||
t3lib_BEfunc::versioningPlaceholderClause($trTable)
|
||
);
|
typo3/class.db_list.inc (Arbeitskopie) | ||
---|---|---|
// Initialize languages:
|
||
if ($this->localizationView) {
|
||
$this->translateTools = t3lib_div::makeInstance('t3lib_transl8tools');
|
||
$this->initializeLanguages();
|
||
}
|
||
}
|
typo3/class.db_list_extra.inc (Arbeitskopie) | ||
---|---|---|
var $duplicateStack=array(); // Used to track which elements has duplicates and how many
|
||
var $references; // References of the current record
|
||
var $translations; // Translations of the current record
|
||
public function __construct() {
|
||
parent::__construct();
|
||
... | ... | |
$selectFields = array_unique($selectFields); // Unique list!
|
||
$selectFields = array_intersect($selectFields,$this->makeFieldList($table,1)); // Making sure that the fields in the field-list ARE in the field-list from TCA!
|
||
$selFieldList = implode(',',$selectFields); // implode it into a list of fields for the SQL-statement.
|
||
$this->translateTools->selFieldList = $selFieldList;
|
||
/**
|
||
* @hook DB-List getTable
|
||
... | ... | |
// Render item row if counter < limit
|
||
if ($cc < $this->iLimit) {
|
||
$cc++;
|
||
$this->translations = FALSE;
|
||
$iOut.= $this->renderListRow($table,$row,$cc,$titleCol,$thumbsCol);
|
||
// If localization view is enabled it means that the selected records are either default or All language and here we will not select translations which point to the main record:
|
||
if ($this->localizationView && $l10nEnabled) {
|
||
// Look for translations of this record:
|
||
$translations = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
|
||
$selFieldList,
|
||
$table,
|
||
'pid='.$row['pid'].
|
||
' AND '.$TCA[$table]['ctrl']['languageField'].'>0'.
|
||
' AND '.$TCA[$table]['ctrl']['transOrigPointerField'].'='.intval($row['uid']).
|
||
t3lib_BEfunc::deleteClause($table).
|
||
t3lib_BEfunc::versioningPlaceholderClause($table)
|
||
);
|
||
// For each available translation, render the record:
|
||
if (is_array($translations)) {
|
||
foreach($translations as $lRow) {
|
||
if (is_array($this->translations)) {
|
||
foreach ($this->translations as $lRow) {
|
||
// In offline workspace, look for alternative record:
|
||
t3lib_BEfunc::workspaceOL($table, $lRow, $GLOBALS['BE_USER']->workspace);
|
||
if (is_array($lRow) && $GLOBALS['BE_USER']->checkLanguageAccess($lRow[$TCA[$table]['ctrl']['languageField']])) {
|
||
$currentIdList[] = $lRow['uid'];
|
||
$iOut.=$this->renderListRow($table,$lRow,$cc,$titleCol,$thumbsCol,18);
|
||
... | ... | |
1 => '',
|
||
);
|
||
$t8Tools = t3lib_div::makeInstance('t3lib_transl8tools');
|
||
$translations = $t8Tools->translationInfo($table,$row['uid']);
|
||
$translations = $this->translateTools->translationInfo($table, $row['uid'], 0, $row);
|
||
$this->translations = $translations['translations'];
|
||
// Language title and icon:
|
||
$out[0] = $this->languageFlag($row[$TCA[$table]['ctrl']['languageField']]);
|