/**
  * Constructor
  * @since 1.0.0
  * @param string $name Name of WP File Field.
  * @param array/string $args List of Arguments.
  */
 function __construct($name, $label = FALSE, $args = array())
 {
     $defaults = array('wp_browse' => __('Add Media'));
     $args = wp_parse_args($args, $defaults);
     $this->wp_browse = $args['wp_browse'];
     parent::__construct($name, $label, $args);
 }
 /**
  * @param FieldList $fields
  */
 public function updateCMSFields(FieldList $fields)
 {
     /** =========================================
          * @var TextareaField $address
          * @var TextareaField $postalAddress
          * @var TextField $mailChimpAPI
          * @var TextareaField $mailChimpSuccessMessage
         ===========================================*/
     if (!$fields->fieldByName('Root.Settings')) {
         $fields->addFieldToTab('Root', TabSet::create('Settings'));
     }
     /** -----------------------------------------
      * Details
      * ----------------------------------------*/
     $address = TextareaField::create('Address', 'Address');
     $address->setRows(8);
     $postalAddress = TextareaField::create('PostalAddress', 'Postal Address');
     $postalAddress->setRows(8);
     $fields->findOrMakeTab('Root.Settings.Details');
     $fields->addFieldsToTab('Root.Settings.Details', array(HeaderField::create('', 'Company Details'), Textfield::create('Phone', 'Phone Number'), Textfield::create('Email', 'Public Email Address'), $address, $postalAddress, TextField::create('Facebook', 'Facebook'), TextField::create('LinkedIn', 'LinkedIn'), TextField::create('Pinterest', 'Pinterest'), TextField::create('TwitterHandle', 'Twitter Handle')));
     /** -----------------------------------------
      * Subscription
      * ----------------------------------------*/
     $mailChimpAPI = TextField::create('MailChimpAPI', 'API Key');
     $mailChimpSuccessMessage = TextareaField::create('MailChimpSuccessMessage', 'Success Message (optional)');
     $mailChimpAPI->setRightTitle('<a href="https://us9.admin.mailchimp.com/account/api-key-popup/" target="_blank"><i>How do I get my MailChimp API Key?</i></a>');
     $mailChimpSuccessMessage->setRows(2)->setRightTitle('Message displayed when a user has successfully subscribed to a list.');
     $fields->findOrMakeTab('Root.Settings.Subscription', 'Subscription');
     $fields->addFieldsToTab('Root.Settings.Subscription', array(HeaderField::create('', 'Newsletter Subscription'), LiteralField::create('', '<p>The API key, and list ID are necessary for the Newsletter Subscription form to function.</p>'), $mailChimpAPI, TextField::create('MailChimpListID', 'List ID'), $mailChimpSuccessMessage));
 }
 public function getCMSFields()
 {
     $this->beforeUpdateCMSFields(function ($fields) {
         $fields->addFieldsToTab('Root.Main', array(Textfield::create('ContactName', 'Name'), TextField::create('Phone', 'Phone'), TextField::create('Mobile', 'Mobile'), TextField::create('Fax', 'Fax'), EmailField::create('Email', 'Email'), $website = TextField::create('Website', 'Website')));
         $website->setRightTitle('e.g ' . Director::absoluteBaseURL());
     });
     return parent::getCMSFields();
 }
         * 'default_value'
         */
        parent::__construct($name, $label, $args);
    }
    /**
     * Rendering Color field
     * @package Skip
     * @since 1.0
     * @return string $html Returns The HTML Code.
     */
    public function render()
    {
        global $skip_javascripts;
        $skip_javascripts[] = '
			$("#' . $this->params['id'] . '").colorpicker({
				altField: "#' . $this->params['id'] . '",
				altProperties: "background-color",
 /**
  * @param FieldList $fields
  */
 public function updateCMSFields(FieldList $fields)
 {
     if (!$fields->fieldByName('Root.Settings')) {
         $fields->addFieldToTab('Root', TabSet::create('Settings'));
     }
     /** -----------------------------------------
      * Details
      * ----------------------------------------*/
     $fields->findOrMakeTab('Root.Settings.TwitterCards');
     $fields->addFieldsToTab('Root.Settings.TwitterCards', array(HeaderField::create('', 'Twitter Cards'), Textfield::create('DefaultTwitterHandle', 'Default Twitter Handle'), UploadField::create('DefaultTwitterImage', 'Default Twitter Card Image')));
 }
 /**
  * @param FieldList $fields
  */
 public function updateCMSFields(FieldList $fields)
 {
     if (!$fields->fieldByName('Root.Settings')) {
         $fields->addFieldToTab('Root', TabSet::create('Settings'));
     }
     /** -----------------------------------------
      * Details
      * ----------------------------------------*/
     $fields->findOrMakeTab('Root.Settings.SEO');
     $fields->addFieldsToTab('Root.Settings.SEO', array(HeaderField::create('', 'SEO Settings'), Textfield::create('DefaultSEOMetaTitle', 'Default Meta Title Addition')->setRightTitle('This is additional copy that will be automatically added to all of your pages\' meta titles.'), OptionsetField::create('DefaultSEOMetaTitlePosition', 'Default Meta Title Position', array('before' => 'Prepend to the Meta Title', 'after' => 'Append to the Meta Title'), 'before')));
 }
 /**
  * @return FieldList
  */
 public function getCMSFields()
 {
     /** @var  $fields */
     $fields = parent::getCMSFields();
     /** =========================================
      * Settings
      * ==========================================*/
     /** -----------------------------------------
      * Contact Page
      * ----------------------------------------*/
     $fields->addFieldToTab('Root.Main', HeaderField::create('Settings', _t('ContactPage.SettingsHeading', 'Settings')), 'Content');
     /** @var TextField $mailTo */
     $fields->addFieldToTab('Root.Main', $mailTo = TextField::create('MailTo', _t('ContactPage.Email', 'Email')), 'Content');
     $mailTo->setRightTitle('Choose an email address for the contact page to send to');
     /** @var TextField $mailCC */
     $fields->addFieldToTab('Root.Main', $mailCC = TextField::create('MailCC', _t('ContactPage.MailCC', 'Cc')), 'Content');
     $mailCC->setRightTitle(_t('ContactPage.MailCCRightTitle', 'Choose an email, or emails to CC (separate emails with a comma and no space e.g: email1@website.com,email2@website.com)'));
     /** @var TextField $mailBCC */
     $fields->addFieldToTab('Root.Main', $mailBCC = TextField::create('MailBCC', _t('ContactPage.MailBCC', 'Bcc')), 'Content');
     /** @var TextareaField $submissionText */
     $fields->addFieldToTab('Root.Main', $submissionText = TextareaField::create('SubmitText', _t('ContactPage.SubmitText', 'Submission Text')), 'Content');
     $submissionText->setRightTitle(_t('ContactPage.SubmitTextRightTitle', 'Text for contact form submission once the email has been sent i.e "Thank you for your enquiry"'));
     $fields->addFieldToTab('Root.Main', HeaderField::create('RecaptchaHeading', _t('ContactPage.RecaptchaHeading', 'reCaptcha'), 4), 'Content');
     $fields->addFieldToTab('Root.Main', LiteralField::create('RecaptchaDescription', _t('ContactPage.RecaptchaDescription', '<p>By filling in the Site Key, and Secret Key fields a reCaptcha field will be added to the form to protect against spam.</p>')), 'Content');
     $fields->addFieldToTab('Root.Main', LiteralField::create('RecaptchaDescriptionInstructions', _t('ContactPage.RecaptchaDescriptionInstructions', '<div class="message"><p><strong>Note:</strong> you can get your SiteKey, and SecretKey at this address <a href="https://www.google.com/recaptcha/" target="_blank">https://www.google.com/recaptcha/</a></p></div>')), 'Content');
     $fields->addFieldToTab('Root.Main', TextField::create('ReCaptchaSiteKey', _t('ContactPage.RecaptchaSiteKey', 'Site Key')), 'Content');
     $fields->addFieldToTab('Root.Main', TextField::create('ReCaptchaSecretKey', _t('ContactPage.RecaptchaSecretKey', 'Secret Key')), 'Content');
     /** -----------------------------------------
      * Google Map
      * ----------------------------------------*/
     $fields->addFieldToTab('Root.Map', HeaderField::create('MapHeading', _t('ContactPage.MapHeading', 'Map')));
     $fields->addFieldToTab('Root.Map', LiteralField::create('MapDescription', _t('ContactPage.MapDescription', '<p>The Latitude and Longitude fields are required to be populated in order for the map to be displayed.</p>')));
     $fields->addFieldToTab('Root.Map', Textfield::create('GoogleAPI', _t('ContactPage.GoogleAPI', 'Maps API (Optional)')));
     $fields->addFieldToTab('Root.Map', Textfield::create('Latitude', _t('ContactPage.Latitude', 'Latitude')));
     $fields->addFieldToTab('Root.Map', Textfield::create('Longitude', _t('ContactPage.Longitude', 'Longitude')));
     $fields->addFieldToTab('Root.Map', LiteralField::create('MapDescriptionInstructions', _t('ContactPage.MapDescriptionInstructions', '<div class="field"><label class="right"><a href="https://support.google.com/maps/answer/18539" target="_blank">How do I find my latitude/longitude?</a></label></div>')));
     /** @var NumericField $mapZoom */
     $fields->addFieldToTab('Root.Map', $mapZoom = NumericField::create('MapZoom', _t('ContactPage.Zoom', 'Zoom')));
     $mapZoom->setRightTitle(_t('ContactPage.Zoom', 'Zoom level: 1-22 - The higher the number the more zoomed in the map will be.'));
     /**
      * If only one of the colours is set, display a warning.
      */
     if (!$this->MapColor && $this->WaterColor || $this->MapColor && !$this->WaterColor) {
         $fields->addFieldToTab('Root.Map', LiteralField::create('MApColorWarning', _t('ContactPage.MapColorWarning', '<div class="message warning"><p><strong>Note:</strong> To activate the map styling, both Map Colour and Water Colour must be set.</p></div>')));
     }
     $fields->addFieldToTab('Root.Map', ColorField::create('MapColor', _t('ContactPage.MapColor', 'Map Colour (Optional)')));
     $fields->addFieldToTab('Root.Map', ColorField::create('WaterColor', _t('ContactPage.WaterColor', 'Water Colour (Optional)')));
     /** @var TextField $mapSaturation */
     $fields->addFieldToTab('Root.Map', $mapSaturation = TextField::create('MapSaturation', _t('ContactPage.MapSaturation', 'Saturation (Optional)')));
     $mapSaturation->setRightTitle(_t('ContactPage.MapSaturationRightTitle', 'A range of -100 to 100, -100 being completely grayscale.'));
     $fields->addFieldToTab('Root.Map', CheckboxField::create('MapMarker', _t('ContactPage.MapMarker', 'Show map marker')));
     return $fields;
 }
Beispiel #8
0
 public function ContestEntryForm()
 {
     $validator = RequiredFields::create('Name', 'Email', 'Title', 'myCaptcha');
     $recaptchaField = RecaptchaField::create('myCaptcha', 'Are You a Robot?');
     $recaptchaField->jsOptions = array('theme' => 'clean');
     // optional
     // Create fields
     $fields = new FieldList(Textfield::create('Name'), Textfield::create('Email'), Textfield::create('Title'), HTMLEditorField::create('Content'), $recaptchaField);
     // Create actions
     $actions = new FieldList(FormAction::create('doContestEnter', 'Submit')->addExtraClass('btn btn-secondary'));
     return Form::create($this, 'ContestEntryForm', $fields, $actions);
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     Requirements::css('boilerplate/css/colorpicker.css');
     Requirements::javascript('boilerplate/javascript/colorpicker.min.js');
     Requirements::javascript('boilerplate/javascript/colorpicker.init.js');
     /* =========================================
        * Settings
        =========================================*/
     /* -----------------------------------------
         * Contact Page
        ------------------------------------------*/
     $fields->addFieldToTab('Root.Main', new HeaderField('Settings'), 'Content');
     $fields->addFieldToTab('Root.Main', $mailTo = new TextField('MailTo', _t('ContactPage.MailToLabel', 'Email')), 'Content');
     $mailTo->setRightTitle('Choose an email address for the contact page to send to');
     $fields->addFieldToTab('Root.Main', $mailCC = new TextField('MailCC', _t('ContactPage.MailCCLabel', 'CC')), 'Content');
     $mailCC->setRightTitle('Choose an email, or emails to CC (separate emails with a comma and no space e.g: email1@website.com,email2@website.com)');
     $fields->addFieldToTab('Root.Main', $submissionText = new TextareaField('SubmitText', _t('ContactPage.SubmitTextLabel', 'Submission Text')), 'Content');
     $submissionText->setRightTitle('Text for contact form submission once the email has been sent i.e "Thank you for your enquiry"');
     /* -----------------------------------------
         * Google Map
        ------------------------------------------*/
     $fields->addFieldToTab('Root.Map', new Textfield('GoogleAPI', _t('ContactPage.GoogleAPILabel', 'Maps API (Optional)')));
     $fields->addFieldToTab('Root.Map', new Textfield('Latitude', _t('ContactPage.LatitudeLabel', 'Latitude')));
     $fields->addFieldToTab('Root.Map', new Textfield('Longitude', _t('ContactPage.LongitudeLabel', 'Longitude')));
     $fields->addFieldToTab('Root.Map', $mapZoom = new Textfield('MapZoom', _t('ContactPage.MapZoomLabel', 'Zoom')));
     $mapZoom->setRightTitle(_t('ContactPage.MapZoomTitle', 'Zoom level: 0-22 - The higher the number the more zoomed in the map will be.'));
     $fields->addFieldToTab('Root.Map', new ColorField('MapColor', _t('ContactPage.MapColorLabel', 'Map Colour (Optional)')));
     $fields->addFieldToTab('Root.Map', new ColorField('WaterColor', _t('ContactPage.WaterColorLabel', 'Water Colour (Optional)')));
     $fields->addFieldToTab('Root.Map', new CheckboxField('MapMarker', _t('ContactPage.MapMarkerLabel', 'Show map marker')));
     /* -----------------------------------------
         * Info Windows
        ------------------------------------------*/
     $config = GridFieldConfig_RelationEditor::create(10);
     $config->addComponent(new GridFieldDeleteAction());
     $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Title' => 'Title'));
     $gridField = new GridField('InfoWindows', 'Markers', $this->owner->InfoWindows(), $config);
     $fields->addFieldToTab('Root.MapMarkers', $gridField);
     return $fields;
 }
 /**
  * Rendering Field
  * @since 1.0
  * @return string $html Returns The HTML Code.
  */
 public function render()
 {
     global $skip_javascripts;
     $autocomplete_values = array();
     foreach ($this->elements as $key => $value) {
         array_push($autocomplete_values, '"' . $value . '"');
     }
     $values = implode(',', $autocomplete_values);
     // If there are any autocomplete values show JS
     if (count($autocomplete_values) > 0) {
         $skip_javascripts[] = '$("#' . $this->params['id'] . '").autocomplete({ source: [' . $values . '] });';
     }
     return parent::render();
 }
 /**
  * @return FieldList
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName('AccessToken');
     if ($this->AccessToken) {
         $token = json_decode($this->AccessToken);
         $usernameField = LiteralField::create('Title', '<div class="field">' . '<label class="left">' . _t('Instagram.FieldLabelTitle', 'Username') . '</label>' . '<div class="middleColumn" style="padding-top:8px;">' . '<a ' . "href='https://www.instagram.com/{$token->user->username}' " . 'title="View on Instagram" ' . 'target="_blank">' . $token->user->username . '</a>' . '</div>' . '</div>');
     } else {
         $usernameField = Textfield::create('Title', _t('Instagram.FieldLabelTitle', 'Username'));
         $usernameField->setDescription(_t('Instagram.FieldDescriptionTitle', 'The Instagram account you want to pull media from.'));
     }
     $fields->addFieldToTab('Root.Main', $usernameField);
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
 /**
  * @param FieldList $fields
  */
 public function updateCMSFields(FieldList $fields)
 {
     /** =========================================
          * @var UploadField $twitterImage
         ===========================================*/
     if (!$fields->fieldByName('Root.Settings')) {
         $fields->addFieldToTab('Root', TabSet::create('Settings'));
     }
     /** -----------------------------------------
      * Details
      * ----------------------------------------*/
     $twitterImage = UploadField::create('DefaultTwitterImage', 'Default Twitter Card Image');
     $twitterImage->setDescription('Ideal size 560px * 750px');
     $fields->findOrMakeTab('Root.Settings.TwitterCards');
     $fields->addFieldsToTab('Root.Settings.TwitterCards', array(HeaderField::create('', 'Twitter Cards'), Textfield::create('DefaultTwitterHandle', 'Default Twitter Handle'), $twitterImage));
 }
 /**
  * @param FieldList $fields
  */
 public function updateCMSFields(FieldList $fields)
 {
     /** -----------------------------------------
      * Settings
      * ----------------------------------------*/
     if (!$fields->fieldByName('Root.Settings')) {
         $fields->addFieldToTab('Root', TabSet::create('Settings'));
     }
     /** -----------------------------------------
      * Images
      * ----------------------------------------*/
     $fields->findOrMakeTab('Root.Settings.Images', 'Images');
     /** @var UploadField $favicon */
     $fields->addFieldsToTab('Root.Settings.Images', array(HeaderField::create('ImagesTabHeading', _t('BoilerplateSiteConfigExtension.ImagesTabHeading', 'Images')), $logo = UploadField::create('LogoImage', _t('BoilerplateSiteConfigExtension.Logo', 'Logo')), $mobileLogo = UploadField::create('MobileLogoImage', _t('BoilerplateSiteConfigExtension.MobileLogoImage', 'Mobile Menu Logo (optional)')), $favicon = UploadField::create('Favicon', _t('BoilerplateSiteConfigExtension.Favicon', 'Favicon'))));
     $favicon->setRightTitle(_t('BoilerplateSiteConfigExtension.FaviconRightTitle', 'Choose an Image For Your Favicon (16px by 16px)'));
     /** -----------------------------------------
      * Company Details
      * ----------------------------------------*/
     $fields->findOrMakeTab('Root.Settings.Details', 'Details');
     /**
      * @var TextareaField $address
      * @var TextareaField $postalAddress
      * @var TextareaField $directions
      */
     $fields->addFieldsToTab('Root.Settings.Details', array(HeaderField::create('DetailsTabHeading', _t('BoilerplateSiteConfigExtension.DetailsTabHeading', 'General')), Textfield::create('Phone', _t('BoilerplateSiteConfigExtension.Phone', 'Phone Number')), Textfield::create('Email', _t('BoilerplateSiteConfigExtension.Email', 'Public Email Address')), $address = TextareaField::create('Address', _t('BoilerplateSiteConfigExtension.Address', 'Address')), $postalAddress = TextareaField::create('PostalAddress', _t('BoilerplateSiteConfigExtension.PostalAddress', 'Postal Address')), $directions = TextareaField::create('Directions', _t('BoilerplateSiteConfigExtension.Directions', 'Google Map Directions')), HeaderField::create('DetailsTabSocialMediaHeading', _t('BoilerplateSiteConfigExtension.DetailsTabSocialMediaHeading', 'Social Media')), TextField::create('Facebook', _t('BoilerplateSiteConfigExtension.Facebook', 'Facebook')), TextField::create('Twitter', _t('BoilerplateSiteConfigExtension.Twitter', 'Twitter')), TextField::create('Youtube', _t('BoilerplateSiteConfigExtension.Youtube', 'Youtube')), TextField::create('GooglePlus', _t('BoilerplateSiteConfigExtension.GooglePlus', 'Google+'))));
     $address->setRows(8);
     $postalAddress->setRows(8);
     $directions->setRows(3);
     $directions->setRightTitle(_t('DirectionsRightTitle', 'The URL of the Address on <a href="https://www.google.com/maps" title="Google Maps" rel="nofollow" target="_blank">Google Maps</a>. This is useful for users on mobile granting the ability to open directions in their native applications.'));
     /** -----------------------------------------
      * Analytics
      * ----------------------------------------*/
     if (Permission::check('ADMIN')) {
         $fields->findOrMakeTab('Root.Settings.Analytics', 'Analytics');
         /**
          * @var TextareaField $googleSiteVerification
          * @var TextareaField $trackingCode
          * @var TextareaField $tagManagerFieldGroup
          */
         $fields->addFieldsToTab('Root.Settings.Analytics', array(HeaderField::create('', 'Analytics'), $googleSiteVerification = TextareaField::create('GoogleSiteVerification', _t('BoilerplateSiteConfigExtension.GoogleSiteVerification', 'Google Site Verification Code')), $trackingCode = TextareaField::create('TrackingCode', _t('BoilerplateSiteConfigExtension.TrackingCode', 'Tracking Code')), $tagManagerFieldGroup = FieldGroup::create(CheckboxField::create('TagManager', _t('BoilerplateSiteConfigExtension.TagManager', 'Does the tracking code above contain Google Tag Manager?')))));
         $googleSiteVerification->setRows(2);
         $trackingCode->setRows(20);
         $tagManagerFieldGroup->setTitle(_t('BoilerplateSiteConfigExtension.TagManagerRightTitle', 'Tag Manager'));
     }
 }
 /**
  * getCMSFields
  * Construct the FieldList used in the CMS. To provide a
  * smarter UI we don't use the scaffolding provided by
  * parent::getCMSFields.
  * 
  * @return FieldList
  */
 public function getCMSFields()
 {
     Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css');
     $customer = $this->Customer();
     $fields = FieldList::create(Tabset::create("Root", Tabset::create("Order", Tab::create("CustomerDetails", HeaderField::create("Customer Selection"), CompositeField::create(DropdownField::create("CustomerID", $this->exists() ? "Customer" : "Select a Customer", Customer::get()->sort(array('Surname' => 'ASC', 'FirstName' => 'ASC'))->map())->setEmptyString("(Select a Customer)")->setRightTitle($this->exists() ? "To change the customer against this order select the new customer above (when editing from the\n\t\t\t\t\t\t\t\t'Store Orders' screen) and click save." : "Which customer is this order for?")), $this->exists() ? HeaderField::create("Customer Details") : null, $this->exists() ? CompositeField::create(ReadonlyField::create("Customer.FirstName", "First Name", $customer->FirstName), ReadonlyField::create("Customer.Surname", "Surname", $customer->Surname), ReadonlyField::create("Customer.CompanyName", "Company", $customer->CompanyName), ReadonlyField::create("Customer.Landline", "Landline Number", $customer->LandlineNumber), ReadonlyField::create("Customer.Mobile", "Mobile Number", $customer->MobileNumber)) : ""), Tab::create("OrderDetails", HeaderField::create("Order Details"), CompositeField::create(DropdownField::create("Status", "Order Status", Order_Statuses::get()->map()), DropdownField::create("BillingAddressID", "Billing Address", DataObject::get("Customer_AddressBook", "(`CustomerID`=" . $this->Customer()->ID . ")")->map())->setRightTitle("Customers' billing address.")->setEmptyString("(Select one)"), DropdownField::create("ShippingAddressID", "Shipping Address", DataObject::get("Customer_AddressBook", "(`CustomerID`=" . $this->Customer()->ID . ")")->map())->setRightTitle("Customers' shipping address.")->setEmptyString("(Select one)")), HeaderField::create("Order Items (Basket)"), CompositeField::create($items = GridField::create("OrderItems", "", $this->Order_Items(), GridFieldConfig_RecordEditor::create()), ReadonlyField::create("SubTotal", "Basket Total (" . Product::getDefaultCurrency() . ")", $this->calculateSubTotal())), HeaderField::create("Shipping"), CompositeField::create(FieldGroup::create(DropdownField::create("Courier", "Courier", $this->getCouriers($this->ID))->setRightTitle("Which courier is being used for this order?")->setEmptyString("(Select one)"), Textfield::create("TrackingNo", "Tracking Number (Optional)")->setRightTitle("If the shipment has a tracking number, enter it here.")), ReadonlyField::create("Shipping", "Shipping Total (" . Product::getDefaultCurrency() . ")", $this->calculateShippingTotal())), HeaderField::create("Order Totals"), CompositeField::create(FieldGroup::create("Tax (" . Product::getDefaultCurrency() . ")", ReadonlyField::create("ProductTaxInclusive", "Product Tax (Inclusive)", $this->calculateProductTax(1))->setRightTitle("Basket total is inclusive of this tax."), ReadonlyField::create("ProductTaxExclusive", "Product Tax (Exclusive)", $this->calculateProductTax(2))->setRightTitle("Basket total is exclusive of this tax."), ReadonlyField::create("ShippingTax", "Shipping Tax", $this->calculateShippingTax($this->calculateShippingTotal()))->setRightTitle(StoreSettings::get_settings()->TaxSettings_ShippingInclusiveExclusive == 1 ? "Shipping price is inclusive of this tax." : "Shipping price is exclusive of this tax.")), FieldGroup::create("Final Totals (" . Product::getDefaultCurrency() . ")", ReadonlyField::create("Total", "Final Total", $this->calculateOrderTotal()), ReadonlyField::create("TotalPayments", "Total Payments", $this->calculatePaymentTotal()), ReadonlyField::create("OutstandingBalance", "Outstanding Balance", $this->calculateRemainingBalance()))), HeaderField::create("Payments"), CompositeField::create($items = GridField::create("OrderPayments", "", $this->Order_Payment(), GridFieldConfig_RecordEditor::create()))), Tab::create("OrderComments", HeaderField::create("Order Comments"), CompositeField::create(ReadonlyField::create("CustomerComments", "Customer Comments")->setRightTitle("These are the comments of this customer."), TextareaField::create("AdminComments", "Admin Comments")->setRightTitle("Only store admins can see these comments"))), Tab::create("OrderEmails", HeaderField::create("Order Emails"), CompositeField::create($items = GridField::create("Order_Emails", "", $this->Order_Emails(), GridFieldConfig_RecordViewer::create()))))));
     //If record doesn't exist yet, hide certain tabs.
     !$this->exists() ? $fields->RemoveFieldsFromTab("Root.Order", array("OrderDetails", "OrderComments", "OrderEmails")) : null;
     /* 
      * If record exists, and order is unpaid show warning message to prevent shipment of unpaid orders.
      * Otherwise show a success message.
      */
     if ($this->exists() && $this->calculateRemainingBalance() > 0) {
         $alert = new LiteralField("OrderPayment_LiteralField", "<div class=\"literal-field field\">\n\t\t\t\t\t<div class=\"message error\">\n\t\t\t\t\t\t<strong>ORDER REMAINS UNPAID</strong> - This order has an outstanding balance of " . Product::getDefaultCurrency() . $this->calculateRemainingBalance() . ". If the customer has paid then the\n\t\t\t\t\t\t payment gateway may not have provided a payment status yet.\n\t\t\t\t\t</div>\n\t\t\t\t</div>");
         $fields->addFieldToTab("Root.Order", $alert, "Status");
     } elseif ($this->exists() && $this->calculateRemainingBalance() == 0) {
         $alert = new LiteralField("OrderPayment_LiteralField", "<div class=\"literal-field field\">\n\t\t\t\t\t<div class=\"message good\">\n\t\t\t\t\t\t<strong>BALANCE PAID</strong> - This balance of this order has been paid. You may now prepare and \n\t\t\t\t\t\tdispatch the order items below.\n\t\t\t\t\t</div> \n\t\t\t\t</div>");
         $fields->addFieldToTab("Root.Order", $alert, "Status");
     }
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = FieldList::create();
     $title = Textfield::create('Title', 'Title');
     $fields->push($title);
     if ($this->IsInDB()) {
         // Allowed Fields
         $allowed = $this->Consultation()->Fields()->filterByCallback(function ($field) {
             return $field->getHasAddableOptions();
         });
         $dropdown_field = DropdownField::create('FieldID', 'Field', $allowed->map())->setEmptyString('Select field to report on...');
         $fields->push($dropdown_field);
         // Report Types
         $dropdown_types = DropdownField::create('Type', 'Type', $this->getAllowedReportTypes());
         $fields->push($dropdown_types);
         $fields->push(ColorField::create('Colour', 'Colour'));
     } else {
         $warning = LiteralField::create('Warning', 'Please save this component to edit it.');
         $fields->push($warning);
     }
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = FieldList::create(new Tabset('Root', new Tab('Main'), new Tab('Modifiers')));
     // set variables from Product
     $productID = $this->ProductID != 0 ? $this->ProductID : Session::get('CMSMain.currentPage');
     $product = ProductPage::get()->byID($productID);
     $parentPrice = $product->obj('Price')->Nice();
     $parentWeight = $product->Weight;
     $parentCode = $product->Code;
     // ProductOptionGroup Dropdown field w/ add new
     $groups = function () {
         return OptionGroup::get()->map()->toArray();
     };
     $groupFields = singleton('OptionGroup')->getCMSFields();
     $groupField = DropdownField::create('ProductOptionGroupID', _t("OptionItem.Group", "Group"), $groups())->setEmptyString('')->setDescription(_t('OptionItem.GroupDescription', 'Name of this group of options. Managed in <a href="admin/settings">Settings > FoxyStripe > Option Groups</a>'));
     if (class_exists('QuickAddNewExtension')) {
         $groupField->useAddNew('OptionGroup', $groups, $groupFields);
     }
     $fields->addFieldsToTab('Root.Main', array(HeaderField::create('DetailsHD', _t("OptionItem.DetailsHD", "Product Option Details"), 2), Textfield::create('Title')->setTitle(_t("OptionItem.Title", "Product Option Name")), CheckboxField::create('Available')->setTitle(_t("OptionItem.Available", "Available for purchase"))->setDescription(_t('OptionItem.AvailableDescription', "If unchecked, will disable this option in the drop down menu")), $groupField));
     $fields->addFieldsToTab('Root.Modifiers', array(HeaderField::create('ModifyHD', _t('OptionItem.ModifyHD', 'Product Option Modifiers'), 2), HeaderField::create('WeightHD', _t('OptionItem.WeightHD', 'Modify Weight'), 3), NumericField::create('WeightModifier')->setTitle(_t('OptionItem.WeightModifier', 'Weight')), DropdownField::create('WeightModifierAction', _t('OptionItem.WeightModifierAction', 'Weight Modification'), array('Add' => _t('OptionItem.WeightAdd', "Add to Base Weight ({weight})", 'Add to weight', array('weight' => $parentWeight)), 'Subtract' => _t('OptionItem.WeightSubtract', "Subtract from Base Weight ({weight})", 'Subtract from weight', array('weight' => $parentWeight)), 'Set' => _t('OptionItem.WeightSet', 'Set as a new Weight')))->setEmptyString('')->setDescription(_t('OptionItem.WeightDescription', 'Does weight modify or replace base weight?')), HeaderField::create('PriceHD', _t('OptionItem.PriceHD', 'Modify Price'), 3), CurrencyField::create('PriceModifier')->setTitle(_t('OptionItem.PriceModifier', 'Price')), DropdownField::create('PriceModifierAction', _t('OptionItem.PriceModifierAction', 'Price Modification'), array('Add' => _t('OptionItem.PriceAdd', "Add to Base Price ({price})", 'Add to price', array('price' => $parentPrice)), 'Subtract' => _t('OptionItem.PriceSubtract', "Subtract from Base Price ({price})", 'Subtract from price', array('price' => $parentPrice)), 'Set' => _t('OptionItem.PriceSet', 'Set as a new Price')))->setEmptyString('')->setDescription(_t('OptionItem.PriceDescription', 'Does price modify or replace base price?')), HeaderField::create('CodeHD', _t('OptionItem.CodeHD', 'Modify Code'), 3), TextField::create('CodeModifier')->setTitle(_t('OptionItem.CodeModifier', 'Code')), DropdownField::create('CodeModifierAction', _t('OptionItem.CodeModifierAction', 'Code Modification'), array('Add' => _t('OptionItem.CodeAdd', "Add to Base Code ({code})", 'Add to code', array('code' => $parentCode)), 'Subtract' => _t('OptionItem.CodeSubtract', 'Subtract from Base Code ({code})', 'Subtract from code', array('code' => $parentCode)), 'Set' => _t('OptionItem.CodeSet', 'Set as a new Code')))->setEmptyString('')->setDescription(_t('OptionItem.CodeDescription', 'Does code modify or replace base code?'))));
     /*
     // Cateogry Dropdown field w/ add new
     // removed until relevance determined
     $categories = function(){
         return ProductCategory::get()->map()->toArray();
     };
     
     // to do - have OptionItem category override set ProductPage category if selected: issue #155
     $categoryField = DropdownField::create('CategoryID', 'Category', $categories())
         ->setEmptyString('')
         ->setDescription('Categories can be managed in <a href="admin/settings">Settings > FoxyStripe > Categories</a>');
     if (class_exists('QuickAddNewExtension')) $categoryField->useAddNew('ProductCategory', $categories);
     
     $fields->insertAfter($categoryField, 'ProductOptionGroupID');
     */
     // allow CMS fields to be extended
     $this->extend('getCMSFields', $fields);
     return $fields;
 }
 /**
  * @param FieldList $fields
  */
 public function updateCMSFields(Fieldlist $fields)
 {
     $fields->addFieldsToTab('Root.Social', array(Textfield::create('FacebookLink', 'Facebook'), Textfield::create('TwitterLink', 'Twitter'), Textfield::create('InstagramLink', 'Instagram'), Textfield::create('GoogleplusLink', 'Google Plus'), Textfield::create('YoutubeLink', 'Youtube'), Textfield::create('LinkedinLink', 'LinkedIn')));
 }
<?php

if (isset($_REQUEST['requestNewPW4Mail']) && isset($_REQUEST['em4il']) && strlen($_REQUEST['em4il']) > 3 && strpos($_REQUEST['em4il'], "@") > 0) {
    $txt = new Text("Es wurde ein neues Passwort generiert.\n" . "Die Email mit den Zugangsdaten wurde versendet an: " . $_REQUEST['em4il']);
    $_SESSION['config']->CURRENTUSER->needNewPassword($_REQUEST['em4il']);
    exit;
}
$txt = new Text("Sie haben ihr Passwort vergessen?\n\n" . "Geben Sie einfach im folgenden Eingabefeld ihre Emailadresse ein und bestätigen " . "Sie ihre Eingabe mit dem Button *Passwort anfordern* ");
$eMail = new Textfield("em4il", "");
$eMail->setTooltip("Geben Sie hier ihre Emailadresse ein mit der Sie sich registriert haben.");
$btn = new Button("requestNewPW4Mail", "Passwort anfordern");
$eMail->setTooltip("Bestätigen Sie hier ihre Eingabe.\nEs wird ein neues Passwort generiert und die neuen Zugangsdaten an ihre Email gesendet.");
$table = new Table(array(""));
$r1 = $table->createRow();
$r1->setAttribute(0, $txt);
$table->addRow($r1);
$r2 = $table->createRow();
$r2->setAttribute(0, $eMail);
$table->addRow($r2);
$r3 = $table->createRow();
$r3->setAttribute(0, $btn);
$table->addRow($r3);
$form = new Form($_SERVER['SCRIPT_NAME']);
$form->add($table);
$form->show();
/**
 * Textfield getter Function
 * @since 1.0.0
 * @param string $name Name of field.
 * @param string $label Label of field.
 * @param string $description Description of field which is shown under element
 * @see textfield()
 * @ignore
 */
function get_textfield($name, $label = FALSE, $description = FALSE)
{
    $textfield = new Textfield($name, $label, $description);
    return $textfield->render();
}