LuxCal Forum

The place for questions, suggestions and news about the LuxCal Event Calendar

User:   Password:   Remember Me?   
LuxCal Forum / LuxCal / Comments and Suggestions / How can I add a new textbox to the form event?
Posted:  02 Sep 2011 22:02
How can add a new textbox to the form event?
Posted:  02 Sep 2011 23:07
This is only possible by changing the PHP code in various scripts and by adding a text field to the events table in the MySQL database.
Posted:  02 Sep 2011 23:14   Last Edited By: Roel B.
Could you tell me which scripts i need to change ?
If you want just the name from the files.
Posted:  03 Sep 2011 10:03   Last Edited By: Roel B.
I would take the following approach:
1. add the new text field to the MySQL database (for instance with phpMyAdmin)
2. change the file common/retrieve.php to read this new field from the db and store it in the $evtList. (to do this you could follow the same logic as is done for the venue field)
Once you've done this, you have the new field available in all files via the $evtList array.
3. change the files event.php, eventform1.php and eventform2.php to be able to see and edit the new field
4. now you can step by step start changing the files which produce views or reports with event data, which are basically all files in the "views" directory and the notify.php and sendchg.php files in the cronjob directory.

What you could do is follow the logic of one existing field (e.g. 'venue' ) throughout all files and do the same for your new field.  If you have a good PHP knowledge, it should not be too complicated. But ok, it is a bit of work ;)
Posted:  20 Jan 2012 11:39
TY more instrucions like this would be greatly appreciated (like how to add more filter types)
Posted:  20 Jan 2012 16:41   Last Edited By: Roel B.
How to add a new filter? OK, here we go . . .

In theory:
The retrieve function (in the file common/retrieve.php) is the heart of the calendar, which retrieves (normal, multi-day and repeating) events from the database. This function has three arguments: 1) start date, 2) end date and 3) filter (which is optional). In return it will populate the global 2-dimensional array $evtList with all events between start and end date and which meet the criteria of the filter. (If no filter is supplied, a default filter (retrieve.php lines 37 - 46) will be applied.)
So adding a new filter just means creating a new filter in MySQL format and calling retrieve.php while passing this filter, and voila . . . $evtList will be filled with events between start date and end date and meeting your filter criteria.

In practice
Because it very much depends on how and where you would like to enter your filter and what you would like to do with the result, easiest is to have a careful look at the pages/search.php script which implements the text search feature (since LuxCal 2.6.0). What this script does is:
1. Prompt the user for the search (re. filter) criteria
2. Compose the filter in MySQL format (search.php - lines 129 - 142)
3. Call the retrieve function, while passing a start and end date and the filter (search.php line 147)
4. Display the events stored in $evtList.

As said earlier the filter should be in MySQL format and should start with " AND " (e.g. search.php line 135).

That's all. Easy ain't it :)