[TYPO3-german] Flexforms: Verschachtelte Auswahllisten ausgeben - ist das möglich?

Manfred Rutschmann . revier.de manfred.rutschmann at revier.de
Tue May 5 10:14:57 CEST 2009


Am Mon, 04 May 2009 20:49:22 +0200 schrieb Markus Kobligk:

> Hallo zusammen,

Hallo Markus,
> 
> 
> Hat irgendjemand einen Plan davon und hat sowas schonmal hinbekommen?
> 
> Beste Grüße,
> Markus

Gibst Du das zur Erstellung der Selektionen an eine itemsProcFunc? Aus der
TCA kannst Du das ableiten, dort habe ich das schon entsprechend gemacht,
sollte für Flexforms also kein problem sein:

		'type' => array(
			'label' => 'LLL:EXT:mr_xxx/locallang_db.xml:tx_xxx_ausstattung.type',
			'config' => array(
				'type' => 'select',
				'foreign_table' => 'tx_xxx_ausstattungsgruppe',
				'foreign_table_where' => 'ORDER BY tx_xxx_ausstattungsgruppe.uid',
				'MM' => 'tx_xxx_ausstattungsgruppe_ausstattungsgruppe_mm',
				'itemsProcFunc' => 'tx_xxx_treeview->generateGroups',
				
				'items' => array(
					array('','0'),
				),
				'size' => 1,
				'maxitems' => 1,
			),
		),
Erst mal die Tabellen an die Funktion geben, und in der funktion dann das
ganze so irgendwie aufbauen:


	function generateGroups(&$PA, &$fobj) {
		$config = $PA['config'];
    	$table = $PA['table'];
		$field = $PA['field'];
		$row = $PA['row'];
		
		$config['modus'] = $config['modus'].'.';
		$storagePid = $this->conf[$config['modus']]['pid'];
		
		$AddWhere = ' deleted = 0 AND ausstattungsgruppe = 0 ';
		
		$catres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
			'*', //Fields
			$config['foreign_table'],	// Table
			$AddWhere,	// Where
			$groupBy='',	// Group
			$orderBy=' sorting',	// Order
			$limit=''		// Limit
		); 
			
		$workItems = $PA['items'];
		$i=0;
		$PA['items'] ='';
		while ($catrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($catres)) {

			$PA['items'][$i][0] = $catrow['title'];
			$PA['items'][$i][1] = '--div--';
			$PA['items'][$i][2] = '';
			
			$AddWhere = ' deleted = 0 AND ausstattungsgruppe = '.$catrow['uid'].' ';
			
			$itemres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
				'*', //Fields
				$config['foreign_table'],	// Table
				$AddWhere,	// Where
				$groupBy='',	// Group
				$orderBy=' sorting',	// Order
				$limit=''		// Limit
			); 
			
			$i++;	
			
			while ($itemrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($itemres)) {
				$PA['items'][$i][0] = $itemrow['title'];
				$PA['items'][$i][1] = $itemrow['uid'];
				$PA['items'][$i][2] = '';
				$i++;	
			}
		}
	}

Wichtig ist, wenn Du eine option als markiert anzeigen willst, brauchst Du
den hier:
$PA['items'][$i][0] = $catrow['title'];
$PA['items'][$i][1] = '--div--';
$PA['items'][$i][2] = '';

Der --div-- sorgt dafür das der Eintrag anders d argestellt wird.

Hoffe das bringt Dich etwas weiter!

Gruß Manne




More information about the TYPO3-german mailing list