/** * Get possible records. * Copied from TCEform and modified. * * @param string The table name of the record * @param string The field name which this element is supposed to edit * @param array The record data array where the value(s) for the field can be found * @param array An array with additional configuration options. * @param string $checkForConfField: For which field in the foreign_table the possible records should be fetched * @return mixed Array of possible record items; false if type is "group/db", then everything could be "possible" */ function getPossibleRecords($table, $field, $row, $conf, $checkForConfField = 'foreign_selector') { // ctrl configuration from TCA: $tcaTableCtrl = $GLOBALS['TCA'][$table]['ctrl']; // Field configuration from TCA: $foreign_table = $conf['foreign_table']; $foreign_check = $conf[$checkForConfField]; $foreignConfig = $this->getPossibleRecordsSelectorConfig($conf, $foreign_check); $PA = $foreignConfig['PA']; $config = $PA['fieldConf']['config']; if ($foreignConfig['type'] == 'select') { // Getting the selector box items from the system $selItems = $this->fObj->addSelectOptionsToItemArray($this->fObj->initItemArray($PA['fieldConf']), $PA['fieldConf'], $this->fObj->setTSconfig($table, $row), $field); // Possibly filter some items: $keepItemsFunc = create_function('$value', 'return $value[1];'); $selItems = t3lib_div::keepItemsInArray($selItems, $PA['fieldTSConfig']['keepItems'], $keepItemsFunc); // Possibly add some items: $selItems = $this->fObj->addItems($selItems, $PA['fieldTSConfig']['addItems.']); if (isset($config['itemsProcFunc']) && $config['itemsProcFunc']) { $selItems = $this->fObj->procItems($selItems, $PA['fieldTSConfig']['itemsProcFunc.'], $config, $table, $row, $field); } // Possibly remove some items: $removeItems = t3lib_div::trimExplode(',', $PA['fieldTSConfig']['removeItems'], 1); foreach ($selItems as $tk => $p) { // Checking languages and authMode: $languageDeny = $tcaTableCtrl['languageField'] && !strcmp($tcaTableCtrl['languageField'], $field) && !$GLOBALS['BE_USER']->checkLanguageAccess($p[1]); $authModeDeny = $config['form_type'] == 'select' && $config['authMode'] && !$GLOBALS['BE_USER']->checkAuthMode($table, $field, $p[1], $config['authMode']); if (in_array($p[1], $removeItems) || $languageDeny || $authModeDeny) { unset($selItems[$tk]); } elseif (isset($PA['fieldTSConfig']['altLabels.'][$p[1]])) { $selItems[$tk][0] = $this->fObj->sL($PA['fieldTSConfig']['altLabels.'][$p[1]]); } // Removing doktypes with no access: if ($table . '.' . $field == 'pages.doktype') { if (!($GLOBALS['BE_USER']->isAdmin() || t3lib_div::inList($GLOBALS['BE_USER']->groupData['pagetypes_select'], $p[1]))) { unset($selItems[$tk]); } } } } else { $selItems = false; } return $selItems; }