/** * @param IRSVPTemplate $template * @param IRSVP $rsvp * @param ISummitEvent $event * @param string $form_name * @return BootstrapForm|PresentationSpeaker */ public function build(IRSVPTemplate $template, IRSVP $rsvp, ISummitEvent $event, $form_name = 'RSVPForm') { $fields = new FieldList(); foreach ($template->getQuestions() as $q) { $type = $q->Type(); $builder_class = $type . 'UIBuilder'; // @IRSVPQuestionTemplateUIBuilder $builder = Injector::inst()->create($builder_class); $answer = $rsvp ? $rsvp->findAnswerByQuestion($q) : null; $field = $builder->build($rsvp, $q, $answer); $fields->add($field); } $validator = null; if ($rsvp) { $fields->add(new HiddenField('rsvp_id', 'rsvp_id', $rsvp->getIdentifier())); } $fields->add(new HiddenField('event_id', 'event_id', $event->getIdentifier())); $fields->add(new HiddenField('summit_id', 'summit_id', $event->Summit()->getIdentifier())); $fields->add(new HiddenField('seat_type', 'seat_type', $event->getCurrentRSVPSubmissionSeatType())); $fields->add(new LiteralField('hr', '<hr>')); $actions = new FieldList(FormAction::create('submit_rsvp')->setTitle('Send RSVP')->addExtraClass('rsvp_submit')); $form = new BootstrapForm(Controller::curr(), $form_name . '_' . $event->getIdentifier(), $fields, $actions, $validator); $form->setAttribute('class', 'rsvp_form'); return $form; }
function __construct($controller, $name, $speakerID, $use_actions = true) { $fields = new FieldList(); //point of contact $speakerIDfield = new HiddenField('speaker_id'); $speakerIDfield->setValue($speakerID); $fields->push($speakerIDfield); $fields->push(new TextField('org_name', 'Name of Organizer')); $fields->push(new EmailField('org_email', 'Email')); $fields->push(new TextField('event_name', 'Event')); $fields->push(new TextField('event_format', 'Format/Length')); $fields->push(new TextField('event_attendance', 'Expected Attendance (number)')); $fields->push(new TextField('event_date', 'Date of Event')); $fields->push(new TextField('event_location', 'Location')); $fields->push(new TextField('event_topic', 'Topic(s)')); $request = new HtmlEditorField('general_request', 'General Request'); $request->setRows(10); $fields->push($request); $sec_field = new TextField('field_98438688', 'field_98438688'); $sec_field->addExtraClass('honey'); $fields->push($sec_field); // Create action $actions = new FieldList(); if ($use_actions) { $actions->push(new FormAction('sendSpeakerEmail', 'Send')); } parent::__construct($controller, $name, $fields, $actions); }
function __construct($controller, $name, $company) { // Define fields ////////////////////////////////////// if ($company->canEditProfile()) { $fields = new FieldList(new TextField('Name', 'Company Name'), new TextField('URL', 'Company Web Address (URL)'), new LiteralField('Break', '<p></p>'), new LiteralField('Break', '<hr/>'), $big_logo = new FileAttachmentField('BigLogo', 'Large Company Logo'), $small_logo = new FileAttachmentField('Logo', 'Small Company Logo'), new LiteralField('Break', '<p></p>'), new LiteralField('Break', '<hr/>'), new TextField('Industry', 'Industry (less than 4 Words)'), $desc = new HtmlEditorField('Description', 'Company Description'), new LiteralField('Break', '<p></p>'), $contrib = new HtmlEditorField('Contributions', 'How you are contributing to OpenStack (less than 150 words)'), new LiteralField('Break', '<p></p>'), $products = new HtmlEditorField('Products', 'Products/Services Related to OpenStack (less than 100 words)'), new LiteralField('Break', '<p></p>'), new LiteralField('Break', '<p></p>'), new ColorField("Color", "Company Color"), new LiteralField('Break', '<p></p>'), new LiteralField('Break', '<hr/>'), new TextField('ContactEmail', 'Best Contact email address (optional)'), new LiteralField('Break', '<p>This email address will be displayed on your profile and may be different than your own address.')); $desc->addExtraClass("company-description"); $contrib->addExtraClass("company-contributions"); $products->addExtraClass("company-products"); $big_logo_validator = new Upload_Image_Validator(); $big_logo_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg')); $big_logo_validator->setAllowedMaxImageWidth(500); $big_logo->setAcceptedFiles(array('jpg', 'png', 'jpeg')); $big_logo->setView('grid'); $big_logo->setFolderName('companies/main_logo'); $big_logo->setValidator($big_logo_validator); $small_logo_validator = new Upload_Image_Validator(); $small_logo_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg')); $small_logo_validator->setAllowedMaxImageWidth(200); $small_logo->setAcceptedFiles(array('jpg', 'png', 'jpeg')); $small_logo->setView('grid'); $small_logo->setFolderName('companies/main_logo'); $small_logo->setValidator($small_logo_validator); } else { if ($company->canEditLogo()) { $fields = new FieldList(new ReadonlyField('Name', 'Company Name'), new ReadonlyField('URL', 'Company Web Address (URL)'), new LiteralField('Break', '<p></p>'), new LiteralField('Break', '<hr/>'), new CustomUploadField('BigLogo', 'Large Company Logo'), new CustomUploadField('Logo', 'Small Company Logo')); } } $actionButton = new FormAction('save', 'Save Changes'); //$actionButton->addExtraClass('btn green-btn'); $actions = new FieldList($actionButton); parent::__construct($controller, $name, $fields, $actions); }
function __construct($controller, $name, PresentationSpeakerSummitAssistanceConfirmationRequest $request) { $PhoneField = new TextField('OnSitePhoneNumber', 'Your OnSite Phone Number for ' . $request->Summit()->Title . ':'); $RegisteredField = new CheckboxField('RegisteredForSummit', 'I have registered for the summit using the confirmation code sent in the email.'); $SpeakerHashField = new HiddenField('RequestID', "RequestID", $request->ID); $fields = new FieldList($PhoneField, $RegisteredField, $SpeakerHashField); $submitButton = new FormAction('doSavePhoneNumber', 'Save'); $actions = new FieldList($submitButton); $validator = new RequiredFields('OnSitePhoneNumber'); parent::__construct($controller, $name, $fields, $actions, $validator); }
public function RenewForm() { $f = FieldList::create(); $f->text("Barcode"); $a = FieldList::create(FormAction::create("doRenewForm", "Renew")->setStyle("success")); if (class_exists('BootstrapForm')) { return BootstrapForm::create($this, "RenewForm", $f, $a); } else { return Form::create($this, "RenewForm", $f, $a); } }
function __construct($controller, $name, $speakerHash) { $activeSummit = Summit::get_active(); $PhoneField = new TextField('OnSitePhoneNumber', 'Your Onsite Phone Number for ' . $activeSummit->Title . ':'); $RegisteredField = new CheckboxField('RegisteredForSummit', 'I have registered for the summit using the confirmation code sent in the email.'); // Speaker Hash Field $SpeakerHashField = new HiddenField('speakerHash', "speakerHash", $speakerHash); $fields = new FieldList($PhoneField, $RegisteredField, $SpeakerHashField); $submitButton = new FormAction('doSavePhoneNumber', 'Save'); $actions = new FieldList($submitButton); $validator = new RequiredFields('OnSitePhoneNumber'); parent::__construct($controller, $name, $fields, $actions, $validator); }
public function loadDataFrom($data, $mergeStrategy = 0, $fieldList = null) { parent::loadDataFrom($data, $mergeStrategy, $fieldList); if ($data && $data instanceof SummitAttendee && $data->ID > 0) { // if we have an attendee then show the form on readonly mode ... $ticket = $data->Tickets()->first(); $this->fields->insertAfter($t1 = new TextField('TicketBoughtDate', 'Ticket Bought Date', $ticket->TicketBoughtDate), 'ExternalOrderId'); $t2 = $this->fields->fieldByName('ExternalOrderId'); $t2->setValue($ticket->ExternalOrderId); $this->fields->insertAfter($t3 = new TextField('TicketType', 'Ticket Type', $ticket->TicketType()->Name), 'TicketBoughtDate'); $t1->setReadonly(true); $t2->setReadonly(true); $t3->setReadonly(true); } }
public function loadDataFrom($data, $mergeStrategy = 0, $fieldList = null) { parent::loadDataFrom($data, $mergeStrategy, $fieldList); if ($data && $data instanceof SummitAttendee && $data->ID > 0) { $this->fields->insertAfter($t1 = new TextField('TicketBoughtDate', 'Ticket Bought Date', $data->TicketBoughtDate), 'ExternalOrderId'); $t2 = $this->fields->fieldByName('ExternalOrderId'); $this->fields->insertAfter($t3 = new TextField('TicketType', 'Ticket Type', $data->TicketType()->Name), 'TicketBoughtDate'); $t1->setReadonly(true); $t2->setReadonly(true); $t3->setReadonly(true); $checkbox = $this->getField('SharedContactInfo'); if (!is_null($checkbox)) { $checkbox->setValue(intval($data->SharedContactInfo) === 1); } $btn = $this->Actions()->first(); if (!is_null($btn)) { $btn->setTitle('Save'); } } }
public function saveInto(DataObjectInterface $dataObject, $fieldList = null) { parent::saveInto($dataObject, $fieldList); if (!$dataObject instanceof Presentation) { return; } $presentation = $dataObject; $old_materials = $presentation->Materials()->filter('ClassName', 'PresentationLink'); foreach ($old_materials as $o) { $o->Delete(); } for ($i = 1; $i <= 5; $i++) { $field = $this->fields->fieldByName("PresentationLink[{$i}]"); if (is_null($field)) { continue; } $val = $field->Value(); if (empty($val)) { continue; } $presentation->Materials()->add(PresentationLink::create(array('Link' => trim($val)))); } }
function __construct($controller, $name, $use_actions = true) { $RatingField = new TextField('rating', ''); $RatingField->setValue(0); $CommentField = new HtmlEditorField('comment', 'Comment'); $CommentField->setRows(8); $sec_field = new TextField('field_98438688', 'field_98438688'); $sec_field->addExtraClass('honey'); $fields = new FieldList($RatingField, $CommentField, $sec_field); // Create action $actions = new FieldList(); if ($use_actions) { $actions->push(new FormAction('submit', 'Submit')); } $this->addExtraClass('review-form'); $css = <<<CSS .honey { \tposition: absolute; left: -9999px } CSS; Requirements::customCSS($css, 'honey_css'); parent::__construct($controller, $name, $fields, $actions); }
function __construct(Controller $controller, $name) { $this->currController = $controller; $fields = new FieldList(array(TextField::create("FirstName")->setTitle(_t("ContactPage.FIRSTNAME", "First Name"))->addPlaceholder(_t("ContactPage.FIRSTNAMEPLACEHOLDER", "Your First Name"))->setMaxLength(55)->setAttribute("autocomplete", "off"), TextField::create("LastName")->setTitle(_t("ContactPage.LASTNAME", "Last Name"))->addPlaceholder(_t("ContactPage.LASTNAMEPLACEHOLDER", "Your Last Name"))->setMaxLength(55)->setAttribute("autocomplete", "off"), EmailField::create("Email")->setTitle(_t("ContactPage.EMAIL", "Email"))->addPlaceholder(_t("ContactPage.EMAILPLACEHOLDER", "Your Email address"))->setMaxLength(55)->setAttribute("autocomplete", "off"), TextField::create("Phone")->setTitle(_t("ContactPage.PHONE", "Phone"))->addPlaceholder(_t("ContactPage.PHONEPLACEHOLDER", "Your Phone number"))->setMaxLength(55)->setAttribute("autocomplete", "off"), TextareaField::create("Description")->setTitle(_t("ContactPage.DESCRIPTION", "Message"))->addPlaceholder(_t("ContactPage.DESCRIPTIONPLACEHOLDER", "Your Message for us"))->setRows(6), TextField::create("Url")->setTitle("")->addPlaceholder(_t("ContactPage.URL", "Url"))->setMaxLength(55)->setAttribute("autocomplete", "off"), TextareaField::create("Comment")->setTitle("")->addPlaceholder(_t("ContactPage.COMMENT", "Comment"))->setRows(6), HiddenField::create("Ref")->setValue($controller->Title), HiddenField::create("Locale")->setValue($controller->Locale))); $actions = new FieldList(FormAction::create('dosave', _t("ContactPage.APPLY", "Send"))->setStyle("success")); $validator = ZenValidator::create(); $validator->addRequiredFields(array('FirstName', 'LastName', 'Email', 'Description')); $validator->setConstraint('Email', Constraint_type::create('email')); $validator->setConstraint('Description', Constraint_length::create('min', 10)); parent::__construct($controller, $name, $fields, $actions, $validator); if ($this->extend('updateFields', $fields) !== null) { $this->setFields($fields); } if ($this->extend('updateActions', $actions) !== null) { $this->setActions($actions); } // if($this->extend('updateValidator', $requiredFields) !== null) {$this->setValidator($requiredFields);} $oldData = Session::get("FormInfo.{$this->FormName()}.data"); if ($oldData && (is_array($oldData) || is_object($oldData))) { $this->loadDataFrom($oldData); } $this->extend('updateContactInquiryForm', $this); }
public function CommentForm() { $form = BootstrapForm::create($this, __FUNCTION__, Fieldlist::create(TextField::create('Name', '')->setAttribute('placeholder', 'Name'), TextAreaField::create('Comment', '')->setAttribute('placeholder', 'Type You Comment Here')), FieldList::create(FormAction::create('handleComment', 'Post Comment')->setStyle('primary')->addExtraClass('btn square-btn')), RequiredFields::create('Name', 'Comment')); return $form; }
/** * Creates the form that lets a speaker review his details. Merges * several forms together. * * @return Form */ public function ReviewForm() { if (!$this->isMe()) { return $this->httpError(403); } $fields = FieldList::create(HeaderField::create('Your details')); $dummy = SpeakerForm::create($this, "EditSpeakerForm", FieldList::create()); $fields->merge($dummy->Fields()); $fields->bootstrapIgnore('Photo'); /*if(!$this->speaker->Member()->getSummitState('VIDEO_AGREEMENT_SEEN')) { $fields->push(HeaderField::create('Do you agree to be video recorded?')); $fields->push(LiteralField::create('legal', $this->parent->getParent()->LegalAgreement)); $fields->merge($this->LegalForm()->Fields()); }*/ if (!$this->speaker->Member()->getSummitState('BUREAU_SEEN')) { $fields->push(HeaderField::create('Want to be in the Speakers\' Bureau?')); $fields->merge($this->BureauForm()->Fields()); } $form = BootstrapForm::create($this, "ReviewForm", $fields, FieldList::create(FormAction::create('doReviewForm', 'Save my details')), $dummy->getSpeakerValidator()); if ($data = Session::get("FormInfo.{$form->FormName()}.data")) { return $form->loadDataFrom($data); } return $form->loadDataFrom($this->speaker); }
public function __construct($summit, $controller, $name, $actions) { parent::__construct($controller, $name, $this->getSummitFields($summit), $actions); $this->setTemplate($this->class); $this->customise(array('Summit' => $summit)); }
public function __construct($controller, $name, $actions) { parent::__construct($controller, $name, $this->getSpeakerFields(), $actions, $this->getSpeakerValidator()); }
/** * Creates the form that lets a speaker review his details. Merges * several forms together. * @return Form */ public function ReviewForm() { if (!$this->isMe()) { return $this->httpError(403); } $fields = FieldList::create(HeaderField::create('Your details')); $dummy = SpeakerForm::create($this, "EditSpeakerForm", FieldList::create()); $fields->merge($dummy->Fields()); $fields->bootstrapIgnore('Photo'); $form = BootstrapForm::create($this, "ReviewForm", $fields, FieldList::create(FormAction::create('doReviewForm', 'Save my details')), $dummy->getSpeakerValidator()); if ($data = Session::get("FormInfo.{$form->FormName()}.data")) { return $form->loadDataFrom($data); } return $form->loadDataFrom($this->speaker); }
public function saveInto(DataObjectInterface $dataObject, $fieldList = null) { parent::saveInto($dataObject, $fieldList); if (!$dataObject instanceof PresentationSpeaker) { return; } $speaker = $dataObject; $expertise_csv = $this->fields->fieldByName("Expertise")->Value(); $expertise_array = explode(',', $expertise_csv); $exp_ids = array(); if ($expertise_array) { foreach ($expertise_array as $expertise) { if (empty($expertise)) { continue; } $expertise = Convert::raw2sql(trim($expertise)); if (!($anexp = $speaker->AreasOfExpertise()->find('Expertise', $expertise))) { $anexp = SpeakerExpertise::create(array('Expertise' => $expertise)); } $anexp->write(); $exp_ids[] = $anexp->ID; } } $speaker->AreasOfExpertise()->setByIdList($exp_ids); $language_csv = $this->fields->fieldByName("Language")->Value(); $language_array = explode(',', $language_csv); $lang_ids = array(); if ($language_array) { foreach ($language_array as $language) { if (empty($language)) { continue; } $language = Convert::raw2sql(trim($language)); if (!($alang = $speaker->Languages()->find('Language', $language))) { $alang = SpeakerLanguage::create(array('Language' => $language)); } $alang->write(); $lang_ids[] = $alang->ID; } } $speaker->Languages()->setByIdList($lang_ids); $link_ids = array(); for ($i = 1; $i <= 5; $i++) { $link = $this->fields->fieldByName("PresentationLink[{$i}]"); $title = $this->fields->fieldByName("PresentationTitle[{$i}]"); if (is_null($link)) { continue; } $link_val = Convert::raw2sql(trim($link->Value())); if (empty($link_val)) { continue; } $title_val = is_null($title) ? '' : Convert::raw2sql(trim($title->Value())); if (!($alink = $speaker->OtherPresentationLinks()->find('LinkUrl', $link_val))) { $alink = SpeakerPresentationLink::create(array('LinkUrl' => $link_val, 'Title' => $title_val)); } else { $alink->Title = $title_val; } $alink->write(); $link_ids[] = $alink->ID; } $speaker->OtherPresentationLinks()->setByIdList($link_ids); $roles = $this->fields->fieldByName("OrganizationalRole")->Value(); if ($roles && in_array(0, $roles)) { // 0 is the id for Other $other_role = $this->fields->fieldByName("OtherOrganizationalRole")->Value(); $other_role = Convert::raw2sql(trim($other_role)); $new_role = SpeakerOrganizationalRole::get()->where("Role = '{$other_role}' ")->first(); if (!$new_role) { $new_role = new SpeakerOrganizationalRole(array('Role' => $other_role, 'IsDefault' => 0)); $new_role->write(); } array_pop($roles); $roles[] = $new_role->ID; } $speaker->OrganizationalRoles()->setByIdList($roles); $countries_2_travel = $this->fields->fieldByName('CountriesToTravel'); $country_ids = array(); if (!is_null($countries_2_travel)) { $country_array = $countries_2_travel->Value(); if ($country_array) { foreach ($country_array as $country_name) { $country_name = Convert::raw2sql(trim($country_name)); if (!($acountry = $speaker->TravelPreferences()->find('Country', $country_name))) { $acountry = SpeakerTravelPreference::create(array('Country' => $country_name)); } $acountry->write(); $country_ids[] = $acountry->ID; } } } $speaker->TravelPreferences()->setByIdList($country_ids); }
public function ContactForm() { $form = BootstrapForm::create($this, __FUNCTION__, FieldList::create(TextField::create('FullName', 'Full Name'), TextField::create('Phone', 'Phone Number'), TextField::create('Email', 'Email Address'), TextAreaField::create('Message', 'Message')), Fieldlist::create(FormAction::create('sendContactForm', 'Send Message')->addExtraClass('square-btn'))); return $form; }
public function NewsletterForm() { $form = BootstrapForm::create($this, __FUNCTION__, FieldList::create(EmailField::create('Email', '')->setAttribute('placeholder', 'Email Address')), Fieldlist::create(FormAction::create('sendNewsletterForm', 'Sign Up')->setStyle('primary')))->setLayout('inline'); return $form; }
public function saveInto(DataObjectInterface $dataObject, $fieldList = null) { parent::saveInto($dataObject, $fieldList); if (!$dataObject instanceof PresentationSpeaker) { return; } $speaker = $dataObject; $speaker->AreasOfExpertise()->removeAll(); for ($i = 1; $i <= 5; $i++) { $field = $this->fields->fieldByName("Expertise[{$i}]"); if (is_null($field)) { continue; } $val = $field->Value(); if (empty($val)) { continue; } $speaker->AreasOfExpertise()->add(SpeakerExpertise::create(array('Expertise' => trim($val)))); } $speaker->Languages()->removeAll(); for ($i = 1; $i <= 5; $i++) { $field = $this->fields->fieldByName("Language[{$i}]"); if (is_null($field)) { continue; } $val = $field->Value(); if (empty($val)) { continue; } $speaker->Languages()->add(SpeakerLanguage::create(array('Language' => trim($val)))); } $speaker->OtherPresentationLinks()->removeAll(); for ($i = 1; $i <= 5; $i++) { $link = $this->fields->fieldByName("PresentationLink[{$i}]"); $title = $this->fields->fieldByName("PresentationTitle[{$i}]"); if (is_null($link)) { continue; } $link_val = $link->Value(); $title_val = is_null($title) ? '' : $title->Value(); if (empty($link_val)) { continue; } $speaker->OtherPresentationLinks()->add(SpeakerPresentationLink::create(array('LinkUrl' => trim($link_val), 'Title' => trim($title_val)))); } $countries_2_travel = $this->fields->fieldByName('CountriesToTravel'); if (!is_null($countries_2_travel)) { $speaker->TravelPreferences()->removeAll(); $country_array = $countries_2_travel->Value(); foreach ($country_array as $country_name) { $speaker->TravelPreferences()->add(SpeakerTravelPreference::create(array('Country' => $country_name))); } } }
public function saveInto(DataObjectInterface $dataObject, $fieldList = null) { parent::saveInto($dataObject, $fieldList); if (!$dataObject instanceof Presentation) { return; } $presentation = $dataObject; $old_materials = $presentation->Materials()->filter('ClassName', 'PresentationLink'); foreach ($old_materials as $o) { $o->Delete(); } for ($i = 1; $i <= 5; $i++) { $field = $this->fields->fieldByName("PresentationLink[{$i}]"); if (is_null($field)) { continue; } $val = $field->Value(); if (empty($val)) { continue; } $presentation = PresentationLink::create(['Name' => trim($val), 'Link' => trim($val)]); $presentation->Materials()->add($presentation); } $extra_questions = $presentation->Category()->Exists() ? $presentation->Category()->ExtraQuestions() : array(); foreach ($extra_questions as $question) { $field = $this->fields->fieldByName($question->Name); if (is_null($field)) { continue; } $answer_value = $field->Value(); if (empty($answer_value)) { continue; } if (!($answer = $presentation->findAnswerByQuestion($question))) { $answer = new TrackAnswer(); } if (is_array($answer_value)) { $answer_value = str_replace('{comma}', ',', $answer_value); $answer->Value = implode(',', $answer_value); } else { $answer->Value = $answer_value; } $answer->QuestionID = $question->getIdentifier(); $answer->write(); $presentation->ExtraAnswers()->add($answer); } }
/** * Handles the registration. Validates and creates the member, then redirects * to the appropriate place * * @param array $data * @param BootstrapForm $form * @return SSViewer */ public function doRegister($data, $form) { try { $back_url = Session::get('BackURL'); Session::set("FormInfo.{$form->getName()}.data", $data); $data = SQLDataCleaner::clean($data); $profile_page = EditProfilePage::get()->first(); $speaker_registration_token = Session::get(SpeakerRegistrationRequest::ConfirmationTokenParamName); if (!empty($speaker_registration_token)) { $data[SpeakerRegistrationRequest::ConfirmationTokenParamName] = $speaker_registration_token; } $member = $this->member_manager->registerSpeaker($data, new MemberRegistrationSenderService()); //Get profile page if (!is_null($profile_page)) { //Redirect to profile page with success message Session::clear("FormInfo.{$form->FormName()}.data"); if ($back_url) { $redirect = HTTP::setGetVar('welcome', 1, $back_url); return OpenStackIdCommon::loginMember($member, $redirect); } $form->sessionMessage('Awesome! You should receive an email shortly.', 'good'); Session::clear(SpeakerRegistrationRequest::ConfirmationTokenParamName); Session::clear('BackURL'); return OpenStackIdCommon::loginMember($member, $this->redirectBackUrl()); } } catch (EntityValidationException $ex1) { Form::messageForForm($form->FormName(), $ex1->getMessage(), 'bad'); //Return back to form SS_Log::log($ex1->getMessage(), SS_Log::WARN); return $this->redirectBack(); } catch (Exception $ex) { Form::messageForForm($form->FormName(), "There was an error with your request, please contact your admin.", 'bad'); //Return back to form SS_Log::log($ex->getMessage(), SS_Log::ERR); return $this->redirectBack(); } }
/** * Handles the registration. Validates and creates the member, then redirects * to the appropriate place * * @param array $data * @param BootstrapForm $form * @return SSViewer */ public function doRegister($data, $form) { try { Session::set("FormInfo.{$form->getName()}.data", $data); $member = Member::get()->filter('Email', $data['Email'])->first(); if ($member) { $form->sessionMessage('Bah! We\'ve already got a user with that email.', 'bad'); return $this->redirectBack(); } if ($data['Password'] != $data['Password_confirm']) { $form->sessionMessage('Passwords do not match.', 'bad'); return $this->redirectBack(); } $member = Member::create(array('FirstName' => $data['FirstName'], 'Surname' => $data['Surname'], 'Email' => $data['Email'], 'Password' => $data['Password'])); $member->write(); if (!empty($data[SpeakerRegistrationRequest::ConfirmationTokenParamName])) { $speaker_registration_token = $data[SpeakerRegistrationRequest::ConfirmationTokenParamName]; $this->speaker_registration_request_manager->confirm($speaker_registration_token, $member); } $member->addToGroupByCode('speakers'); $member->sendWelcomeEmail(); Session::clear("FormInfo.{$form->getName()}.data"); if ($data['BackURL']) { $redirect = HTTP::setGetVar('welcome', 1, $data['BackURL']); return OpenStackIdCommon::loginMember($member, $redirect); } $form->sessionMessage('Awesome! You should receive an email shortly.', 'good'); return OpenStackIdCommon::loginMember($member, $this->redirectBackUrl()); } catch (Exception $ex) { SS_Log::log($ex, SS_Log::WARN); return $this->httpError(404, $ex->getMessage()); } }
/** * Sets form to disable/enable inclusion of jQuery * * @param bool $bool */ public static function set_jquery_included($bool = true) { self::$jquery_included = $bool; }
public function __construct($controller, $name, $actions) { parent::__construct($controller, $name, $this->getPresentationFields(), $actions, $this->getPresentationValidator()); }