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); } }
/** * 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); }
/** * 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 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; }
/** * Creates the registration form * * @return BootstrapForm */ public function RegistrationForm() { $url = Controller::curr()->getRequest()->requestVar('BackURL'); $speaker_registration_token = Controller::curr()->getRequest()->requestVar(SpeakerRegistrationRequest::ConfirmationTokenParamName); $fields = FieldList::create($first_name = TextField::create('FirstName', 'Your First Name'), $last_name = TextField::create('Surname', 'Your Last Name'), $email = EmailField::create('Email', 'Your email address'), PasswordField::create('Password', 'Password'), PasswordField::create('Password_confirm', 'Confirm your password'), HiddenField::create('BackURL', '', $url)); if (!empty($speaker_registration_token)) { $request = $this->speaker_registration_request_repository->getByConfirmationToken($speaker_registration_token); if (is_null($request) || $request->alreadyConfirmed()) { return $this->httpError(404, 'speaker registration request not found!'); } // auto-populate fields $fields->add(HiddenField::create(SpeakerRegistrationRequest::ConfirmationTokenParamName, '', $speaker_registration_token)); $first_name->setValue($request->proposedSpeakerFirstName()); $last_name->setValue($request->proposedSpeakerLastName()); $email->setValue($request->proposedSpeakerEmail()); } $form = BootstrapForm::create($this, 'RegistrationForm', $fields, FieldList::create(FormAction::create('doRegister', 'Register now')), RequiredFields::create('FirstName', 'Surname', 'Email', 'Password', 'Password_confirm')); $data = Session::get("FormInfo.{$form->getName()}.data"); return $form->loadDataFrom($data ?: array()); }
/** * Creates the registration form * * @return BootstrapForm */ public function RegistrationForm() { $speaker_registration_token = Session::get(SpeakerRegistrationRequest::ConfirmationTokenParamName); $fields = FieldList::create($first_name = TextField::create('FirstName', 'Your First Name'), $last_name = TextField::create('Surname', 'Your Last Name'), $email = EmailField::create('Email', 'Your email address'), $password = ConfirmedPasswordField::create('Password', 'Password')); $password->setAttribute('required', 'true'); //if we have in session a registration token, autopopulate values if (!empty($speaker_registration_token)) { $request = $this->speaker_registration_request_repository->getByConfirmationToken($speaker_registration_token); if (is_null($request) || $request->alreadyConfirmed()) { return $this->httpError(404, 'speaker registration request not found!'); } $first_name->setValue($request->proposedSpeakerFirstName()); $last_name->setValue($request->proposedSpeakerLastName()); $email->setValue($request->proposedSpeakerEmail()); } $form = BootstrapForm::create($this, 'RegistrationForm', $fields, FieldList::create(FormAction::create('doRegister', 'Register now')), RequiredFields::create('FirstName', 'Surname', 'Email')); $data = Session::get("FormInfo.{$form->getName()}.data"); return $form->loadDataFrom($data ?: array()); }
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 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; }