当前位置: 首页>>代码示例>>PHP>>正文


PHP FieldGroup类代码示例

本文整理汇总了PHP中FieldGroup的典型用法代码示例。如果您正苦于以下问题:PHP FieldGroup类的具体用法?PHP FieldGroup怎么用?PHP FieldGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FieldGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCMSFields

 public function getCMSFields()
 {
     $self = $this;
     $this->beforeUpdateCMSFields(function ($f) use($self) {
         Requirements::javascript('event_calendar/javascript/calendar_cms.js');
         $f->addFieldToTab("Root.Main", TextField::create("Location", _t('Calendar.LOCATIONDESCRIPTION', 'The location for this event')), 'Content');
         $dt = _t('CalendarEvent.DATESANDTIMES', 'Dates and Times');
         $recursion = _t('CalendarEvent.RECURSION', 'Recursion');
         $f->addFieldToTab("Root.{$dt}", GridField::create("DateTimes", _t('Calendar.DATETIMEDESCRIPTION', 'Add dates for this event'), $self->DateTimes(), GridFieldConfig_RecordEditor::create()));
         $f->addFieldsToTab("Root.{$recursion}", array(new CheckboxField('Recursion', _t('CalendarEvent.REPEATEVENT', 'Repeat this event')), new OptionsetField('CustomRecursionType', _t('CalendarEvent.DESCRIBEINTERVAL', 'Describe the interval at which this event recurs.'), array('1' => _t('CalendarEvent.DAILY', 'Daily'), '2' => _t('CalendarEvent.WEEKLY', 'Weekly'), '3' => _t('CalendarEvent.MONTHLY', 'Monthly')))));
         $f->addFieldToTab("Root.{$recursion}", $dailyInterval = new FieldGroup(new LabelField($name = "every1", $title = _t("CalendarEvent.EVERY", "Every ")), new DropdownField('DailyInterval', '', array_combine(range(1, 10), range(1, 10))), new LabelField($name = "days", $title = _t("CalendarEvent.DAYS", " day(s)"))));
         $f->addFieldToTab("Root.{$recursion}", $weeklyInterval = new FieldGroup(new LabelField($name = "every2", $title = _t("CalendarEvent.EVERY", "Every ")), new DropdownField('WeeklyInterval', '', array_combine(range(1, 10), range(1, 10))), new LabelField($name = "weeks", $title = _t("CalendarEvent.WEEKS", " weeks"))));
         $f->addFieldToTab("Root.{$recursion}", new CheckboxSetField('RecurringDaysOfWeek', _t('CalendarEvent.ONFOLLOWINGDAYS', 'On the following day(s)...'), DataList::create("RecurringDayOfWeek")->map("ID", "Title")));
         $f->addFieldToTab("Root.{$recursion}", $monthlyInterval = new FieldGroup(new LabelField($name = "every3", $title = _t("CalendarEvent.EVERY", "Every ")), new DropdownField('MonthlyInterval', '', array_combine(range(1, 10), range(1, 10))), new LabelField($name = "months", $title = _t("CalendarEvent.MONTHS", " month(s)"))));
         $f->addFieldsToTab("Root.{$recursion}", array(new OptionsetField('MonthlyRecursionType1', '', array('1' => _t('CalendarEvent.ONTHESEDATES', 'On these date(s)...'))), new CheckboxSetField('RecurringDaysOfMonth', '', DataList::create("RecurringDayOfMonth")->map("ID", "Value")), new OptionsetField('MonthlyRecursionType2', '', array('1' => _t('CalendarEvent.ONTHE', 'On the...')))));
         $f->addFieldToTab("Root.{$recursion}", $monthlyIndex = new FieldGroup(new DropdownField('MonthlyIndex', '', array('1' => _t('CalendarEvent.FIRST', 'First'), '2' => _t('CalendarEvent.SECOND', 'Second'), '3' => _t('CalendarEvent.THIRD', 'Third'), '4' => _t('CalendarEvent.FOURTH', 'Fourth'), '5' => _t('CalendarEvent.LAST', 'Last'))), new DropdownField('MonthlyDayOfWeek', '', DataList::create("RecurringDayOfWeek")->map("Value", "Title")), new LabelField($name = "ofthemonth", $title = _t("CalendarEvent.OFTHEMONTH", " of the month."))));
         $f->addFieldToTab("Root.{$recursion}", GridField::create("Exceptions", _t('CalendarEvent.ANYEXCEPTIONS', 'Any exceptions to this pattern? Add the dates below.'), $self->Exceptions(), GridFieldConfig_RecordEditor::create()));
         $dailyInterval->addExtraClass('dailyinterval');
         $weeklyInterval->addExtraClass('weeklyinterval');
         $monthlyInterval->addExtraClass('monthlyinterval');
         $monthlyIndex->addExtraClass('monthlyindex');
     });
     $f = parent::getCMSFields();
     return $f;
 }
开发者ID:helpfulrobot,项目名称:unclecheese-eventcalendar,代码行数:25,代码来源:CalendarEvent.php

示例2: getCMSFields

 /**
  * Overwrites SiteTree.getCMSFields.
  *
  * This method creates a customised CMS form for back-end user.
  *
  * @return fieldset
  */
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $csv_file = $fields->fieldByName("Root.Main.CSVFile");
     $pdf_file = $fields->fieldByName("Root.Main.PDFFile");
     $html_file = $fields->fieldByName("Root.Main.HTMLFile");
     //Remove all fields - then add nicely...
     $fields->removeFieldsFromTab("Root.Main", array("ReportFields", "ReportHeaders", "ConditionFields", "ConditionOps", "ConditionValues", "PaginateBy", "PageHeader", "SortBy", "SortDir", "ClearColumns", "AddInRows", "AddCols", "CSVFile", "PDFFile", "HTMLFile", "ReportID"));
     $reportFields = $this->getReportableFields();
     $fieldsGroup = new FieldGroup('Fields', new MultiValueDropdownField('ReportFields', _t('AdvancedReport.REPORT_FIELDS', 'Report Fields'), $reportFields), new MultiValueTextField('ReportHeaders', _t('AdvancedReport.REPORT_HEADERS', 'Headers')));
     $fieldsGroup->addExtraClass('reportMultiField');
     $conditions = new FieldGroup('Conditions', new MultiValueDropdownField('ConditionFields', _t('AdvancedReport.CONDITION_FIELDS', 'Condition Fields'), $reportFields), new MultiValueDropdownField('ConditionOps', _t('AdvancedReport.CONDITION_OPERATIONS', 'Op'), self::$allowed_conditions), new MultiValueTextField('ConditionValues', _t('AdvancedReport.CONDITION_VALUES', 'Value')));
     $conditions->addExtraClass('reportMultiField');
     $combofield = new FieldGroup('Sorting', new MultiValueDropdownField('SortBy', _t('AdvancedReport.SORTED_BY', 'Sorted By'), $reportFields), new MultiValueDropdownField('SortDir', _t('AdvancedReport.SORT_DIRECTION', 'Sort Direction'), array('ASC' => _t('AdvancedReport.ASC', 'Ascending'), 'DESC' => _t('AdvancedReport.DESC', 'Descending'))));
     $combofield->addExtraClass('reportMultiField');
     $paginateFields = $reportFields;
     array_unshift($paginateFields, '');
     $fields->addFieldsToTab("Root.Main", array($fieldsGroup, $conditions, $combofield, new FieldGroup('Formatting', new DropdownField('PaginateBy', _t('AdvancedReport.PAGINATE_BY', 'Paginate By'), $paginateFields), new TextField('PageHeader', _t('AdvancedReport.PAGED_HEADER', 'Header text (use $name for the page name)'), '$name'), new MultiValueDropdownField('AddInRows', _t('AdvancedReport.ADD_IN_ROWS', 'Add these columns for each row'), $reportFields), new MultiValueDropdownField('AddCols', _t('AdvancedReport.ADD_IN_ROWS', 'Provide totals for these columns'), $reportFields), new MultiValueDropdownField('ClearColumns', _t('AdvancedReport.CLEARED_COLS', '"Cleared" columns'), $reportFields))));
     /* create a dedicated tab for report download files
      * @todo convert to InlineFormAction or the like to allow user to download report files
      * @todo provide a Generate Link Action on this page
      */
     $fields->addFieldsToTab("Root.Reports", array(new FieldGroup("Files", $csv_file, $pdf_file, $html_file)));
     return $fields;
 }
开发者ID:rodneyway,项目名称:silverstripe-advancedreports,代码行数:32,代码来源:AdvancedReport.php

示例3: __construct

 function __construct($controller, $name)
 {
     $org_field = null;
     $current_user = Member::currentUser();
     $current_affiliations = $current_user->getCurrentAffiliations();
     if (!$current_affiliations) {
         $org_field = new TextField('Organization', 'Your Organization Name');
     } else {
         if (count($current_affiliations) > 1) {
             $source = array();
             foreach ($current_affiliations as $a) {
                 $org = $a->Organization();
                 $source[$org->ID] = $org->Name;
             }
             $source['0'] = "-- New One --";
             $ddl = new DropdownField('OrgID', 'Your Organization', $source);
             $ddl->setEmptyString('-- Select Your Organization --');
             $org_field = new FieldGroup();
             $org_field->push($ddl);
             $org_field->push($txt = new TextField('Organization', ''));
             $txt->addExtraClass('new-org-name');
         } else {
             $org_field = new TextField('Organization', 'Your Organization Name', $current_user->getOrgName());
         }
     }
     $fields = new FieldList($org_field, new DropdownField('Industry', 'Your Organization’s Primary Industry', ArrayUtils::AlphaSort(DeploymentSurveyOptions::$industry_options, array('' => '-- Please Select One --'), array('Other' => 'Other Industry (please specify)'))), new TextareaField('OtherIndustry', 'Other Industry'), $org_it_activity = new TextareaField('ITActivity', 'Your Organization’s Primary IT Activity'), new LiteralField('Break', '<hr/>'), new LiteralField('Break', '<p>Your Organization’s Primary Location or Headquarters</p>'), $country = new DropdownField('PrimaryCountry', 'Country', CountryCodes::$iso_3166_countryCodes), new TextField('PrimaryState', 'State / Province / Region'), new TextField('PrimaryCity', 'City'), new DropdownField('OrgSize', 'Your Organization Size (All Branches, Locations, Sites)', DeploymentSurveyOptions::$organization_size_options), new CustomCheckboxSetField('OpenStackInvolvement', 'What best describes your Organization’s involvement with OpenStack?<BR>Select All That Apply', ArrayUtils::AlphaSort(DeploymentSurveyOptions::$openstack_involvement_options)));
     $org_it_activity->addExtraClass('hidden');
     $country->setEmptyString('-- Select One --');
     $nextButton = new FormAction('NextStep', '  Next Step  ');
     $actions = new FieldList($nextButton);
     $validator = new RequiredFields();
     Requirements::javascript('surveys/js/deployment_survey_yourorganization_form.js');
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:34,代码来源:DeploymentSurveyYourOrganizationForm.php

示例4: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
     Requirements::javascript('eventmanagement/javascript/event-ticket-cms.js');
     $fields->removeByName('EventID');
     $fields->removeByName('StartType');
     $fields->removeByName('StartDate');
     $fields->removeByName('StartDays');
     $fields->removeByName('StartHours');
     $fields->removeByName('StartMins');
     $fields->removeByName('EndType');
     $fields->removeByName('EndDate');
     $fields->removeByName('EndDays');
     $fields->removeByName('EndHours');
     $fields->removeByName('EndMins');
     if (class_exists('Payment')) {
         $fields->insertBefore(new OptionSetField('Type', 'Ticket type', array('Free' => 'Free ticket', 'Price' => 'Fixed price ticket')), 'Price');
     } else {
         $fields->removeByName('Type');
         $fields->removeByName('Price');
     }
     foreach (array('Start', 'End') as $type) {
         $fields->addFieldsToTab('Root.Main', array(new OptionSetField("{$type}Type", "{$type} sales at", array('Date' => 'A specific date and time', 'TimeBefore' => 'A time before the event starts')), $dateTime = new DatetimeField("{$type}Date", ''), $before = new FieldGroup("{$type}Offset", new NumericField("{$type}Days", 'Days'), new NumericField("{$type}Hours", 'Hours'), new NumericField("{$type}Mins", 'Minutes'))));
         $before->setName("{$type}Offset");
         $before->setTitle(' ');
         $dateTime->getDateField()->setConfig('showcalendar', true);
         $dateTime->getTimeField()->setConfig('showdropdown', true);
     }
     $fields->addFieldsToTab('Root.Advanced', array(new TextareaField('Description', 'Description'), new NumericField('MinTickets', 'Minimum tickets per order'), new NumericField('MaxTickets', 'Maximum tickets per order')));
     return $fields;
 }
开发者ID:tim-lar,项目名称:silverstripe-eventmanagement,代码行数:32,代码来源:EventTicket.php

示例5: SearchForm

 function SearchForm()
 {
     $query = isset($_GET['CommentSearch']) ? $_GET['CommentSearch'] : null;
     $searchFields = new FieldGroup(new TextField('CommentSearch', _t('CommentTableField.SEARCH', 'Search'), $query), new HiddenField("ctf[ID]", '', $this->mode), new HiddenField('CommentFieldName', '', $this->name));
     $actionFields = new LiteralField('CommentFilterButton', '<input type="submit" name="CommentFilterButton" value="' . _t('CommentTableField.FILTER', 'Filter') . '" id="CommentFilterButton"/>');
     $fieldContainer = new FieldGroup($searchFields, $actionFields);
     return $fieldContainer->FieldHolder();
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:8,代码来源:CommentTableField.php

示例6: testMessagesInsideNestedCompositeFields

 public function testMessagesInsideNestedCompositeFields()
 {
     $fieldGroup = new FieldGroup(new CompositeField($textField = new TextField('TestField', 'Test Field'), $emailField = new EmailField('TestEmailField', 'Test Email Field')));
     $textField->setError('Test error message', 'warning');
     $emailField->setError('Test error message', 'error');
     $this->assertEquals('Test error message,  Test error message.', $fieldGroup->Message());
     $this->assertEquals('warning.  error', $fieldGroup->MessageType());
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:8,代码来源:FieldGroupTest.php

示例7: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $options = new FieldGroup(new CheckboxField('CleanOnSave', _t('TidyContent.CLEAN_ON_SAVE', 'Clean this content whenever the page is saved')), new CheckboxField('TidyHtml', _t('TidyContent.TIDY_HTML', 'Tidy HTML')), new CheckboxField('PurifyHtml', _t('TidyContent.PURIFY_HTML', 'Purify HTML')), new CheckboxField('FixUTF8', _t('TidyContent.FIX_UTF8', 'Fix badly encoded UTF8 characters')), new CheckboxField('CheckAccessible', _t('TidyContent.CHECK_ACCESS', 'Check accessibility')), new CheckboxField('StripWordTags', _t('TidyContent.STRIP_WORD', 'Strip extraneous MS word tags')));
     $options->setTitle('Cleaning:');
     $fields->addFieldToTab('Root.Cleaning', $options);
     $conf = SiteConfig::current_site_config();
     if (strlen($this->owner->AccessibleErrors) && ($conf->ForceAccessibilityChecks || $this->owner->CheckAccessible)) {
         $fields->addFieldToTab('Root.Main', new ReadonlyField('AccessibleErrorsList', 'Possible accessibility issues', $this->owner->AccessibleErrors), 'Content');
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripe-australia-silverstripe-cleancontent,代码行数:10,代码来源:CleanContentExtension.php

示例8: testInvalidCoefficientType

 /**
  * @expectedException InvalidCoefficientException
  */
 public function testInvalidCoefficientType()
 {
     $FGC = new DOMDocument('1.0', 'UTF-8');
     $FGC->load(FGCInvalidCoefficientType, LIBXML_NOBLANKS);
     $FGCXPath = new DOMXPath($FGC);
     $FGCXPath->registerNamespace('fg', 'http://keg.vse.cz/ns/fieldgroupconfig0_1');
     $FGCNode = $FGCXPath->evaluate('//FieldGroupConfig[1]')->item(0);
     $FG = new FieldGroup($FGCNode, $FGCXPath, 'en', true, $this->attributes, $this->coefficients);
     $FG->parse();
 }
开发者ID:KIZI,项目名称:sewebar-cms,代码行数:13,代码来源:FieldGroupTest.php

示例9: Field

 public function Field($properties = array())
 {
     $fields = new FieldGroup($this->name);
     $fields->setID("{$this->name}_Holder");
     list($countryCode, $areaCode, $phoneNumber, $extension) = $this->parseValue();
     if ($this->value == "") {
         $countryCode = $this->countryCode;
         $areaCode = $this->areaCode;
         $extension = $this->ext;
     }
     if ($this->countryCode !== null) {
         $fields->push(new NumericField($this->name . '[Country]', '+', $countryCode, 4));
     }
     if ($this->areaCode !== null) {
         $fields->push(new NumericField($this->name . '[Area]', '(', $areaCode, 4));
         $fields->push(new NumericField($this->name . '[Number]', ')', $phoneNumber, 10));
     } else {
         $fields->push(new NumericField($this->name . '[Number]', '', $phoneNumber, 10));
     }
     if ($this->ext !== null) {
         $fields->push(new NumericField($this->name . '[Extension]', 'ext', $extension, 6));
     }
     $description = $this->getDescription();
     if ($description) {
         $fields->getChildren()->First()->setDescription($description);
     }
     foreach ($fields as $field) {
         $field->setDisabled($this->isDisabled());
         $field->setReadonly($this->isReadonly());
     }
     return $fields;
 }
开发者ID:congaaids,项目名称:silverstripe-framework,代码行数:32,代码来源:PhoneNumberField.php

示例10: Field

 public function Field()
 {
     $field = new FieldGroup($this->name);
     $field->setID("{$this->name}_Holder");
     list($countryCode, $areaCode, $phoneNumber, $extension) = $this->parseValue();
     $hasTitle = false;
     if ($this->value == "") {
         $countryCode = $this->countryCode;
         $areaCode = $this->areaCode;
         $extension = $this->ext;
     }
     if ($this->countryCode !== null) {
         $field->push(new NumericField($this->name . '[Country]', '+', $countryCode, 4));
     }
     if ($this->areaCode !== null) {
         $field->push(new NumericField($this->name . '[Area]', '(', $areaCode, 4));
         $field->push(new NumericField($this->name . '[Number]', ')', $phoneNumber, 10));
     } else {
         $field->push(new NumericField($this->name . '[Number]', '', $phoneNumber, 10));
     }
     if ($this->ext !== null) {
         $field->push(new NumericField($this->name . '[Extension]', 'ext', $extension, 6));
     }
     return $field;
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:25,代码来源:PhoneNumberField.php

示例11: getSettingsFields

 public function getSettingsFields()
 {
     $dataTypes = $this->getAvailableTypes();
     $reportable = $this->getReportableFields();
     $converted = array();
     foreach ($reportable as $k => $v) {
         $converted[$this->dottedFieldToUnique($k)] = $v;
     }
     $dataTypes = array_merge(array('' => ''), $dataTypes);
     $types = new MultiValueDropdownField('DataTypes', _t('AdvancedReport.DATA_TYPES', 'Data types'), $dataTypes);
     $fieldsGroup = new FieldGroup('Fields', $reportFieldsSelect = new MultiValueDropdownField('ReportFields', _t('AdvancedReport.REPORT_FIELDS', 'Report Fields'), $reportable));
     $fieldsGroup->push(new MultiValueTextField('ReportHeaders', _t('AdvancedReport.HEADERS', 'Header labels')));
     $fieldsGroup->addExtraClass('reportMultiField');
     $reportFieldsSelect->addExtraClass('reportFieldsSelection');
     $fieldsGroup->setName('FieldsGroup');
     $fieldsGroup->addExtraClass('advanced-report-fields dropdown');
     $conditions = new FieldGroup('Conditions', new MultiValueDropdownField('ConditionFields', _t('AdvancedReport.CONDITION_FIELDS', 'Condition Fields'), $reportable), new MultiValueDropdownField('ConditionOps', _t('AdvancedReport.CONDITION_OPERATIONS', 'Op'), $this->config()->allowed_conditions), new MultiValueTextField('ConditionValues', _t('AdvancedReport.CONDITION_VALUES', 'Value')));
     $conditions->setName('ConditionsGroup');
     $conditions->addExtraClass('dropdown');
     // define the group for the sort field
     $sortGroup = new FieldGroup('Sort', new MultiValueDropdownField('SortBy', _t('AdvancedReport.SORTED_BY', 'Sorted By'), $reportable), new MultiValueDropdownField('SortDir', _t('AdvancedReport.SORT_DIRECTION', 'Sort Direction'), array('ASC' => _t('AdvancedReport.ASC', 'Ascending'), 'DESC' => _t('AdvancedReport.DESC', 'Descending'))));
     $sortGroup->setName('SortGroup');
     $sortGroup->addExtraClass('dropdown');
     // build a list of the formatters
     $formatters = ClassInfo::implementorsOf('ReportFieldFormatter');
     $fmtrs = array();
     foreach ($formatters as $formatterClass) {
         $formatter = new $formatterClass();
         $fmtrs[$formatterClass] = $formatter->label();
     }
     // define the group for the custom field formatters
     $fieldFormattingGroup = new FieldGroup(_t('AdvancedReport.FORMAT_FIELDS', 'Custom field formatting'), new MultiValueDropdownField('FieldFormattingField', _t('AdvancedReport.FIELDFORMATTING', 'Field'), $converted), new MultiValueDropdownField('FieldFormattingFormatter', _t('AdvancedReport.FIELDFORMATTINGFORMATTER', 'Formatter'), $fmtrs));
     $fieldFormattingGroup->setName('FieldFormattingGroup');
     $fieldFormattingGroup->addExtraClass('dropdown');
     // assemble the fieldlist
     $fields = new FieldList(new TextField('Title', _t('AdvancedReport.TITLE', 'Title')), new TextareaField('Description', _t('AdvancedReport.DESCRIPTION', 'Description')), $types, $fieldsGroup, $conditions, new KeyValueField('ReportParams', _t('AdvancedReport.REPORT_PARAMETERS', 'Default report parameters')), $sortGroup, new MultiValueDropdownField('NumericSort', _t('AdvancedReport.SORT_NUMERICALLY', 'Sort these fields numerically'), $reportable), DropdownField::create('PaginateBy')->setTitle(_t('AdvancedReport.PAGINATE_BY', 'Paginate By'))->setSource($reportable)->setHasEmptyDefault(true), TextField::create('PageHeader')->setTitle(_t('AdvancedReport.HEADER_TEXT', 'Header text'))->setDescription(_t('AdvancedReport.USE_NAME_FOR_PAGE_NAME', 'use $name for the page name'))->setValue('$name'), new MultiValueDropdownField('AddInRows', _t('AdvancedReport.ADD_IN_ROWS', 'Add these columns for each row'), $converted), new MultiValueDropdownField('AddCols', _t('AdvancedReport.ADD_IN_ROWS', 'Provide totals for these columns'), $converted), $fieldFormattingGroup, new MultiValueDropdownField('ClearColumns', _t('AdvancedReport.CLEARED_COLS', '"Cleared" columns'), $converted));
     if ($this->config()->allow_grouping) {
         // GroupBy
         $groupingGroup = new FieldGroup('Grouping', new MultiValueDropdownField('GroupBy', _t('AdvancedReport.GROUPBY_FIELDS', 'Group by fields'), $reportable), new MultiValueDropdownField('SumFields', _t('AdvancedReport.SUM_FIELDS', 'SUM fields'), $reportable));
         $groupingGroup->addExtraClass('dropdown');
         $fields->insertAfter($groupingGroup, 'ConditionsGroup');
     }
     if ($this->hasMethod('updateReportFields')) {
         Deprecation::notice('3.0', 'The updateReportFields method is deprecated, instead overload getSettingsFields');
         $this->updateReportFields($fields);
     }
     $this->extend('updateSettingsFields', $fields);
     return $fields;
 }
开发者ID:nyeholt,项目名称:silverstripe-advancedreports,代码行数:49,代码来源:FreeformReport.php

示例12: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $group = new FieldGroup();
     $group->setTitle(_t('News.Author'));
     $group->setDescription(_t('News.AuthorHolder'));
     $fields->addFieldToTab('Root.Main', $group, 'Content');
     $field = new TextField('AuthorName', _t('News.Name'));
     $group->push($field);
     $field = new TextField('AuthorURI', _t('News.URI'));
     $group->push($field);
     $field = new TextField('AuthorEmail', _t('News.Email'));
     $group->push($field);
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:entidi-silverstripe-news,代码行数:15,代码来源:NewsHolder.php

示例13: updateSettingsFields

 /**
  * If this extension is applied to a {@link SiteTree} record then
  * append a Provide Comments checkbox to allow authors to trigger
  * whether or not to display comments
  *
  * @todo Allow customization of other {@link Commenting} configuration
  *
  * @param FieldList $fields
  */
 public function updateSettingsFields(FieldList $fields)
 {
     $options = FieldGroup::create()->setTitle(_t('CommentsExtension.COMMENTOPTIONS', 'Comments'));
     // Check if enabled setting should be cms configurable
     if ($this->owner->getCommentsOption('enabled_cms')) {
         $options->push(new CheckboxField('ProvideComments', _t('Comment.ALLOWCOMMENTS', 'Allow Comments')));
     }
     // Check if we should require users to login to comment
     if ($this->owner->getCommentsOption('require_login_cms')) {
         $options->push(new CheckboxField('CommentsRequireLogin', _t('Comments.COMMENTSREQUIRELOGIN', 'Require login to comment')));
     }
     if ($options->FieldList()->count()) {
         if ($fields->hasTabSet()) {
             $fields->addFieldsToTab('Root.Settings', $options);
         } else {
             $fields->push($options);
         }
     }
     // Check if moderation should be enabled via cms configurable
     if ($this->owner->getCommentsOption('require_moderation_cms')) {
         $moderationField = new DropdownField('ModerationRequired', 'Comment Moderation', array('None' => _t('CommentsExtension.MODERATIONREQUIRED_NONE', 'No moderation required'), 'Required' => _t('CommentsExtension.MODERATIONREQUIRED_REQUIRED', 'Moderate all comments'), 'NonMembersOnly' => _t('CommentsExtension.MODERATIONREQUIRED_NONMEMBERSONLY', 'Only moderate non-members')));
         if ($fields->hasTabSet()) {
             $fields->addFieldsToTab('Root.Settings', $moderationField);
         } else {
             $fields->push($moderationField);
         }
     }
 }
开发者ID:bhavesh1212310,项目名称:silverstripe-comments,代码行数:37,代码来源:CommentsExtension.php

示例14: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Remove fields
     $fields->removeByName(array('Unique', 'Permanent', 'CanClose', 'CloseColor', 'LinkID'));
     // Add fields
     // Main tab
     $fields->addFieldToTab("Root.Main", $test = TextField::create("ButtonText")->setTitle(_t("SiteMessage.LABELBUTTONTEXT", "Button Text")));
     $fields->addFieldToTab("Root.Main", TreeDropdownField::create("PageID")->setTitle(_t("SiteMessage.LABELLINKTO", "Link to"))->setSourceObject("SiteTree"));
     $fields->addFieldToTab("Root.Main", HTMLEditorField::create("Content")->setTitle(_t("SiteMessage.LABELCONTENT", "Message content"))->setRows(15));
     // Design tab
     $fields->addFieldToTab("Root.Design", HeaderField::create("ColorSettings")->setTitle(_t("SiteMessage.HEADERCOLORSETTINGS", "Color settings")));
     $fields->addFieldToTab("Root.Design", ColorField::create("BackgroundColor")->setTitle(_t("SiteMessage.LABELBACKGROUNDCOLOR", "Background Color")));
     $fields->addFieldToTab("Root.Design", ColorField::create("TextColor")->setTitle(_t("SiteMessage.LABELTEXTCOLOR", "Text Color")));
     $fields->addFieldToTab("Root.Design", ColorField::create("ButtonColor")->setTitle(_t("SiteMessage.LABELBUTTONCOLOR", "Button Color")));
     $fields->addFieldToTab("Root.Design", ColorField::create("ButtonTextColor")->setTitle(_t("SiteMessage.LABELBUTTONTEXTCOLOR", "Button Text Color")));
     $fields->addFieldToTab("Root.Design", HeaderField::create("CloseSettings")->setTitle(_t("SiteMessage.HEADERCLOSESETTINGS", "Close button settings")));
     $fields->addFieldToTab("Root.Design", FieldGroup::create(_t("SiteMessage.LABELCANCLOSE", "Show close button?"), Checkboxfield::create("CanClose", "")));
     $fields->addFieldToTab("Root.Design", ColorField::create("CloseColor")->setTitle(_t("SiteMessage.LABELCLOSECOLOR", "Close button color")));
     // Schedule tab
     $fields->addFieldToTab("Root.Schedule", FieldGroup::create(_t("SiteMessage.LABELPERMANENT", "Is this message permanent?"), CheckboxField::create("Permanent", "")));
     $fields->addFieldToTab("Root.Schedule", $Start = new DatetimeField("Start"));
     $fields->addFieldToTab("Root.Schedule", $End = new DatetimeField("End"));
     $Start->setConfig('datavalueformat', 'YYYY-MM-dd HH:mm')->setTitle(_t("SiteMessage.LABELSTART", "Start Date"))->getDateField('Start')->setConfig('showcalendar', TRUE);
     $End->setConfig('datavalueformat', 'YYYY-MM-dd HH:mm')->setTitle(_t("SiteMessage.LABELSTART", "End Date"))->getDateField('End')->setConfig('showcalendar', TRUE);
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:christohill-silverstripe-sitemessages,代码行数:27,代码来源:SiteMessage.php

示例15: 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;
 }
开发者ID:helpfulrobot,项目名称:silvershop-discounts,代码行数:26,代码来源:Discount.php


注:本文中的FieldGroup类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。