[TYPO3] flexform wizard (edit, add) problem ...
Dr. Ronald P. Steiner
Ronald.Steiner at googlemail.com
Wed Sep 10 21:53:08 CEST 2008
Hi Kay,
I did something similar a while ago. I use a flex form and display in a
select box all uid/titles from the current page to select one or more.
I hope this helps.
greetings
Ron
###########################
#### This is my FlexForm field for the select:
###########################
<sourceTable_exclude_uid>
<TCEforms>
<label>LLL:EXT:rs_tablebrowser/locallang_db.php:rs_tablebrowser.pi_flexform.sourceTable_exclude_uid</label>
<config>
<type>select</type>
<items>
<numIndex index="0">
<numIndex index="0">BLANK</numIndex>
<numIndex index="1">0</numIndex>
</numIndex>
</items>
<size>10</size>
<renderMode>singlebox</renderMode>
<minitems>0</minitems>
<maxitems>100</maxitems>
<iconsInOptionTags>1</iconsInOptionTags>
<itemsProcFunc>tx_rstablebrowser_tca->selectElements</itemsProcFunc>
</config>
</TCEforms>
</sourceTable_exclude_uid>
#################################
### This the class->function referred to in FlexForm.
### This class-> function is contained e.g. in file:
class.tx_rstablebrowser_tca.php
################################
class tx_rstablebrowser_tca {
function selectElements( &$params, &$pObj ) {
// get the information that already is stored in the flexform
$data = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
'pi_flexform',
'tt_content',
'uid = '.$params['row']['uid'].''
);
// the setting for the mySQL-Query:
$queryParts['SELECT'] =
"tt_content.pid,tt_content.uid,tt_content.header";
$queryParts['FROM'] = "tt_content";
$queryParts['WHERE'] = "tt_content.pid IN (".$params[ 'row' ][ 'pid'
].")";
$queryParts['WHERE'] .= ' AND (tt_content.uid != '.$params[ 'row' ][
'uid' ].')';
$queryParts['WHERE'] .= t3lib_BEfunc::BEenableFields('tt_content');
$queryParts['WHERE'] .= " AND (tt_content.sys_language_uid=0)";
$queryParts['GROUPBY'] = "";
$queryParts['ORDERBY'] = "";
$queryParts['LIMIT'] = "0,1000";
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
$items = array();
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$items[] = $row;
}
// options for the TCA
$params['items'] = array();
$params['items'][0] = array(' ','','');
foreach ($items as $item) {
array_push( $params['items'],array(
$item['uid'].': '.$item['header'].$item['title'],
// text in selection
$item['uid'],
// value
t3lib_iconWorks::skinImg( $GLOBALS['BACK_PATH'],
'gfx/icon_fatalerror.gif', // icon
'', 1)
)
);
}
}
}
#################################
## finally include this file with class->function in ext_tables.php:
#################################
include_once( t3lib_extMgm::extPath( 'rs_tablebrowser' ) .
'class.tx_rstablebrowser_tca.php' );
Kay Strobach schrieb:
> Hello Ron,
>
> thats nearly what i want ...
> The Problem with field type db is that the user can select records from
> the whole page tree.
> But the user should only select entries from the current page, i found
> no config option to restrict the user with the db type
> The select type offers such an option (i used that, example in the
> previous post) with the "foreign table" and the pid option.
>
> But the nice thing is i found a working way to avoid the add problem -
> not nice, but working
> I dropped the following lines (refer to last post):
> <numIndex index="0">
> <numIndex index="0">«»«» no Question selected
> «»«»</numIndex>
> <numIndex index="1">0</numIndex>
> </numIndex>
> </items>
> Because of
> <setValue>append</setValue>
> The new Record is the first!(should be the last one?) one in the list
> and selected.
>
> The edit Problem is still unresolved. The Popup opens and closes without
> any error message or notice.
>
> Regards Kay
>
>
> Dr. Ronald P. Steiner schrieb:
> >
> > <TCEforms type="array">
> > <config type="array">
> > <type>group</type>
> > <internal_type>db</internal_type>
> > <allowed>tt_content</allowed>
> > <size>5</size>
> > <maxitems>200</maxitems>
> > <minitems>0</minitems>
> > <multiple>1</multiple>
> > <show_thumbs>1</show_thumbs>
> > </config>
> > <label>elements</label>
> > </TCEforms>
>
More information about the TYPO3-english
mailing list