Trigger for editing an event before saving
Proposed new features of merit and bugs to be fixed. Messages are moved here from the main forum by moderators.
Gold and Silver members can add posts here directly.
Gold and Silver members can add posts here directly.
Trigger for editing an event before saving
by spauldingsmails » Thu Jun 18, 2009 5:49 am
I was wondering if there is some way of intercepting a posted event in order to make changes to it prior to the event being saved? For example, we have heavily modified the add/edit event form but we have to use extensive amounts of client-side javascript to massage the data so that it matches the way saveicalevent::save stores the posted form. Even though we have used mootools to improve browser compatibility, there is still a concern that data may not be correctly manipulated and consequently, incorrect information will be stored.
If there is no currently existing method for manipulating the post, is there a possibility it could be incorporated into the icalevent::save and icalrepeat::save methods or saveicalevent::save; say, for example, via a trigger?
E.g.
Cheers
Hayden
If there is no currently existing method for manipulating the post, is there a possibility it could be incorporated into the icalevent::save and icalrepeat::save methods or saveicalevent::save; say, for example, via a trigger?
E.g.
- Code: Select all
class SaveIcalEvent {
function save($array, &$queryModel, $rrule){
$cfg = & JEVConfig::getInstance();
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$dispatcher =& JDispatcher::getInstance();
JPluginHelper::importPlugin("jevents");
$res = $dispatcher->trigger( 'onBeforeSaveEvent' , $array, $rrule);
...
}
Cheers
Hayden
- spauldingsmails
- Posts: 15
- Joined: Sun Apr 26, 2009 11:15 am
Re: Trigger for editing an event before saving
by Geraint » Thu Jun 18, 2009 8:32 am
No problem - I can add this to the next release.
Geraint
Geraint
------------
JEvents club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits.
Join the JEvents club today!
JEvents club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits.
Join the JEvents club today!
-

Geraint - Posts: 30518
- Joined: Fri Feb 15, 2008 6:14 pm
Re: Trigger for editing an event before saving
by spauldingsmails » Thu Jun 18, 2009 11:07 am
Thanks, that would be great.
May I extend my thoughts to the following;
1. An event that triggers before the event save (AdminIcaleventController::save);
E.g.
2. An event that triggers before the repeat save (AdminIcalrepeatController::save);
E.g.
The benefit above being that one can take alternative actions based on what is being updated.
Cheers
Hayden
May I extend my thoughts to the following;
1. An event that triggers before the event save (AdminIcaleventController::save);
E.g.
- Code: Select all
function save(){
if (!JEVHelper::isEventCreator()){
JError::raiseError( 403, JText::_("ALERTNOTAUTH") );
}
// clean out the cache
$cache = &JFactory::getCache('com_jevents');
$cache->clean(JEV_COM_COMPONENT);
// JREQUEST_ALLOWHTML requires at least Joomla 1.5 svn9979 (past 1.5 stable)
$array = JRequest::get('request', JREQUEST_ALLOWHTML);
$dispatcher =& JDispatcher::getInstance();
JPluginHelper::importPlugin("jevents");
$res = $dispatcher->trigger("onBeforeSaveIcalEvent", array(&$array));
$rrule = SaveIcalEvent::generateRRule($array);
2. An event that triggers before the repeat save (AdminIcalrepeatController::save);
E.g.
- Code: Select all
function save(){
...
$data["X-COLOR"] = JRequest::getVar( "color","");
$dispatcher =& JDispatcher::getInstance();
JPluginHelper::importPlugin("jevents");
$res = $dispatcher->trigger("onBeforeSaveIcalRepeat", array(&$data));
$detail = iCalEventDetail::iCalEventDetailFromData($data);
// if we already havea unique event detail then edit this one!
if ($eventdetailid != $rpt->eventdetail_id){
$detail->evdet_id = $rpt->eventdetail_id;
}
...
}
The benefit above being that one can take alternative actions based on what is being updated.
Cheers
Hayden
- spauldingsmails
- Posts: 15
- Joined: Sun Apr 26, 2009 11:15 am
3 posts
• Page 1 of 1
Return to Feature Requests/Suggestions
Who is online
Users browsing this forum: No registered users

