factory = new EventRegistrationRequestFactory; $this->event_registration_request_manager = new EventRegistrationRequestManager( new SapphireEventRegistrationRequestRepository, new SapphireEventRepository, $this->factory, new GoogleGeoCodingService( new SapphireGeoCodingQueryRepository, new UtilFactory, SapphireTransactionManager::getInstance(), $google_geo_coding_api_key, $google_geo_coding_client_id, $google_geo_coding_private_key), new SapphireEventPublishingService, new EventValidatorFactory, SapphireTransactionManager::getInstance() ); //js files Requirements::css("themes/openstack/css/chosen.css", "screen,projection"); Requirements::css("themes/openstack/javascript/jquery-ui-1.10.3.custom/css/smoothness/jquery-ui-1.10.3.custom.min.css"); Requirements::javascript("themes/openstack/javascript/chosen.jquery.min.js"); Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"); Requirements::javascript(Director::protocol()."ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js"); Requirements::javascript("themes/openstack/javascript/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.js"); Requirements::javascript("themes/openstack/javascript/jquery.ui.datepicker.validation.package-1.0.1/jquery.ui.datepicker.validation.js"); Requirements::javascript("themes/openstack/javascript/jquery.validate.custom.methods.js"); Requirements::javascript('events/js/event.registration.request.page.js'); } public function EventRegistrationRequestForm() { $data = Session::get("FormInfo.Form_EventRegistrationRequestForm.data"); Requirements::css('events/css/event.registration.form.css'); Requirements::javascript("events/js/event.registration.form.js"); $form = new EventRegistrationRequestForm($this, 'EventRegistrationRequestForm'); // we should also load the data stored in the session. if failed if(is_array($data)) { $form->loadDataFrom($data); } // Optional spam protection if(class_exists('SpamProtectorManager')) { SpamProtectorManager::update_form($form); } return $form; } //Save event registration form function saveEventRegistrationRequest($data, Form $form){ // Check if the honeypot has been filled out if(@$data['username']) { SS_Log::log(sprintf('EventRegistrationRequestForm honeypot triggered (data: %s)',http_build_query($data)), SS_Log::NOTICE); return $this->httpError(403); } try{ $this->event_registration_request_manager->registerEventRegistrationRequest($data); Session::clear("FormInfo.Form_EventRegistrationRequestForm.data"); return $this->redirect($this->Link('?saved=1')); } catch(EntityValidationException $ex1){ $messages = $ex1->getMessages(); $msg = $messages[0]; $form->addErrorMessage('City',$msg['message'] ,'bad'); SS_Log::log($msg['message'] ,SS_Log::ERR); // Load errors into session and post back Session::set("FormInfo.Form_EventRegistrationRequestForm.data", $data); return $this->redirectBack(); } catch(Exception $ex){ $form->addErrorMessage('Title','Server Error','bad'); SS_Log::log($ex->getMessage(), SS_Log::ERR); // Load errors into session and post back Session::set("FormInfo.Form_EventRegistrationRequestForm.data", $data); return $this->redirectBack(); } } //Check for just saved function Saved() { return $this->request->getVar('saved'); } }