/**
  * 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');
     //Create the FieldList and push the Root TabSet on to it.
     $fields = FieldList::create($root = TabSet::create('Root', Tab::create("Main", HeaderField::create("Add/Edit Tax Class"), CompositeField::create(TextField::create("Title", "Class Name")->setRightTitle("i.e. Zero Rate, Standard Rate.")))));
     return $fields;
 }
 /**
  * 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');
     //Create the FieldList and push the Root TabSet on to it.
     $fields = FieldList::create($root = TabSet::create('Root', Tab::create("Main", HeaderField::create("Add/Edit Tax Zone"), CompositeField::create(DropdownField::create("Enabled", "Enable this zone?", array("1" => "Yes", "2" => "No"))->setRightTitle($this->SystemCreated == 1 && $this->exists() ? "DISABLED: You can not disable the default tax zone." : "If enabled your store will use the rates defined in this zone for customers in the selected country.")->setDisabled($this->SystemCreated == 1 && $this->exists() ? true : false), !$this->exists() ? CountryDropdownField::create("Title", "Country")->setRightTitle($this->SystemCreated == 1 && $this->exists() ? "DISABLED: You can not select a country as this zone applies to all countries." : "Select the country this zone applies to.")->setDisabled($this->SystemCreated == 1 && $this->exists() ? true : false) : "", $this->exists() ? GridField::create("TaxZones_TaxRates", "Tax Rates within the '" . $this->Title . "' Tax Zone", $this->TaxRates(), GridFieldConfig_RecordEditor::create()) : ""))));
     return $fields;
 }
 public function __construct($controller, $name, $show_actions = true)
 {
     $TempBasketID = Store_BasketController::get_temp_basket_id();
     $order_id = DB::Query("SELECT id FROM `order` WHERE (`TempBasketID`='" . $TempBasketID . "')")->value();
     /* Basket GridField */
     $config = new GridFieldConfig();
     $dataColumns = new GridFieldDataColumns();
     $dataColumns->setDisplayFields(array('getPhoto' => "Photo", 'Title' => 'Product', 'Price' => 'Item Price', 'Quantity' => 'Quantity', 'productPrice' => 'Total Price', 'getfriendlyTaxCalculation' => 'Tax Inc/Exc', 'TaxClassName' => 'Tax'));
     $config->addComponent($dataColumns);
     $config->addComponent(new GridFieldTitleHeader());
     $basket = GridField::create("BasketItems", "", DataObject::get("Order_Items", "(OrderID='" . $order_id . "')"), $config);
     /* Basket Subtotal */
     $subtotal = new Order();
     $subtotal = $subtotal->calculateSubTotal($order_id);
     $subtotal = ReadonlyField::create("SubTotal", "Basket Total (" . Product::getDefaultCurrency() . ")", $subtotal);
     /* Fields */
     $fields = FieldList::create($basket, $subtotal, ReadonlyField::create("Tax", "Tax", "Calculated on the Order Summary page."));
     /* Actions */
     $actions = FieldList::create(CompositeField::create(FormAction::create('continueshopping', 'Continue Shopping'), FormAction::create('placeorder', 'Place Order')));
     /* Required Fields */
     $required = new RequiredFields(array());
     /*
      * Now we create the actual form with our fields and actions defined 
      * within this class.
      */
     return parent::__construct($controller, $name, $fields, $show_actions ? $actions : FieldList::create(), $required);
 }
 public function __construct($controller, $name = "PostagePaymentForm")
 {
     // Get delivery data and postage areas from session
     $delivery_data = Session::get("Commerce.DeliveryDetailsForm.data");
     $country = $delivery_data['DeliveryCountry'];
     $postcode = $delivery_data['DeliveryPostCode'];
     $postage_areas = $controller->getPostageAreas($country, $postcode);
     // Loop through all postage areas and generate a new list
     $postage_array = array();
     foreach ($postage_areas as $area) {
         $area_currency = new Currency("Cost");
         $area_currency->setValue($area->Cost);
         $postage_array[$area->ID] = $area->Title . " (" . $area_currency->Nice() . ")";
     }
     $postage_id = Session::get('Commerce.PostageID') ? Session::get('Commerce.PostageID') : 0;
     // Setup postage fields
     $postage_field = CompositeField::create(HeaderField::create("PostageHeader", _t('Commerce.Postage', "Postage")), OptionsetField::create("PostageID", _t('Commerce.PostageSelection', 'Please select your prefered postage'), $postage_array)->setValue($postage_id))->setName("PostageFields")->addExtraClass("unit")->addExtraClass("size1of2")->addExtraClass("unit-50");
     // Get available payment methods and setup payment
     $payment_methods = SiteConfig::current_site_config()->PaymentMethods();
     // Deal with payment methods
     if ($payment_methods->exists()) {
         $payment_map = $payment_methods->map('ID', 'Label');
         $payment_value = $payment_methods->filter('Default', 1)->first()->ID;
     } else {
         $payment_map = array();
         $payment_value = 0;
     }
     $payment_field = CompositeField::create(HeaderField::create('PaymentHeading', _t('Commerce.Payment', 'Payment'), 2), OptionsetField::create('PaymentMethodID', _t('Commerce.PaymentSelection', 'Please choose how you would like to pay'), $payment_map, $payment_value))->setName("PaymentFields")->addExtraClass("unit")->addExtraClass("size1of2")->addExtraClass("unit-50");
     $fields = FieldList::create(CompositeField::create($postage_field, $payment_field)->setName("PostagePaymentFields")->addExtraClass("units-row")->addExtraClass("line"));
     $back_url = $controller->Link("billing");
     $actions = FieldList::create(LiteralField::create('BackButton', '<a href="' . $back_url . '" class="btn btn-red commerce-action-back">' . _t('Commerce.Back', 'Back') . '</a>'), FormAction::create('doContinue', _t('Commerce.PaymentDetails', 'Enter Payment Details'))->addExtraClass('btn')->addExtraClass('commerce-action-next')->addExtraClass('btn-green'));
     $validator = RequiredFields::create(array("PostageID", "PaymentMethod"));
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
 /**
  * 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');
     //Create the FieldList and push the Root TabSet on to it.
     $fields = FieldList::create($root = TabSet::create('Root', Tab::create("Main", HeaderField::create("Add/Edit Currency"), CompositeField::create(DropdownField::create("Enabled", "Enable Currency?", array("1" => "Yes", "2" => "No"))->setRightTitle($this->SystemCreated == 1 ? "DISABLED: You can not disable the default currency." : "Select the country this zone applies to.")->setDisabled($this->SystemCreated == 1 ? true : false), TextField::create("Title", "Currency Name")->setRightTitle("i.e. Great British Pound."), TextField::create("Code", "Currency Code")->setRightTitle("i.e. GBP, USD, EUR."), TextField::create("ExchangeRate", "Exchange Rate")->setRightTitle("i.e. Your new currency is USD, a conversion rate of 1.53 may apply against the local currency."), TextField::create("Symbol", "Currency Symbol")->setRightTitle("i.e. &pound;, \$, &euro;."), DropdownField::create("SymbolLocation", "Symbol Location", array("1" => "On the left, i.e. \$1.00", "2" => "On the right, i.e. 1.00\$", "3" => "Display the currency code instead, i.e. 1 USD."))->setRightTitle("Where should the currency symbol be placed?"), TextField::create("DecimalSeperator", "Decimal Separator")->setRightTitle("What decimal separator does this currency use?"), TextField::create("ThousandsSeparator", "Thousands Separator")->setRightTitle("What thousands separator does this currency use?"), NumericField::create("DecimalPlaces", "Decimal Places")->setRightTitle("How many decimal places does this currency use?")))));
     return $fields;
 }
 /**
  * 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');
     //Create the FieldList and push the Root TabSet on to it.
     $fields = FieldList::create($root = TabSet::create('Root', Tab::create("Main", HeaderField::create("Add/Edit Order Status"), CompositeField::create(TextField::create("Title", "Friendly Name")->setRightTitle("The name of your custom order status. i.e. Pending, Awaiting Stock."), TextareaField::create("Content", "Friendly Description")->setRightTitle("This will be shown to your customers. What do you wish to tell them about this status?")))));
     return $fields;
 }
 /**
  * Provides a GUI for the insert/edit shortcode popup
  * @return Form
  **/
 public function ShortcodeForm()
 {
     if (!Permission::check('CMS_ACCESS_CMSMain')) {
         return;
     }
     Config::inst()->update('SSViewer', 'theme_enabled', false);
     // create a list of shortcodable classes for the ShortcodeType dropdown
     $classList = ClassInfo::implementorsOf('Shortcodable');
     $classes = array();
     foreach ($classList as $class) {
         $classes[$class] = singleton($class)->singular_name();
     }
     // load from the currently selected ShortcodeType or Shortcode data
     $classname = false;
     $shortcodeData = false;
     if ($shortcode = $this->request->requestVar('Shortcode')) {
         $shortcode = str_replace("", '', $shortcode);
         //remove BOM inside string on cursor position...
         $shortcodeData = singleton('ShortcodableParser')->the_shortcodes(array(), $shortcode);
         if (isset($shortcodeData[0])) {
             $shortcodeData = $shortcodeData[0];
             $classname = $shortcodeData['name'];
         }
     } else {
         $classname = $this->request->requestVar('ShortcodeType');
     }
     if ($shortcodeData) {
         $headingText = _t('Shortcodable.EDITSHORTCODE', 'Edit Shortcode');
     } else {
         $headingText = _t('Shortcodable.INSERTSHORTCODE', 'Insert Shortcode');
     }
     // essential fields
     $fields = FieldList::create(array(CompositeField::create(LiteralField::create('Heading', sprintf('<h3 class="htmleditorfield-shortcodeform-heading insert">%s</h3>', $headingText)))->addExtraClass('CompositeField composite cms-content-header nolabel'), LiteralField::create('shortcodablefields', '<div class="ss-shortcodable content">'), DropdownField::create('ShortcodeType', 'ShortcodeType', $classes, $classname)->setHasEmptyDefault(true)->addExtraClass('shortcode-type')));
     // attribute and object id fields
     if ($classname) {
         if (class_exists($classname)) {
             $class = singleton($classname);
             if (is_subclass_of($class, 'DataObject')) {
                 if (singleton($classname)->hasMethod('get_shortcodable_records')) {
                     $dataObjectSource = $classname::get_shortcodable_records();
                 } else {
                     $dataObjectSource = $classname::get()->map()->toArray();
                 }
                 $fields->push(DropdownField::create('id', $class->singular_name(), $dataObjectSource)->setHasEmptyDefault(true));
             }
             if ($attrFields = $classname::shortcode_attribute_fields()) {
                 $fields->push(CompositeField::create($attrFields)->addExtraClass('attributes-composite'));
             }
         }
     }
     // actions
     $actions = FieldList::create(array(FormAction::create('insert', _t('Shortcodable.BUTTONINSERTSHORTCODE', 'Insert shortcode'))->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept')->setUseButtonTag(true)));
     // form
     $form = Form::create($this, "ShortcodeForm", $fields, $actions)->loadDataFrom($this)->addExtraClass('htmleditorfield-form htmleditorfield-shortcodable cms-dialog-content');
     if ($shortcodeData) {
         $form->loadDataFrom($shortcodeData['atts']);
     }
     $this->extend('updateShortcodeForm', $form);
     return $form;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab("Root", $subscriptionTab = new Tab(_t('Newsletter.SUBSCRIPTIONFORM', 'SubscriptionForm')));
     Requirements::javascript('newsletter/javascript/SubscriptionPage.js');
     Requirements::css('newsletter/css/SubscriptionPage.css');
     $subscriptionTab->push(new HeaderField("SubscriptionFormConfig", _t('Newsletter.SUBSCRIPTIONFORMCONFIGURATION', "Subscription Form Configuration")));
     $subscriptionTab->push(new TextField('CustomisedHeading', 'Heading at the top of the form'));
     //Fields selction
     $frontFields = singleton('Recipient')->getFrontEndFields()->dataFields();
     $fieldCandidates = array();
     if (count($frontFields)) {
         foreach ($frontFields as $fieldName => $dataField) {
             $fieldCandidates[$fieldName] = $dataField->Title() ? $dataField->Title() : $dataField->Name();
         }
     }
     //Since Email field is the Recipient's identifier,
     //and newsletters subscription is non-sence if no email is given by the user,
     //we should force that email to be checked and required.
     //FisrtName should be checked as default, though it might not be required
     $defaults = array("Email", "FirstName");
     $extra = array('CustomLabel' => "Varchar", "ValidationMessage" => "Varchar", "Required" => "Boolean");
     $extraValue = array('CustomLabel' => $this->CustomLabel, "ValidationMessage" => $this->ValidationMessage, "Required" => $this->Required);
     $subscriptionTab->push($fieldsSelection = new CheckboxSetWithExtraField("Fields", _t('Newsletter.SelectFields', "Select the fields to display on the subscription form"), $fieldCandidates, $extra, $defaults, $extraValue));
     $fieldsSelection->setCellDisabled(array("Email" => array("Value", "Required")));
     //Mailing Lists selection
     $mailinglists = MailingList::get();
     $newsletterSelection = $mailinglists && $mailinglists->count() ? new CheckboxSetField("MailingLists", _t("Newsletter.SubscribeTo", "Newsletters to subscribe to"), $mailinglists->map('ID', 'FullTitle'), $mailinglists) : new LiteralField("NoMailingList", sprintf('<p>%s</p>', sprintf('You haven\'t defined any mailing list yet, please go to ' . '<a href=\\"%s\\">the newsletter administration area</a> ' . 'to define a mailing list.', singleton('NewsletterAdmin')->Link())));
     $subscriptionTab->push($newsletterSelection);
     $subscriptionTab->push(new TextField("SubmissionButtonText", "Submit Button Text"));
     $subscriptionTab->push(new LiteralField('BottomTaskSelection', sprintf('<div id="SendNotificationControlls" class="field actions">' . '<label class="left">%s</label>' . '<ul><li class="ss-ui-button no" data-panel="no">%s</li>' . '<li class="ss-ui-button yes" data-panel="yes">%s</li>' . '</ul></div>', _t('Newsletter.SendNotif', 'Send notification email to the subscriber'), _t('Newsletter.No', 'No'), _t('Newsletter.Yes', 'Yes'))));
     $subscriptionTab->push(CompositeField::create(new HiddenField("SendNotification", "Send Notification"), new TextField("NotificationEmailSubject", _t('Newsletter.NotifSubject', "Notification Email Subject Line")), new TextField("NotificationEmailFrom", _t('Newsletter.FromNotif', "From Email Address for Notification Email")))->addExtraClass('SendNotificationControlledPanel'));
     $subscriptionTab->push(new HtmlEditorField('OnCompleteMessage', _t('Newsletter.OnCompletion', 'Message shown on subscription completion')));
     return $fields;
 }
 public function updateCMSFields(FieldList $fields)
 {
     $fields->removeByName(array('Lat', 'Lng'));
     // Adds Lat/Lng fields for viewing in the CMS
     $compositeField = CompositeField::create();
     $compositeField->push($overrideField = CheckboxField::create('LatLngOverride', 'Override Latitude and Longitude?'));
     $overrideField->setDescription('Check this box and save to be able to edit the latitude and longitude manually.');
     if ($this->owner->Lng && $this->owner->Lat) {
         $googleMapURL = 'http://maps.google.com/?q=' . $this->owner->Lat . ',' . $this->owner->Lng;
         $googleMapDiv = '<div class="field"><label class="left" for="Form_EditForm_MapURL_Readonly">Google Map</label><div class="middleColumn"><a href="' . $googleMapURL . '" target="_blank">' . $googleMapURL . '</a></div></div>';
         $compositeField->push(LiteralField::create('MapURL_Readonly', $googleMapDiv));
     }
     if ($this->owner->LatLngOverride) {
         $compositeField->push(TextField::create('Lat', 'Lat'));
         $compositeField->push(TextField::create('Lng', 'Lng'));
     } else {
         $compositeField->push(ReadonlyField::create('Lat_Readonly', 'Lat', $this->owner->Lat));
         $compositeField->push(ReadonlyField::create('Lng_Readonly', 'Lng', $this->owner->Lng));
     }
     if ($this->owner->hasExtension('Addressable')) {
         // If using addressable, put the fields with it
         $fields->addFieldToTab('Root.Address', ToggleCompositeField::create('Coordinates', 'Coordinates', $compositeField));
     } else {
         if ($this->owner instanceof SiteTree) {
             // If SIteTree but not using Addressable, put after 'Metadata' toggle composite field
             $fields->insertAfter($compositeField, 'ExtraMeta');
         } else {
             $fields->addFieldToTab('Root.Main', ToggleCompositeField::create('Coordinates', 'Coordinates', $compositeField));
         }
     }
 }
Пример #10
0
 /**
  * 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');
     //Create the FieldList and push the Root TabSet on to it.
     $fields = FieldList::create($root = TabSet::create('Root', Tab::create("Main", HeaderField::create($this->SystemName), CompositeField::create(TextField::create("Title", "Friendly Name")->setRightTitle("This is the name your customers would see against this courier."), DropdownField::create("Enabled", "Enable this courier?", array("0" => "No", "1" => "Yes"))->setEmptyString("(Select one)")->setRightTitle("Can customers use this courier?")))));
     return $fields;
 }
 /**
  * Form used for defining the conversion form
  * @return {Form} Form to be used for configuring the conversion
  */
 public function ConvertObjectForm()
 {
     //Reset the reading stage
     Versioned::reset();
     $fields = new FieldList(CompositeField::create($convertModeField = new OptionsetField('ConvertMode', '', array('ReplacePage' => _t('KapostAdmin.REPLACES_AN_EXISTING_PAGE', '_This replaces an existing page'), 'NewPage' => _t('KapostAdmin.IS_NEW_PAGE', '_This is a new page')), 'NewPage'))->addExtraClass('kapostConvertLeftSide'), CompositeField::create($replacePageField = TreeDropdownField::create('ReplacePageID', _t('KapostAdmin.REPLACE_PAGE', '_Replace this page'), 'SiteTree')->addExtraClass('replace-page-id'), TreeDropdownField::create('ParentPageID', _t('KapostAdmin.USE_AS_PARENT', '_Use this page as the parent for the new page, leave empty for a top level page'), 'SiteTree')->addExtraClass('parent-page-id'))->addExtraClass('kapostConvertRightSide'));
     $actions = new FieldList(FormAction::create('doConvertObject', _t('KapostAdmin.CONTINUE_CONVERT', '_Continue'))->setUseButtonTag(true)->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'kapost-convert'));
     $validator = new RequiredFields('ConvertMode');
     $form = new Form($this, 'ConvertObjectForm', $fields, $actions, $validator);
     $form->addExtraClass('KapostAdmin center')->setAttribute('data-layout-type', 'border')->setTemplate('KapostAdmin_ConvertForm');
     //Handle pages to see if the page exists
     $convertToClass = $this->getDestinationClass();
     if ($convertToClass !== false && ($convertToClass == 'SiteTree' || is_subclass_of($convertToClass, 'SiteTree'))) {
         $obj = SiteTree::get()->filter('KapostRefID', Convert::raw2sql($this->record->KapostRefID))->first();
         if (!empty($obj) && $obj !== false && $obj->ID > 0) {
             $convertModeField->setValue('ReplacePage');
             $replacePageField->setValue($obj->ID);
             $recordTitle = $this->record->Title;
             if (!empty($recordTitle) && $recordTitle != $obj->Title) {
                 $urlFieldLabel = _t('KapostAdmin.TITLE_CHANGE_DETECT', '_The title differs from the page being replaced, it was "{wastitle}" and will be changed to "{newtitle}". Do you want to update the URL Segment?', array('wastitle' => $obj->Title, 'newtitle' => $recordTitle));
                 $fields->push(CheckboxField::create('UpdateURLSegment', $urlFieldLabel)->addExtraClass('urlsegmentcheck')->setAttribute('data-replace-id', $obj->ID)->setForm($form)->setDescription(_t('KapostAdmin.NEW_URL_SEGMENT', '_The new URL Segment will be or will be close to "{newsegment}"', array('newsegment' => $obj->generateURLSegment($recordTitle)))));
             }
         }
     }
     Requirements::css(KAPOST_DIR . '/css/KapostAdmin.css');
     Requirements::add_i18n_javascript(KAPOST_DIR . '/javascript/lang/');
     Requirements::javascript(KAPOST_DIR . '/javascript/KapostAdmin_convertPopup.js');
     //Allow extensions to adjust the form
     $this->extend('updateConvertObjectForm', $form, $this->record);
     return $form;
 }
 public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->push(new TabSet("Root", new Tab("Main", TextField::create("Title", "Title"), GridField::create("Slides", "Nivo Slide", $this->Slides(), GridFieldConfig_RecordEditor::create())), new Tab("Advanced", DropdownField::create("Theme", "Theme", self::get_all_themes()), DropdownField::create("Effect", "Effect", $this->dbObject("Effect")->enumValues()), NumericField::create("AnimationSpeed", "Animation Speed")->setDescription("Animation speed in milliseconds."), NumericField::create("PauseTime", "Pause Time")->setDescription("Pause time on each frame in milliseconds."), TextField::create("PrevText", "Previous Text"), TextField::create("NextText", "Next Text"), NumericField::create("Slices", "Slices")->setDescription("Number of slices for slice animation effects."), NumericField::create("BoxCols", "Box Columns")->setDescription("Number of box columns for box animation effects."), NumericField::create("BoxRows", "Box Rows")->setDescription("Number of box rows for box animation effects."), NumericField::create("StartSlide", "Start Slide")->setDescription("Slide to start on (0 being the first)."), HeaderField::create("ControlHeading", "Control Options", 4), CompositeField::create(array(CheckboxField::create("DirectionNav", "Display Direction Navigation?"), CheckboxField::create("ControlNav", "Display Control Navigation?"), CheckboxField::create("ControlNavThumbs", "Use thumbnails for control nav?"), CheckboxField::create("PauseOnHover", "Stop the animation whilst hovering?"), CheckboxField::create("ManualAdvance", "Force manual transition?"), CheckboxField::create("RandomStart", "Random Start?"))))));
     $fields->extend("updateCMSFields", $fields);
     return $fields;
 }
 function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     $actions = $form->Actions();
     $majorActions = CompositeField::create()->setName('MajorActions')->setTag('fieldset')->addExtraClass('ss-ui-buttonset');
     $rootTabSet = new TabSet('ActionMenus');
     $moreOptions = new Tab('MoreOptions', _t('SiteTree.MoreOptions', 'More options', 'Expands a view for more buttons'));
     $rootTabSet->push($moreOptions);
     $rootTabSet->addExtraClass('ss-ui-action-tabset action-menus');
     // Render page information into the "more-options" drop-up, on the top.
     $baseClass = ClassInfo::baseDataClass($this->record->class);
     $live = Versioned::get_one_by_stage($this->record->class, 'Live', "\"{$baseClass}\".\"ID\"='{$this->record->ID}'");
     $existsOnLive = $this->record->getExistsOnLive();
     $published = $this->record->isPublished();
     $moreOptions->push(new LiteralField('Information', $this->record->customise(array('Live' => $live, 'ExistsOnLive' => $existsOnLive))->renderWith('SiteTree_Information')));
     $actions->removeByName('action_doSave');
     $actions->removeByName('action_doDelete');
     if ($this->record->canEdit()) {
         if ($this->record->IsDeletedFromStage) {
             if ($existsOnLive) {
                 $majorActions->push(FormAction::create('revert', _t('CMSMain.RESTORE', 'Restore')));
                 if ($this->record->canDelete() && $this->record->canDeleteFromLive()) {
                     $majorActions->push(FormAction::create('unpublish', _t('CMSMain.DELETEFP', 'Delete'))->addExtraClass('ss-ui-action-destructive'));
                 }
             } else {
                 if (!$this->record->isNew()) {
                     $majorActions->push(FormAction::create('restore', _t('CMSMain.RESTORE', 'Restore'))->setAttribute('data-icon', 'decline'));
                 } else {
                     $majorActions->push(FormAction::create('save', _t('SiteTree.BUTTONSAVED', 'Saved'))->addExtraClass('ss-ui-alternate ss-ui-action-constructive')->setAttribute('data-icon', 'accept')->setAttribute('data-icon-alternate', 'addpage')->setAttribute('data-text-alternate', _t('CMSMain.SAVEDRAFT', 'Save draft'))->setUseButtonTag(true));
                     $majorActions->push(FormAction::create('publish', _t('SiteTree.BUTTONPUBLISHED', 'Published'))->addExtraClass('ss-ui-alternate ss-ui-action-constructive')->setAttribute('data-icon', 'accept')->setAttribute('data-icon-alternate', 'disk')->setAttribute('data-text-alternate', _t('SiteTree.BUTTONSAVEPUBLISH', 'Save & publish'))->setUseButtonTag(true));
                 }
             }
         } else {
             if ($this->record->canDelete() && !$published) {
                 $moreOptions->push(FormAction::create('delete', _t('SiteTree.BUTTONDELETE', 'Delete draft'))->addExtraClass('ss-ui-action-destructive')->setUseButtonTag(true));
             }
             $majorActions->push(FormAction::create('save', _t('SiteTree.BUTTONSAVED', 'Saved'))->setAttribute('data-icon', 'accept')->setAttribute('data-icon-alternate', 'addpage')->setAttribute('data-text-alternate', _t('CMSMain.SAVEDRAFT', 'Save draft'))->setUseButtonTag(true));
         }
     }
     $publish = FormAction::create('publish', $published ? _t('SiteTree.BUTTONPUBLISHED', 'Published') : _t('SiteTree.BUTTONSAVEPUBLISH', 'Save & publish'))->setAttribute('data-icon', 'accept')->setAttribute('data-icon-alternate', 'disk')->setAttribute('data-text-alternate', _t('SiteTree.BUTTONSAVEPUBLISH', 'Save & publish'))->setUseButtonTag(true);
     if (!$published || $this->record->stagesDiffer('Stage', 'Live') && $published) {
         $publish->addExtraClass('ss-ui-alternate');
     }
     if ($this->record->canPublish() && !$this->record->IsDeletedFromStage) {
         $majorActions->push($publish);
     }
     if ($published && $this->record->canPublish() && !$this->record->IsDeletedFromStage && $this->record->canDeleteFromLive()) {
         $moreOptions->push(FormAction::create('unpublish', _t('SiteTree.BUTTONUNPUBLISH', 'Unpublish'), 'delete')->addExtraClass('ss-ui-action-destructive')->setUseButtonTag(true));
     }
     if ($this->record->stagesDiffer('Stage', 'Live') && !$this->record->IsDeletedFromStage && $this->record->isPublished() && $this->record->canEdit()) {
         $moreOptions->push(FormAction::create('rollback', _t('SiteTree.BUTTONCANCELDRAFT', 'Cancel draft changes'))->setDescription(_t('SiteTree.BUTTONCANCELDRAFTDESC', 'Delete your draft and revert to the currently published page'))->setUseButtonTag(true));
     }
     $actions->push($majorActions);
     $actions->push($rootTabSet);
     if ($this->record->hasMethod('getCMSValidator')) {
         $form->setValidator($this->record->getCMSValidator());
     }
     return $form;
 }
 /**
  * Add fields to the CMS for this courier.
  */
 public function getCMSFields()
 {
     //Fetch the fields from the Courier DataObject
     $fields = parent::getCMSFields();
     //Add new fields
     $fields->addFieldsToTab("Root.Main", array(HeaderField::create("Item Rate"), CompositeField::create(NumericField::create("FlatRate", "Item Rate (" . Product::getDefaultCurrency() . ")")->setRightTitle("Enter a flat rate of shipping to charge for every item in this order."))));
     return $fields;
 }
 public function testValidation()
 {
     $field = CompositeField::create($fieldOne = DropdownField::create('A'), $fieldTwo = TextField::create('B'));
     $validator = new RequiredFields();
     $this->assertFalse($field->validate($validator), "Validation fails when child is invalid");
     $fieldOne->setEmptyString('empty');
     $this->assertTrue($field->validate($validator), "Validates when children are valid");
 }
 /**
  * Add fields to the CMS for this gateway.
  */
 public function getCMSFields()
 {
     //Fetch the fields from the Courier DataObject
     $fields = parent::getCMSFields();
     //Add new fields
     $fields->addFieldsToTab("Root.Main", array(HeaderField::create("Your PayPal Account Details"), CompositeField::create(TextField::create("EmailAddress", "Account Email")->setRightTitle("Enter the email address associated with PayPal account where customer funds will be deposited."), TextField::create("PDTToken", "PDT Token")->setRightTitle("Enter your PayPal account 'Payment Data Transfer' (PDT) Token. Find out how to get this \n\t\t\t\t<a href='http://bit.ly/RMhgZQ'>here</a>.")), HeaderField::create("ADVANCED USERS ONLY: Sandbox Mode & Debug"), CompositeField::create(DropdownField::create("Sandbox", "Sandbox Mode", array("0" => "No", "1" => "Yes"))->setRightTitle("Do you wish to test your store use PayPal's test environment. <em>i.e. no real transactions?</em> See \n\t\t\t\t<a href='https://developer.paypal.com/developer/accounts/'>developer.paypal.com</a> for more information"), DropdownField::create("Debug", "Debug Mode", array("0" => "No", "1" => "Yes"))->setRightTitle("If enabled, all IPN communications will saved to 'ipn.log' in your installations root folder."))));
     return $fields;
 }
 /**
  * Add fields to the CMS for this gateway.
  */
 public function getCMSFields()
 {
     //Fetch the fields from the Courier DataObject
     $fields = parent::getCMSFields();
     //Add new fields
     $fields->addFieldsToTab("Root.Main", array(HeaderField::create("PayPal Transaction Information"), CompositeField::create(ReadonlyField::create("custom", "Order Number"), ReadonlyField::create("payment_date", "Payment Date"), ReadonlyField::create("payment_status", "Payment Status")->setRightTitle("\n\t\t\t\t\tIf this status is pending, see Pending Reason below. \n\t\t\t\t"), ReadonlyField::create("payment_type", "Payment Type")->setRightTitle("\n\t\t\t\t\tFor a explanation of the different payment types please see 'payment_type' at \n\t\t\t\t\t<a href=\"https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/\">paypal.com</a>\n\t\t\t\t"), ReadonlyField::create("pending_reason", "Pending Reason")->setRightTitle("\n\t\t\t\t\tFor a explanation of pending reasons please see 'pending_reason' at \n\t\t\t\t\t<a href=\"https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/\">paypal.com</a>\n\t\t\t\t"), ReadonlyField::create("reason_code", "Reason Code")->setRightTitle("\n\t\t\t\t\tThis is set if Payment Status is Reversed, Refunded, Canceled_Reversal, or Denied. For an explanation of its\n\t\t\t\t\tmeaning see 'reason_code' at \n\t\t\t\t\t<a href=\"https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/\">paypal.com</a>\n\t\t\t\t"), FieldGroup::create("Transaction Identifiers", ReadonlyField::create("txn_id", "<strong>Transaction ID</strong>"), ReadonlyField::create("parent_txn_id", "<strong>Parent Transaction ID</strong>"))->setRightTitle("\n\t\t\t\t\t<strong>Transaction ID</strong><br />\n\t\t\t\t\tThe identifier for this specific transaction entry.\n\t\t\t\t\t\n\t\t\t\t\t<br /><br />\n\t\t\t\t\t\n\t\t\t\t\t<strong>Parent Transaction ID</strong><br />\n\t\t\t\t\tIf provided, this value is the transaction identifier of the\n\t\t\t\t\tparent transaction. i.e. If this transaction is a refund, the\n\t\t\t\t\tvalue will be the transaction ID of the original purchase.\n\t\t\t\t\t<br />\n\t\t\t\t"), FieldGroup::create("Funds", ReadonlyField::create("mc_gross", "<strong>Gross Payment</strong>"), ReadonlyField::create("mc_fee", "<strong>PayPal Fee</strong>"))->setRightTitle("\n\t\t\t\t\t<strong>Gross Payment</strong><br />\n\t\t\t\t\tFull amount of the customer's payment, before transaction fee is subtracted.\n\t\t\t\t\t\n\t\t\t\t\t<br /><br />\n\t\t\t\t\t\n\t\t\t\t\t<strong>PayPal Fee</strong><br />\n\t\t\t\t\tTransaction fee associated with the payment.\n\t\t\t\t"))));
     return $fields;
 }
 /**
  * Add fields to the CMS for this courier.
  */
 public function getCMSFields()
 {
     //Fetch the fields from the Courier DataObject
     $fields = parent::getCMSFields();
     //Add new fields
     $fields->addFieldsToTab("Root.Main", array(HeaderField::create("Minimum Spend"), CompositeField::create(NumericField::create("MinSpend", "Qualifying Spend (" . Product::getDefaultCurrency() . ")")->setRightTitle("Enter the amount a customer must spend before qualifying for Free Shipping."))));
     return $fields;
 }
 /**
  * @param bool $renameActions if set renames actions with record id appended to prevent naming conflicts
  * @return an|FieldList
  */
 public function getCMSActions($renameActions = false)
 {
     $minorActions = CompositeField::create()->setTag('fieldset')->addExtraClass('ss-ui-buttonset');
     $actions = new FieldList($minorActions);
     // "readonly"/viewing version that isn't the current version of the record
     $stageOrLiveRecord = Versioned::get_one_by_stage($this->class, Versioned::current_stage(), sprintf('"ContentModule"."ID" = %d', $this->ID));
     if ($stageOrLiveRecord && $stageOrLiveRecord->Version != $this->Version) {
         //$minorActions->push(FormAction::create('email', _t('CMSMain.EMAIL', 'Email')));
         //$minorActions->push(FormAction::create('rollback', _t('CMSMain.ROLLBACK', 'Roll back to this version')));
         // getCMSActions() can be extended with updateCMSActions() on a extension
         $this->extend('updateCMSActions', $actions);
         return $actions;
     }
     if (($cModField = ContentModuleField::curr()) && $this->exists()) {
         // "unlink"
         $minorActions->push(FormAction::create($renameActions ? 'unlink_' . $this->ID : 'unlink', _t('ContentModule.BUTTONUNLINK', 'Unlink'))->setDescription(_t('ContentModule.BUTTONUNLINKDESC', 'Unlink this module from the current page'))->addExtraClass('ss-ui-action-destructive unlink')->setAttribute('data-icon', 'unlink'));
     }
     if ($this->isPublished() && $this->canPublish() && !$this->IsDeletedFromStage && $this->canDeleteFromLive()) {
         // "unpublish"
         $minorActions->push(FormAction::create($renameActions ? 'unpublish_' . $this->ID : 'unpublish', _t('ContentModule.BUTTONUNPUBLISH', 'Unpublish'))->setDescription(_t('ContentModule.BUTTONUNPUBLISHDESC', 'Remove this module from the published site'))->addExtraClass('ss-ui-action-destructive unpublish')->setAttribute('data-icon', 'unpublish'));
     }
     if ($this->stagesDiffer('Stage', 'Live') && !$this->IsDeletedFromStage) {
         if ($this->isPublished() && $this->canEdit()) {
             // "rollback"
             $minorActions->push(FormAction::create($renameActions ? 'rollback_' . $this->ID : 'rollback', _t('ContentModule.BUTTONCANCELDRAFT', 'Cancel draft changes'))->setDescription(_t('ContentModule.BUTTONCANCELDRAFTDESC', 'Delete your draft and revert to the currently published module'))->addExtraClass('rollback'));
         }
     }
     if ($this->canEdit()) {
         if ($this->IsDeletedFromStage) {
             if ($this->ExistsOnLive) {
                 // "restore"
                 $minorActions->push(FormAction::create($renameActions ? 'revert_' . $this->ID : 'revert', _t('CMSMain.RESTORE', 'Restore'))->addExtraClass('revert ss-ui-action-destructive'));
                 if ($this->canDelete() && $this->canDeleteFromLive()) {
                     // "delete from live"
                     $minorActions->push(FormAction::create($renameActions ? 'deletefromlive_' . $this->ID : 'deletefromlive', _t('CMSMain.DELETEFP', 'Delete'))->addExtraClass('deletefromlive ss-ui-action-destructive'));
                 }
             } else {
                 // "restore"
                 $minorActions->push(FormAction::create($renameActions ? 'restore_' . $this->ID : 'restore', _t('CMSMain.RESTORE', 'Restore'))->setAttribute('data-icon', 'decline')->addExtraClass('restore'));
             }
         } else {
             if ($this->canDelete()) {
                 // "delete"
                 $minorActions->push(FormAction::create($renameActions ? 'delete_' . $this->ID : 'delete', _t('ContentModule.DELETE', 'Delete'))->addExtraClass('delete ss-ui-action-destructive')->setAttribute('data-icon', 'decline'));
             }
             // "save"
             $minorActions->push(FormAction::create($renameActions ? 'save_' . $this->ID : 'save', _t('CMSMain.SAVEDRAFT', 'Save Draft'))->setAttribute('data-icon', 'addpage')->addExtraClass('save'));
         }
     }
     if ($this->canPublish() && !$this->IsDeletedFromStage) {
         // "publish"
         $actions->push(FormAction::create($renameActions ? 'publish_' . $this->ID : 'publish', _t('ContentModule.BUTTONSAVEPUBLISH', 'Save & Publish'))->addExtraClass('ss-ui-action-constructive publish')->setAttribute('data-icon', 'accept'));
     }
     // getCMSActions() can be extended with updateCMSActions() on a extension
     $this->extend('updateCMSActions', $actions);
     return $actions;
 }
 public function AccountPaymentFields($request)
 {
     if (Director::is_ajax()) {
         $customer = Member::currentUser();
         $fields = CompositeField::create(TextField::create('AccountPaymentNumber', 'Account Number', $customer ? $customer->AccountNumber : '')->setAttribute('required', 'required'))->setName('AccountPaymentFields');
         return $fields->FieldHolder();
     }
     return false;
 }
 public function getFormFields(Order $order)
 {
     $fields = parent::getFormFields($order);
     if (!$fields->exists()) {
         return $fields;
     }
     $checkbox = CheckboxField::create('RegisterAnAccount', _t('DependantMembershipCheckoutComponent.REGISTER_ACCOUNT', 'Register an account'), $this->checked);
     return FieldList::create($checkbox, CompositeField::create(parent::getFormFields($order))->setName('RegisterAccount-Holder')->setAttribute('data-show-if', '[name=' . get_class($this) . '_RegisterAnAccount]:checked'));
 }
 public function getFormFields(Order $order)
 {
     $fields = parent::getFormFields($order);
     $field = $this->addresstype . 'ToSameAddress';
     $checkbox = CheckboxField::create($field, _t('Dependant' . $this->addresstype . 'AddressCheckoutComponent.SAME_AS_' . $this->useAddressType, 'Use ' . $this->useAddressType . ' address'), true)->setRightTitle(_t('AddressCheckoutComponent.ADDRESS-' . $this->useAddressType, 'Billing Address'));
     if ($use = $fields->fieldByName('Use')) {
         $use->setTitle(_t('Dependant' . $this->addresstype . 'AddressCheckoutComponent.USE', 'Use'));
     }
     return FieldList::create($checkbox, CompositeField::create($fields)->setName($this->addresstype . 'Address')->setAttribute('data-hide-if', '[name=' . $this->name() . '_' . $field . ']:checked'));
 }
 /**
  * Form used for adding or editing addresses
  */
 public function AddressForm()
 {
     $personal_fields = CompositeField::create(HeaderField::create('PersonalHeader', _t('Checkout.PersonalDetails', 'Personal Details'), 2), TextField::create('FirstName', _t('Checkout.FirstName', 'First Name(s)')), TextField::create('Surname', _t('Checkout.Surname', 'Surname')), CheckboxField::create('Default', _t('Checkout.DefaultAddress', 'Default Address?'))->setRightTitle(_t('Checkout.Optional', 'Optional')))->setName("PersonalFields")->addExtraClass('unit')->addExtraClass('size1of2')->addExtraClass('unit-50');
     $address_fields = CompositeField::create(HeaderField::create('AddressHeader', _t('Checkout.Address', 'Address'), 2), TextField::create('Address1', _t('Checkout.Address1', 'Address Line 1')), TextField::create('Address2', _t('Checkout.Address2', 'Address Line 2'))->setRightTitle(_t('Checkout.Optional', 'Optional')), TextField::create('City', _t('Checkout.City', 'City')), TextField::create('PostCode', _t('Checkout.PostCode', 'Post Code')), CountryDropdownField::create('Country', _t('Checkout.Country', 'Country'))->setAttribute("class", 'countrydropdown dropdown'))->setName("AddressFields")->addExtraClass('unit')->addExtraClass('size1of2')->addExtraClass('unit-50');
     $fields = FieldList::create(HiddenField::create("ID"), HiddenField::create("OwnerID"), CompositeField::create($personal_fields, $address_fields)->setName("DeliveryFields")->addExtraClass('line')->addExtraClass('units-row'));
     $actions = FieldList::create(LiteralField::create('BackButton', '<a href="' . $this->owner->Link('addresses') . '" class="btn btn-red">' . _t('Checkout.Cancel', 'Cancel') . '</a>'), FormAction::create('doSaveAddress', _t('Checkout.Add', 'Add'))->addExtraClass('btn')->addExtraClass('btn-green'));
     $validator = RequiredFields::create(array('FirstName', 'Surname', 'Address1', 'City', 'PostCode', 'Country'));
     $form = Form::create($this->owner, "AddressForm", $fields, $actions, $validator);
     return $form;
 }
 /**
  * Return field list for iframe insert/update form
  *
  * @see HtmlEditorField_Toolbar::getFieldsForOembed()
  */
 protected function getFieldsForIframe($url, $file)
 {
     $thumbnailURL = FRAMEWORK_DIR . '/images/default_media.png';
     $fields = new FieldList($filePreview = CompositeField::create(CompositeField::create(new LiteralField("ImageFull", "<img id='thumbnailImage' class='thumbnail-preview' " . "src='{$thumbnailURL}?r=" . rand(1, 100000) . "' alt='{$file->Name}' />\n"))->setName("FilePreviewImage")->addExtraClass('cms-file-info-preview'), CompositeField::create(CompositeField::create(new ReadonlyField("FileType", _t('AssetTableField.TYPE', 'File type') . ':', $file->Type), $urlField = ReadonlyField::create('ClickableURL', _t('AssetTableField.URL', 'URL'), sprintf('<a href="%s" target="_blank" class="file">%s</a>', $url, $url))->addExtraClass('text-wrap')))->setName("FilePreviewData")->addExtraClass('cms-file-info-data'))->setName("FilePreview")->addExtraClass('cms-file-info'), new TextField('CaptionText', _t('HtmlEditorField.CAPTIONTEXT', 'Caption text')), DropdownField::create('CSSClass', _t('HtmlEditorField.CSSCLASS', 'Alignment / style'), array('left' => _t('HtmlEditorField.CSSCLASSLEFT', 'On the left, with text wrapping around.'), 'leftAlone' => _t('HtmlEditorField.CSSCLASSLEFTALONE', 'On the left, on its own.'), 'right' => _t('HtmlEditorField.CSSCLASSRIGHT', 'On the right, with text wrapping around.'), 'center' => _t('HtmlEditorField.CSSCLASSCENTER', 'Centered, on its own.')))->addExtraClass('last'));
     if ($file->Width != null) {
         $fields->push(FieldGroup::create(_t('HtmlEditorField.IMAGEDIMENSIONS', 'Dimensions'), TextField::create('Width', _t('HtmlEditorField.IMAGEWIDTHPX', 'Width'), $file->Width)->setMaxLength(5), TextField::create('Height', _t('HtmlEditorField.IMAGEHEIGHTPX', 'Height'), $file->Height)->setMaxLength(5))->addExtraClass('dimensions last'));
     }
     $urlField->dontEscape = true;
     $fields->push(new HiddenField('URL', false, $url));
     return $fields;
 }
 function updateLinkForm($form)
 {
     $numericLabelTmpl = '<span class="step-label"><span class="flyout">%s</span><span class="arrow"></span>' . '<strong class="title">%s</strong></span>';
     $form->Fields()->insertAfter($fields[] = CompositeField::create(LiteralField::create('Step-Google-URLTracking', '<div class="step2">' . sprintf($numericLabelTmpl, '+', _t('HtmlEditorField.GOOGLE-LINK_TRACKING', 'Google Link Tracking')) . '</div>'), $fields[] = TextField::create('utm_source', _t('HtmlEditorField.GOOGLE-CAMPAIGN_SOURCE', 'Campaign Source'))->setDescription(_t('HtmlEditorField.DESC-GOOGLE-CAMPAIGN_SOURCE', 'Referrer/Subject (eg. Google or July Newsletter). This must be filled to track this link.')), $fields[] = TextField::create('utm_medium', _t('HtmlEditorField.GOOGLE-CAMPAIGN_MEDIUM', 'Campaign Medium'))->setDescription(_t('HtmlEditorField.DESC-GOOGLE-CAMPAIGN_MEDIUM', 'Marketing Medium (eg. email, banner, CPC). This must be filled to track this link.')), $fields[] = TextField::create('utm_term', _t('HtmlEditorField.GOOGLE-CAMPAIGN_TERM', 'Campaign Term'))->setDescription(_t('HtmlEditorField.DESC-GOOGLE-CAMPAIGN_TERM', 'Keywords - usually used only for CPC')), $fields[] = TextField::create('utm_content', _t('HtmlEditorField.GOOGLE-CAMPAIGN_CONTENT', 'Campaign Content'))->setDescription(_t('HtmlEditorField.DESC-GOOGLE-CAMPAIGN_CONTENT', 'Used for A/B Testing - to differentiate between links that point to the same URL')), $fields[] = TextField::create('utm_campaign', _t('HtmlEditorField.GOOGLE-CAMPAIGN_NAME', 'Campaign Name'))->setDescription(_t('HtmlEditorField.DESC-GOOGLE-CAMPAIGN_NAME', '(eg. promo code, product) Used for keyword analysis - useful for identifying a product promotion or strategic campaign')))->addExtraClass('field google-analytics-tracking')->setTitle('&nbsp;'), 'TargetBlank');
     if ($this->owner->config()->bootstrap_modals) {
         $form->Fields()->insertAfter($fields[] = CheckboxField::create('TargetModal', _t('HtmlEditorField.TARGET_MODAL', 'Open link in modal window?')), 'TargetBlank');
     }
     foreach ($fields as $field) {
         $field->setForm($form);
     }
 }
 /**
  * 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');
     //Product Item not yet created
     $select_product_item = Tab::create("Item", HeaderField::create("Add Order Item"), CompositeField::create(DropdownField::create("OriginalProductID", "Select Product", Product::get()->sort("Title ASC")->map())->setEmptyString("(Select a product)")));
     //Product Item has been created
     $edit_product_item = Tab::create("Item", HeaderField::create("Order Item"), CompositeField::create(ReadonlyField::create("Title", "Product")->setRightTitle("You will need to remove this item and add another should you wish to change the product."), ReadonlyField::create("SKU", "SKU"), FieldGroup::create(NumericField::create("Price", "Cost per item"), DropdownField::create("Discounted", "Is this the sale price?", array("0" => "No", "1" => "Yes")), NumericField::create("Quantity", "Quantity ordered"))->setTitle("Pricing (" . Product::getDefaultCurrency() . ") "), ReadonlyField::create("SubTotal", "Subtotal (" . Product::getDefaultCurrency() . ")", StoreCurrency::convertToCurrency($this->Price * $this->Quantity)), ReadonlyField::create("TAX", $this->TaxClassName . " (" . Product::getDefaultCurrency() . ")", $this->calculateItemTax())->setRightTitle($this->TaxCalculation == 1 ? "Subtotal is inclusive of this tax." : "Subtotal is exclusive of this tax."), ReadonlyField::create("Total", "Total (" . Product::getDefaultCurrency() . ")", $this->TaxCalculation == 1 ? StoreCurrency::convertToCurrency($this->Price * $this->Quantity) : StoreCurrency::convertToCurrency($this->Price * $this->Quantity + $this->calculateItemTax()))));
     //Create the FieldList and push the either of the above Tabs to the Root TabSet based on if Product Item exists yet or not.
     $fields = FieldList::create($root = TabSet::create('Root', $this->exists() ? $edit_product_item : $select_product_item));
     return $fields;
 }
Пример #27
0
 public function Form()
 {
     $fields = FieldList::create(CompositeField::create(array(TextField::create('FirstName', 'First Name')->addExtraClass('col-sm-6 col-xs-12'), TextField::create('LastName', 'Last Name')->addExtraClass('col-sm-6 col-xs-12'), TextField::create('Email', 'Email Address')->addExtraClass('col-sm-6 col-xs-12'), TextField::create('Contact', 'Contact Number')->addExtraClass('col-sm-6 col-xs-12'), TextField::create('CallingTime', 'Best Calling Time')->addExtraClass('col-sm-6 col-xs-12'), TextField::create('LiquidCapital', 'Liquid Capital')->addExtraClass('col-sm-6 col-xs-12'), DateField::create('TimeStart', 'Time Frame to Start')->setConfig('showcalendar', 'true')->addExtraClass('col-sm-6 col-xs-12')))->addExtraClass('info'), CompositeField::create(array(TextareaField::create('Area', 'In what area are you looking to invest in a franchise?')->addExtraClass('col-sm-12'), TextareaField::create('Experience', 'Business & Relevant Experience')->addExtraClass('col-sm-12'), TextareaField::create('Hear', 'How did you hear about the Beard Papa’s franchise')->addExtraClass('col-sm-12'), TextareaField::create('Message', 'Message')->addExtraClass('col-sm-12')))->addExtraClass('questions'));
     $actions = FieldList::create(FormAction::create('Send', 'Send')->addExtraClass('btn btn-primary'));
     $requires = RequiredFields::create('FirstName', 'LastName', 'Email', 'Contact', 'CallingTime', 'LiquidCapital', 'TimeStart', 'Area', 'Experience', 'Hear');
     $form = new Form($this, __FUNCTION__, $fields, $actions, $requires);
     if ($formData = Session::get('FranchiseData')) {
         $form->loadDataFrom($formData);
     }
     return $form;
 }
 /**
  * Gets the fields for displaying in the cms
  * @param {string} $url Vidyard Video URL
  * @param {VidyardInsertMedia_Embed} $file Vidyard Insert Media Embed Object
  * @return {FieldList} Field List of fields used in the cms
  */
 protected function getFieldsForVidyard($url, VidyardInsertMedia_Embed $file)
 {
     $thumbnailURL = Convert::raw2att($file->Oembed->thumbnail_url);
     $fileName = Convert::raw2att($file->Name);
     $fields = new FieldList($filePreview = CompositeField::create(CompositeField::create(new LiteralField("ImageFull", "<img id='thumbnailImage' class='thumbnail-preview' " . "src='{$thumbnailURL}?r=" . rand(1, 100000) . "' alt='{$fileName}' />\n"))->setName("FilePreviewImage")->addExtraClass('cms-file-info-preview'), CompositeField::create(CompositeField::create(new ReadonlyField("FileType", _t('AssetTableField.TYPE', 'File type') . ':', $file->Type), $urlField = ReadonlyField::create('ClickableURL', _t('AssetTableField.URL', 'URL'), sprintf('<a href="%s" target="_blank" class="file">%s</a>', Convert::raw2att($url), Convert::raw2att($url)))->addExtraClass('text-wrap')))->setName("FilePreviewData")->addExtraClass('cms-file-info-data'))->setName("FilePreview")->addExtraClass('cms-file-info'), DropdownField::create('CSSClass', _t('HtmlEditorField.CSSCLASS', 'Alignment / style'), array('leftAlone' => _t('HtmlEditorField.CSSCLASSLEFTALONE', 'On the left, on its own.'), 'center' => _t('HtmlEditorField.CSSCLASSCENTER', 'Centered, on its own.'), 'left' => _t('HtmlEditorField.CSSCLASSLEFT', 'On the left, with text wrapping around.'), 'right' => _t('HtmlEditorField.CSSCLASSRIGHT', 'On the right, with text wrapping around.')))->addExtraClass('last'), new CheckboxField('UseLightbox', _t('VidyardInsertMedia.USE_LIGHTBOX', '_Use the Lightbox Display')));
     if ($file->Width != null) {
         $fields->push(FieldGroup::create(_t('HtmlEditorField.IMAGEDIMENSIONS', 'Dimensions'), TextField::create('Width', _t('HtmlEditorField.IMAGEWIDTHPX', 'Width'), $file->InsertWidth)->setMaxLength(5), TextField::create('Height', _t('HtmlEditorField.IMAGEHEIGHTPX', 'Height'), $file->InsertHeight)->setMaxLength(5))->addExtraClass('dimensions last'));
     }
     $urlField->dontEscape = true;
     $fields->push(new HiddenField('URL', false, $file->getURL()));
     return $fields;
 }
 protected function baseTransform($nonEditableField, $originalField, $fieldname)
 {
     $nonEditableField_holder = CompositeField::create($nonEditableField);
     $nonEditableField_holder->setName($fieldname . '_holder');
     $nonEditableField_holder->addExtraClass('originallang_holder');
     $nonEditableField->setValue($this->original->{$fieldname});
     $nonEditableField->setName($fieldname . '_original');
     $nonEditableField->addExtraClass('originallang');
     $nonEditableField->setTitle(_t('Translatable_Transform.OriginalFieldLabel', 'Original {title}', 'Label for the original value of the translatable field.', array('title' => $originalField->Title())));
     $nonEditableField_holder->insertBefore($originalField, $fieldname . '_original');
     return $nonEditableField_holder;
 }
 /**
  * getCMSFields
  * Customise the FieldList used in the CMS.
  * 
  * @return FieldList
  */
 public function getCMSFields()
 {
     Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css');
     /*
      * In order to keep the automatic construction of the has_one relationship in the backgroud we will make 
      * use of the parent's getCMSFields() and not create our own FieldList as in other models 
      */
     $fields = parent::getCMSFields();
     //Remove fields
     $fields->removeFieldsFromTab("Root.Main", array("ProductID", "Title", "Value"));
     $fields->addFieldsToTab("Root.Main", array(HeaderField::create("Add/Edit Custom Field"), CompositeField::create(TextField::create("Title", "Custom Field Name")->setRightTitle("The description for the field as shown to site visitors. i.e. ISBN Number."), TextField::create("Value", "Custom Field Value")->setRightTitle("The value for this custom field. i.e. 9788071457060"))));
     return $fields;
 }