本文整理汇总了PHP中Tab::setTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP Tab::setTitle方法的具体用法?PHP Tab::setTitle怎么用?PHP Tab::setTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tab
的用法示例。
在下文中一共展示了Tab::setTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFieldList
/**
* Gets the form fields as defined through the metadata
* on {@link $obj} and the custom parameters passed to FormScaffolder.
* Depending on those parameters, the fields can be used in ajax-context,
* contain {@link TabSet}s etc.
*
* @return FieldList
*/
public function getFieldList()
{
$fields = new FieldList();
// tabbed or untabbed
if ($this->tabbed) {
$fields->push(new TabSet("Root", $mainTab = new Tab("Main")));
$mainTab->setTitle(_t('SiteTree.TABMAIN', "Main"));
}
//var_dump($this->obj->db());exit();
// add database fields
foreach ($this->obj->db() as $fieldName => $fieldType) {
if ($this->restrictFields && !in_array($fieldName, $this->restrictFields)) {
continue;
}
// @todo Pass localized title
if ($this->fieldClasses && isset($this->fieldClasses[$fieldName])) {
$fieldClass = $this->fieldClasses[$fieldName];
$fieldObject = new $fieldClass($fieldName);
} else {
$fieldObject = $this->obj->dbObject($fieldName)->scaffoldFormField(null, $this->getParamsArray());
}
$fieldObject->setTitle($this->obj->fieldLabel($fieldName));
if ($this->tabbed) {
$fields->addFieldToTab("Root.Main", $fieldObject);
} else {
$fields->push($fieldObject);
}
}
return $fields;
}
示例2: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$fields->insertBefore($shoptab = new Tab('Shop', 'Shop'), 'Access');
$fields->addFieldsToTab("Root.Shop", new TabSet("ShopTabs", $maintab = new Tab("Main", TreeDropdownField::create('TermsPageID', _t("ShopConfig.TERMSPAGE", 'Terms and Conditions Page'), 'SiteTree'), TreeDropdownField::create("CustomerGroupID", _t("ShopConfig.CUSTOMERGROUP", "Group to add new customers to"), "Group"), UploadField::create('DefaultProductImage', _t('ShopConfig.DEFAULTIMAGE', 'Default Product Image'))), $countriestab = new Tab("Countries", CheckboxSetField::create('AllowedCountries', 'Allowed Ordering and Shipping Countries', self::config()->iso_3166_country_codes))));
$fields->removeByName("CreateTopLevelGroups");
$countriestab->setTitle("Allowed Countries");
}
示例3: getCMSFields
/**
* Get the fields that are sent to the CMS. In
* your decorators: updateCMSFields(&$fields)
*
* @return Fieldset
*/
function getCMSFields()
{
Requirements::javascript(CMS_DIR . "/javascript/SitetreeAccess.js");
$fields = new FieldSet(new TabSet("Root", $tabMain = new Tab('Main', $titleField = new TextField("Title", _t('SiteConfig.SITETITLE', "Site title")), $taglineField = new TextField("Tagline", _t('SiteConfig.SITETAGLINE', "Site Tagline/Slogan")), new DropdownField("Theme", _t('SiteConfig.THEME', 'Theme'), $this->getAvailableThemes(), '', null, _t('SiteConfig.DEFAULTTHEME', '(Use default theme)'))), $tabAccess = new Tab('Access', new HeaderField('WhoCanViewHeader', _t('SiteConfig.VIEWHEADER', "Who can view pages on this site?"), 2), $viewersOptionsField = new OptionsetField("CanViewType"), $viewerGroupsField = new TreeMultiselectField("ViewerGroups", _t('SiteTree.VIEWERGROUPS', "Viewer Groups")), new HeaderField('WhoCanEditHeader', _t('SiteConfig.EDITHEADER', "Who can edit pages on this site?"), 2), $editorsOptionsField = new OptionsetField("CanEditType"), $editorGroupsField = new TreeMultiselectField("EditorGroups", _t('SiteTree.EDITORGROUPS', "Editor Groups")), new HeaderField('WhoCanCreateTopLevelHeader', _t('SiteConfig.TOPLEVELCREATE', "Who can create pages in the root of the site?"), 2), $topLevelCreatorsOptionsField = new OptionsetField("CanCreateTopLevelType"), $topLevelCreatorsGroupsField = new TreeMultiselectField("CreateTopLevelGroups", _t('SiteTree.TOPLEVELCREATORGROUPS', "Top level creators")))));
$viewersOptionsSource = array();
$viewersOptionsSource["Anyone"] = _t('SiteTree.ACCESSANYONE', "Anyone");
$viewersOptionsSource["LoggedInUsers"] = _t('SiteTree.ACCESSLOGGEDIN', "Logged-in users");
$viewersOptionsSource["OnlyTheseUsers"] = _t('SiteTree.ACCESSONLYTHESE', "Only these people (choose from list)");
$viewersOptionsField->setSource($viewersOptionsSource);
$editorsOptionsSource = array();
$editorsOptionsSource["LoggedInUsers"] = _t('SiteTree.EDITANYONE', "Anyone who can log-in to the CMS");
$editorsOptionsSource["OnlyTheseUsers"] = _t('SiteTree.EDITONLYTHESE', "Only these people (choose from list)");
$editorsOptionsField->setSource($editorsOptionsSource);
$topLevelCreatorsOptionsField->setSource($editorsOptionsSource);
// Translatable doesn't handle updateCMSFields on DataObjects,
// so add it here to save the current Locale,
// because onBeforeWrite does not work.
if (Object::has_extension('SiteConfig', "Translatable")) {
$fields->push(new HiddenField("Locale"));
}
if (!Permission::check('EDIT_SITECONFIG')) {
$fields->makeFieldReadonly($viewersOptionsField);
$fields->makeFieldReadonly($viewerGroupsField);
$fields->makeFieldReadonly($editorsOptionsField);
$fields->makeFieldReadonly($editorGroupsField);
$fields->makeFieldReadonly($topLevelCreatorsOptionsField);
$fields->makeFieldReadonly($topLevelCreatorsGroupsField);
$fields->makeFieldReadonly($taglineField);
$fields->makeFieldReadonly($titleField);
}
$tabMain->setTitle(_t('SiteConfig.TABMAIN', "Main"));
$tabAccess->setTitle(_t('SiteConfig.TABACCESS', "Access"));
$this->extend('updateCMSFields', $fields);
return $fields;
}
示例4: updateCMSFields
function updateCMSFields(&$fields)
{
/*
* don't want slideshow on a redirector page
*/
if ($this->owner->ClassName == 'RedirectorPage') {
return $fields;
}
/*
* if this is a new page set defaults
*/
if ($this->owner->Version == 1) {
$this->set_defaults();
}
$tabSlides = new Tab('Slides');
$tabSlides->setTitle(_t('Slideshow.SLIDESTABTITLE', 'Slides'));
$tabSettings = new Tab('Settings');
$tabSettings->setTitle(_t('Slideshow.SETTINGSTABTITLE', 'Settings'));
$tabSlideShow = new TabSet('SlideshowTabs', $tabSlides, $tabSettings);
$tabSlideShow->setTitle(_t('Slideshow.SLIDESHOWTABTITLE', 'Slideshow'));
$fields->addFieldToTab('Root.Content', $tabSlideShow);
$image_manager = new ImageDataObjectManager($this->owner, 'SlideshowSlides', 'SlideshowSlide', 'SlideImage', array(), 'getCMSFields_forPopup');
$image_manager->copyOnImport = false;
$fields->addFieldToTab('Root.Content.SlideshowTabs.Slides', $image_manager);
/*
* settings
*/
if (count(self::$effects) > 1) {
$fields->addFieldToTab('Root.Content.SlideshowTabs.Settings', new DropdownField($name = 'SlideEffect', $title = _t('Slideshow.EFFECT', 'Slide effect'), $source = array_combine(array_keys(self::$effects), array_keys(self::$effects))));
} else {
$fields->addFieldToTab('Root.Content.SlideshowTabs.Settings', new HiddenField($name = 'SlideEffect', $title = 'Slide Effect', $value = key(self::$effects)));
}
$fields->addFieldsToTab('Root.Content.SlideshowTabs.Settings', array(new TextField($name = 'SlideDuration', $title = _t('Slideshow.SLIDEDURATIOM', 'Duration of Each Slide (milliseconds)')), new TextField($name = 'TransitionDuration', $title = _t('Slideshow.TRANSITIONDURATION', 'Duration of Transition Between Slides (milliseconds)')), new CheckboxField($name = 'AutoPlay', $title = _t('Slideshow.AUTOPLAY', 'Start slideshow automatically')), new CheckboxField($name = 'Loop', $title = _t('Slideshow.LOOP', 'Loop slides')), new CheckboxField($name = 'PauseOnHover', $title = _t('Slideshow.PAUSEONHOVER', 'Pause the slideshow when the mouse hovers over it')), new OptionsetField($name = 'UpdateSlideshows', $title = _t('Slideshow.UPDATE', 'Update slideshows'), $source = array('page' => _t('Slideshow.UPDATEPAGEONLY', 'Apply to this page only'), 'section' => _t('Slideshow.UPDATESECTION', 'Apply to all slideshows in this section'), 'site' => _t('Slideshow.UPDATEALL', 'Apply to all slideshows on this site')), $value = 'page')));
}
示例5: getCMSFields
function getCMSFields()
{
Requirements::javascript("sapphire/javascript/RedirectorPage.js");
$fields = new FieldSet(new TabSet("Root", $tabContent = new Tab("Content", new TextField("Title", _t('SiteTree.PAGETITLE')), new TextField("MenuTitle", _t('SiteTree.MENUTITLE')), new FieldGroup(_t('SiteTree.URL'), new LabelField("http://www.yoursite.com/"), new TextField("URLSegment", ""), new LabelField("/")), new HeaderField(_t('RedirectorPage.HEADER', "This page will redirect users to another page")), new OptionsetField("RedirectionType", _t('RedirectorPage.REDIRECTTO', "Redirect to"), array("Internal" => _t('RedirectorPage.REDIRECTTOPAGE', "A page on your website"), "External" => _t('RedirectorPage.REDIRECTTOEXTERNAL', "Another website")), "Internal"), new TreeDropdownField("LinkToID", _t('RedirectorPage.YOURPAGE', "Page on your website"), "SiteTree"), new TextField("ExternalURL", _t('RedirectorPage.OTHERURL', "Other website URL")), new TextareaField("MetaDescription", _t('SiteTree.METADESC'))), $tabBehaviour = new Tab("Behaviour", new DropdownField("ClassName", _t('SiteTree.PAGETYPE'), $this->getClassDropdown()), new CheckboxField("ShowInMenus", _t('SiteTree.SHOWINMENUS')), new CheckboxField("ShowInSearch", _t('SiteTree.SHOWINSEARCH')))));
$tabContent->setTitle(_t('SiteTree.TABCONTENT'));
$tabBehaviour->setTitle(_t('SiteTree.TABBEHAVIOUR'));
return $fields;
}
示例6: getCMSFields
public function getCMSFields()
{
$fields = FieldList::create();
$fields->push(TabSet::create('Root', $mainTab = new Tab('Main')));
$mainTab->setTitle(_t('SiteTree.TABMAIN', "Main"));
$fields->addFieldsToTab('Root.Main', array(TextField::create('Title', _t('Block.TITLE', 'Title'))));
$this->extend('updateCMSFields', $fields);
return $fields;
}
示例7: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-livequery/jquery.livequery.js');
Requirements::javascript('memberprofiles/javascript/MemberProfilePageCms.js');
// Setup tabs
$fields->addFieldToTab('Root', $profile = new TabSet('Profile'), 'Content');
$fields->addFieldToTab('Root', $email = new Tab('Email'), 'Behaviour');
$profile->setTitle(_t('MemberProfiles.PROFILE', 'Profile'));
$email->setTitle(_t('MemberProfiles.EMAIL', 'Email'));
$fields->findOrMakeTab('Root.Profile.Fields', _t('MemberProfiles.FIELDS', 'Fields'));
$fields->findOrMakeTab('Root.Profile.Groups', _t('MemberProfiles.GROUPS', 'Groups'));
$fields->findOrMakeTab('Root.Profile.PublicProfile', _t('MemberProfiles.PUBLICPROFILE', 'Public Profile'));
// Profile fields
$fields->addFieldsToTab('Root.Profile.Fields', array(new HeaderField('ProfileFieldsHeader', _t('MemberProfiles.PROFILEFIELDS', 'Profile Fields')), $table = new OrderableComplexTableField($this, 'Fields', 'MemberProfileField')));
$table->setPermissions(array('show', 'edit'));
$table->setCustomSourceItems($this->getProfileFields());
// Groups
$fields->addFieldsToTab('Root.Profile.Groups', array(new HeaderField('GroupsHeader', _t('MemberProfiles.GROUPASSIGNMENT', 'Group Assignment')), new LiteralField('GroupsNote', '<p>' . _t('MemberProfiles.GROUPSNOTE', 'Any users registering via this page will always be added to ' . 'the below groups (if registration is enabled). Conversely, a ' . 'member must belong to these groups in order to edit their ' . 'profile on this page.') . '</p>'), new CheckboxSetField('Groups', '', DataObject::get('Group')->map()), new HeaderField('SelectableGroupsHeader', _t('MemberProfiles.USERSELECTABLE', 'User Selectable')), new LiteralField('SelectableGroupsNote', '<p>' . _t('MemberProfiles.SELECTABLEGROUPSNOTE', 'Users can choose to belong to the following groups, if the ' . '"Groups" field is enabled in the "Fields" tab.') . '</p>'), new CheckboxSetField('SelectableGroups', '', DataObject::get('Group')->map())));
// Public profile
$fields->addFieldsToTab('Root.Profile.PublicProfile', array(new HeaderField('PublicProfileHeader', _t('MemberProfiles.PUBLICPROFILE', 'Public Profile')), new CheckboxField('AllowProfileViewing', _t('MemberProfiles.ALLOWPROFILEVIEWING', 'Allow people to view user profiles.')), new HeaderField('ProfileSectionsHeader', _t('MemberProfiles.PROFILESECTIONS', 'Profile Sections')), new MemberProfileSectionField($this, 'Sections', 'MemberProfileSection')));
// Email confirmation and validation
$fields->addFieldsToTab('Root.Email', array(new HeaderField('EmailHeader', 'Email Confirmation and Validation'), new OptionSetField('EmailType', '', array('Validation' => 'Require email validation to activate an account', 'Confirmation' => 'Send a confirmation email after a user registers', 'None' => 'Do not send any emails')), new ToggleCompositeField('EmailContent', 'Email Content', array(new TextField('EmailSubject', 'Email subject'), new TextField('EmailFrom', 'Email from'), new TextareaField('EmailTemplate', 'Email template'), new LiteralField('TemplateNote', MemberConfirmationEmail::TEMPLATE_NOTE))), new ToggleCompositeField('ConfirmationContent', 'Confirmation Content', array(new LiteralField('ConfirmationNote', '<p>This content is dispayed when
a user confirms their account.</p>'), new TextField('ConfirmationTitle', 'Title'), new HtmlEditorField('ConfirmationContent', 'Content')))));
// Content
$fields->removeFieldFromTab('Root.Content.Main', 'Content');
$fields->addFieldToTab('Root.Content', $profileContent = new Tab('Profile'), 'Metadata');
$fields->addFieldToTab('Root.Content', $regContent = new Tab('Registration'), 'Metadata');
$fields->addFieldToTab('Root.Content', $afterReg = new Tab('AfterRegistration'), 'Metadata');
$profileContent->setTitle(_t('MemberProfiles.PROFILE', 'Profile'));
$regContent->setTitle(_t('MemberProfiles.REGISTRATION', 'Registration'));
$afterReg->setTitle(_t('MemberProfiles.AFTERREG', 'After Registration'));
$tabs = array('Profile', 'Registration', 'AfterRegistration');
foreach ($tabs as $tab) {
$fields->addFieldsToTab("Root.Content.{$tab}", array(new TextField("{$tab}Title", _t('MemberProfiles.TITLE', 'Title')), new HtmlEditorField("{$tab}Content", _t('MemberProfiles.CONTENT', 'Content'))));
}
$fields->addFieldToTab('Root.Content.AfterRegistration', new CheckboxField('RegistrationRedirect', _t('MemberProfiles.REDIRECT_AFTER_REG', 'Redirect after registration?')), 'AfterRegistrationContent');
$fields->addFieldToTab('Root.Content.AfterRegistration', new TreeDropdownField('PostRegistrationTargetID', _t('MemberProfiles.REDIRECT_TARGET', 'Redirect to page'), 'SiteTree'), 'AfterRegistrationContent');
// Behaviour
$fields->addFieldToTab('Root.Behaviour', new HeaderField('ProfileBehaviour', _t('MemberProfiles.PROFILEBEHAVIOUR', 'Profile Behaviour')), 'ClassName');
$fields->addFieldToTab('Root.Behaviour', new CheckboxField('AllowRegistration', _t('MemberProfiles.ALLOWREG', 'Allow registration via this page')), 'ClassName');
$fields->addFieldToTab('Root.Behaviour', new CheckboxField('AllowProfileEditing', _t('MemberProfiles.ALLOWEDITING', 'Allow users to edit their own profile on this page')), 'ClassName');
$fields->addFieldToTab('Root.Behaviour', new CheckboxField('AllowAdding', _t('MemberProfiles.ALLOWADD', 'Allow members with member creation permissions to add members via this page')), 'ClassName');
$requireApproval = new CheckboxField('RequireApproval', _t('MemberProfiles.REQUIREREGAPPROVAL', 'Require registration approval by an administrator?'));
$fields->addFieldToTab('Root.Behaviour', $requireApproval, 'ClassName');
$approvalGroups = _t('MemberProfiles.NOTIFYTHESEGROUPS', 'Notify these groups to approve new registrations');
$approvalGroups = new TreeMultiselectField('ApprovalGroups', $approvalGroups, 'Group');
$fields->addFieldToTab('Root.Behaviour', $approvalGroups, 'ClassName');
$pageSettings = new HeaderField('PageSettingsHeader', _t('MemberProfiles.PAGEBEHAVIOUR', 'Page Behaviour'));
$fields->addFieldToTab('Root.Behaviour', $pageSettings, 'ClassName');
return $fields;
}
示例8: getCMSFields
public function getCMSFields()
{
$fields = new FieldList();
$fields->push(new TabSet("Root", $mainTab = new Tab("Main")));
$mainTab->setTitle(_t('SiteTree.TABMAIN', "Main"));
$fields->addFieldToTab('Root.Main', new TextField('Email', $this->fieldLabel('Email')));
$fields->addFieldsToTab('Root.Main', array(Object::create('TextField', 'Salutation', $this->fieldLabel('Salutation')), Object::create('TextField', 'FirstName', $this->fieldLabel('First Name')), Object::create('TextField', 'MiddleName', $this->fieldLabel('Middle Name')), Object::create('TextField', 'Surname', $this->fieldLabel('Surname'))));
if (!empty($this->ID)) {
$fields->addFieldToTab('Root.Main', Object::create('CheckboxSetField', 'MailingLists', $this->fieldLabel('MailingLists'), MailingList::get()->map('ID', 'FullTitle')));
}
$fields->addFieldsToTab('Root.Main', array(Object::create('ReadonlyField', 'BouncedCount', $this->fieldLabel('BouncedCount')), Object::create('CheckboxField', 'Verified', $this->fieldLabel('Verified'))->setDescription(_t('Newsletter.VerifiedDesc', 'Has this user verified his subscription?')), Object::create('CheckboxField', 'Blacklisted', $this->fieldLabel('Blacklisted'))->setDescription(_t('Newsletter.BlacklistedDesc', 'Excluded from emails, either by automated process or manually. ' . 'An invalid address or undeliverable email will eventually result in blacklisting.')), Object::create('ReadonlyField', 'ReceivedCount', $this->fieldLabel('ReceivedCount'))->setDescription(_t('Newsletter.ReceivedCountDesc', 'Number of emails sent without undeliverable errors. ' . 'Only one indication that an email has actually been received and read.'))));
$this->extend('updateCMSFields', $fields);
return $fields;
}
示例9: getCMSFields
public function getCMSFields()
{
$fields = FieldList::create();
$fields->push(TabSet::create('Root', $mainTab = new Tab('Main')));
$mainTab->setTitle(_t('SiteTree.TABMAIN', "Main"));
$sort = 'ParentID';
if ($this->has_extension('Sortable')) {
$sort .= ', SortOrder';
}
$source = Block::get()->exclude('ClassName', 'VirtualBlock')->sort($sort)->map('ID', 'FullTitle');
$fields->addFieldsToTab('Root.Main', array(ReadonlyField::create('Title', _t('Block.TITLE', 'Title'), $this->getTitle()), DropdownField::create('OriginalBlockID', _t('VirtualBlock.SELECT_ORIGINAL', 'Select original'), $source)));
$this->extend('updateCMSFields', $fields);
return $fields;
}
示例10: getCMSFields
/**
* Returns a FieldSet with which to create the CMS editing form.
* You can use the extend() method of FieldSet to create customised forms for your other
* data objects.
*
* @param Controller
* @return FieldSet
*/
function getCMSFields($controller = null)
{
$group = DataObject::get_by_id("Group", $this->Parent()->GroupID);
$sentReport = $this->renderWith("Newsletter_SentStatusReport");
$previewLink = Director::absoluteBaseURL() . 'admin/newsletter/preview/' . $this->ID;
$ret = new FieldSet(new TabSet("Root", $mailTab = new Tab(_t('Newsletter.NEWSLETTER', 'Newsletter'), new TextField("Subject", _t('Newsletter.SUBJECT', 'Subject'), $this->Subject), new HtmlEditorField("Content", _t('Newsletter.CONTENT', 'Content')), new LiteralField('PreviewNewsletter', "<p><a href=\"{$previewLink}\" target=\"_blank\">" . _t('PREVIEWNEWSLETTER', 'Preview this newsletter') . "</a></p>")), $sentToTab = new Tab(_t('Newsletter.SENTREPORT', 'Sent Status Report'), new LiteralField("SentStatusReport", $sentReport)), $tracked = new Tab('TrackedLinks', $trackedTable = new TableListField('TrackedLinks', 'Newsletter_TrackedLink', array('Original' => 'Link', 'Visits' => 'Visits'), '"NewsletterID" = ' . $this->ID, '"Visits" DESC'))));
$tracked->setTitle(_t('Newsletter.TRACKEDLINKS', 'Tracked Links'));
$trackedTable->setPermissions(array('show'));
if ($this->Status != 'Draft') {
$mailTab->push(new ReadonlyField("SentDate", _t('Newsletter.SENTAT', 'Sent at'), $this->SentDate));
}
$this->extend("updateCMSFields", $ret);
return $ret;
}
示例11: getCMSFields
public function getCMSFields()
{
$fields = FieldList::create();
$fields->push(TabSet::create('Root', $mainTab = new Tab('Main')));
$mainTab->setTitle(_t('SiteTree.TABMAIN', "Main"));
$blockList = Block::get()->exclude('ClassName', 'VirtualBlock');
// Apply the allowed blocks config to the virtual-block
$allowed = $this->Parent()->config()->get('allowed_blocks');
if (is_array($allowed)) {
$blockList = $blockList->filter(array('ClassName' => $allowed));
}
$source = $blockList->sort('ParentID, SortOrder')->map('ID', 'FullTitle');
$fields->addFieldsToTab('Root.Main', array(ReadonlyField::create('Title', _t('Block.TITLE', 'Title'), $this->getTitle()), DropdownField::create('OriginalBlockID', _t('VirtualBlock.SELECT_ORIGINAL', 'Select original'), $source)));
$this->extend('updateCMSFields', $fields);
return $fields;
}
示例12: getCMSFields
public function getCMSFields()
{
$fields = new FieldList();
$fields->push(new TabSet("Root", $mainTab = new Tab("Main")));
$mainTab->setTitle(_t('SiteTree.TABMAIN', "Main"));
$fields->addFieldToTab('Root.Main', new TextField('Title', _t('NewsletterAdmin.MailingListTitle', 'Mailing List Title')));
$gridFieldConfig = GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldSortableHeader(), $dataColumns = new GridFieldDataColumns(), new GridFieldFilterHeader(), new GridFieldDeleteAction(true), new GridFieldPaginator(30), new GridFieldAddNewButton(), new GridFieldDetailForm(), new GridFieldEditButton(), $autocompelete = new GridFieldAutocompleterWithFilter('before', array('FirstName', 'MiddleName', 'Surname', 'Email')));
$dataColumns->setFieldCasting(array("Blacklisted" => "Boolean->Nice", "Verified" => "Boolean->Nice"));
$autocompelete->filters = array("Blacklisted" => false);
$recipientsGrid = GridField::create('Recipients', _t('NewsletterAdmin.Recipients', 'Mailing list recipients'), $this->Recipients(), $gridFieldConfig);
$fields->addFieldToTab('Root.Main', new FieldGroup($recipientsGrid));
$this->extend("updateCMSFields", $fields);
if (!$this->ID) {
$fields->removeByName('Recipients');
}
return $fields;
}
示例13: getCMSFields
public function getCMSFields($params = null)
{
$fields = new FieldList();
// tabbed or untabbed
$fields->push(new TabSet("Root", $mainTab = new Tab("Main")));
$mainTab->setTitle(_t('SiteTree.TABMAIN', "Main"));
$reports = array();
$reportObjs = AdvancedReport::get()->filter(array('ReportID' => 0));
if ($reportObjs && $reportObjs->count()) {
foreach ($reportObjs as $obj) {
if ($obj instanceof CombinedReport) {
continue;
}
$reports[$obj->ID] = $obj->Title . '(' . $obj->ClassName . ')';
}
}
$fields->addFieldsToTab('Root.Main', array(new DropdownField('ReportID', 'Related report', $reports), new TextField('Title'), new KeyValueField('Parameters', 'Parameters to pass to the report'), new NumericField('Sort')));
return $fields;
}
示例14: getCMSFields
/**
* Get the fields that are sent to the CMS. In
* your extensions: updateCMSFields($fields)
*
* @return FieldList
*/
public function getCMSFields()
{
$groupsMap = array();
foreach (Group::get() as $group) {
// Listboxfield values are escaped, use ASCII char instead of »
$groupsMap[$group->ID] = $group->getBreadcrumbs(' > ');
}
asort($groupsMap);
$fields = new FieldList(new TabSet("Root", $tabMain = new Tab('Main', $titleField = new TextField("Title", _t('SiteConfig.SITETITLE', "Site title")), $taglineField = new TextField("Tagline", _t('SiteConfig.SITETAGLINE', "Site Tagline/Slogan")))), new HiddenField('ID'));
if (!Permission::check('EDIT_SITECONFIG')) {
$fields->makeFieldReadonly($taglineField);
$fields->makeFieldReadonly($titleField);
}
if (file_exists(BASE_PATH . '/install.php')) {
$fields->addFieldToTab("Root.Main", new LiteralField("InstallWarningHeader", "<p class=\"message warning\">" . _t("SiteTree.REMOVE_INSTALL_WARNING", "Warning: You should remove install.php from this SilverStripe install for security reasons.") . "</p>"), "Title");
}
$tabMain->setTitle(_t('SiteConfig.TABMAIN', "Main"));
$this->extend('updateCMSFields', $fields);
return $fields;
}
示例15: getCMSFields
function getCMSFields()
{
Requirements::javascript(FLICKR_EDIT_TOOLS_PATH . '/javascript/flickredit.js');
Requirements::css(FLICKR_EDIT_TOOLS_PATH . '/css/flickredit.css');
$fields = new FieldList();
$fields->push(new TabSet("Root", $mainTab = new Tab("Main")));
$mainTab->setTitle(_t('SiteTree.TABMAIN', "Main"));
$fields->addFieldToTab('Root.Main', new TextField('Title', 'Title'));
$fields->addFieldToTab('Root.Main', new TextAreaField('Description', 'Description'));
$fields->addFieldToTab('Root.Main', new TextField('ImageFooter', 'Text to be added to each image in this album when saving'));
$fields->addFieldToTab('Root.Main', new CheckBoxField('LockGeo', 'If the map positions were calculated by GPS, tick this to hide map editing features'));
$gridConfig = GridFieldConfig_RelationEditor::create();
// need to add sort order in many to many I think // ->addComponent( new GridFieldSortableRows( 'SortOrder' ) );
$gridConfig->getComponentByType('GridFieldAddExistingAutocompleter')->setSearchFields(array('Title', 'Description'));
$gridConfig->getComponentByType('GridFieldPaginator')->setItemsPerPage(100);
$gridField = new GridField("Flickr Photos", "List of Photos:", $this->FlickrPhotos(), $gridConfig);
$fields->addFieldToTab("Root.FlickrPhotos", $gridField);
$gridConfig2 = GridFieldConfig_RelationEditor::create();
$gridConfig2->getComponentByType('GridFieldAddExistingAutocompleter')->setSearchFields(array('Title', 'Description'));
$gridConfig2->getComponentByType('GridFieldPaginator')->setItemsPerPage(100);
$bucketsByDate = $this->FlickrBucketsByDate();
if ($bucketsByDate->count() > 0) {
$gridField2 = new GridField("Flickr Buckets", "List of Buckets:", $bucketsByDate, $gridConfig2);
$fields->addFieldToTab("Root.SavedBuckets", $gridField2);
}
$forTemplate = new ArrayData(array('Title' => $this->Title, 'ID' => $this->ID, 'FlickrPhotosNotInBucket' => $this->FlickrPhotosNotInBucket()));
$html = $forTemplate->renderWith('GridFieldFlickrBuckets');
$bucketTimeField = new NumericField('BucketTime');
// $fields->addFieldToTab( 'Root.Buckets', $bucketTimeField );
$lfImage = new LiteralField('BucketEdit', $html);
$fields->addFieldToTab('Root.Buckets', $lfImage);
$this->extend('updateCMSFields', $fields);
$fields->addFieldToTab('Root.Batch', new TextField('BatchTitle', 'Batch Title'));
$fields->addFieldToTab('Root.Batch', new TextAreaField('BatchDescription', 'Batch Description'));
$fields->addFieldToTab('Root.Batch', new TextAreaField('BatchTags', 'Batch Tags'));
$htmlBatch = "<p>Click on the batch update button to update the description and title of all of the images, and add tags to each image</p>";
$htmlBatch .= '<input type="button" id="batchUpdatePhotographs" value="Batch Update"></input>';
$lf = new LiteralField('BatchUpdate', $htmlBatch);
$fields->addFieldToTab('Root.Batch', $lf);
return $fields;
}