TYPO3 CMS  TYPO3_6-2
ElementBrowserRecordList.php
Go to the documentation of this file.
1 <?php
3 
20 
28 class ElementBrowserRecordList extends \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList {
34  protected $relatingTable;
35 
41  protected $relatingField;
42 
49  public function __construct() {
50  parent::__construct();
51  $this->determineScriptUrl();
52  }
53 
63  public function listURL($altId = '', $table = -1, $exclList = '') {
64  return $this->getThisScript() . 'id=' . ($altId !== '' ? $altId : $this->id) . '&table=' . rawurlencode(($table == -1 ? $this->table : $table)) . ($this->thumbs ? '&imagemode=' . $this->thumbs : '') . ($this->searchString ? '&search_field=' . rawurlencode($this->searchString) : '') . ($this->searchLevels ? '&search_levels=' . rawurlencode($this->searchLevels) : '') . ((!$exclList || !GeneralUtility::inList($exclList, 'sortField')) && $this->sortField ? '&sortField=' . rawurlencode($this->sortField) : '') . ((!$exclList || !GeneralUtility::inList($exclList, 'sortRev')) && $this->sortRev ? '&sortRev=' . rawurlencode($this->sortRev) : '') . $this->ext_addP();
65  }
66 
73  public function ext_addP() {
74  $str = '&act=' . rawurlencode($GLOBALS['SOBE']->browser->act) . '&mode=' . rawurlencode($GLOBALS['SOBE']->browser->mode) . '&expandPage=' . rawurlencode($GLOBALS['SOBE']->browser->expandPage) . '&bparams=' . rawurlencode($GLOBALS['SOBE']->browser->bparams);
75  return $str;
76  }
77 
88  public function linkWrapItems($table, $uid, $code, $row) {
89  if (!$code) {
90  $code = '<i>[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.no_title', TRUE) . ']</i>';
91  } else {
92  $code = BackendUtility::getRecordTitlePrep($code, $this->fixedL);
93  }
94  $title = BackendUtility::getRecordTitle($table, $row, FALSE, TRUE);
95  $ficon = IconUtility::getIcon($table, $row);
96  $aOnClick = 'return insertElement(' . GeneralUtility::quoteJSvalue($table) . ', \'' . $row['uid'] . '\', \'db\', ' . GeneralUtility::quoteJSvalue($title) . ', \'\', \'\', \'' . $ficon . '\');';
97  $ATag = '<a href="#" onclick="' . $aOnClick . '">';
98  $ATag_alt = substr($ATag, 0, -4) . ',\'\',1);">';
99  $ATag_e = '</a>';
100  return $ATag . '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('addToList', TRUE) . '" alt="" />' . $ATag_e . $ATag_alt . $code . $ATag_e;
101  }
102 
110  protected function isRowListingConditionFulfilled($table, $row) {
111  $returnValue = TRUE;
112  if ($this->relatingField && $this->relatingTable) {
113  $tcaFieldConfig = $GLOBALS['TCA'][$this->relatingTable]['columns'][$this->relatingField]['config'];
114  if (is_array($tcaFieldConfig['filter'])) {
115  foreach ($tcaFieldConfig['filter'] as $filter) {
116  if (!$filter['userFunc']) {
117  continue;
118  }
119  $parameters = $filter['parameters'] ?: array();
120  $parameters['values'] = array($table . '_' . $row['uid']);
121  $parameters['tcaFieldConfig'] = $tcaFieldConfig;
122  $valueArray = GeneralUtility::callUserFunction($filter['userFunc'], $parameters, $this);
123  if (count($valueArray) === 0) {
124  $returnValue = FALSE;
125  }
126  }
127  }
128  }
129  return $returnValue;
130  }
131 
138  public function setRelatingTableAndField($tableName, $fieldName) {
139  global $TCA;
140  // Check validity of the input data and load TCA
141  if (isset($TCA[$tableName])) {
142  $this->relatingTable = $tableName;
143  if ($fieldName && isset($TCA[$tableName]['columns'][$fieldName])) {
144  $this->relatingField = $fieldName;
145  }
146  }
147  }
148 
156  public function generateList() {
157  $this->allFields = TRUE;
158  parent::generateList();
159  }
160 
161 }
$uid
Definition: server.php:36
static getRecordTitle($table, $row, $prep=FALSE, $forceResult=TRUE)
static getIcon($table, $row=array(), $shaded=FALSE)
static getRecordTitlePrep($title, $titleLength=0)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]