TYPOlight version 2.6.2 available

TYPOlight version 2.6.2 is available. The maintenance release includes some powerful new features like the extension repository client, a pagination menu for articles, the memberlist module and the option to move news and events between archives.

Read the announcement  of all changes

michael_art
TYPOlight novice
Avatar
Posts: 19
Germany
Hi!

I have an request for a page who is offering classes with a limited number of participants.
Is there a way to extend the calendar module, to include a number of participants and the way to include a booking form that automatically reduces the number of available places?

Or would you do this as an copletely seperate module?

A similar mechanich would be usefull to book available resources, like a hotel room or simmelar.

Does anyone have an Idea, how to implement it?
2007-10-14 22:35
thyon
TYPOlight professional
Avatar
Posts: 1288
Cape Town, South Africa
hi michael_art

You can check-out the module: EFG (Extended Form Generator).
http://www.typolight.org/wiki/extensions:efg

This automatically takes any TL Form and then stores it values into a database and allows you to send a customised e-mail to the end-user with his details. Unfortunately, you'll have to wait until the next release, because only then it will perform the necessary functions you require.

New functions in next release:
[ Duplication check on a field, e.g. e-mail (this is where you can check if a user double-registered
[ Counter Variables, which will count-down, e.g. booking values.

At the moment, you can still use the module, but you'll have to know how to program PHP to intercept the booking once stored, then check for an over-booking, then redirect back to the form page again. There is a tutorial explaining how to set-up PHP code in your "registration complete" page in the wiki.
http://www.typolight.org/wiki/tutorials:form_processing]]
thyon | iMac 24" 3.06GHz, OSX Leopard, Safari, Camino, Coda
2007-10-23 11:38
thyon
TYPOlight professional
Avatar
Posts: 1288
Cape Town, South Africa
Hi Michael

In the meantime, I've completely written the code in a php class, which can be used with TL, but it would be better to integrate it into TL's Form Generator, similar to EFG. I've added counter (counts how many of this field < countmax) and totals (adds the value, e.g. me+guests=3) so that the total value plus current registration will be less than totalmax. It also checks for unique (duplicates) using the e-mail address (selectable) and also checks for mandatory fields.

As I don't fully understand the way TL's Forms work, I can't code it for this.
thyon | iMac 24" 3.06GHz, OSX Leopard, Safari, Camino, Coda
2007-11-07 15:09
michael_art
TYPOlight novice
Avatar
Posts: 19
Germany
Hi Thyon!
This is a really usefull feature for the Form-Generator! Does it check the counter, before the form is shown? I mean this to show a warining before someone fills in the Form.
I am still a bit wondering, if I could combine this with the events, to show in an event, how many fre places are still available.
2007-11-07 16:33
thyon
TYPOlight professional
Avatar
Posts: 1288
Cape Town, South Africa
Event AttendaNce Module
- a Calendar Module Extension

I'm currently developing a module that expands the TL Calendar Events module and adds a new event type:
[ Default Basic Event ] (as supplied by TL)
[ Event with Attendance Registration ] (new)

This extended module with registration will add the following features:
- Form selection (just assign a registration form to the event)
- Last registration Date
[ Add Validation
- Unique Validation Field Selection from Form above (usually e-mail must be unique)
- Count Validation, count(*) < maximum for booking
- Total Validation, sum(*) < maximum for booking with values like -- myself+1 guest
[ Add Confirmation Mail
- To Field selection (from Form above)
- From e-mail (defaults to TL admin e-mail)
- Sender Name
- Subject
- HTML Template selection (text version is automatically extracted)
- JumpTo (after registration is complete)

Once a user submits the registration, its checked by standard form validation first, then additional validations (as set-up above) and then submit into a DB table and when successful, also send the confirmation e-mail (if set-up).

(removed screenshot, as I'm changing the implementation method)]]
Last edited by thyon, 2007-11-23 07:36
thyon | iMac 24" 3.06GHz, OSX Leopard, Safari, Camino, Coda
2007-11-15 13:25
michael_art
TYPOlight novice
Avatar
Posts: 19
Germany
This sounds phantastic! If you need any help let me know!
2007-11-15 13:27
Ben
TYPOlight partner
Avatar
Posts: 1913
Atlanta, Georgia, United States
Thyon,

This looks like a great module! I know rayfusion is happy about it. I'm going to remove 'Request' from the topic title ... since it is no longer relevant.
Ben - "I live for live updates."
{follow me on twitter}
2007-11-16 02:32
thyon
TYPOlight professional
Avatar
Posts: 1288
Cape Town, South Africa
After thinking long and hard about this, the best solution is to keep the form valdiation, storage email, jumpto and retrieval in a seperate form_storage module. However, this would clash in functionality with EFG (which already does storage, retrieval and confirmation e-mails). Best solution would be to link a form with EFG enabled.

EFG doesn't yet do the extended validation as tom hasn't written the code yet. In the meantime, I'll write my over "version" of a form storage module (as this will help me in other ways to understand TL), so I'll be releasing a form_storage module with this calendar extensions. It won't work exactly like EFG, so here goes....

Does this sound OK to setup?
- Create registration form, with confirmation e-mail, storage, JumpTo (you have to create a seperate form for each event)
- Create the Event with title, dates, description, etc. then link the form above to the registration event.
- Goto the Form Storage module (new) to allow you to review the registrations
thyon | iMac 24" 3.06GHz, OSX Leopard, Safari, Camino, Coda
2007-11-23 07:42
michael_art
TYPOlight novice
Avatar
Posts: 19
Germany
Sound great for a start!
The next thing I have to figure out, how Paypal works for registration fees.

I am looking forward to it!

Thanks man!
2007-11-26 23:45
leo
Administrator
Avatar
Posts: 6031
München, Germany
Hi thyon,

I have been trying to contact you via e-mail but I keep getting a failure notice that your mailbox is full :-)

Regarding the form validation issue: you cannot validate fields in the "processFormData" callback. It is some kind of "post submission callback". I have added another hook to the form class that you can use:

iconCode:
// Validate input
if ($this->Input->post('FORM_SUBMIT') == $formId)
{
	$objWidget->validate();

	// HOOK: validate form field callback
	if (array_key_exists('validateFormField', $GLOBALS['TL_HOOKS']) && is_array($GLOBALS['TL_HOOKS']['validateFormField']))
	{
		foreach ($GLOBALS['TL_HOOKS']['validateFormField'] as $callback)
		{
			$this->import($callback[0]);
			$objWidget = $this->$callback[0]->$callback[1]($objWidget, $formId);
		}
	}

	if ($objWidget->hasErrors())
	{
		$doNotSubmit = true;
	}

	...

This way you can check each widget and add custom error messages:

iconCode:
// Check for unique e-mail addresses
public function my_callback(Widget $objWidget)
{
	if ($objWidget instanceof FormTextField && $objWidget->name == 'email')
	{
		if (email_exists($objWidget->value))
		{
			$objWidget->addError('E-mail address exists');
		}
	}

	return $objWidget;
}

Regards
Leo
2007-11-27 10:52
thyon
TYPOlight professional
Avatar
Posts: 1288
Cape Town, South Africa
sorry leo, there has been problems, mailbox was NOT full, they recently moved my e-mail mailbox and it caused a few problems.

this is awesome news. now I'm bounding back to form processing again. ouch! ouch! ouch! (I just can't seem to start development on this module).
thyon | iMac 24" 3.06GHz, OSX Leopard, Safari, Camino, Coda
2007-11-29 11:37
thyon
TYPOlight professional
Avatar
Posts: 1288
Cape Town, South Africa
Hi Leo

I've completed my code conversion from my own PHP script into TL's new validation HOOKS. Thanks.

I've used $this->Input->post('otherfield') to access other form field values outside the scope of the widget being validated (e.g. I look up another form field value and compare it against a total, while in the current widget). Is this acceptable. Otherwise, you'll have to pass the form post data as another parameter.

Also, is there a way to "get" the options from radio/select/checkboxes within the Widget, as the arrOptions is protected and also there is no function or variable (that I can see) to retrieve the options. I have to run a query against the tl_form_field and deserialize the options. If this is intended behaviour, then i'll keep my code like that.
Last edited by thyon, 2007-11-29 19:16
thyon | iMac 24" 3.06GHz, OSX Leopard, Safari, Camino, Coda
2007-11-29 19:07
leo
Administrator
Avatar
Posts: 6031
München, Germany
Hi thyon,

I have added $this->options to the getter method. Anything else you need access to?

Regards
Leo
2007-11-30 10:40
thyon
TYPOlight professional
Avatar
Posts: 1288
Cape Town, South Africa
UPDATE

leo
thanks for that. Can you also add User Access to the back-end of the Form Generator (and possibly member access also for front-end). Then I can grant permissions to a user to a calendar group (to create events) and then also to a Form to access the stored data for that form. But since the Form Generator doesn't have archives (like news/calendar, etc). This might be difficult, unless you only allow the user to access forms that they create themselves, e.g. default permission is their own group/userid. Maybe you could consider Form Groups to make permissions easier?

Tech Blurb
I've managed to get my form storage module up and running. Its working great. I added another DC to manage my formstorage table, which serializes all its form data into a field called 'data'. I just deserialize the data field wherever its required (but there's so much code!!!). I also added an automated form field DCA builder to access the serialized formstorage table/DCA. My goal was to allow edit/delete (not create/copy/cut).

Itemz complete
- I've now added a selector TYPE field to a form, which allows you to change it from a "basic" form to a "form with storage, validation and confirmation e-mail".
- When you add this type of form, an icon will appear next to the saved form, to indicate that you can access the data for this form (e.g. registration form submissions)
- You can view, edit and delete the form data (in the back-end ONLY) -- NO copy/create
- When you create a Calendar Event, you can now also select a TYPE, e.g. Event with Registration.
- You can then select a registration cut-off date and the FORM to use for the registration.

What's left
- add code for CSV export (quick)
- add the confirmation e-mail (quick)
- module to display the event + form (if <last registration date) (also quick)

Form storage can also be used independently, but is not as complete as EFG.
thyon | iMac 24" 3.06GHz, OSX Leopard, Safari, Camino, Coda
2007-11-30 10:56
leo
Administrator
Avatar
Posts: 6031
München, Germany
Hi thyon,

iconthyon:
Can you also add User Access to the back-end of the Form Generator

I have already done this (it is not included in the current beta, though).

Regards
Leo
2007-11-30 11:22
Total Members: 2987 Total Topics: 8156 Total Messages: 54358