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) { $fields = new FieldList(array($t1 = new TextField('ExternalOrderId', 'Eventbrite Order #'), $checkbox = new CheckboxField('SharedContactInfo', 'Allow to share contact info?'))); $t1->setAttribute('placeholder', 'Enter your Eventbrite order #'); $t1->addExtraClass('event-brite-order-number'); $attendees = Session::get('attendees'); if (count($attendees) > 0) { $t1->setValue(Session::get('ExternalOrderId')); $t1->setReadonly(true); $checkbox->setValue(intval(Session::get('SharedContactInfo')) === 1); $fields->add(new LiteralField('ctrl1', 'Current Order has following registered attendees, please select one:')); $options = array(); foreach ($attendees as $attendee) { $ticket_external_id = intval($attendee['ticket_class_id']); $ticket_type = SummitTicketType::get()->filter('ExternalId', $ticket_external_id)->first(); if (is_null($ticket_type)) { continue; } $options[$attendee['id']] = $attendee['profile']['name'] . ' (' . $ticket_type->Name . ')'; } $attendees_ctrl = new OptionSetField('SelectedAttendee', '', $options); $fields->add($attendees_ctrl); $validator = new RequiredFields(array('ExternalOrderId')); // Create action $actions = new FieldList($btn_clear = new FormAction('clearSummitAttendeeInfo', 'Clear'), $btn = new FormAction('saveSummitAttendeeInfo', 'Done')); $btn->addExtraClass('btn btn-default active'); $btn_clear->addExtraClass('btn btn-danger active'); } else { $validator = new RequiredFields(array('ExternalOrderId')); // Create action $actions = new FieldList($btn = new FormAction('saveSummitAttendeeInfo', 'Get Order')); $btn->addExtraClass('btn btn-default active'); } parent::__construct($controller, $name, $fields, $actions, $validator); }
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, 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); }
/** * PresentationForm constructor. * @param Controller $controller * @param string $name * @param FieldList $actions * @param ISummit $summit * @param IPresentationManager $presentation_manager * @param IPresentation $presentation */ public function __construct($controller, $name, $actions, ISummit $summit, IPresentationManager $presentation_manager, IPresentation $presentation) { $this->presentation_manager = $presentation_manager; $this->summit = $summit; $this->presentation = $presentation; 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('summit/javascript/presentation-form.js'); Requirements::css('themes/openstack/bower_assets/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css'); parent::__construct($controller, $name, $this->getPresentationFields(), $actions, $this->getPresentationValidator()); }
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 __construct($controller, $name, $actions) { 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"); parent::__construct($controller, $name, $this->getSpeakerFields(), $actions, $this->getSpeakerValidator()); $script = <<<JS var form_validator_{$this->FormName()} = null; (function( \$ ){ \$(document).ready(function(){ form_validator_{$this->FormName()} = \$('#{$this->FormName()}').validate( { ignore:[], highlight: function(element) { \$(element).closest('.form-group').addClass('has-error'); }, unhighlight: function(element) { \$(element).closest('.form-group').removeClass('has-error'); }, errorElement: 'span', errorClass: 'help-block', errorPlacement: function(error, element) { if(element.parent('.input-group').length) { error.insertAfter(element.parent()); } else { error.insertAfter(element); } }, invalidHandler: function(form, validator) { if (!validator.numberOfInvalids()) return; var element = \$(validator.errorList[0].element); if(!element.is(":visible")){ element = element.parent(); } \$('html, body').animate({ scrollTop: element.offset().top }, 2000); }, }); \$("#SpeakerForm_BioForm_CountriesToTravel").chosen({width: '100%'}); }); // End of closure. }(jQuery )); JS; Requirements::customScript($script); }
public function __construct($controller, $name, $actions, ISummit $summit) { $this->summit = $summit; parent::__construct($controller, $name, $this->getSpeakerFields(), $actions, $this->getSpeakerValidator()); $form_id = $this->FormName(); Requirements::customScript("var form_id = '{$form_id}';"); 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/chosen.jquery.min.js'); Requirements::javascript('themes/openstack/bower_assets/typeahead.js/dist/typeahead.bundle.min.js'); Requirements::javascript('themes/openstack/bower_assets/bootstrap-tagsinput/dist/bootstrap-tagsinput.min.js'); Requirements::javascript('summit/javascript/speaker-form.js'); Requirements::css('themes/openstack/bower_assets/chosen/chosen.min.css'); Requirements::css('themes/openstack/bower_assets/bootstrap-tagsinput/dist/bootstrap-tagsinput.css'); Requirements::css('themes/openstack/bower_assets/bootstrap-tagsinput/dist/bootstrap-tagsinput-typeahead.css'); Requirements::css('summit/css/speaker-form.css'); }
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); }
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); }
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()); }
public function __construct($controller, $name, $actions) { parent::__construct($controller, $name, $this->getPresentationFields(), $actions, $this->getPresentationValidator()); }