function __construct($controller, $name)
 {
     // Define fields //////////////////////////////////////
     $CurrentDeploymentID = Session::get('CurrentDeploymentID');
     $CountryCodes = CountryCodes::$iso_3166_countryCodes;
     $CountryCodes['Worldwide'] = 'Worldwide';
     $CountryCodes['Prefer not to say'] = 'Prefer not to say';
     $CountryCodes['Too many to list'] = 'Too many to list';
     $fields = new FieldList(new HiddenField('DeploymentID', 'DeploymentID', $CurrentDeploymentID), new LiteralField('Break', '<p>Each deployment profile can be marked public if you wish for the basic information on this page to appear on openstack.org. If you select private we will treat all of the profile information as confidential information.</p>'), new OptionSetField('IsPublic', 'Would you like to keep this information confidential or allow the Foundation to share information about this deployment publicly?', array('1' => '<strong>Willing to share:</strong> The information on this page may be shared for this deployment', '0' => '<strong>Confidential:</strong> All details provided should be kept confidential to the OpenStack Foundation'), 0), new LiteralField('Break', '<hr/>'), new TextField('Label', 'Deployment Name<BR><p class="clean_text">Please create a friendly label, like “Production OpenStack Deployment”. This name is for your deployment in our survey tool. If several people at your organization work on one deployment, we would <b>really appreciate</b> you all referring to the same deployment by the same name!</p>'), $ddl_stage = new DropdownField('DeploymentStage', 'In what stage is your OpenStack deployment? (make a new deployment profile for each type of deployment)', DeploymentOptions::$stage_options), new MultiDropdownField('CountriesPhysicalLocation', 'In which country / countries is this OpenStack deployment physically located?', $CountryCodes), new MultiDropdownField('CountriesUsersLocation', 'In which country / countries are the users / customers for this deployment physically located?', $CountryCodes), $ddl_type = new DropdownField('DeploymentType', 'Deployment Type', DeploymentOptions::$deployment_type_options), new CustomCheckboxSetField('ProjectsUsed', 'What projects does this deployment use?<BR>Select All That Apply', DeploymentOptions::$projects_used_options), new CustomCheckboxSetField('CurrentReleases', 'What releases does this deployment currently use?<BR>Select All That Apply', DeploymentOptions::$current_release_options), new LiteralField('Break', 'Describe the workloads and frameworks running in this OpenStack environment.<BR>Select All That Apply'), new LiteralField('Break', '<hr/>'), new CustomCheckboxSetField('ServicesDeploymentsWorkloads', '<b>Services Deployments - workloads designed to be accessible for external users / customers</b>', DeploymentOptions::$services_deployment_workloads_options), $other_service_workload = new TextAreaField('OtherServicesDeploymentsWorkloads', ''), new CustomCheckboxSetField('EnterpriseDeploymentsWorkloads', '<b>Enterprise Deployments - workloads designed to be run internally to support business</b>', DeploymentOptions::$enterprise_deployment_workloads_options), $other_enterprise_workload = new TextAreaField('OtherEnterpriseDeploymentsWorkloads', ''), new CustomCheckboxSetField('HorizontalWorkloadFrameworks', '<b>Horizontal Workload Frameworks</b>', DeploymentOptions::$horizontal_workload_framework_options), $other_horizontal_workload = new TextAreaField('OtherHorizontalWorkloadFrameworks', ''));
     $saveButton = new FormAction('SaveDeployment', 'Next Step');
     $nextButton = new CancelFormAction($controller->Link() . 'Deployments', 'Cancel');
     $other_service_workload->addExtraClass('hidden');
     $other_enterprise_workload->addExtraClass('hidden');
     $other_horizontal_workload->addExtraClass('hidden');
     $ddl_type->setEmptyString('-- Select One --');
     $ddl_stage->setEmptyString('-- Select One --');
     $actions = new FieldList($saveButton, $nextButton);
     // Create Validators
     $validator = null;
     parent::__construct($controller, $name, $fields, $actions, $validator);
     if ($CurrentDeploymentID) {
         //Populate the form with the current members data
         if ($Deployment = $this->controller->LoadDeployment($CurrentDeploymentID)) {
             $this->loadDataFrom($Deployment->data());
         } else {
             // HTTP ERROR
             return $this->httpError(403, 'Access Denied.');
         }
     }
     Requirements::javascript('surveys/js/deployment_survey_deployment_details_form.js');
 }
 function __construct($controller, $name)
 {
     $current_user = Member::currentUser();
     $fields = new FieldList($this->first_name_field = new TextField('FirstName', 'First name / Given name', $current_user->FirstName), $this->last_name_field = new TextField('Surname', 'Last name / Family name', $current_user->Surname), $os_activity = new CustomCheckboxSetField('OpenStackActivity', 'Which of the following do you yourself personally do?<BR>Select All That Apply', DeploymentSurveyOptions::$activities_options), $os_relationship = new TextAreaField('OpenStackRelationship', 'Please describe your relationship with OpenStack'), $this->email_field = new TextField('Email', 'Your Email', $current_user->Email), $ok_2_contact = new CheckboxField('OkToContact', 'The OpenStack Foundation and User Committee may communicate with me in the future about my usage.'));
     $os_relationship->addExtraClass('hidden');
     $os_relationship->setColumns(30);
     $ok_2_contact->setValue(0);
     $this->email_field->setDisabled(true);
     $nextButton = new FormAction('NextStep', '  Next Step  ');
     $actions = new FieldList($nextButton);
     $validator = new RequiredFields();
     Requirements::javascript('surveys/js/deployment_survey_aboutyou_form.js');
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
 public function FieldHolder($properties = array())
 {
     Requirements::css(LINKABLE_PATH . '/css/embeddedobjectfield.css');
     Requirements::javascript(LINKABLE_PATH . '/javascript/embeddedobjectfield.js');
     if ($this->object && $this->object->ID) {
         $properties['SourceURL'] = TextField::create($this->getName() . '[sourceurl]', '')->setAttribute('placeholder', _t('Linkable.SOURCEURL', 'Source URL'));
         if (strlen($this->object->SourceURL)) {
             $properties['ObjectTitle'] = TextField::create($this->getName() . '[title]', _t('Linkable.TITLE', 'Title'));
             $properties['Width'] = TextField::create($this->getName() . '[width]', _t('Linkable.WIDTH', 'Width'));
             $properties['Height'] = TextField::create($this->getName() . '[height]', _t('Linkable.HEIGHT', 'Height'));
             $properties['ThumbURL'] = HiddenField::create($this->getName() . '[thumburl]', '');
             $properties['Type'] = HiddenField::create($this->getName() . '[type]', '');
             $properties['EmbedHTML'] = HiddenField::create($this->getName() . '[embedhtml]', '');
             $properties['ObjectDescription'] = TextAreaField::create($this->getName() . '[description]', _t('Linkable.DESCRIPTION', 'Description'));
             $properties['ExtraClass'] = TextField::create($this->getName() . '[extraclass]', _t('Linkable.CSSCLASS', 'CSS class'));
             foreach ($properties as $key => $field) {
                 if ($key == 'ObjectTitle') {
                     $key = 'Title';
                 } elseif ($key == 'ObjectDescription') {
                     $key = 'Description';
                 }
                 $field->setValue($this->object->{$key});
             }
             if ($this->object->ThumbURL) {
                 $properties['ThumbImage'] = LiteralField::create($this->getName(), '<img src="' . $this->object->ThumbURL . '" />');
             }
         }
     } else {
         $properties['SourceURL'] = TextField::create($this->getName() . '[sourceurl]', '')->setAttribute('placeholder', _t('Linkable.SOURCEURL', 'Source URL'));
     }
     $field = parent::FieldHolder($properties);
     return $field;
 }
Esempio n. 4
0
 public function getCMSFields()
 {
     $fields = FieldList::create(TextField::create('Title'), TextField::create('Teaser'), TextAreaField::create('Description'), $uploader = UploadField::create('Icon'));
     $uploader->setFolderName('feature-icons');
     $uploader->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpeg', 'jpg', 'svg'));
     return $fields;
 }
Esempio n. 5
0
 public function getCMSFields()
 {
     $fields = FieldList::create(TextField::create('Name'), TextField::create('Job'), TextAreaField::create('Description'), $uploader = UploadField::create('Photo'));
     $uploader->setFolderName('profile-pictures');
     $uploader->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpeg', 'jpg'));
     return $fields;
 }
 public function updateCMSFields(FieldList $fields)
 {
     // Payment Methods
     $payment_table = GridField::create('PaymentMethods', _t("CheckoutAdmin.PaymentMethods", "Payment Methods"), $this->owner->PaymentMethods(), GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldAddNewButton('toolbar-header-right'), new GridFieldSortableHeader(), new GridFieldDataColumns(), new GridFieldPaginator(20), new GridFieldEditButton(), new GridFieldDeleteAction(), new GridFieldDetailForm()));
     // setup compressed payment options
     $payment_fields = ToggleCompositeField::create('PaymentSettings', _t("CheckoutAdmin.Payments", "Payment Settings"), array(TextField::create('PaymentNumberPrefix', _t("CheckoutAdmin.OrderPrefix", "Add prefix to order numbers"), null, 9)->setAttribute("placeholder", _t("CheckoutAdmin.OrderPrefixPlaceholder", "EG 'abc'")), TextAreaField::create('PaymentSuccessContent', _t("CheckoutAdmin.PaymentSuccessContent", "Payment successfull content"))->setRows(4)->setColumns(30)->addExtraClass('stacked'), TextAreaField::create('PaymentFailerContent', _t("CheckoutAdmin.PaymentFailerContent", "Payment failer content"))->setRows(4)->setColumns(30)->addExtraClass('stacked'), $payment_table));
     // Add html description of how to edit contries
     $country_html = "<div class=\"field\">";
     $country_html .= "<p>First select valid countries using the 2 character ";
     $country_html .= "shortcode (see http://fasteri.com/list/2/short-names-of-countries-and-iso-3166-codes).</p>";
     $country_html .= "<p>You can add multiple countries seperating them with";
     $country_html .= "a comma or use a '*' for all countries.</p>";
     $country_html .= "</div>";
     $country_html_field = LiteralField::create("CountryDescription", $country_html);
     // Deal with product features
     $postage_field = new GridField('PostageAreas', '', $this->owner->PostageAreas(), GridFieldConfig::create()->addComponents(new GridFieldButtonRow('before'), new GridFieldToolbarHeader(), new GridFieldTitleHeader(), new GridFieldEditableColumns(), new GridFieldDeleteAction(), new GridFieldAddNewInlineButton('toolbar-header-left')));
     // Add country dropdown to inline editing
     $postage_field->getConfig()->getComponentByType('GridFieldEditableColumns')->setDisplayFields(array('Title' => array('title' => 'Title', 'field' => 'TextField'), 'Country' => array('title' => 'ISO 3166 codes', 'field' => 'TextField'), 'ZipCode' => array('title' => 'Zip/Post Codes', 'field' => 'TextField'), 'Calculation' => array('title' => 'Base unit', 'callback' => function ($record, $column, $grid) {
         return DropdownField::create($column, "Based on", singleton('PostageArea')->dbObject('Calculation')->enumValues())->setValue("Weight");
     }), 'Unit' => array('title' => 'Unit (equals or above)', 'field' => 'NumericField'), 'Cost' => array('title' => 'Cost', 'field' => 'NumericField'), 'Tax' => array('title' => 'Tax (percentage)', 'field' => 'NumericField')));
     // Setup compressed postage options
     $postage_fields = ToggleCompositeField::create('PostageFields', 'Postage Options', array($country_html_field, $postage_field));
     // Setup compressed postage options
     $discount_fields = ToggleCompositeField::create('DiscountFields', 'Discounts', array(GridField::create('Discounts', '', $this->owner->Discounts(), GridFieldConfig_RecordEditor::create())));
     // Add config sets
     $fields->addFieldToTab('Root.Checkout', $payment_fields);
     $fields->addFieldToTab('Root.Checkout', $postage_fields);
     $fields->addFieldToTab('Root.Checkout', $discount_fields);
 }
 /**
  * Add and re-arrange CMS fields for streamlined summary editing
  */
 public function updateCMSFields(FieldList $fields)
 {
     // Remove all Meta fields
     $fields->removeByName('Metadata');
     // Add summary fields
     $fields->addFieldToTab("Root.Main", TextAreaField::create("MetaDescription", "Content summary")->setDescription("Summarise the content of this page. This will be used for search engine results and social media so make it enticing.")->setAttribute('placeholder', $this->owner->getDefaultOGDescription())->setRows(2), "Content");
     $fields->addFieldToTab("Root.Main", UploadField::create('MetaImage', 'Summary image')->setAllowedFileCategories('image')->setAllowedMaxFileNumber(1)->setDescription('Choose an image to represent this page in listings and on social media.'), "Content");
 }
Esempio n. 8
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName('Content');
     $fields->removeByName('Metadata');
     $fields->addFieldToTab('Root.Main', TextField::create('Factheading', 'Fact heading'), 'Content');
     $fields->addFieldToTab('Root.Main', TextAreaField::create('Fact', 'Fun Fact'), 'Content');
     return $fields;
 }
 /**
  * Setup the fields for the frontend
  * @param type $params
  * @return FieldList $fields the default FieldList
  */
 public function getFrontEndFields($params = null)
 {
     $fields = parent::getFrontEndFields($params);
     $fields->removeByName(array('MD5Email', 'AkismetMarked', 'Visible', 'ShowGravatar', 'News'));
     $fields->replaceField('Email', EmailField::create('Email', $this->fieldLabel('Email')));
     $fields->replaceField('Comment', TextAreaField::create('Comment', $this->fieldLabel('Comment')));
     $fields->fieldByName('Comment')->setColumns(20)->setRows(10);
     return $fields;
 }
Esempio n. 10
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldsToTab('Root.Main', array(TextField::create('Intro', 'Introduction'), TextAreaField::create('CTA', 'Call To Action')), 'Content');
     $fields->addFieldsToTab('Root.Story', array(TextField::create('StoryTitle', 'Story Title'), TextField::create('StorySubheading', 'Story Subheading'), TextAreaField::create('StoryContent', 'Story Content'), $upload = UploadField::create('StoryImage', 'Story Image')));
     $upload->getValidator()->setAllowedExtensions(array('png', 'jpeg', 'jpg', 'gif'));
     $upload->setFolderName('homepage-story');
     return $fields;
 }
 public function updateCMSFields(FieldList $fields)
 {
     $fields->addFieldToTab('Root.Main', UploadField::create('Logo')->setFolderName('logos'));
     $footer_fields = ToggleCompositeField::create('FoooterInfo', 'Footer', array(HTMLEditorField::create('FooterContent', 'Content to appear in footer')->setRows(15)->addExtraClass('stacked')))->setHeadingLevel(4);
     $contact_fields = ToggleCompositeField::create('ContactInfo', 'Contact Info.', array(TextAreaField::create('ContactAddress', $this->owner->fieldLabel('ContactAddress')), TextField::create('ContactEmail', $this->owner->fieldLabel('ContactEmail')), TextField::create('ContactPhone', $this->owner->fieldLabel('ContactPhone')), TextAreaField::create('MiscContactInfo', $this->owner->fieldLabel('MiscContactInfo')), TextAreaField::create('MapHTML', "HTML to be loaded for mapping info")))->setHeadingLevel(4);
     $theme_custom_fields = ToggleCompositeField::create('CustomTheme', 'Theme Customisation', array(TextField::create('CustomMainBackground', $this->owner->fieldLabel('CustomMainBackground')), TextField::create('CustomBodyBackground', $this->owner->fieldLabel('CustomBodyBackground')), TextField::create('CustomHeadBackground', $this->owner->fieldLabel('CustomHeadBackground')), TextField::create('CustomFootBackground', $this->owner->fieldLabel('CustomFootBackground')), TextField::create('CustomMaxWidth', $this->owner->fieldLabel('CustomMaxWidth'))))->setHeadingLevel(4);
     $fields->addFieldToTab('Root.Main', $footer_fields);
     $fields->addFieldToTab('Root.Main', $contact_fields);
     $fields->addFieldToTab('Root.Main', $theme_custom_fields);
 }
 /**
  * Add and re-arrange CMS fields for streamlined summary editing.
  */
 public function updateCMSFields(FieldList $fields)
 {
     // Remove all Meta fields
     $fields->removeByName('Metadata');
     // Add summary fields
     $fields->addFieldToTab('Root.Main', TextAreaField::create('MetaDescription', 'Content summary')->setDescription('Summarise the content of this page. This will be used for search engine results and social media so make it enticing.')->setAttribute('placeholder', $this->owner->getDefaultOGDescription())->setRows(2), 'Content');
     $imgFieldDescription = 'Choose an image to represent this page in listings and on social media.';
     if (!$this->owner->MetaImageID && $this->owner->isPublished()) {
         $imgFieldDescription .= " <i style=\"color:#ec720f\">For best results, please don't leave this empty.</i>";
     }
     $fields->addFieldToTab('Root.Main', UploadField::create('MetaImage', 'Summary image')->setAllowedFileCategories('image')->setAllowedMaxFileNumber(1)->setDescription($imgFieldDescription), 'Content');
 }
 public function __construct($controller, $name, $discussion = null)
 {
     // Get member and upload path
     $member = Member::currentUser();
     $fields = new FieldList(HiddenField::create("ID"), TextField::create("Title", _t("Discussions.GiveTitle", "Give your discussion a title")), TextAreaField::create("Content", _t("Discussions.AddContent", "And some content (optional)")), TextField::create("Tags", _t("Discussions.AddTags", "Finally, add some tags (optional)"))->setAttribute("placeholder", "Tag 1, Tag 2"));
     if ($controller->Categories()->exists()) {
         $fields->add(CheckboxsetField::create("Categories", _t("Discussions.Categories", "Or Post this under a category? (optional)"), $controller->Categories()->map()));
     }
     $actions = new FieldList(FormAction::create("post")->setTitle(_t("Discussions.Post", "Post")));
     $validator = new RequiredFields("Title", "Content");
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
 /**
  * Add CMS fields to allow setting of custom open graph values.
  */
 public function updateCMSFields(FieldList $fields)
 {
     $msg = Config::inst()->get('ShareCareFields', 'cms_message');
     if ($msg) {
         $fields->addFieldToTab('Root.Share', new LiteralField('ShareCareFieldsMessage', '<div class="message notice"><p>' . $msg . '</p></div>'));
     }
     $fields->addFieldToTab('Root.Share', TextField::create('OGTitleCustom', 'Share title')->setAttribute('placeholder', $this->owner->getDefaultOGTitle())->setMaxLength(90));
     $fields->addFieldToTab('Root.Share', TextAreaField::create('OGDescriptionCustom', 'Share description')->setAttribute('placeholder', $this->owner->getDefaultOGDescription())->setRows(2));
     $fields->addFieldToTab('Root.Share', UploadField::create('OGImageCustom', 'Share image')->setAllowedFileCategories('image')->setAllowedMaxFileNumber(1)->setDescription('<a href="https://developers.facebook.com/docs/sharing/best-practices#images" target="_blank">Optimum image ratio</a> is 1.91:1. (1200px wide by 630px tall or better)'));
     if (Config::inst()->get('ShareCare', 'pinterest')) {
         $fields->addFieldToTab('Root.Share', UploadField::create('PinterestImageCustom', 'Pinterest image')->setAllowedFileCategories('image')->setAllowedMaxFileNumber(1)->setDescription('Square/portrait or taller images look best on Pinterest. This image should be at least 750px wide.'));
     }
 }
 function __construct($name, $title = null, $value = null, $type = "html")
 {
     // Requirements
     Requirements::javascript(ABC_VENDOR_PATH . '/codemirror/lib/codemirror.js');
     Requirements::css(ABC_VENDOR_PATH . '/codemirror/lib/codemirror.css');
     Requirements::javascript(ABC_VENDOR_PATH . '/codemirror/mode/' . $type . '/' . $type . '.js');
     Requirements::javascript(ABC_PATH . '/javascript/SyntaxHighlightedField.js');
     // classes
     $this->addExtraClass('syntax-highlighted');
     $this->addExtraClass('syntax-highlighted-' . $type);
     $this->setAttribute('data-type', $type);
     // call parent constructor
     parent::__construct($name, $title = null, $value = null);
 }
Esempio n. 16
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $gridFieldConfig = GridFieldConfig_RecordEditor::create();
     $gridFieldConfig->addComponent(new GridFieldSortableRows('SortOrder'));
     $gridfield = new GridField("Pictures", "Pictures", $this->Pictures()->sort("SortOrder"), $gridFieldConfig);
     $fields->addFieldToTab('Root.Pictures', $gridfield);
     $fields->addFieldToTab('Root.Pictures', new DropdownField('Align', 'Align (relative to text)', singleton('Page')->dbObject('Align')->enumValues()), '');
     $gridFieldConfig2 = GridFieldConfig_RecordEditor::create();
     $gridFieldConfig2->addComponent(new GridFieldSortableRows('SortOrder'));
     $gridfield2 = new GridField("Videos", "Videos", $this->Videos()->sort("SortOrder"), $gridFieldConfig2);
     $fields->addFieldToTab('Root.Videos', $gridfield2);
     $fields->addFieldToTab('Root.Videos', new CheckboxField('Videobottom', 'Show all videos below'), '');
     $gridFieldConfig3 = GridFieldConfig_RecordEditor::create();
     $gridFieldConfig3->addComponent(new GridFieldSortableRows('SortOrder'));
     $gridfield3 = new GridField("ExtraContentBlocks", "ExtraContentBlocks", $this->ExtraContentBlocks()->sort("SortOrder"), $gridFieldConfig3);
     $fields->addFieldToTab('Root.Main', new LiteralField('Note1', '<br /><br />'), 'Metadata');
     // Spacer
     $fields->addFieldToTab('Root.Main', $gridfield3, 'Metadata');
     $fields->addFieldToTab('Root.Main', new LiteralField('Note2', '<br /><br />'), 'Metadata');
     // Spacer
     $fields->addFieldToTab('Root.Gallery', $uploadField = new SortableUploadField($name = 'GalleryImages', $title = 'Upload images (max 100 in total)'));
     $uploadField->setAllowedMaxFileNumber(100);
     $uploadField->setFolderName('GalleryImages');
     $uploadField->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     $metatitle = new TextField('MetaTitle', 'Alternative Page Title');
     $metatitle->setRightTitle('Used in the browser window, search listings, bookmarks etc');
     $fields->addFieldToTab('Root.Main', $metatitle, 'MetaDescription');
     $CustomPreviewText = new TextAreaField('CustomPreviewText', 'Custom Preview Text');
     $CustomPreviewText->setRightTitle('Replaces the content summary for this page when shown on listing pages or search engines');
     $fields->addFieldToTab('Root.Main', $CustomPreviewText, 'MetaDescription');
     $fields->removeByName("Dependent");
     $fields->removeByName("MetaDescription");
     $fields->removeByName("ExtraMeta");
     return $fields;
 }
 public function updateCMSFields(FieldList $fields)
 {
     $fields->removeByName('ContactEmail');
     $fields->removeByName('ContactPhone');
     // Ecommerce Fields
     // Compress default commerce settings
     $contact_fields = ToggleCompositeField::create('ContactDetails', 'Contact Details', array(TextField::create('ContactEmail', 'Email Address'), TextField::create('ContactPhone', 'Phone Number')))->setHeadingLevel(4);
     // Compress default commerce settings
     $settings_fields = ToggleCompositeField::create('CommerceSettings', 'Default Settings', array(TextField::create('OrderPrefix', 'Short code that can appear at the start of order numbers', null, 9), DropdownField::create('CurrencyID', 'Currency to use', CommerceCurrency::get()->map(), $this->owner->CurrencyID)->setEmptyString('Please Select'), DropdownField::create('WeightID', 'Weight to use', ProductWeight::get()->map(), $this->owner->WeightID)->setEmptyString('Please Select'), UploadField::create('NoProductImage', 'Overwrite default "image unavailable" image')))->setHeadingLevel(4);
     // Compress shopping cart settings
     $cart_fields = ToggleCompositeField::create('CartProcess', 'Cart and Checkout Content', array(HtmlEditorField::create('CartCopy', 'Shopping cart')->setRows(15)->addExtraClass('stacked'), TextAreaField::create('SuccessCopy', 'Order success page')->setRows(4)->setColumns(30)->addExtraClass('stacked'), TextAreaField::create('FailerCopy', 'Order failer page')->setRows(4)->setColumns(30)->addExtraClass('stacked')))->setHeadingLevel(4);
     // Compress email alerts
     $email_fields = ToggleCompositeField::create('EmailAlerts', 'Email Alerts', array(TextField::create('EmailFromAddress', 'Send commerce notifications from?'), LiteralField::create('OrderPlacedHeader', '<div class="field"><h4>When an order is placed</h4></div>'), DropdownField::create('SendPaidEmail', 'Send emails to', $this->owner->dbObject('SendPaidEmail')->enumValues()), TextField::create('PaidEmailAddress', 'Vendor address'), LiteralField::create('OrderFailedHeader', '<div class="field"><h4>When an order fails</h4></div>'), DropdownField::create('SendFailedEmail', 'Send emails to', $this->owner->dbObject('SendPaidEmail')->enumValues()), TextField::create('FailedEmailAddress', 'Vendor address'), LiteralField::create('OrderProcessingHeader', '<div class="field"><h4>When an order is marked as processing</h4></div>'), DropdownField::create('SendProcessingEmail', 'Send emails to', $this->owner->dbObject('SendProcessingEmail')->enumValues()), TextField::create('ProcessingEmailAddress', 'Vendor address'), LiteralField::create('OrderPlacedHeader', '<div class="field"><h4>When an order is marked as dispatched</h4></div>'), DropdownField::create('SendDispatchedEmail', 'Send emails to', $this->owner->dbObject('SendDispatchedEmail')->enumValues()), TextField::create('DispatchedEmailAddress', 'Vendor address'), LiteralField::create('FooterContent', '<div class="field"><h4>Footer Content</h4></div>'), TextareaField::create('VendorEmailFooter', 'Add custom content to the footer of vendor emails?')))->setHeadingLevel(4);
     // Add html description of how to edit contries
     $country_html = "<div class=\"field\">";
     $country_html .= "<p>First select valid countries using the 2 character ";
     $country_html .= "shortcode (see http://fasteri.com/list/2/short-names-of-countries-and-iso-3166-codes).</p>";
     $country_html .= "<p>You can add multiple countries seperating them with";
     $country_html .= "a comma or use a '*' for all countries.</p>";
     $country_html .= "</div>";
     $country_html_field = LiteralField::create("CountryDescription", $country_html);
     // Deal with product features
     $postage_field = new GridField('PostageAreas', '', $this->owner->PostageAreas(), GridFieldConfig::create()->addComponents(new GridFieldButtonRow('before'), new GridFieldToolbarHeader(), new GridFieldTitleHeader(), new GridFieldEditableColumns(), new GridFieldDeleteAction(), new GridFieldAddNewInlineButton('toolbar-header-left')));
     // Add country dropdown to inline editing
     $postage_field->getConfig()->getComponentByType('GridFieldEditableColumns')->setDisplayFields(array('Title' => array('title' => 'Title', 'field' => 'TextField'), 'Country' => array('title' => 'ISO 3166 codes', 'field' => 'TextField'), 'ZipCode' => array('title' => 'Zip/Post Codes', 'field' => 'TextField'), 'Calculation' => array('title' => 'Base unit', 'callback' => function ($record, $column, $grid) {
         return DropdownField::create($column, "Based on", singleton('PostageArea')->dbObject('Calculation')->enumValues())->setValue("Weight");
     }), 'Unit' => array('title' => 'Unit (equals or above)', 'field' => 'NumericField'), 'Cost' => array('title' => 'Cost', 'field' => 'NumericField')));
     // Setup compressed postage options
     $postage_fields = ToggleCompositeField::create('PostageFields', 'Postage Options', array($country_html_field, $postage_field));
     // Setup compressed postage options
     $discounts_fields = ToggleCompositeField::create('DiscountFields', 'Discounts', array(GridField::create('Discounts', '', $this->owner->Discounts(), GridFieldConfig_RecordEditor::create())));
     // Payment Methods
     $payment_table = GridField::create('PaymentMethods', 'CommercePaymentMethod', $this->owner->PaymentMethods(), GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldAddNewButton('toolbar-header-right'), new GridFieldSortableHeader(), new GridFieldDataColumns(), new GridFieldPaginator(20), new GridFieldEditButton(), new GridFieldDeleteAction(), new GridFieldDetailForm()));
     // setup compressed payment options
     $payment_fields = ToggleCompositeField::create('PaymentFields', 'Payment Options', array($payment_table));
     // Compress tax fields
     $tax_fields = ToggleCompositeField::create('TaxDetails', 'Tax', array(NumericField::create('TaxRate'), TextField::create("TaxName", "Name of your tax (EG 'VAT')"), CheckboxField::create('TaxPriceInclude', 'Show price including tax?')))->setHeadingLevel(4);
     // Add config sets
     $fields->addFieldToTab('Root.Commerce', $contact_fields);
     $fields->addFieldToTab('Root.Commerce', $settings_fields);
     $fields->addFieldToTab('Root.Commerce', $cart_fields);
     $fields->addFieldToTab('Root.Commerce', $email_fields);
     $fields->addFieldToTab('Root.Commerce', $postage_fields);
     $fields->addFieldToTab('Root.Commerce', $discounts_fields);
     $fields->addFieldToTab('Root.Commerce', $payment_fields);
     $fields->addFieldToTab('Root.Commerce', $tax_fields);
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByname('ParentID');
     $fields->removeByname('MapLocationHelp');
     $fields->removeByname('Address');
     $fields->removeByname('PostCode');
     $fields->removeByname('Latitude');
     $fields->removeByname('Longitude');
     $fields->removeByname('ZoomLevel');
     $fields->removeByname('Content');
     if ($this->ID) {
         $fields->addFieldToTab("Root.Main", HtmlEditorField::create("Content", "Content to be displayed with this map")->addExtraClass('stacked')->setRows(15));
         $config_fields = ToggleCompositeField::create('MapConfig', 'Configuration Options', array(LiteralField::create('MapLocationHelp', '<p class="field">Set EITHER an address / post code OR latitude / longitude to generate a map</p>'), TextAreaField::create("Address"), TextField::create("PostCode", "Post Code"), TextField::create("Latitude"), TextField::create("Longitude"), NumericField::create("ZoomLevel", "Zoom (1 = world, 20 = close)")))->setHeadingLevel(4);
         $fields->addFieldToTab('Root.Main', $config_fields);
     }
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $languageField = DropdownField::create('Language', 'Language', array('af' => 'Afrikaans', 'sq' => 'Albanian', 'eu' => 'Basque', 'be' => 'Belarusian', 'bg' => 'Bulgarian', 'ca' => 'Catalan', 'zh-cn' => 'Chinese (Simplified)', 'zh-tw' => 'Chinese (Traditional)', 'hr' => 'Croatian', 'cs' => 'Czech', 'da' => 'Danish', 'nl' => 'Dutch', 'nl-be' => 'Dutch (Belgium)', 'nl-nl' => 'Dutch (Netherlands)', 'en' => 'English', 'en-au' => 'English (Australia)', 'en-bz' => 'English (Belize)', 'en-ca' => 'English (Canada)', 'en-ie' => 'English (Ireland)', 'en-jm' => 'English (Jamaica)', 'en-nz' => 'English (New Zealand)', 'en-ph' => 'English (Phillipines)', 'en-za' => 'English (South Africa)', 'en-tt' => 'English (Trinidad)', 'en-gb' => 'English (United Kingdom)', 'en-us' => 'English (United States)', 'en-zw' => 'English (Zimbabwe)', 'et' => 'Estonian', 'fo' => 'Faeroese', 'fi' => 'Finnish', 'fr' => 'French', 'fr-be' => 'French (Belgium)', 'fr-ca' => 'French (Canada)', 'fr-fr' => 'French (France)', 'fr-lu' => 'French (Luxembourg)', 'fr-mc' => 'French (Monaco)', 'fr-ch' => 'French (Switzerland)', 'gl' => 'Galician', 'gd' => 'Gaelic', 'de' => 'German', 'de-at' => 'German (Austria)', 'de-de' => 'German (Germany)', 'de-li' => 'German (Liechtenstein)', 'de-lu' => 'German (Luxembourg)', 'de-ch' => 'German (Switzerland)', 'el' => 'Greek', 'haw' => 'Hawaiian', 'hu' => 'Hungarian', 'is' => 'Icelandic', 'in' => 'Indonesian', 'ga' => 'Irish', 'it' => 'Italian', 'it-it' => 'Italian (Italy)', 'it-ch' => 'Italian (Switzerland)', 'ja' => 'Japanese', 'ko' => 'Korean', 'mk' => 'Macedonian', 'no' => 'Norwegian', 'pl' => 'Polish', 'pt' => 'Portuguese', 'pt-br' => 'Portuguese (Brazil)', 'pt-pt' => 'Portuguese (Portugal)', 'ro' => 'Romanian', 'ro-mo' => 'Romanian (Moldova)', 'ro-ro' => 'Romanian (Romania)', 'ru' => 'Russian', 'ru-mo' => 'Russian (Moldova)', 'ru-ru' => 'Russian (Russia)', 'sr' => 'Serbian', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'es' => 'Spanish', 'es-ar' => 'Spanish (Argentina)', 'es-bo' => 'Spanish (Bolivia)', 'es-cl' => 'Spanish (Chile)', 'es-co' => 'Spanish (Colombia)', 'es-cr' => 'Spanish (Costa Rica)', 'es-do' => 'Spanish (Dominican Republic)', 'es-ec' => 'Spanish (Ecuador)', 'es-sv' => 'Spanish (El Salvador)', 'es-gt' => 'Spanish (Guatemala)', 'es-hn' => 'Spanish (Honduras)', 'es-mx' => 'Spanish (Mexico)', 'es-ni' => 'Spanish (Nicaragua)', 'es-pa' => 'Spanish (Panama)', 'es-py' => 'Spanish (Paraguay)', 'es-pe' => 'Spanish (Peru)', 'es-pr' => 'Spanish (Puerto Rico)', 'es-es' => 'Spanish (Spain)', 'es-uy' => 'Spanish (Uruguay)', 'es-ve' => 'Spanish (Venezuela)', 'sv' => 'Swedish', 'sv-fi' => 'Swedish (Finland)', 'sv-se' => 'Swedish (Sweden)', 'tr' => 'Turkish', 'uk' => 'Ukranian'));
     $languageField->setHasEmptyDefault(true)->setEmptyString('Select Language');
     $podcastImage = UploadField::create('PodcastImage', 'Podcast Image');
     $podcastImage->setFolderName('podcast/podcast-artwork')->setDescription("iTunes recommends a size of at least 1400x1400")->getValidator()->setAllowedExtensions(array('jpg', 'png'));
     $completeField = CheckboxField::create('Complete');
     $completeField->setDescription('This podcast is complete. No more episodes will be added to the podcast.');
     $blockField = CheckboxField::create('Block');
     $blockField->setDescription('Prevent the <strong>entire</strong> podcast from appearing in the iTunes podcast directory.');
     $explicitField = DropdownField::create('Explicit', 'Explicit', $this->dbObject('Explicit')->enumValues());
     $explicitField->setDescription("Displays an 'Explicit', 'Clean' or no parental advisory graphic next to your podcast artwork in iTunes.");
     $fields->addFieldsToTab('Root.Podcast', array(TextField::create('PodcastTitle', 'Podcast Title'), TextField::create('Subtitle'), $languageField, TextField::create('Author'), TextAreaField::create('Summary'), TextField::create('OwnerName', 'Owner Name'), EmailField::create('OwnerEmail', 'Owner Email'), TextField::create('Copyright'), $completeField, $blockField, $explicitField, TextAreaField::create('Categories'), $podcastImage));
     $config = GridFieldConfig_RelationEditor::create();
     $episodesTable = GridField::create('PodcastEpisodes', 'Podcast Episodes', $this->PodcastEpisodes()->sort('EpisodeDate', 'DESC'), $config);
     $fields->addFieldToTab('Root.Episodes', $episodesTable);
     return $fields;
 }
Esempio n. 20
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     //Main Content标签页
     //将类型添加到admin中页面编辑选项中,并排在Content选项之前显示
     $fields->addFieldToTab('Root.Main', DateField::create('Date', 'Date of the article')->setConfig('showcalendar', true), 'Content');
     //第二个参数是解释文字,代替真实类型名显示在网页上
     $fields->addFieldToTab('Root.Main', TextAreaField::create('Teaser'), 'Content');
     $fields->addFieldToTab('Root.Main', TextField::create('Author', 'Author of the article')->setDescription('If mulitple authors,separate with commas')->setMaxLength(50), 'Content');
     //Attachment标签页
     $fields->addFieldToTab('Root.Attachments', $photo = UploadField::create('Photo'));
     $fields->addFieldToTab('Root.Attachments', $brochure = UploadField::create('Brochure', 'Travel brochure, optional (pdf only)'));
     $photo->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpeg', 'jpg'));
     $photo->setFolderName('travel-photos');
     $brochure->getValidator()->setAllowedExtensions(array('pdf'));
     $brochure->setFolderName('travel-brochures');
     //Categories标签页
     $fields->addFieldToTab('Root.Categories', CheckBoxSetField::create('Categories', 'Select categories', $this->Parent()->Categories()->map('ID', 'Title')));
     return $fields;
 }
 public function updateCMSFields(FieldList $fields)
 {
     if ($this->owner->ClassName != 'Folder') {
         $fields->addFieldToTab('Root.Main', TextAreaField::create('Description'));
     }
 }
 /**
  * @param FieldList $fields
  * @return Object
  */
 public function updateCMSFields(FieldList $fields)
 {
     $fields->addFieldsToTab('Root.Main', ToggleCompositeField::create('Open graph', 'Open graph', array(LiteralField::create('', '<h2>&nbsp;&nbsp;&nbsp;Open Graph Information <img style="position:relative;top:8px;" src="' . Director::absoluteBaseURL() . 'open-graph-meta/Images/opengraph.png"></h2>'), TextField::create('OGTitle', '')->setAttribute('placeholder', 'e.g My Website')->setRightTitle('Page title goes here, automatically defaults to the page title'), TextField::create('OGUrl', '')->setAttribute('placeholder', 'http://www.mywebsite.com/')->setRightTitle('Page URL goes here, automatically defaults to the page URL (shouldn\'t need overwriting)'), DropdownField::create('OGContent', 'Content Type', array('website' => 'website', 'article' => 'article', 'blog' => 'blog', 'product' => 'product', 'profile' => 'profile', 'video' => 'video', 'place' => 'place'), 'website')->setRightTitle('Will default to website (the most common open graph object type'), TextAreaField::create('OGDescription', '')->setRightTitle('Page description goes here, automatically defaults to the content summary'), UploadField::create('OGImage', 'Open Graph Image'))));
 }
 /**
  * @param FieldList $fields
  */
 public function updateCMSFields(FieldList $fields)
 {
     $helpText = LiteralField::create('ContentReviewHelp', _t('ContentReview.DEFAULTSETTINGSHELP', 'These content review settings will apply to all pages that does not have specific Content Review schedule.'));
     $fields->addFieldToTab('Root.ContentReview', $helpText);
     $reviewFrequency = DropdownField::create('ReviewPeriodDays', _t('ContentReview.REVIEWFREQUENCY', 'Review frequency'), SiteTreeContentReview::get_schedule())->setDescription(_t('ContentReview.REVIEWFREQUENCYDESCRIPTION', 'The review date will be set to this far in the future whenever the page is published'));
     $fields->addFieldToTab('Root.ContentReview', $reviewFrequency);
     $users = Permission::get_members_by_permission(array('CMS_ACCESS_CMSMain', 'ADMIN'));
     $usersMap = $users->map('ID', 'Title')->toArray();
     asort($usersMap);
     $userField = ListboxField::create('OwnerUsers', _t('ContentReview.PAGEOWNERUSERS', 'Users'), $usersMap)->setMultiple(true)->setAttribute('data-placeholder', _t('ContentReview.ADDUSERS', 'Add users'))->setDescription(_t('ContentReview.OWNERUSERSDESCRIPTION', 'Page owners that are responsible for reviews'));
     $fields->addFieldToTab('Root.ContentReview', $userField);
     $groupsMap = array();
     foreach (Group::get() as $group) {
         // Listboxfield values are escaped, use ASCII char instead of &raquo;
         $groupsMap[$group->ID] = $group->getBreadcrumbs(' > ');
     }
     asort($groupsMap);
     $groupField = ListboxField::create('OwnerGroups', _t('ContentReview.PAGEOWNERGROUPS', 'Groups'), $groupsMap)->setMultiple(true)->setAttribute('data-placeholder', _t('ContentReview.ADDGROUP', 'Add groups'))->setDescription(_t('ContentReview.OWNERGROUPSDESCRIPTION', 'Page owners that are responsible for reviews'));
     $fields->addFieldToTab('Root.ContentReview', $groupField);
     $FirstReviewDaysBefore = NumericField::create('FirstReviewDaysBefore', _t('ContentReview.FIRSTREVIEWDAYSBEFORE', 'First review reminder # days before final review'));
     $SecondReviewDaysBefore = NumericField::create('SecondReviewDaysBefore', _t('ContentReview.SECONDREVIEWDAYSBEFORE', 'Second review reminder # days before final review'));
     // Email content
     $fields->addFieldsToTab('Root.ContentReview', array(TextField::create('ReviewFrom', _t('ContentReview.EMAILFROM', 'From email address'))->setRightTitle(_t('Review.EMAILFROM_RIGHTTITLE', 'e.g: do-not-reply@site.com')), $FirstReviewDaysBefore, $SecondReviewDaysBefore, TextField::create('ReviewReminderEmail', 'Review reminder email address')->setRightTitle('e.g: review.reminders@site.com'), TextField::create('ReviewSubjectReminder', _t('ContentReview.EMAILSUBJECTREMINDER', 'Subject line - reminder')), TextField::create('ReviewSubject', _t('ContentReview.EMAILSUBJECT', 'Subject line - Review due')), TextAreaField::create('ReviewBodyFirstReminder', _t('ContentReview.EMAILTEMPLATEFIRSTREMINDER', 'Email body - First reminder')), TextAreaField::create('ReviewBodySecondReminder', _t('ContentReview.EMAILTEMPLATESECONDREMINDER', 'Email body - Second reminder')), TextAreaField::create('ReviewBody', _t('ContentReview.EMAILTEMPLATE', 'Email body - Review due')), LiteralField::create('TemplateHelp', $this->owner->renderWith('ContentReviewAdminHelp'))));
 }
 public function updateCMSFields(FieldList $fields)
 {
     $fields->removeByName(array('MetaTitle', 'OGTitle', 'MetaDescription', 'OGDescription', 'OGImage'));
     $fields->addFieldsToTab('Root.Meta', array(LiteralField::create('Message', '<div class="message warning">Fallback data may be provided for each of the fields below if left blank.</div>'), TextField::create('MetaTitle')->setTitle('Meta Title'), TextField::create('OGTitle')->setTitle('OG Title'), TextAreaField::create('MetaDescription')->setTitle('Meta Description'), TextAreaField::create('OGDescription')->setTitle('OG Description'), UploadField::create('OGImage')->setTitle('OG Image')->setFolderName('Meta')));
 }
Esempio n. 25
0
 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;
 }
 /**
  * @param FieldList $fields
  * @return Object
  */
 public function updateCMSFields(FieldList $fields)
 {
     $fields->addFieldsToTab('Root.Main', ToggleCompositeField::create('Twitter Graph', 'Twitter Card', array(LiteralField::create('', '<h2>&nbsp;&nbsp;&nbsp;Twitter Card <img style="position:relative;top:4px;left 4px;" src="' . Director::absoluteBaseURL() . 'twitter-card-meta/Images/twitter.png"></h2>'), TextField::create('TwitterSite', 'Site Handle')->setAttribute('placeholder', 'e.g @sitename')->setRightTitle('Twitter account name for the site'), TextField::create('TwitterCreator', 'Creator Handle')->setAttribute('placeholder', 'e.g @username')->setRightTitle('Twitter account name for the author/creator (Will default to site handle)'), OptionsetField::create('TwitterCardType', 'Twitter Card Type', array('summary_large_image' => 'summary with large image', 'summary' => 'summary'), 'summary_large_image')->setRightTitle('Choose which type of twitter card you would like this page to share as.'), TextField::create('TwitterTitle', 'Twitter Card Title')->setAttribute('placeholder', 'e.g Description Of Page Content')->setRightTitle('Twitter title to to display on the Twitter card'), TextAreaField::create('TwitterDescription', '')->setRightTitle('Twitter card description goes here, automatically defaults to the content summary'), UploadField::create('TwitterImage', 'Twitter Card Image')->setRightTitle('Will default too the first image in the WYSIWYG editor or banner image if left blank'))));
 }
 function __construct($controller, $name, $speaker = null, $member = null, $email = null)
 {
     // Get the city for the current member
     if ($member) {
         $country = $member->Country;
     } else {
         $country = '';
     }
     // Fields
     $FirstNameField = new TextField('FirstName', "Speaker's First Name");
     $LastNameField = new TextField('LastName', "Speaker's Last Name");
     $TitleField = new TextField('Title', "Speaker's Title");
     $BioField = new TextAreaField('Bio', "Speaker's Bio");
     // ID Fields
     $SpeakerIDField = new HiddenField('SpeakerID', 'SpeakerID', "");
     $MemberIDField = new HiddenField('MemberID', 'MemberID');
     // Replace Fields
     $ReplaceBioField = new HiddenField('ReplaceBio', 'ReplaceBio', 0);
     $ReplaceNameField = new HiddenField('ReplaceName', 'ReplaceName', 0);
     $ReplaceSurnameField = new HiddenField('ReplaceSurname', 'ReplaceSurname', 0);
     // IRC and Twitter
     $IRCHandleField = new TextField('IRCHandle', 'IRC Handle <em>(Optional)</em>');
     $TwiiterNameField = new TextField('TwitterName', 'Twitter Name <em>(Optional)</em>');
     // Upload Speaker Photo
     $PhotoField = new CustomUploadField('Photo', 'Upload a speaker photo');
     $PhotoField->setCanAttachExisting(false);
     $PhotoField->setAllowedMaxFileNumber(1);
     $PhotoField->setAllowedFileCategories('image');
     $PhotoField->setTemplateFileButtons('CustomUploadField_FrontEndFIleButtons');
     $PhotoField->setFolderName('profile-images');
     $sizeMB = 2;
     // 1 MB
     $size = $sizeMB * 1024 * 1024;
     // 1 MB in bytes
     $PhotoField->getValidator()->setAllowedMaxFileSize($size);
     $PhotoField->setCanPreviewFolder(false);
     // Don't show target filesystem folder on upload field
     // Opt In Field
     $OptInField = new CheckboxField('AvailableForBureau', "I'd like to be in the speaker bureau.");
     $Divider = new LiteralField('hr', '<hr/>');
     // Funded Travel
     $FundedTravelField = new CheckboxField('FundedTravel', "My Company would be willing to fund my travel to events.");
     // Country Field
     $CountryCodes = CountryCodes::$iso_3166_countryCodes;
     $CountryField = new DropdownField('Country', 'Country', $CountryCodes);
     $CountryField->setEmptyString('-- Select One --');
     $CountryField->setValue($country);
     $ExpertiseField = new TextareaField('Expertise', 'Topics of interest (one per line)');
     // Load Existing Data if present
     if ($speaker) {
         $this->record = $speaker;
         $FirstNameField->setValue($speaker->FirstName);
         $LastNameField->setValue($speaker->LastName);
         $BioField->setValue($speaker->Bio);
         $SpeakerIDField->setValue($speaker->ID);
         $MemberIDField->setValue($speaker->MemberID);
         $TitleField->setValue($speaker->Title);
         $IRCHandleField->setValue($speaker->IRCHandle);
         $TwiiterNameField->setValue($speaker->TwitterName);
         $OptInField->setValue($speaker->AvailableForBureau);
         $FundedTravelField->setValue($speaker->FundedTravel);
         $ExpertiseField->setValue($speaker->Expertise);
         $PhotoField->setValue(null, $speaker);
     } elseif ($member) {
         $FirstNameField->setValue($member->FirstName);
         $LastNameField->setValue($member->LastName);
         $BioField->setValue($member->Bio);
         $MemberIDField->setValue($member->ID);
         $IRCHandleField->setValue($member->IRCHandle);
         $TwiiterNameField->setValue($member->TwitterName);
     }
     $fields = new FieldList($FirstNameField, $LastNameField, $TitleField, $BioField, $SpeakerIDField, $MemberIDField, $ReplaceBioField, $ReplaceNameField, $ReplaceSurnameField, $IRCHandleField, $TwiiterNameField, $PhotoField, $Divider, $OptInField, $FundedTravelField, $CountryField, $ExpertiseField);
     $actions = new FieldList(new FormAction('addAction', 'Save Speaker Details'));
     $validator = new RequiredFields('FirstName', 'LastName', 'Title');
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
Esempio n. 28
0
 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 GameFields()
 {
     $fields = new FieldList();
     // get current event
     $siteConfig = SiteConfig::current_site_config();
     $current = $siteConfig->getCurrentEventID();
     $event = Event::get()->byID($current);
     $genres = $this->getGroupedGames('Genre');
     $fields->push(new HiddenField('ID'));
     $fields->push(new TextField('Title'));
     $fields->push(new TextField('Restriction', 'Restriction (R18, PG, etc)'));
     // tag input field
     $fields->push($tagfield = new TextField('Genre', 'Genres'));
     $tagfield->addExtraClass('tag-field genre');
     // hidden field for all current genres
     $fields->push(new LiteralField('GenreList', $this->renderGenreList($genres)));
     $briefEditor = new TextAreaField('Brief', 'Brief (Short Description)');
     $briefEditor->setRows(5);
     $fields->push($briefEditor);
     $detailsEditor = CompositeField::create(new LabelField('GameDetails', 'Game Details'), $html = new HTMLEditorField('Details'), new LiteralField('editorDiv', '<div class="editable"></div>'));
     $fields->push($detailsEditor);
     $html->addExtraClass('hide');
     $detailsEditor->addExtraClass('field');
     $costuming = new TextAreaField('Costuming', 'Costuming');
     $costuming->setRows(5);
     $fields->push($costuming);
     $fields->push(new TextField('NumPlayers', 'Number of players'));
     $sessions = array();
     if ($event) {
         for ($i = 1; $i <= $event->NumberOfSessions; $i++) {
             $sessions[$i] = $i;
         }
         $session = new DropdownField('Session', 'Preferred Session', $sessions);
         $session->setEmptyString(' ');
         $fields->push($session);
     }
     return $fields;
 }