本文整理汇总了PHP中NumericField类的典型用法代码示例。如果您正苦于以下问题:PHP NumericField类的具体用法?PHP NumericField怎么用?PHP NumericField使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NumericField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testNumberTypeOnInputHtml
public function testNumberTypeOnInputHtml()
{
$field = new NumericField('Number');
$html = $field->Field();
$this->assertContains('type="number"', $html, 'number type set');
$this->assertContains('step="any"', $html, 'step value set to any');
}
示例2: getNumericField
/**
* @param string $name
* @param string $title
*
* @return NumericField
*/
protected function getNumericField($name, $title)
{
$field = new NumericField($name, $title);
$field->setAttribute("type", "number");
$field->setAttribute("min", 0);
return $field;
}
示例3: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('Capacity');
$fields->removeByName('Registrations');
$fields->removeByName('Tickets');
$fields->removeByName('EmailReminder');
$fields->removeByName('RemindDays');
$fields->removeByName('PaymentID');
$fields->removeByName('ReminderJobID');
if (!$this->isInDB()) {
$fields->push(new LiteralField('RegistrationNote', '<p>You can configure registration once ' . 'you save for the first time.</p>'));
return $fields;
}
$fields->push(new GridField('Tickets', _t('EventManagement.AVAILABLE_TICKETS', 'Available Tickets'), $this->Tickets(), GridFieldConfig::create()->addComponent(new GridFieldButtonRow('before'))->addComponent(new GridFieldToolbarHeader())->addComponent($add = new GridFieldAddExistingSearchButton())->addComponent(new GridFieldTitleHeader())->addComponent(new GridFieldOrderableRows('Sort'))->addComponent($editable = new GridFieldEditableColumns())->addComponent(new GridFieldDeleteAction(true))));
$fields->push($capacity = new NumericField('Capacity', _t('EventManagement.CAPACITY', 'Capacity')));
$editable->setDisplayFields(array('Title' => array('title' => 'Title', 'field' => 'ReadonlyField'), 'StartSummary' => 'Sales Start', 'PriceSummary' => 'Price', 'Available' => array('field' => 'NumericField')));
$add->setTitle(_t('EventManagement.ADD_TICKET_TYPE', 'Add Ticket Type'));
$capacity->setDescription('Set to 0 for unlimited capacity.');
if (class_exists('AbstractQueuedJob')) {
if ($this->ReminderJobID && $this->ReminderJob()->StepsProcessed) {
$fields->push(new LiteralField('RemindersAlreadySent', '<p>Reminder emails have already been sent out.</p>'));
} else {
$fields->push(new CheckboxField('EmailReminder', _t('EventManagement.SEND_REMINDER_EMAIL', 'Send the registered attendees a reminder email?')));
$fields->push($remindDays = new NumericField('RemindDays', _t('EventManagement.SEND_REMINDER', 'Send reminder')));
$remindDays->setDescription(_t('EventManagement.DAYS_BEFORE_EVENT', 'Days before the event starts.'));
}
}
return $fields;
}
示例4: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName("FlexSliderID");
// Main
$field_Picture = new UploadField('Picture', _t("FlexSlider.Picture"));
$field_Picture->setFolderName("FlexSlides");
$field_Picture->setConfig('allowedMaxFileNumber', 1);
$field_Position = new NumericField("Position", _t("FlexSlider.Position"));
$field_Position->RightTitle(_t("FlexSlider.PositionExplain"));
$field_SlideTitle = new TextField("SlideTitle", _t("FlexSlider.Title"));
$field_SlideDescription = new TextField("SlideDescription", _t("FlexSlider.Description"));
$field_HeadlineLinks = new HeaderField("HeadlineLinks", _t("FlexSlider.HeadlineLinks"));
$field_InternalLink = new TreeDropdownField("InternalLinkID", _t('FlexSlider.InternalLink'), 'SiteTree');
$field_removeInternalLink = new CheckboxField("doRemoveInternalLink", _t("FlexSlider.doRemoveInternalLink"));
$field_ExternalLink = new TextField("ExternalLink", _t("FlexSlider.or") . " " . _t("FlexSlider.ExternalLink"));
$field_HeadlineEnabled = new HeaderField("HeadlineEnabled", _t("FlexSlider.HeadlineEnabled"));
$field_isEnabled = new CheckboxField("isEnabled", _t("FlexSlider.isEnabled"));
$FieldsArray = array($field_Position, $field_Picture, $field_SlideTitle, $field_SlideDescription, $field_InternalLink, $field_removeInternalLink, $field_ExternalLink, $field_HeadlineEnabled, $field_isEnabled);
$fields->addFieldToTab('Root.Main', $field_Position);
$fields->addFieldToTab('Root.Main', $field_Picture);
$fields->addFieldToTab('Root.Main', $field_SlideTitle);
$fields->addFieldToTab('Root.Main', $field_SlideDescription);
$fields->addFieldToTab('Root.Main', $field_HeadlineLinks);
$fields->addFieldToTab('Root.Main', $field_InternalLink);
$fields->addFieldToTab('Root.Main', $field_removeInternalLink);
$fields->addFieldToTab('Root.Main', $field_ExternalLink);
$fields->addFieldToTab('Root.Main', $field_HeadlineEnabled);
$fields->addFieldToTab('Root.Main', $field_isEnabled);
return $fields;
}
示例5: getQuantityField
/**
* @param String $label
* @return NumericField
*/
public function getQuantityField($label = '')
{
$f = new NumericField("Product[{$this->owner->ID}][Quantity]", $label);
$f->setAttribute('type', Config::inst()->get('GroupedCartFormChildHooks', 'quantity_field_type'));
$f->setAttribute('min', '0');
$f->addExtraClass('grouped-quantity');
return $f;
}
开发者ID:helpfulrobot,项目名称:markguinn-silverstripe-shop-groupedproducts,代码行数:12,代码来源:GroupedCartFormChildHooks.php
示例6: getSettingsFields
public function getSettingsFields()
{
$fields = parent::getSettingsFields();
Requirements::javascript('eventmanagement/javascript/cms.js');
$fields->addFieldsToTab('Root.Registration', array(new CheckboxField('OneRegPerEmail', _t('EventManagement.ONE_REG_PER_EMAIL', 'Limit to one registration per email address?')), new CheckboxField('RequireLoggedIn', _t('EventManagement.REQUIRE_LOGGED_IN', 'Require users to be logged in to register?')), $limit = new NumericField('RegistrationTimeLimit', _t('EventManagement.REG_TIME_LIMIT', 'Registration time limit'))));
$limit->setDescription(_t('EventManagement.REG_TIME_LIMIT_NOTE', 'The time limit to complete registration, in seconds. Set to 0 to disable place holding.'));
$fields->addFieldsToTab('Root.Email', array(new EmailField('EventManagerEmail', _t('EventManagement.EMAIL_EVENT_MANAGER', 'Event manager email to receive registration notifications?')), new CheckboxField('RegEmailConfirm', _t('EventManagement.REQ_EMAIL_CONFIRM', 'Require email confirmation to complete free registrations?')), $info = new TextField('EmailConfirmMessage', _t('EventManagement.EMAIL_CONFIRM_INFO', 'Email confirmation information')), $limit = new NumericField('ConfirmTimeLimit', _t('EventManagement.EMAIL_CONFIRM_TIME_LIMIT', 'Email confirmation time limit')), new CheckboxField('UnRegEmailConfirm', _t('EventManagement.REQ_UN_REG_EMAIL_CONFIRM', 'Require email confirmation to un-register?')), new CheckboxField('EmailNotifyChanges', _t('EventManagement.EMAIL_NOTIFY_CHANGES', 'Notify registered users of event changes via email?')), new CheckboxSetField('NotifyChangeFields', _t('EventManagement.NOTIFY_CHANGE_IN', 'Notify of changes in'), singleton('RegistrableDateTime')->fieldLabels(false))));
$info->setDescription(_t('EventManagement.EMAIL_CONFIRM_INFO_NOTE', 'This message is displayed to users to let them know they need to confirm their registration.'));
$limit->setDescription(_t('EventManagement.CONFIRM_TIME_LIMIT_NOTE', 'The time limit to conform registration, in seconds. Set to 0 for no limit.'));
return $fields;
}
示例7: getFormField
/**
* @return NumericField
*/
public function getFormField()
{
$field = new NumericField($this->Name, $this->Title);
$field->addExtraClass('number');
if ($field->Required) {
// Required and numeric validation can conflict so add the
// required validation messages as input attributes
$errorMessage = $this->getErrorMessage()->HTML();
$field->setAttribute('data-rule-required', 'true');
$field->setAttribute('data-msg-required', $errorMessage);
}
return $field;
}
示例8: updateCMSFields
/**
* Adds our SEO Meta fields to the page field list
*
* @since version 1.0.0
*
* @param string $fields The current FieldList object
*
* @return object Return the FieldList object
**/
public function updateCMSFields(FieldList $fields)
{
$fields->removeByName('HeadTags');
$fields->removeByName('SitemapImages');
if (!$this->owner instanceof Page) {
$fields->addFieldToTab('Root.Page', HeaderField::create('Page'));
$fields->addFieldToTab('Root.Page', TextField::create('Title', 'Page name'));
}
$fields->addFieldToTab('Root.PageSEO', $this->preview());
$fields->addFieldToTab('Root.PageSEO', TextField::create('MetaTitle'));
$fields->addFieldToTab('Root.PageSEO', TextareaField::create('MetaDescription'));
$fields->addFieldToTab('Root.PageSEO', HeaderField::create(false, 'Indexing', 2));
$fields->addFieldToTab('Root.PageSEO', TextField::create('Canonical'));
$fields->addFieldToTab('Root.PageSEO', DropdownField::create('Robots', 'Robots', SEO_FieldValues::IndexRules()));
$fields->addFieldToTab('Root.PageSEO', NumericField::create('Priority'));
$fields->addFieldToTab('Root.PageSEO', DropdownField::create('ChangeFrequency', 'Change Frequency', SEO_FieldValues::SitemapChangeFrequency()));
$fields->addFieldToTab('Root.PageSEO', CheckboxField::create('SitemapHide', 'Hide in sitemap? (XML and HTML)'));
$fields->addFieldToTab('Root.PageSEO', HeaderField::create('Social Meta'));
$fields->addFieldToTab('Root.PageSEO', CheckboxField::create('HideSocial', 'Hide Social Meta?'));
$fields->addFieldToTab('Root.PageSEO', DropdownField::create('OGtype', 'Open Graph Type', SEO_FieldValues::OGtype()));
$fields->addFieldToTab('Root.PageSEO', DropdownField::create('OGlocale', 'Open Graph Locale', SEO_FieldValues::OGlocale()));
$fields->addFieldToTab('Root.PageSEO', DropdownField::create('TwitterCard', 'Twitter Card', SEO_FieldValues::TwitterCardTypes()));
$fields->addFieldToTab('Root.PageSEO', $this->SharingImage());
$fields->addFieldToTab('Root.PageSEO', HeaderField::create('Other Meta Tags'));
$fields->addFieldToTab('Root.PageSEO', $this->OtherHeadTags());
$fields->addFieldToTab('Root.PageSEO', HeaderField::create('Sitemap Images'));
$fields->addFieldToTab('Root.PageSEO', $this->SitemapImagesGrid());
$fields->addFieldToTab('Root.PageSEO', LiteralField::create(false, '<br><br>Silverstripe SEO v1.0'));
return $fields;
}
示例9: getCMSFields
/**
* 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. £, \$, €."), 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;
}
示例10: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
// check if the insertbefore field is present (may be added later, in which case the above
// fields never get added
//$insertOnTab = $this->owner->getFilterableArchiveConfigValue('pagination_control_tab');
//$insertBefore = $this->owner->getFilterableArchiveConfigValue('pagination_insert_before');
$insertOnTab = Config::inst()->get($this->owner->className, 'pagination_control_tab');
$insertBefore = Config::inst()->get($this->owner->className, 'pagination_insert_before');
if (!$fields->fieldByName("{$insertOnTab}.{$insertBefore}")) {
$insertBefore = null;
}
//if($this->owner->getFilterableArchiveConfigValue('datearchive_active')){
if (Config::inst()->get($this->owner->className, 'datearchive_active')) {
//$fields->addFieldToTab($this->owner->getFilterableArchiveConfigValue('pagination_control_tab'),
$fields->addFieldToTab(Config::inst()->get($this->owner->className, 'pagination_control_tab'), DropdownField::create('ArchiveUnit', _t('filterablearchive.ARCHIVEUNIT', 'Archive unit'), array('year' => _t('filterablearchive.YEAR', 'Year'), 'month' => _t('filterablearchive.MONTH', 'Month'), 'day' => _t('filterablearchive.DAY', 'Day'))), $insertBefore);
}
$pagerField = NumericField::create("ItemsPerPage", _t("filterablearchive.ItemsPerPage", "Pagination: items per page"))->setRightTitle(_t("filterablearchive.LeaveEmptyForNone", "Leave empty or '0' for no pagination"));
$fields->addFieldToTab($insertOnTab, $pagerField, $insertBefore);
//
// Create categories and tag config
//
// $config = GridFieldConfig_RecordEditor::create();
// $config->removeComponentsByType("GridFieldAddNewButton");
// $config->addComponent(new GridFieldAddByDBField("buttons-before-left"));
// Lets just use what others have made already...
$config = GridFieldConfig::create()->addComponent(new GridFieldButtonRow('before'))->addComponent(new GridFieldToolbarHeader())->addComponent(new GridFieldTitleHeader())->addComponent(new GridFieldEditableColumns())->addComponent(new GridFieldDeleteAction())->addComponent(new GridFieldAddNewInlineButton('toolbar-header-right'));
//if($this->owner->getFilterableArchiveConfigValue('categories_active')){
if (Config::inst()->get($this->owner->className, 'categories_active')) {
$fields->addFieldToTab($insertOnTab, $categories = GridField::create("Categories", _t("FilterableArchive.Categories", "Categories"), $this->owner->Categories(), $config), $insertBefore);
}
//if($this->owner->getFilterableArchiveConfigValue('tags_active')){
if (Config::inst()->get($this->owner->className, 'tags_active')) {
$fields->addFieldToTab($insertOnTab, $tags = GridField::create("Tags", _t("FilterableArchive.Tags", "Tags"), $this->owner->Tags(), $config), $insertBefore);
}
}
开发者ID:helpfulrobot,项目名称:micschk-silverstripe-filterablearchive,代码行数:35,代码来源:FilterableArchiveHolderExtension.php
示例11: Inputs
public function Inputs()
{
if (count($this->linkedFields)) {
return \ArrayList::create();
}
$ranged = is_array($this->settings['start']) && count($this->settings['start']) > 1;
$minName = $ranged ? 'min' : 'value';
$fields[$minName] = ['Render' => $this->castedCopy(\NumericField::create($this->Name . '[' . $minName . ']'))];
$fields[$minName]['Render']->Value = is_array($this->settings['start']) ? $this->settings['start'][0] : $this->settings['start'];
if ($ranged) {
$fields['max'] = ['Render' => $this->castedCopy(\NumericField::create($this->Name . '[max]'))];
$fields['max']['Render']->Value = $this->settings['start'][1];
}
$count = 0;
array_walk($fields, function ($field) use(&$count) {
if (!isset($field['Handle'])) {
$field['Handle'] = $count % 2 ? 'upper' : 'lower';
}
if (isset($field['Render'])) {
$field['Render']->removeExtraClass('rangeslider-display')->addExtraClass('rangeslider-linked')->setAttribute('data-rangeslider-handle', $field['Handle']);
}
$count++;
});
$fields = \ArrayList::create(array_map(function ($field) {
return \ArrayData::create($field);
}, $fields));
if ($this->inputCallback && is_callable($this->inputCallback)) {
call_user_func_array($this->inputCallback, [$fields]);
}
$this->extend('updateInputs', $fields);
return $fields;
}
示例12: getCMSFields
public function getCMSFields($params = null)
{
//fields that shouldn't be changed once coupon is used
$fields = new FieldList(array($tabset = new TabSet("Root", $maintab = new Tab("Main", TextField::create("Title"), CheckboxField::create("Active", "Active")->setDescription("Enable/disable all use of this discount."), HeaderField::create("ActionTitle", "Action", 3), $typefield = SelectionGroup::create("Type", array(new SelectionGroup_Item("Percent", $percentgroup = FieldGroup::create($percentfield = NumericField::create("Percent", "Percentage", "0.00")->setDescription("e.g. 0.05 = 5%, 0.5 = 50%, and 5 = 500%"), $maxamountfield = CurrencyField::create("MaxAmount", _t("MaxAmount", "Maximum Amount"))->setDescription("The total allowable discount. 0 means unlimited.")), "Discount by percentage"), new SelectionGroup_Item("Amount", $amountfield = CurrencyField::create("Amount", "Amount", "\$0.00"), "Discount by fixed amount")))->setTitle("Type"), OptionSetField::create("For", "Applies to", array("Order" => "Entire Order", "Cart" => "Cart Subtotal", "Shipping" => "Shipping Subtotal", "Items" => "Each Individual Item")), new Tab("Main", HeaderField::create("ConstraintsTitle", "Constraints", 3), LabelField::create("ConstraintsDescription", "Configure the requirements an order must meet for this discount to be valid:")), new TabSet("Constraints")))));
if (!$this->isInDB()) {
$fields->addFieldToTab("Root.Main", LiteralField::create("SaveNote", "<p class=\"message good\">More constraints will show up after you save for the first time.</p>"), "Constraints");
}
$this->extend("updateCMSFields", $fields, $params);
if ($count = $this->getUseCount()) {
$fields->addFieldsToTab("Root.Usage", array(HeaderField::create("UseCount", sprintf("This discount has been used {$count} time%s.", $count > 1 ? "s" : "")), HeaderField::create("TotalSavings", sprintf("A total of %s has been saved by customers using this discount.", $this->SavingsTotal), "3"), GridField::create("Orders", "Orders", $this->getAppliedOrders(), GridFieldConfig_RecordViewer::create()->removeComponentsByType("GridFieldViewButton"))));
}
if ($params && isset($params['forcetype'])) {
$valuefield = $params['forcetype'] == "Percent" ? $percentfield : $amountfield;
$fields->insertAfter($valuefield, "Type");
$fields->removeByName("Type");
} elseif ($this->Type && (double) $this->{$this->Type}) {
$valuefield = $this->Type == "Percent" ? $percentfield : $amountfield;
$fields->removeByName("Type");
$fields->insertAfter($valuefield, "ActionTitle");
$fields->replaceField($this->Type, $valuefield->performReadonlyTransformation());
if ($this->Type == "Percent") {
$fields->insertAfter($maxamountfield, "Percent");
}
}
return $fields;
}
示例13: getCMSFields
public function getCMSFields()
{
$fields = FieldList::create();
$fields->merge(array(DropdownField::create("BlogID", _t("BlogRecentPostsWidget.Blog", "Blog"), Blog::get()->map()), NumericField::create("NumberOfPosts", _t("BlogRecentPostsWidget.NumberOfPosts", "Number of Posts"))));
$this->extend("updateCMSFields", $fields);
return $fields;
}
示例14: getCMSFields
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;
}
示例15: getCMSFields
public function getCMSFields()
{
$fields = new FieldList();
$fields->push(TextField::create("TwitterHandle", "Twitter Handle"));
$fields->push(NumericField::create("NumberOfTweets", "Number of Tweets"));
return $fields;
}