Zum Inhalt springen

flexform, dynamische selectbox und sysfolder

Erstellt am 7. November 2007 · 1 Antwort · letzte Antwort am 13. Dezember 2007

Tags: Frage

dnalor ·

Hallo Experten,

ich habe mit Flexform eine dynamische Selectbox gebaut. Inhalt der Selectbox sind die Gruppen aus fe_groups. Das funktioniert wunderbar nur brauche ich jetzt eine zusätzliche where-Bedingung in der Abfrage zum Füllen der Selectorbox. Momentan werden alle Gruppen aus fe_groups gelesen. Ich möchte aber nur die Gruppen die im Systemordner gespeichert sind, der als "Allgemeine Datensatzsammlung" auf der Seite meines Plugins definiert wird. Wie komme ich in der Funktion zum Füllen der dyn. Selectorbox an die ID des Systemordner?

Flexform:

   <dynfield>
    <tceforms>
     <label>Profilkategorie</label>
     <config>
       <itemsprocfunc>tx_sytextuserprofiles_addFieldsToFlexForm->addFields</itemsprocfunc>
      <type>select</type>
     </config>
     </tceforms>
  </dynfield>

Funktion zum Füllen der Selectorbox:

<?php

class tx_sytextuserprofiles_addFieldsToFlexForm {
 function addFields ($config) {
   $optionList = array();
   
   $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,title', 'fe_groups', 'hidden=0 and deleted=0'/* and pid='.$GLOBALS['TSFE']->getStorageSiterootPids()*/, '','','');

 $i=0;   
   
 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result))
  {
   $optionList[$i] = array(0 => $row['title'], 1 => $row['uid']);
   $i++;
  }

   $config['items'] = array_merge($config['items'],$optionList);
   return $config;
 }
}

?>
InforMedic ·

Hi,

ich brauch zwar kein extra where, habe aber das problem das mir die selectbox ind er flexform nicht dynamisch gefüllt wird.

Ich habe folgendes in der flex.xml stehen:

          <dbtable>
            <TCEforms>
              <label>LLL:EXT:myext/locallang_tca.php:tx_myext.pi_flexform.dbtable</label>
                <config>
                <type>select</type>
                <itemsprocfunc>EXT:myext/pi2/tx_myext_pi2->addFieldsToFlexForm</itemsprocfunc>
                <maxitems>10</maxitems>
                <size>5</size>
                <multiple>0</multiple>
                <selectedListStyle>width:250px</selectedListStyle>
                <itemListStyle>width:250px</itemListStyle>
                </config>
            </TCEforms>
          </dbtable>

Meine pi2.php sieht so aus:

// Declare global constants
define('PATH_t3conf', 'http://'.$_SERVER['SERVER_NAME'].'/testpage/typo3conf/ext/');
require_once(PATH_t3conf.'myext/pi2/class.tx_myext_pi2.php');

/**
 * Plugin 'blablub.
 *
 * @author	Ich
 * @package	TYPO3
 * @subpackage	tx_myext
 */
class tx_myext_pi2 extends tx_myext_pi1 {
	function addFieldsToFlexForm ($config) {
		$optionList = array();
		$TCA = $GLOBALS['TCA'];
		//debug($TCA, "TCA");
		// Load table config array (TCA)
		while(list($table)=each($TCA)) {
			$table = strstr($table, 'tx_');
			if (isset($TCA[$table]['ctrl']['transOrigPointerField'])) {
				t3lib_div::loadTCA($table);
				$optionList[] = $table;
			}
		}
		$config['items'] = array_merge($config['items'],$optionList);
		return $config;
	}

Wie sind denn die Pfade bei dir? Wo liegt denn deine php klasse?
Ist meine itemsprocfunc(tion) so richtig?

Gruß
Info