[TYPO3-project-seminars] New Seminar - configuration

Andrea Schmuttermair typo3 at schmutt.de
Wed Aug 26 15:06:00 CEST 2009


Hi,

Thank you Bernd for your answer, it workes fine now without editing anything
from the seminars-code!

I would like to share my solution based on formidable and typoscript, maybe
it will help someone:

I. TypoScript configuration
---------------------------

I added an extension template to the page with the event editor. There I
added the following TypoScript to configure the default formidable settings.


First I want to set the default value for object_type to 1:

plugin.tx_seminars_pi1.form.eventEditor.elements.object_type =
renderlet:HIDDEN
plugin.tx_seminars_pi1.form.eventEditor.elements.object_type{
	name = object_type
	data.defaultvalue = 1
}

The next one is a bit more difficult, as I want to set a default mm-relation
to the speaker table. In my design, the speaker is always the logged in
FEUser. The mm-relations are already configured in the datahandler-section,
so I just have to set the correct speaker UID.  

plugin.tx_seminars_pi1.form.eventEditor.elements.speakers = renderlet:HIDDEN
plugin.tx_seminars_pi1.form.eventEditor.elements.speakers {
	name = speakers
	label =
LLL:EXT:seminars/locallang_db.xml:tx_seminars_seminars.speakers
	data.value.userobj {
		extension = tx_myextension_pi1 
		method = getSpeaker
	}
}

II. PHP userobj 
---------------
This is only needed for the speaker value.

In my extension class tx_myextension_pi1, I add the function "getSpeaker",
and this function returns the UID I need. 

class tx_myextension_pi1 extends tslib_pibase {
		
	function main($content,$conf)	{
		(...)
	}

	(...)

	public function getSpeaker() 
	{
		$userid = $GLOBALS['TSFE']->fe_user->user[uid];
		
		$result = $GLOBALS ['TYPO3_DB']->exec_SELECTgetRows (
't1.uid', 
           ' tx_seminars_speakers AS t1 ',
           't1.cruser_id = '.$userid.' AND t1.deleted=0');

		if ($result[0]['uid'] != NULL)
		{
			return $result[0]['uid'];
		}
		else 
		return 0;
		
	}
}

III. Template
-------------

And finally, I have to add the new variables to the template:

<!-- ###seminars_FORM### -->
<p class="tx-seminars-pi1-error" style="display: {errors.cssdisplay};">
	{errors}
</p>
<!-- hidden fields -->
{object_type}
{speakers}
<table class="tx-seminars-pi1-event-editor">
	<tbody>
		<tr>
			<td>{title}</td>
		</tr>
		(...)

IV. Reference
-------------
All current formidable-settings are made in
typo3conf/ext/seminars/Configuration/TypoScript/setup.txt" 

Formidable documentation: http://formidable.typo3.ug/
Reference is in XML Syntax, but if you look at the setup.txt you see it is
the same system with TS Syntax

Greetings,
Andrea



More information about the TYPO3-project-seminars mailing list