Inheritance: extends InputField
    function __construct($controller, $name)
    {
        $Name = new TextField('Name', 'Your name');
        $Phone = new TextField('Phone', 'Your phone number');
        $Email = new TextField('Email', 'Your email');
        $Subject = new TextField('Subject', 'Subject');
        $Message = new TextareaField('Message', 'Your message', '10', '45');
        $Name->addExtraClass('Required');
        $Email->addExtraClass('Required');
        $Message->addExtraClass('Required');
        $messageFields = new CompositeField($Name, $Phone, $Email, $Subject, $Message);
        $fields = new FieldSet($messageFields);
        $actions = new FieldSet(new FormAction('processMessage', 'send'));
        Requirements::customScript('
			jQuery(document).ready(function() {
				
				jQuery("#ContactForm_ContactForm_Name").addClass("validate[required,custom[onlyLetter],length[0,100]] text-input");
				jQuery("#ContactForm_ContactForm_Email").addClass("validate[required,custom[email]] text-input");
				jQuery("#ContactForm_ContactForm_Message").addClass("validate[required,length[6,300]] text-input");
				
				jQuery("#ContactForm_ContactForm").validationEngine()
				
			});
		');
        parent::__construct($controller, $name, $fields, $actions);
    }
 public function __construct($name, $title = null, $value = null, $form = null)
 {
     $allowed_types = $this->stat('allowed_types');
     $field_types = $this->stat('field_types');
     if (empty($allowed_types)) {
         $allowed_types = array_keys($field_types);
     }
     $field = new DropdownField("{$name}[Type]", '', array_combine($allowed_types, $allowed_types));
     $field->setEmptyString('Please choose the Link Type');
     $this->composite_fields['Type'] = $field;
     foreach ($allowed_types as $type) {
         $def = $field_types[$type];
         $field_name = "{$name}[{$type}]";
         switch ($def['field']) {
             case 'TreeDropdownField':
                 $field = new TreeDropdownField($field_name, '', 'SiteTree', 'ID', 'Title');
                 break;
             default:
                 $field = new TextField($field_name, '');
                 break;
         }
         $field->setDescription($def['description']);
         $field->addExtraClass('FlexiLinkCompositeField');
         $this->composite_fields[$type] = $field;
     }
     $this->setForm($form);
     parent::__construct($name, $title, $value, $form);
 }
 public function updateCMSFields(FieldList $fields)
 {
     $type = new DropdownField('EventType', _t('ScoutDistrict.Events.TYPE', 'Type'), array('section-meeting' => _t('ScoutDistrict.Enum.SECTIONMEETING', 'Section Meeting'), 'leaders-meeting' => _t('ScoutDistrict.Enum.LEADERSMEETING', 'Leaders Meeting'), 'activity' => _t('ScoutDistrict.Enum.ACTIVITY', 'Activity'), 'fundraising' => _t('ScoutDistrict.Enum.FUNDRAISING', 'Fundraising'), 'committee' => _t('ScoutDistrict.Enum.COMMITTEE', 'Committee'), 'camp' => _t('ScoutDistrict.Enum.CAMP', 'Camp'), 'group' => _t('ScoutDistrict.Enum.GROUP', 'Group'), 'district' => _t('ScoutDistrict.Enum.DISTRICT', 'District'), 'training' => _t('ScoutDistrict.Enum.TRAINING', 'Training'), 'other' => _t('ScoutDistrict.Enum.OTHER', 'Other')));
     $type->setRightTitle(_t('ScoutDistrict.Events.TYPE_HELP', 'What Type of event is this'))->addExtraClass('help');
     $location = new TextField('EventLocation', _t('ScoutDistrict.Events.LOCATION', 'Location'));
     $location->setRightTitle(_t('ScoutDistrict.Events.LOCATION_HELP', 'Where is the event being held'))->addExtraClass('help');
     $latitude = new TextField('EventLatitude', _t('ScoutDistrict.Events.LATITUDE', 'Latitude'));
     $latitude->setRightTitle(_t('ScoutDistrict.Events.LATITUDE_HELP', 'Latitude of event Location'))->addExtraClass('help');
     $longitude = new TextField('EventLongitude', _t('ScoutDistrict.Events.LONGITUDE', 'Longitude'));
     $longitude->setRightTitle(_t('ScoutDistrict.Events.LONGITUDE_HELP', 'Longitude of event Location'))->addExtraClass('help');
     $bookingDetails = new TextareaField('EventBookingDetails', _t('ScoutDistrict.Events.BOOKINGDETAILS', 'Booking Details'));
     $bookingDetails->setRightTitle(_t('ScoutDistrict.Events.BOOKINGDETAILS_HELP', 'Details of how to book a place for the Event'))->addExtraClass('help');
     $bookingURL = new TextField('EventBookingURL', _t('ScoutDistrict.Events.BOOKINGURL', 'Booking URL'));
     $bookingURL->setRightTitle(_t('ScoutDistrict.Events.BOOKINGURL_HELP', 'The URL of an external site to book a place'))->addExtraClass('help');
     $fields->addFieldsToTab('Root.Scouts', array($type, $location, $latitude, $longitude, $bookingDetails, $bookingURL));
     $thumbnail = new UploadField('ThumbnailImage', _t('ScoutDistrict.Events.THUMBNAIL', 'Thumbnail Image'));
     $thumbnail->setFolderName('event/thumbnail');
     $thumbnail->setRightTitle(_t('ScoutDistrict.Events.THUMBNAIL_HELP', 'A small image for displaying in listing/aggregated content'))->addExtraClass('help');
     $image = new UploadField('Image', _t('ScoutDistrict.Events.IMAGE', 'Image'));
     $image->setFolderName('event/image');
     $image->setRightTitle(_t('ScoutDistrict.Events.IMAGE_HELP', 'A Larger image for displaying in event header'))->addExtraClass('help');
     $files = new UploadField('Files', _t('ScoutDistrict.Events.FILE', 'Files'));
     $files->setFolderName('event/file');
     $files->setRightTitle(_t('ScoutDistrict.Events.FILE_HELP', 'This can be a file containing information about the event or an application form, etc'))->addExtraClass('help');
     $fields->addFieldsToTab('Root.Files', array($thumbnail, $image, $files));
     return $fields;
 }
 public function __construct($opponentId)
 {
     parent::__construct('composeMessageForm');
     $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
     $field = new HiddenField('uid');
     $field->setValue(UTIL_HtmlTag::generateAutoId('mailbox_new_message_' . $opponentId));
     $this->addElement($field);
     $field = new HiddenField('opponentId');
     $field->setValue($opponentId);
     $this->addElement($field);
     $field = new TextField('subject');
     $field->setInvitation(OW::getLanguage()->text('mailbox', 'subject'));
     $field->setHasInvitation(true);
     $field->setRequired();
     $this->addElement($field);
     $field = new Textarea('message');
     $field->setInvitation(OW::getLanguage()->text('mailbox', 'text_message_invitation'));
     $field->setHasInvitation(true);
     $field->setRequired();
     $this->addElement($field);
     $field = new HiddenField('attachment');
     $this->addElement($field);
     $submit = new Submit('sendBtn');
     $submit->setId('sendBtn');
     $submit->setValue(OW::getLanguage()->text('mailbox', 'add_button'));
     $this->addElement($submit);
     if (!OW::getRequest()->isAjax()) {
         $js = UTIL_JsGenerator::composeJsString('
         owForms["composeMessageForm"].bind( "submit", function( r )
         {
             $("#newmessage-mail-send-btn").addClass("owm_preloader_circle");
         });');
         OW::getDocument()->addOnloadScript($js);
     }
 }
 /**
  * @return Form|SS_HTTPResponse
  */
 public function EditProfileForm()
 {
     if (!Member::currentUser()) {
         $this->setFlash(_t('EditProfilePage.LoginWarning', 'Please login to edit your profile'), 'warning');
         return $this->redirect(Director::absoluteBaseURL());
     }
     $firstName = new TextField('FirstName');
     $firstName->setAttribute('placeholder', _t('EditProfilePage.FirstNamePlaceholder', 'Enter your first name'))->setAttribute('required', 'required')->addExtraClass('form-control');
     $surname = new TextField('Surname');
     $surname->setAttribute('placeholder', _t('EditProfilePage.SurnamePlaceholder', 'Enter your surname'))->setAttribute('required', 'required')->addExtraClass('form-control');
     $email = new EmailField('Email');
     $email->setAttribute('placeholder', _t('EditProfilePage.EmailPlaceholder', 'Enter your email address'))->setAttribute('required', 'required')->addExtraClass('form-control');
     $jobTitle = new TextField('JobTitle');
     $jobTitle->setAttribute('placeholder', _t('EditProfilePage.JobTitlePlaceholder', 'Enter your job title'))->addExtraClass('form-control');
     $website = new TextField('Website');
     $website->setAttribute('placeholder', _t('EditProfilePage.WebsitePlaceholder', 'Enter your website'))->addExtraClass('form-control');
     $blurb = new TextareaField('Blurb');
     $blurb->setAttribute('placeholder', _t('EditProfilePage.BlurbPlaceholder', 'Enter your blurb'))->addExtraClass('form-control');
     $confirmPassword = new ConfirmedPasswordField('Password', _t('EditProfilePage.PasswordLabel', 'New Password'));
     $confirmPassword->canBeEmpty = true;
     $confirmPassword->setAttribute('placeholder', _t('EditProfilePage.PasswordPlaceholder', 'Enter your password'))->addExtraClass('form-control');
     $fields = new FieldList($firstName, $surname, $email, $jobTitle, $website, $blurb, $confirmPassword);
     $action = new FormAction('SaveProfile', _t('EditProfilePage.SaveProfileText', 'Update Profile'));
     $action->addExtraClass('btn btn-primary btn-lg');
     $actions = new FieldList($action);
     // Create action
     $validator = new RequiredFields('FirstName', 'Email');
     //Create form
     $form = new Form($this, 'EditProfileForm', $fields, $actions, $validator);
     //Populate the form with the current members data
     $Member = Member::currentUser();
     $form->loadDataFrom($Member->data());
     //Return the form
     return $form;
 }
Example #6
0
 /**
  * Class constructor
  */
 public function __construct($providerName)
 {
     parent::__construct('provider-config-form');
     $this->setAjax(true);
     $this->bindJsFunction(Form::BIND_SUCCESS, 'function(data){if( data.result ){OW.info(data.message);setTimeout(function(){location.reload();}, 1000);}else{OW.error(data.message);}}');
     $this->setAction(OW::getRouter()->urlForRoute('ynsocialconnect-admin-ajaxUpdateProfileQuestion'));
     $language = OW::getLanguage();
     $service = YNSOCIALCONNECT_BOL_ServicesService::getInstance();
     $questionDtoList = $service->getOWQuestionDtoList($providerName);
     $aliases = $service->findAliasList($providerName);
     $options = $service->getServiceFields($providerName);
     foreach ($questionDtoList as $question) {
         $new_element = new Selectbox('alias[' . $question->name . ']');
         foreach ($options as $option) {
             $new_element->addOption($option->name, $option->label);
         }
         $new_element->setValue(empty($aliases[$question->name]) ? '' : $aliases[$question->name]);
         $this->addElement($new_element);
     }
     $hidden = new TextField('providerName');
     $hidden->addAttribute('type', 'hidden');
     $hidden->setValue($providerName);
     $this->addElement($hidden);
     $submit = new Submit('edit');
     $submit->setValue($language->text('ynsocialconnect', 'save_btn_label'));
     $this->addElement($submit);
 }
 /**
  * @return Comosite FieldSet with Categorys and Items
  */
 function getCompositeField()
 {
     //create new composite field group for each category
     $oCatFieldSet = new CompositeField();
     // Set the field group ID
     $oCatFieldSet->setID('Cat' . $this->ID);
     $oCatFieldSet->addExtraClass('category');
     //create new composite field group for each category
     $oCatField = new TextField($this->ID . '_' . $this->FieldName, $this->Title, null, null);
     $oCatField->addExtraClass('category-field');
     //Add Category Percentage Field to the Form
     $oCatFieldSet->push($oCatField);
     if ($this->Description) {
         $oCatDescField = new LiteralField($this->ID . '_Description', '<p class="category-field-desc">' . $this->Description . '</p>');
         $oCatDescField->addExtraClass('category-field');
         $oCatFieldSet->push($oCatDescField);
     }
     //Add item Composite Field to this Composite Field
     //now get all of the items matched with this category
     $oFormCategoryItems = self::FormCategoryItems();
     foreach ($oFormCategoryItems as $item) {
         $oCatFieldSet->push($item->getFormField());
     }
     return $oCatFieldSet;
 }
Example #8
0
 /**
  * Class constructor
  *
  */
 public function __construct($plugins)
 {
     parent::__construct('configForm');
     $language = OW::getLanguage();
     $values = OW::getConfig()->getValues('attachments');
     if ($plugins['video']) {
         $field = new CheckboxField('video_share');
         $field->setValue($values['video_share']);
         $this->addElement($field);
     }
     if ($plugins['links']) {
         $field = new CheckboxField('link_share');
         $field->setValue($values['link_share']);
         $this->addElement($field);
     }
     if ($plugins['photo']) {
         $field = new CheckboxField('photo_share');
         $field->setId('photo_share_check');
         $field->setValue($values['photo_share']);
         $this->addElement($field);
         $field = new TextField('photo_album_name');
         $field->setValue(OW::getLanguage()->text('attachments', 'default_photo_album_name'));
         $field->setRequired();
         $this->addElement($field);
     }
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('attachments', 'config_save_label'));
     $this->addElement($submit);
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Contact Form settings
     $recipient_field = new EmailField('DefaultRecipient', 'Email recipient');
     $recipient_field->setDescription('Default email address to send submissions to.');
     $subject_field = new TextField('Subject', 'Email subject');
     $subject_field->setDescription('Subject for the email.');
     $default_from_field = new EmailField('DefaultFrom', 'Email from');
     $default_from_field->setDescription('Default from email address.');
     $fields->addFieldToTab('Root.ContactForm.Settings', $recipient_field);
     $fields->addFieldToTab('Root.ContactForm.Settings', $subject_field);
     $fields->addFieldToTab('Root.ContactForm.Settings', $default_from_field);
     // Contact Form fields
     $conf = GridFieldConfig_RelationEditor::create(10);
     $conf->addComponent(new GridFieldSortableRows('SortOrder'));
     $data_columns = $conf->getComponentByType('GridFieldDataColumns');
     $data_columns->setDisplayFields(array('Name' => 'Name', 'Type' => 'Type', 'requiredText' => 'Required'));
     $contact_form_fields = new GridField('Fields', 'Field', $this->ContactFields(), $conf);
     $fields->addFieldToTab('Root.ContactForm.Fields', $contact_form_fields);
     // Recipient map
     $contact_fields = array();
     foreach ($this->ContactFields() as $contact_field) {
         $contact_fields[$contact_field->Name] = $contact_field->Name;
     }
     $recipient_map_field_field = new DropdownField('RecipientMapField', 'Recipient Map Field', $contact_fields);
     $recipient_map_field_field->setDescription('Field used to map recipients.');
     $recipient_map_field = new TextareaField('RecipientMap', 'Recipient Map');
     $recipient_map_field->setDescription('Map field values to an email address (format: value:email address) one per line.');
     $fields->addFieldToTab('Root.ContactForm.RecipientMap', $recipient_map_field_field);
     $fields->addFieldToTab('Root.ContactForm.RecipientMap', $recipient_map_field);
     return $fields;
 }
Example #10
0
 public function index($params = array())
 {
     $userService = BOL_UserService::getInstance();
     $language = OW::getLanguage();
     $this->setPageHeading($language->text('hotlist', 'admin_heading_settings'));
     $this->setPageHeadingIconClass('ow_ic_gear_wheel');
     $settingsForm = new Form('settingsForm');
     $settingsForm->setId('settingsForm');
     $expiration_time = new TextField('expiration_time');
     $expiration_time->setRequired();
     $expiration_time->setLabel($language->text('hotlist', 'label_expiration_time'));
     $expiration_time_value = (int) OW::getConfig()->getValue('hotlist', 'expiration_time') / 86400;
     $expiration_time->setValue($expiration_time_value);
     $settingsForm->addElement($expiration_time);
     $submit = new Submit('save');
     $submit->addAttribute('class', 'ow_ic_save');
     $submit->setValue($language->text('hotlist', 'label_save_btn_label'));
     $settingsForm->addElement($submit);
     $this->addForm($settingsForm);
     if (OW::getRequest()->isPost()) {
         if ($settingsForm->isValid($_POST)) {
             $data = $settingsForm->getValues();
             OW::getConfig()->saveConfig('hotlist', 'expiration_time', $data['expiration_time'] * 86400);
             OW::getFeedback()->info($language->text('hotlist', 'settings_saved'));
             $this->redirect();
         }
     }
 }
 public function getCMSFields()
 {
     //Fetch curret fields and store in Fields
     $fields = parent::getCMSFields();
     //Remove Fields
     $fields->removeFieldFromTab("Root.Main", array("SortOrder", "CalendarID", "Title", "Content", "StartDate", "StartTime", "EndDate", "EndTime", "Location"));
     //Event Title
     $Title = new TextField("Title", "Event Title");
     $Title->setRightTitle("Enter the event title. i.e. sports day.");
     //Start Date & Time
     $StartDate = new DateField("StartDate", "Start Date");
     $StartDate->setConfig('showcalendar', 1);
     $StartDate->setConfig('dateformat', 'dd/MM/YYYY');
     $StartTime = new TimeField("StartTime", "Start Time (Optional)");
     $StartTime->setConfig('use_strtotime', 1);
     //End Date & Time
     $EndDate = new DateField("EndDate", "End Date (Optional)");
     $EndDate->setConfig('showcalendar', 1);
     $EndDate->setConfig('dateformat', 'dd/MM/YYYY');
     $EndTime = new TimeField("EndTime", "End Time (Optional)");
     $StartTime->setConfig('use_strtotime', 1);
     //Location
     $Location = new AddressTextField("Location", "Event Location", "AIzaSyA-folYpPWGiFcpBZURJpf610nO6FJtqqQ");
     $Location->SetRightTitle("Optional. Begin typing and you will see address suggestions (Beta). Powered by Google.");
     $Location->addExtraClass("text");
     //Event Description
     $Description = new HTMLEditorField("Content", "Event Description");
     //Group Start and End Date & Time Fields
     $Times = FieldGroup::create($StartDate, $StartTime, $EndDate, $EndTime)->setTitle('Timings');
     //Add Fields to the CMS
     $fields->addFieldsToTab("Root.Main", array($Title, $Times, $Location, $Description));
     //Return Fields to the CMS
     return $fields;
 }
Example #12
0
 public function __construct($configs, $features)
 {
     parent::__construct('MCOMPOSE_ConfigForm');
     $this->configs = $configs;
     $language = OW::getLanguage();
     $field = new TextField('max_users');
     $field->setRequired();
     $field->setValue($configs['max_users']);
     $this->addElement($field);
     if ($features["friends"]) {
         $field = new CheckboxField('friends_enabled');
         $field->setValue($configs['friends_enabled']);
         $this->addElement($field);
     }
     if ($features["groups"]) {
         $field = new CheckboxField('groups_enabled');
         $field->setValue($configs['groups_enabled']);
         $this->addElement($field);
     }
     if ($features["events"]) {
         $field = new CheckboxField('events_enabled');
         $field->setValue($configs['events_enabled']);
         $this->addElement($field);
     }
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('mcompose', 'admin_save_btn'));
     $this->addElement($submit);
 }
 /**
  * returns the form
  * @return Form
  */
 public function getGoogleSiteSearchForm($name = "GoogleSiteSearchForm")
 {
     $formIDinHTML = "Form_" . $name;
     if ($page = GoogleCustomSearchPage::get()->first()) {
         Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
         Requirements::javascript('googlecustomsearch/javascript/GoogleCustomSearch.js');
         $apiKey = Config::inst()->get("GoogleCustomSearchExt", "api_key");
         $cxKey = Config::inst()->get("GoogleCustomSearchExt", "cx_key");
         if ($apiKey && $cxKey) {
             Requirements::customScript("\n\t\t\t\t\t\tGoogleCustomSearch.apiKey = '" . $apiKey . "';\n\t\t\t\t\t\tGoogleCustomSearch.cxKey = '" . $cxKey . "';\n\t\t\t\t\t\tGoogleCustomSearch.formSelector = '#" . $formIDinHTML . "';\n\t\t\t\t\t\tGoogleCustomSearch.inputFieldSelector = '#" . $formIDinHTML . "_search';\n\t\t\t\t\t\tGoogleCustomSearch.resultsSelector = '#" . $formIDinHTML . "_Results';\n\t\t\t\t\t", "GoogleCustomSearchExt");
             $form = new Form($this->owner, 'GoogleSiteSearchForm', new FieldList($searchField = new TextField('search'), $resultField = new LiteralField($name . "_Results", "<div id=\"" . $formIDinHTML . "_Results\"></div>")), new FieldList(new FormAction('doSearch', _t("GoogleCustomSearchExt.GO", "Full Results"))));
             $form->setFormMethod('GET');
             if ($page = GoogleCustomSearchPage::get()->first()) {
                 $form->setFormAction($page->Link());
             }
             $form->disableSecurityToken();
             $form->loadDataFrom($_GET);
             $searchField->setAttribute("autocomplete", "off");
             $form->setAttribute("autocomplete", "off");
             return $form;
         } else {
             user_error("You must set an API Key and a CX key in your configs to use the Google Custom Search Form", E_USER_NOTICE);
         }
     } else {
         user_error("You must create a GoogleCustomSearchPage first.", E_USER_NOTICE);
     }
 }
Example #14
0
 public function testRegexpPrice()
 {
     \Input::setPost('test_rgxp_price', 'foobar');
     $objWidget = new \TextField(array('name' => 'test_rgxp_price'));
     $objWidget->rgxp = 'price';
     $objWidget->validate();
     $this->assertTrue($objWidget->hasErrors());
     unset($objWidget);
     \Input::setPost('test_rgxp_price', '20.00');
     $objWidget = new \TextField(array('name' => 'test_rgxp_price'));
     $objWidget->rgxp = 'price';
     $objWidget->validate();
     $this->assertFalse($objWidget->hasErrors());
     unset($objWidget);
     \Input::setPost('test_rgxp_price', '20');
     $objWidget = new \TextField(array('name' => 'test_rgxp_price'));
     $objWidget->rgxp = 'price';
     $objWidget->validate();
     $this->assertFalse($objWidget->hasErrors());
     unset($objWidget);
     \Input::setPost('test_rgxp_price', '-20');
     $objWidget = new \TextField(array('name' => 'test_rgxp_price'));
     $objWidget->rgxp = 'price';
     $objWidget->validate();
     $this->assertFalse($objWidget->hasErrors());
     unset($objWidget);
     \Input::setPost('test_rgxp_price', '20.-');
     $objWidget = new \TextField(array('name' => 'test_rgxp_price'));
     $objWidget->rgxp = 'price';
     $objWidget->validate();
     $this->assertFalse($objWidget->hasErrors());
     unset($objWidget);
 }
 function __construct($controller, $name)
 {
     $org_field = null;
     $current_user = Member::currentUser();
     $current_affiliations = $current_user->getCurrentAffiliations();
     if (!$current_affiliations) {
         $org_field = new TextField('Organization', 'Your Organization Name');
     } else {
         if (count($current_affiliations) > 1) {
             $source = array();
             foreach ($current_affiliations as $a) {
                 $org = $a->Organization();
                 $source[$org->ID] = $org->Name;
             }
             $source['0'] = "-- New One --";
             $ddl = new DropdownField('OrgID', 'Your Organization', $source);
             $ddl->setEmptyString('-- Select Your Organization --');
             $org_field = new FieldGroup();
             $org_field->push($ddl);
             $org_field->push($txt = new TextField('Organization', ''));
             $txt->addExtraClass('new-org-name');
         } else {
             $org_field = new TextField('Organization', 'Your Organization Name', $current_user->getOrgName());
         }
     }
     $fields = new FieldList($org_field, new DropdownField('Industry', 'Your Organization’s Primary Industry', ArrayUtils::AlphaSort(DeploymentSurveyOptions::$industry_options, array('' => '-- Please Select One --'), array('Other' => 'Other Industry (please specify)'))), new TextareaField('OtherIndustry', 'Other Industry'), $org_it_activity = new TextareaField('ITActivity', 'Your Organization’s Primary IT Activity'), new LiteralField('Break', '<hr/>'), new LiteralField('Break', '<p>Your Organization’s Primary Location or Headquarters</p>'), $country = new DropdownField('PrimaryCountry', 'Country', CountryCodes::$iso_3166_countryCodes), new TextField('PrimaryState', 'State / Province / Region'), new TextField('PrimaryCity', 'City'), new DropdownField('OrgSize', 'Your Organization Size (All Branches, Locations, Sites)', DeploymentSurveyOptions::$organization_size_options), new CustomCheckboxSetField('OpenStackInvolvement', 'What best describes your Organization’s involvement with OpenStack?<BR>Select All That Apply', ArrayUtils::AlphaSort(DeploymentSurveyOptions::$openstack_involvement_options)));
     $org_it_activity->addExtraClass('hidden');
     $country->setEmptyString('-- Select One --');
     $nextButton = new FormAction('NextStep', '  Next Step  ');
     $actions = new FieldList($nextButton);
     $validator = new RequiredFields();
     Requirements::javascript('surveys/js/deployment_survey_yourorganization_form.js');
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
Example #16
0
 public function __construct($providerName)
 {
     parent::__construct('login-form');
     $language = OW::getLanguage();
     $this->setAction("");
     $label = $language->text('yncontactimporter', 'login_email');
     if ($providerName == 'hyves') {
         $label = $language->text('yncontactimporter', 'login_username');
     }
     // email
     $email = new TextField('email');
     $email->setLabel($label)->setRequired(true);
     $this->addElement($email);
     //pass
     $password = new PasswordField('password');
     $password->setLabel($language->text('yncontactimporter', 'login_password'))->setRequired(true);
     $this->addElement($password);
     //providerName
     $hiddenProviderName = new HiddenField('providerName');
     $hiddenProviderName->setValue($providerName);
     $this->addElement($hiddenProviderName);
     // button submit
     $submit = new Submit('submit');
     $submit->setValue($language->text('yncontactimporter', 'submit_btn_label'));
     $this->addElement($submit);
 }
 /**
  * 
  * @param GridField $gridField
  * @return string - HTML
  */
 public function getHTMLFragments($gridField)
 {
     $searchState = $gridField->State->GridFieldSearchRelation;
     $dataClass = $gridField->getList()->dataClass();
     $forTemplate = new ArrayData(array());
     $forTemplate->Fields = new ArrayList();
     $searchFields = $this->getSearchFields() ? $this->getSearchFields() : $this->scaffoldSearchFields($dataClass);
     $value = $this->findSingleEntry($gridField, $searchFields, $searchState, $dataClass);
     $searchField = new TextField('gridfield_relationsearch', _t('GridField.RelationSearch', "Relation search"), $value);
     // Apparently the data-* needs to be double qouted for the jQuery.meta data plugin
     $searchField->setAttribute('data-search-url', '\'' . Controller::join_links($gridField->Link('search') . '\''));
     $searchField->setAttribute('placeholder', $this->getPlaceholderText($dataClass));
     $searchField->addExtraClass('relation-search no-change-track');
     $findAction = new GridField_FormAction($gridField, 'gridfield_relationfind', _t('GridField.Find', "Find"), 'find', 'find');
     $findAction->setAttribute('data-icon', 'relationfind');
     $addAction = new GridField_FormAction($gridField, 'gridfield_relationadd', _t('GridField.LinkExisting', "Link Existing"), 'addto', 'addto');
     $addAction->setAttribute('data-icon', 'chain--plus');
     // If an object is not found, disable the action
     if (!is_int($gridField->State->GridFieldAddRelation)) {
         $addAction->setReadonly(true);
     }
     $forTemplate->Fields->push($searchField);
     $forTemplate->Fields->push($findAction);
     $forTemplate->Fields->push($addAction);
     return array($this->targetFragment => $forTemplate->renderWith($this->itemClass));
 }
Example #18
0
 /**
  * Constructor.
  */
 public function __construct($ajax = false)
 {
     parent::__construct();
     $form = new Form('sign-in');
     $form->setAction("");
     $username = new TextField('identity');
     $username->setRequired(true);
     $username->setHasInvitation(true);
     $username->setInvitation(OW::getLanguage()->text('base', 'component_sign_in_login_invitation'));
     $form->addElement($username);
     $password = new PasswordField('password');
     $password->setHasInvitation(true);
     $password->setInvitation('password');
     $password->setRequired(true);
     $form->addElement($password);
     $remeberMe = new CheckboxField('remember');
     $remeberMe->setValue(true);
     $remeberMe->setLabel(OW::getLanguage()->text('base', 'sign_in_remember_me_label'));
     $form->addElement($remeberMe);
     $submit = new Submit('submit');
     $submit->setValue(OW::getLanguage()->text('base', 'sign_in_submit_label'));
     $form->addElement($submit);
     $this->addForm($form);
     if ($ajax) {
         $form->setAjaxResetOnSuccess(false);
         $form->setAjax();
         $form->setAction(OW::getRouter()->urlFor('BASE_CTRL_User', 'ajaxSignIn'));
         $form->bindJsFunction(Form::BIND_SUCCESS, 'function(data){if( data.result ){if(data.message){OW.info(data.message);}setTimeout(function(){window.location.reload();}, 1000);}else{OW.error(data.message);}}');
         $this->assign('forgot_url', OW::getRouter()->urlForRoute('base_forgot_password'));
     }
     $this->assign('joinUrl', OW::getRouter()->urlForRoute('base_join'));
 }
 public function updateCMSFields(\FieldList $fields)
 {
     $tabTitle = _t('SiteConfigExtension.TABSITEINFO', "Site Infos");
     // add a Logo to whole sites
     $fields->addFieldToTab('Root.' . $tabTitle, new UploadField('Logo', _t('SiteConfigExtension.LOGO', 'Logo')));
     $latField = new TextField('Lat', _t('SiteConfigExtension.LATITUDE', 'Latitude'));
     $lngField = new TextField('Lng', _t('SiteConfigExtension.LONGITUDE', 'Longitude'));
     $lngField->setDescription(_t('SiteConfigExtension.GEOINFO', 'Get latitude & longitude values here: <a href="http://itouchmap.com/latlong.html" target="_blank">itouchmap.com</a>.'));
     $fields->addFieldToTab('Root.' . $tabTitle, new TextField('Company', _t('SiteConfigExtension.COMPANY', 'Company')));
     $fields->addFieldToTab('Root.' . $tabTitle, new TextField('SiteOwner', _t('SiteConfigExtension.SITEOWNER', 'Owner')));
     $fields->addFieldToTab('Root.' . $tabTitle, new TextField('Street', _t('SiteConfigExtension.STREET', 'Street')));
     $fields->addFieldToTab('Root.' . $tabTitle, new TextField('HouseNumber', _t('SiteConfigExtension.HOUSENUMBER', 'Housenumber')));
     $fields->addFieldToTab('Root.' . $tabTitle, new TextField('Zipcode', _t('SiteConfigExtension.ZIPCODE', 'Zipcode')));
     $fields->addFieldToTab('Root.' . $tabTitle, new TextField('Destination', _t('SiteConfigExtension.DESTINATION', 'City')));
     $fields->addFieldToTab('Root.' . $tabTitle, $latField);
     $fields->addFieldToTab('Root.' . $tabTitle, $lngField);
     $fields->addFieldToTab('Root.' . $tabTitle, new EmailField('Email', _t('SiteConfigExtension.EMAIL', 'Email')));
     $fields->addFieldToTab('Root.' . $tabTitle, new TextField('Phone', _t('SiteConfigExtension.PHONE', 'Phone')));
     $fields->addFieldToTab('Root.' . $tabTitle, new TextField('Mobile', _t('SiteConfigExtension.MOBILE', 'Mobile')));
     $fields->addFieldToTab('Root.' . $tabTitle, new TextField('Fax', _t('SiteConfigExtension.FAX', 'Fax')));
     $fields->addFieldToTab('Root.' . $tabTitle, new TextField('Twitter', _t('SiteConfigExtension.TWITTER', 'Twitter')));
     $fields->addFieldToTab('Root.' . $tabTitle, new TextField('Facebook', _t('SiteConfigExtension.FACEBOOK', 'Facebook')));
     $fields->addFieldToTab('Root.' . $tabTitle, new TextField('Google', _t('SiteConfigExtension.GOOGLE', 'Google+')));
     $fields->addFieldToTab('Root.' . $tabTitle, new HtmlEditorField('Message', _t('SiteConfigExtension.MESSAGE', 'Message')));
 }
 public function __construct($conversationId, $opponentId)
 {
     parent::__construct('newMailMessageForm');
     $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
     $field = new TextField('newMessageText');
     $field->setValue(OW::getLanguage()->text('mailbox', 'text_message_invitation'));
     $field->setId('newMessageText');
     $this->addElement($field);
     $field = new HiddenField('attachment');
     $this->addElement($field);
     $field = new HiddenField('conversationId');
     $field->setValue($conversationId);
     $this->addElement($field);
     $field = new HiddenField('opponentId');
     $field->setValue($opponentId);
     $this->addElement($field);
     $field = new HiddenField('uid');
     $field->setValue(UTIL_HtmlTag::generateAutoId('mailbox_conversation_' . $conversationId . '_' . $opponentId));
     $this->addElement($field);
     $submit = new Submit('newMessageSendBtn');
     $submit->setId('newMessageSendBtn');
     $submit->setName('newMessageSendBtn');
     $submit->setValue(OW::getLanguage()->text('mailbox', 'add_button'));
     $this->addElement($submit);
     if (!OW::getRequest()->isAjax()) {
         $js = UTIL_JsGenerator::composeJsString('
         owForms["newMailMessageForm"].bind( "submit", function( r )
         {
             $("#newmessage-mail-send-btn").addClass("owm_preloader_circle");
         });');
         OW::getDocument()->addOnloadScript($js);
     }
     $this->setAction(OW::getRouter()->urlFor('MAILBOX_MCTRL_Messages', 'newmessage'));
 }
Example #21
0
 function __construct($controller, $name, $use_actions = true)
 {
     $fields = new FieldList();
     //main info
     $fields->push(new TextField('title', 'Title'));
     $fields->push(new TextField('url', 'Url'));
     $categoryField = new TextField('event_category', 'Category');
     $categoryField->setAttribute('class', 'event-category-autocomplete text');
     $fields->push($categoryField);
     //location
     $fields->push(new TextField('location', 'Location'));
     //duration
     $fields->push($start_date = new TextField('start_date', 'Start Date'));
     $fields->push($end_date = new TextField('end_date', 'End Date'));
     $start_date->addExtraClass('date');
     $end_date->addExtraClass('date');
     // Guard against automated spam registrations by optionally adding a field
     // that is supposed to stay blank (and is hidden from most humans).
     // The label and field name are intentionally common ("username"),
     // as most spam bots won't resist filling it out. The actual username field
     // on the forum is called "Nickname".
     $fields->push(new TextField('user_name', 'UserName'));
     // Create action
     $actions = new FieldList();
     if ($use_actions) {
         $actions->push(new FormAction('saveEvent', 'Save'));
     }
     // Create validators
     $validator = new ConditionalAndValidationRule(array(new HtmlPurifierRequiredValidator('title', 'location'), new RequiredFields('start_date', 'end_date')));
     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);
 }
 /**
  * standard SS method
  * @var Array
  **/
 public function updateCMSFields(FieldList $fields)
 {
     //separate MetaTitle
     if (Config::inst()->get("MetaTagsContentControllerEXT", "use_separate_metatitle") == 1) {
         $fields->addFieldToTab('Root.Main.Metadata', $allowField0 = new TextField('MetaTitle', _t('SiteTree.METATITLE', 'Meta Title')), "MetaDescription");
         $allowField0->setRightTitle(_t("SiteTree.METATITLE_EXPLANATION", "Leave this empty to use the page title"));
     }
     //info about automation
     $fields->addFieldToTab('Root.Main.Metadata', $allowField1 = new CheckboxField('AutomateMetatags', _t('MetaManager.UPDATEMETA', 'Automatically update Meta Description and Navigation Label? ')));
     $automatedFields = $this->updatedFieldsArray();
     $updatedFieldString = "";
     if (count($automatedFields)) {
         $updatedFieldString = "" . _t("MetaManager.UPDATED_EXTERNALLY", "Based on your current settings, the following fields will be automatically updated at all times") . ": <em>" . implode("</em>, <em>", $automatedFields) . "</em>.";
         foreach ($automatedFields as $fieldName => $fieldTitle) {
             $oldField = $fields->dataFieldByName($fieldName);
             if ($oldField) {
                 $newField = $oldField->performReadonlyTransformation();
                 //$newField->setTitle($newField->Title());
                 $newField->setRightTitle(_t("MetaTags.AUTOMATICALLY_UPDATED", "Automatically updated when you save this page (see metadata settings)."));
                 $fields->replaceField($fieldName, $newField);
             }
         }
     }
     $fields->removeByName('ExtraMeta');
     $linkToManager = Config::inst()->get("MetaTagCMSControlPages", "url_segment") . '/';
     $fields->addFieldToTab('Root.Main.Metadata', new LiteralField("LinkToManagerHeader", "<blockquote style='padding-left: 12px;'>\n\t\t\t\t\t<p>\n\t\t\t\t\t\tOpen the Meta Tag Manager to\n\t\t\t\t\t\t<a href=\"{$linkToManager}\" target=\"_blank\">Review and Edit</a>\n\t\t\t\t\t\tthe Meta Data for all pages on this site.\n\t\t\t\t\t\tAlso make sure to review the general settings for\n\t\t\t\t\t\t<a href=\"/admin/settings/\">Search Engines</a>. {$updatedFieldString}\n\t\t\t\t\t</p>\n\t\t\t\t</blockquote>"));
     if ($this->owner->URLSegment == RootURLController::get_default_homepage_link()) {
         $newField = $fields->dataFieldByName('URLSegment');
         $newField->setRightTitle("Careful: changing the URL from 'home' to anything else means that this page will no longer be the home page");
         $fields->replaceField('URLSegment', $newField);
     }
     return $fields;
 }
Example #24
0
 public function render()
 {
     $name = $this->getName();
     $hidden = new HiddenField($name, $this->getValue());
     $id = $this->getId();
     $hidden->addAttribute("id", $id);
     $ret = $hidden->render();
     if ($this->storedFieldSet === false) {
         $this->addSearchField($this->storedField);
         $this->storedFieldSet = true;
     }
     $object = array("model" => $this->model->package, "format" => "json", "fields" => $this->searchFields, "limit" => 20, "conditions" => "", "and_conditions" => $this->andConditions);
     $jsonSearchFields = array_reverse($this->searchFields);
     $object = base64_encode(serialize($object));
     $path = Application::$prefix . "/lib/models/urlaccess.php?object={$object}";
     $fields = urlencode(json_encode($jsonSearchFields));
     $text = new TextField();
     $text->addAttribute("onkeyup", "fapiUpdateSearchField('{$id}','{$path}','{$fields}',this," . ($this->boldFirst ? "true" : "false") . ",'{$this->onChangeAttribute}')");
     $text->addAttribute("autocomplete", "off");
     if ($this->getValue() != "") {
         $data = $this->model[$this->getValue()];
         for ($i = 2; $i < count($jsonSearchFields); $i++) {
             $val .= $data[0][$jsonSearchFields[$i]] . " ";
         }
         $text->setValue($val);
     }
     $text->setId($id . "_search_entry");
     $ret .= $text->render();
     $ret .= "<div class='fapi-popup' id='{$id}_search_area'></div>";
     return $ret;
 }
Example #25
0
 /**
  * Class constructor
  *
  */
 public function __construct()
 {
     parent::__construct('configSaveForm');
     $language = OW::getLanguage();
     $configs = OW::getConfig()->getValues('googlelocation');
     $element = new TextField('api_key');
     $element->setValue($configs['api_key']);
     $validator = new StringValidator(0, 40);
     $validator->setErrorMessage($language->text('googlelocation', 'api_key_too_long'));
     $element->addValidator($validator);
     $this->addElement($element);
     $options = array(GOOGLELOCATION_BOL_LocationService::DISTANCE_UNITS_MILES => $language->text('googlelocation', 'miles'), GOOGLELOCATION_BOL_LocationService::DISTANCE_UNITS_KM => $language->text('googlelocation', 'kms'));
     $distanseUnits = new Selectbox('distanse_units');
     $distanseUnits->setOptions($options);
     $distanseUnits->setValue(GOOGLELOCATION_BOL_LocationService::getInstance()->getDistanseUnits());
     $distanseUnits->setHasInvitation(false);
     $this->addElement($distanseUnits);
     $restrictions = new Selectbox('country_restriction');
     $restrictions->setValue(!empty($configs['country_restriction']) ? $configs['country_restriction'] : null);
     $restrictions->setOptions($this->countryList);
     $restrictions->setInvitation(OW::getLanguage()->text('googlelocation', 'no_country_restriction'));
     $this->addElement($restrictions);
     $autofill = OW::getConfig()->getValue('googlelocation', 'auto_fill_location_on_search');
     $autoFillLocationOnSearch = new CheckboxField('auto_fill_location_on_search');
     $autoFillLocationOnSearch->setValue(empty($autofill) || $autofill == '0' ? false : $autofill);
     $this->addElement($autoFillLocationOnSearch);
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('base', 'edit_button'));
     $this->addElement($submit);
 }
Example #26
0
 public function __construct($name)
 {
     parent::__construct($name);
     $this->setAction(OW::getRouter()->urlForRoute('ocsaffiliates.action_signup'));
     $this->setAjax();
     $lang = OW::getLanguage();
     $affName = new TextField('name');
     $affName->setRequired(true);
     $affName->setLabel($lang->text('ocsaffiliates', 'affiliate_name'));
     $this->addElement($affName);
     $email = new TextField('email');
     $email->setRequired(true);
     $email->setLabel($lang->text('ocsaffiliates', 'email'));
     $email->addValidator(new EmailValidator());
     $this->addElement($email);
     $password = new PasswordField('password');
     $password->setRequired(true);
     $password->setLabel($lang->text('ocsaffiliates', 'password'));
     $this->addElement($password);
     $payment = new Textarea('payment');
     $payment->setRequired(true);
     $payment->setLabel($lang->text('ocsaffiliates', 'payment_details'));
     $this->addElement($payment);
     if (OW::getConfig()->getValue('ocsaffiliates', 'terms_agreement')) {
         $terms = new CheckboxField('terms');
         $validator = new RequiredValidator();
         $validator->setErrorMessage($lang->text('ocsaffiliates', 'terms_required_msg'));
         $terms->addValidator($validator);
         $this->addElement($terms);
     }
     $submit = new Submit('signup');
     $submit->setValue($lang->text('ocsaffiliates', 'signup_btn'));
     $this->addElement($submit);
     $this->bindJsFunction(Form::BIND_SUCCESS, "function(data){\n            if ( !data.result ) {\n                OW.error(data.error);\n            }\n            else {\n                document.location.reload();\n            }\n        }");
 }
Example #27
0
 /**
  * Class constructor
  */
 public function __construct()
 {
     parent::__construct('update-question-form');
     $this->setAction(OW::getRouter()->urlFor('OCSFAQ_CTRL_Admin', 'editQuestion'));
     $lang = OW::getLanguage();
     $questionId = new HiddenField('questionId');
     $questionId->setRequired(true);
     $this->addElement($questionId);
     $question = new TextField('question');
     $question->setRequired(true);
     $question->setLabel($lang->text('ocsfaq', 'question'));
     $this->addElement($question);
     $btnSet = array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO, BOL_TextFormatService::WS_BTN_HTML);
     $answer = new WysiwygTextarea('answer', $btnSet);
     $answer->setRequired(true);
     $answer->setLabel($lang->text('ocsfaq', 'answer'));
     $this->addElement($answer);
     $isFeatured = new CheckboxField('isFeatured');
     $isFeatured->setLabel($lang->text('ocsfaq', 'is_featured'));
     $this->addElement($isFeatured);
     $categories = OCSFAQ_BOL_FaqService::getInstance()->getCategories();
     if ($categories) {
         $category = new Selectbox('category');
         foreach ($categories as $cat) {
             $category->addOption($cat->id, $cat->name);
         }
         $category->setLabel($lang->text('ocsfaq', 'category'));
         $this->addElement($category);
     }
     // submit
     $submit = new Submit('update');
     $submit->setValue($lang->text('ocsfaq', 'btn_save'));
     $this->addElement($submit);
 }
 public function updateSiteCMSFields(FieldList $fields)
 {
     $fields->addFieldToTab('Root.Main', $gaCode = new TextField('GACode', 'Google Analytics account'));
     $gaCode->setRightTitle('Account number to be used all across the site (in the format <strong>UA-XXXXX-X</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $facebookURL = new TextField('FacebookURL', 'Facebook UID or username'));
     $facebookURL->setRightTitle('Facebook link (everything after the "http://facebook.com/", eg http://facebook.com/<strong>username</strong> or http://facebook.com/<strong>pages/108510539573</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $twitterUsername = new TextField('TwitterUsername', 'Twitter username'));
     $twitterUsername->setRightTitle('Twitter username (eg, http://twitter.com/<strong>username</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $addThisID = new TextField('AddThisProfileID', 'AddThis Profile ID'));
     $addThisID->setRightTitle('Profile ID to be used all across the site (in the format <strong>ra-XXXXXXXXXXXXXXXX</strong>)');
     $fields->addFieldToTab('Root.Logos/Icons', $favIconField = new UploadField('FavIcon', 'Favicon, in .ico format, dimensions of 16x16, 32x32, or 48x48'));
     $favIconField->getValidator()->setAllowedExtensions(array('ico'));
     $favIconField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos/Icons', $atIcon144 = new UploadField('AppleTouchIcon144', 'Apple Touch Web Clip and Windows 8 Tile Icon (dimensions of 144x144, PNG format)'));
     $atIcon144->getValidator()->setAllowedExtensions(array('png'));
     $atIcon144->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos/Icons', $atIcon114 = new UploadField('AppleTouchIcon114', 'Apple Touch Web Clip Icon (dimensions of 114x114, PNG format)'));
     $atIcon114->getValidator()->setAllowedExtensions(array('png'));
     $atIcon114->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos/Icons', $atIcon72 = new UploadField('AppleTouchIcon72', 'Apple Touch Web Clip Icon (dimensions of 72x72, PNG format)'));
     $atIcon72->getValidator()->setAllowedExtensions(array('png'));
     $atIcon72->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos/Icons', $atIcon57 = new UploadField('AppleTouchIcon57', 'Apple Touch Web Clip Icon (dimensions of 57x57, PNG format)'));
     $atIcon57->getValidator()->setAllowedExtensions(array('png'));
     $atIcon57->setConfig('allowedMaxFileNumber', 1);
 }
Example #29
0
 public function __construct()
 {
     parent::__construct('payeer-config-form');
     $language = OW::getLanguage();
     $billingService = BOL_BillingService::getInstance();
     $gwKey = BILLINGPAYEER_CLASS_PayeerAdapter::GATEWAY_KEY;
     $element = new TextField('m_key');
     $element->setValue($billingService->getGatewayConfigValue($gwKey, 'm_key'));
     $this->addElement($element);
     $element = new TextField('m_shop');
     $element->setValue($billingService->getGatewayConfigValue($gwKey, 'm_shop'));
     $this->addElement($element);
     $element = new Selectbox('m_curr');
     $element->setValue($billingService->getGatewayConfigValue($gwKey, 'm_curr'))->setHasInvitation(false)->addOption('RUB', 'RUB')->addOption('usd', 'USD');
     $this->addElement($element);
     $element = new Selectbox('lang');
     $element->setValue($billingService->getGatewayConfigValue($gwKey, 'lang'))->setHasInvitation(false)->addOption('ru', 'Русский')->addOption('en', 'English');
     $this->addElement($element);
     $element = new Selectbox('tabNum');
     $element->setValue($billingService->getGatewayConfigValue($gwKey, 'tabNum'))->setHasInvitation(false)->addOption('1', 'Electronic Systems')->addOption('2', 'Cash / Bank Transfers')->addOption('3', 'Terminals')->addOption('4', 'SMS payments');
     $this->addElement($element);
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('billingpayeer', 'btn_save'));
     $this->addElement($submit);
 }
 public function getHTMLFragments($gridField)
 {
     $fields = new ArrayList();
     $state = $gridField->State->UserFormsGridField;
     $selectedField = $state->filter;
     $selectedValue = $state->value;
     // show dropdown of all the fields available from the submitted form fields
     // that have been saved. Takes the titles from the currently live form.
     $columnField = new DropdownField('FieldNameFilter', '');
     $columnField->setSource($this->columns);
     $columnField->setEmptyString(_t('UserFormsGridFieldFilterHeader.FILTERSUBMISSIONS', 'Filter Submissions..'));
     $columnField->setHasEmptyDefault(true);
     $columnField->setValue($selectedField);
     $valueField = new TextField('FieldValue', '', $selectedValue);
     $columnField->addExtraClass('ss-gridfield-sort');
     $columnField->addExtraClass('no-change-track');
     $valueField->addExtraClass('ss-gridfield-sort');
     $valueField->addExtraClass('no-change-track');
     $valueField->setAttribute('placeholder', _t('UserFormsGridFieldFilterHeader.WHEREVALUEIS', 'where value is..'));
     $fields->push(new FieldGroup(new CompositeField($columnField, $valueField)));
     $fields->push(new FieldGroup(new CompositeField($start = new DateField('StartFilter', 'From'), $end = new DateField('EndFilter', 'Till'))));
     foreach (array($start, $end) as $date) {
         $date->setConfig('showcalendar', true);
         $date->setConfig('dateformat', 'y-mm-dd');
         $date->setConfig('datavalueformat', 'y-mm-dd');
         $date->addExtraClass('no-change-track');
     }
     $end->setValue($state->end);
     $start->setValue($state->start);
     $fields->push($actions = new FieldGroup(GridField_FormAction::create($gridField, 'filter', false, 'filter', null)->addExtraClass('ss-gridfield-button-filter')->setAttribute('title', _t('GridField.Filter', "Filter"))->setAttribute('id', 'action_filter_' . $gridField->getModelClass() . '_' . $columnField), GridField_FormAction::create($gridField, 'reset', false, 'reset', null)->addExtraClass('ss-gridfield-button-close')->setAttribute('title', _t('GridField.ResetFilter', "Reset"))->setAttribute('id', 'action_reset_' . $gridField->getModelClass() . '_' . $columnField)));
     $actions->addExtraClass('filter-buttons');
     $actions->addExtraClass('no-change-track');
     $forTemplate = new ArrayData(array('Fields' => $fields));
     return array('header' => $forTemplate->renderWith('GridFieldFilterHeader_Row'));
 }