本文整理汇总了PHP中DropdownField::setRightTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP DropdownField::setRightTitle方法的具体用法?PHP DropdownField::setRightTitle怎么用?PHP DropdownField::setRightTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DropdownField
的用法示例。
在下文中一共展示了DropdownField::setRightTitle方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$cssFiles = new UploadField('CustomCSSFiles', _t('UserTemplatesExtension.CustomCSSFiles', "Custom CSS Files"));
$jsFiles = new UploadField('CustomJSFiles', _t('UserTemplatesExtension.CustomJSFiles', "Custom JS Files"));
$cssFiles->setFolderName(self::$css_folder);
$jsFiles->setFolderName(self::$js_folder);
$fields->removeByName('CustomCSSFiles');
$fields->removeByName('CustomJSFiles');
$templates = $this->fileBasedTemplates();
if (count($templates)) {
$fields->addFieldToTab('Root.Main', $dd = new DropdownField('ContentFile', _t('UserTemplatesExtension.CONTENT_FILE', 'File containing template'), $templates));
$dd->setRightTitle('If selected, any Content set above will be ignored');
} else {
$fields->removeByName('ContentFile');
}
$fields->push($strict = CheckboxField::create('StrictActions', _t('UserTemplates.STRICT_ACTIONS', 'Require actions to be explicitly overridden')));
$text = <<<DOC
When applied to a page type that has sub-actions, an action template will be used ONLY if the action is listed below, and this main
\t template will only be used for the 'index' action. If this is not checked, then this template will be used for ALL actions
\t in the page it is applied to.
DOC;
$strict->setRightTitle(_t('UserTemplates.STRICT_HELP', $text));
$templates = DataList::create('UserTemplate')->filter(array('ID:not' => $this->ID));
if ($templates->count()) {
$templates = $templates->map();
$fields->addFieldToTab('Root.Main', $kv = new KeyValueField('ActionTemplates', _t('UserTemplates.ACTION_TEMPLATES', 'Action specific templates'), array(), $templates));
$kv->setRightTitle(_t('UserTemplates.ACTION_TEMPLATES_HELP', 'Specify an action name and select another user defined template to handle a specific action. Only used for Layout templates'));
}
$fields->addFieldToTab('Root.Main', $cssFiles);
$fields->addFieldToTab('Root.Main', $jsFiles);
return $fields;
}
示例2: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$type = new DropdownField('EventType', _t('ScoutDistrict.Events.TYPE', 'Type'), array('section-meeting' => _t('ScoutDistrict.Enum.SECTIONMEETING', 'Section Meeting'), 'leaders-meeting' => _t('ScoutDistrict.Enum.LEADERSMEETING', 'Leaders Meeting'), 'activity' => _t('ScoutDistrict.Enum.ACTIVITY', 'Activity'), 'fundraising' => _t('ScoutDistrict.Enum.FUNDRAISING', 'Fundraising'), 'committee' => _t('ScoutDistrict.Enum.COMMITTEE', 'Committee'), 'camp' => _t('ScoutDistrict.Enum.CAMP', 'Camp'), 'group' => _t('ScoutDistrict.Enum.GROUP', 'Group'), 'district' => _t('ScoutDistrict.Enum.DISTRICT', 'District'), 'training' => _t('ScoutDistrict.Enum.TRAINING', 'Training'), 'other' => _t('ScoutDistrict.Enum.OTHER', 'Other')));
$type->setRightTitle(_t('ScoutDistrict.Events.TYPE_HELP', 'What Type of event is this'))->addExtraClass('help');
$location = new TextField('EventLocation', _t('ScoutDistrict.Events.LOCATION', 'Location'));
$location->setRightTitle(_t('ScoutDistrict.Events.LOCATION_HELP', 'Where is the event being held'))->addExtraClass('help');
$latitude = new TextField('EventLatitude', _t('ScoutDistrict.Events.LATITUDE', 'Latitude'));
$latitude->setRightTitle(_t('ScoutDistrict.Events.LATITUDE_HELP', 'Latitude of event Location'))->addExtraClass('help');
$longitude = new TextField('EventLongitude', _t('ScoutDistrict.Events.LONGITUDE', 'Longitude'));
$longitude->setRightTitle(_t('ScoutDistrict.Events.LONGITUDE_HELP', 'Longitude of event Location'))->addExtraClass('help');
$bookingDetails = new TextareaField('EventBookingDetails', _t('ScoutDistrict.Events.BOOKINGDETAILS', 'Booking Details'));
$bookingDetails->setRightTitle(_t('ScoutDistrict.Events.BOOKINGDETAILS_HELP', 'Details of how to book a place for the Event'))->addExtraClass('help');
$bookingURL = new TextField('EventBookingURL', _t('ScoutDistrict.Events.BOOKINGURL', 'Booking URL'));
$bookingURL->setRightTitle(_t('ScoutDistrict.Events.BOOKINGURL_HELP', 'The URL of an external site to book a place'))->addExtraClass('help');
$fields->addFieldsToTab('Root.Scouts', array($type, $location, $latitude, $longitude, $bookingDetails, $bookingURL));
$thumbnail = new UploadField('ThumbnailImage', _t('ScoutDistrict.Events.THUMBNAIL', 'Thumbnail Image'));
$thumbnail->setFolderName('event/thumbnail');
$thumbnail->setRightTitle(_t('ScoutDistrict.Events.THUMBNAIL_HELP', 'A small image for displaying in listing/aggregated content'))->addExtraClass('help');
$image = new UploadField('Image', _t('ScoutDistrict.Events.IMAGE', 'Image'));
$image->setFolderName('event/image');
$image->setRightTitle(_t('ScoutDistrict.Events.IMAGE_HELP', 'A Larger image for displaying in event header'))->addExtraClass('help');
$files = new UploadField('Files', _t('ScoutDistrict.Events.FILE', 'Files'));
$files->setFolderName('event/file');
$files->setRightTitle(_t('ScoutDistrict.Events.FILE_HELP', 'This can be a file containing information about the event or an application form, etc'))->addExtraClass('help');
$fields->addFieldsToTab('Root.Files', array($thumbnail, $image, $files));
return $fields;
}
开发者ID:helpfulrobot,项目名称:phpboyscout-silverstripe-scouts,代码行数:27,代码来源:ScoutCalenderEventExtension.php
示例3: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
/* -----------------------------------------
* Advanced
------------------------------------------*/
$fields->addFieldToTab('Root.Main', new HeaderField('', _t('PortfolioHolder.SettingsText', 'Settings')), 'Content');
$fields->addFieldToTab('Root.Main', $items = new TextField('Items', 'Items'), 'Content');
$items->setRightTitle('How many items to display on each page');
$fields->addFieldToTab('Root.Main', $columns = new DropdownField('Columns', 'Columns', array('One Item (Full Width)', 'Two Items', 'Three Items', 'Four Items')), 'Content');
$columns->setRightTitle('How many items to display on each row');
return $fields;
}
示例4: updateSolrCMSFields
public function updateSolrCMSFields(\FieldList $fields)
{
// geo spatial field stuff
$fields->addFieldToTab('Root.Main', $geoHeader = new HeaderField('GeoHeader', _t('SolrSearch.GEO_HEADER', 'Geospatial Settings')), 'Content');
$fields->addFieldToTab('Root.Main', new GeoCoordinateField('GeoCentre', _t('SolrSearch.GEO_CENTRE', 'Centre for geo restriction')), 'Content');
$geoFields = $this->getGeoSelectableFields();
$geoFields = array_merge(array('' => ''), $geoFields);
$fields->addFieldToTab('Root.Main', $geoField = new DropdownField('GeoRestrictionField', _t('SolrSearch.RESTRICT_BY', 'Geo field to restrict within radius'), $geoFields), 'Content');
$geoField->setRightTitle('Leave the geo field blank and no geospatial restriction will be used');
$fields->addFieldToTab('Root.Main', new NumericField('GeoRadius', _t('SolrSearch.RESTRICT_RADIUS', 'Restrict results within radius (in km)')), 'Content');
$distanceOpts = array('' => 'None', 'asc' => 'Nearest to furthest', 'desc' => 'Furthest to nearest');
$fields->addFieldToTab('Root.Main', new DropdownField('DistanceSort', _t('SolrSearch.SORT_BY_DISTANCE', 'Sort by distance from point'), $distanceOpts), 'Content');
}
示例5: getCMSFields
function getCMSFields()
{
$fields = FieldList::create(TabSet::create('Root'));
$fields->addFieldToTab('Root.Main', new HeaderField('Settings'));
$fields->addFieldToTab('Root.Main', new TextField('Title', _t('FileGroup.TitleLabel', 'Group Title')));
$fields->addFieldToTab('Root.Main', $panelClass = new DropdownField('PanelClass', _t('FileGroup.PanelClassLabel', 'Type'), array('panel-default' => 'Default', 'panel-primary' => 'Primary', 'panel-secondary' => 'Secondary', 'panel-info' => 'Info', 'panel-success' => 'Success', 'panel-warning' => 'Warning', 'panel-danger' => 'Danger')));
$panelClass->setRightTitle('Color of the group');
/* -----------------------------------------
* Files
------------------------------------------*/
$fields->addFieldToTab('Root.Main', new HeaderField('Files'));
$fields->addFieldToTab('Root.Main', $file = new UploadField('File', _t('FileGroup.FileLabel', 'Files for upload')));
$file->setFolderName('Uploads/files');
return $fields;
}
示例6: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main', $columns = new DropdownField('Columns', _t('FilePage.ColumnsLabel', 'Columns'), array('One Item (Full Width)', 'Two Items', 'Three Items', 'Four Items')), 'Content');
$columns->setRightTitle('How many groups to display on each row');
/* -----------------------------------------
* Groups
------------------------------------------*/
$config = GridFieldConfig_RelationEditor::create(10);
$config->addComponent(new GridFieldSortableRows('SortOrder'))->addComponent(new GridFieldDeleteAction());
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Title' => 'Title'));
$gridField = new GridField('FileGroups', 'File Groups', $this->owner->FileGroups(), $config);
$fields->addFieldToTab('Root.FileGroups', $gridField);
return $fields;
}
示例7: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
/* -----------------------------------------
* Settings
------------------------------------------*/
$fields->addFieldToTab('Root.Main', $columns = new DropdownField('Columns', _t('BlogHolder.ColumnsLabel', 'Columns'), array('One Item (Full Width)', 'Two Items', 'Three Items', 'Four Items')), 'Content');
$columns->setRightTitle('Items per row');
$fields->addFieldToTab('Root.Main', $items = new TextField('Items', _t('BlogHolder.ItemsLabel', 'Items')), 'Content');
$items->setRightTitle('Items displayed per page');
/* -----------------------------------------
* Blog Sidebar
------------------------------------------*/
$fields->addFieldToTab('Root.BlogSidebar', new HtmlEditorField('BlogSidebarContent', _t('BlogHolder.BlogSidebarLabel', 'Content For the Sidebar')));
return $fields;
}
示例8: getCMSFields
function getCMSFields()
{
$photoManager = new PhotoAlbumPage_Manager($this, "Photos", "PhotoAlbumPage_Photo", "Photo", array("Caption" => "Caption"), "getCMSFields_forPopup");
$photoManager->setUploadFolder(str_replace('assets/', '', $this->AssociatedFolder()->Filename));
$fields = parent::GetCMSFields();
$fields->addFieldToTab("Root.Content.Configuration", new NumericField('ThumbnailSize', 'Thumbnail size (pixels)'));
$fields->addFieldToTab("Root.Content.Configuration", new NumericField('NormalSize', 'Normal size (pixels)'));
$fields->addFieldToTab("Root.Content.Configuration", new NumericField('MediaPerPage', 'Number of images per page'));
$fields->addFieldToTab('Root.Content.AlbumPhotos', $photoManager);
$photos = DataObject::get("PhotoAlbumPage_Photo", "PhotoAlbumPageID = " . $this->ID);
if ($photos && $photos->Count() > 0) {
$coverPhotoField = new DropdownField('CoverImageID', 'Cover Photo', $photos->toDropdownMap('ID', 'Caption'));
$coverPhotoField->setRightTitle('Choose a photo that will be used in holder pages.');
$fields->addFieldToTab('Root.Content.Main', $coverPhotoField, 'Content');
}
return $fields;
}
示例9: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Gallery', new HeaderField('Settings'));
$fields->addFieldToTab('Root.Gallery', $columns = new DropdownField('Columns', _t('GalleryPage.ColumnsLabel', 'Columns'), array('One Item (Full Width)', 'Two Items', 'Three Items', 'Four Items', 'Six Items', 'Twelve Items')));
$columns->setRightTitle('How many items to display on each row');
$fields->addFieldToTab('Root.Gallery', $items = new TextField('Items', _t('GalleryPage.ItemsLabel', 'Items')));
$items->setRightTitle('How many items to display on each page');
$fields->addFieldToTab('Root.Gallery', new CheckboxField('NoMargin', 'Remove margin from between gallery items'));
/* -----------------------------------------
* Gallery Images
------------------------------------------*/
$fields->addFieldToTab('Root.Gallery', new HeaderField('Images'));
$fields->addFieldToTab('Root.Gallery', $images = new UploadField('Images', _t('GalleryPage.ImagesLabel', 'Images'), $this->owner->Images()));
$images->setFolderName('Uploads/gallery');
return $fields;
}
示例10: updateCMSFields
/**
* @param FieldList $fields
*/
public function updateCMSFields(FieldList $fields)
{
$fields->addFieldToTab('Root.YouTube', new TextField('YouTubeFeed_AppID', 'Application ID'));
$fields->addFieldToTab('Root.YouTube', new TextField('YouTubeFeed_AppSecret', 'Application Secret'));
if ($this->owner->YouTubeFeed_AppID && $this->owner->YouTubeFeed_AppSecret) {
$service = new YouTubeFeed();
if ($service->getIsAuthenticated()) {
// We have a valid access token
$fields->addFieldToTab('Root.YouTube', new LiteralField('YouTubeTabHeading', "<h2>YouTube has an active connection.</h2>"));
$fields->addFieldToTab('Root.YouTube', new CheckboxField('YouTubeFeed_AutoUpdate', 'Automatically fetch YouTube video information'));
if ($this->owner->YouTubeFeed_AutoUpdate) {
$fields->addFieldToTab('Root.YouTube', new NumericField('YouTubeFeed_UpdateInterval', 'Update interval'));
$fields->addFieldToTab('Root.YouTube', $updateIntervalUnitsField = new DropdownField('YouTubeFeed_UpdateIntervalUnit', ' ', singleton('SiteConfig')->dbObject('YouTubeFeed_UpdateIntervalUnit')->enumValues()));
$updateIntervalUnitsField->setRightTitle('This time period defines the minimum length of time between each request to YouTube to check for new or updated videos.');
}
} else {
// YouTube isn't connected -- provide auth link
$serviceURL = $service->getAuthURL();
$fields->addFieldToTab('Root.YouTube', new LiteralField('area', '<a href="' . $serviceURL . '" name="action_AuthenticateYouTube" value="Authenticate YouTube Application" class="action ss-ui-button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="Form_EditForm_action_AuthenticateYouTube" role="button" aria-disabled="false"><span class="ui-button-text">
Authenticate YouTube Application
</span></a>'));
}
}
}
示例11: getCMSFields
/**
*/
public function getCMSFields()
{
$cmsUsers = Member::mapInCMSGroups();
$fields = new FieldList(new TabSet('Root'));
$fields->addFieldToTab('Root.Main', new TextField('Title', _t('WorkflowDefinition.TITLE', 'Title')));
$fields->addFieldToTab('Root.Main', new TextareaField('Description', _t('WorkflowDefinition.DESCRIPTION', 'Description')));
if ($this->ID) {
$fields->addFieldToTab('Root.Main', new CheckboxSetField('Users', _t('WorkflowDefinition.USERS', 'Users'), $cmsUsers));
$fields->addFieldToTab('Root.Main', new TreeMultiselectField('Groups', _t('WorkflowDefinition.GROUPS', 'Groups'), 'Group'));
}
if (class_exists('AbstractQueuedJob')) {
$before = _t('WorkflowDefinition.SENDREMINDERDAYSBEFORE', 'Send reminder email after ');
$after = _t('WorkflowDefinition.SENDREMINDERDAYSAFTER', ' days without action.');
$fields->addFieldToTab('Root.Main', new FieldGroup(_t('WorkflowDefinition.REMINDEREMAIL', 'Reminder Email'), new LabelField('ReminderEmailBefore', $before), new NumericField('RemindDays', ''), new LabelField('ReminderEmailAfter', $after)));
}
if ($this->ID) {
if ($this->Template) {
$template = $this->workflowService->getNamedTemplate($this->Template);
$fields->addFieldToTab('Root.Main', new ReadonlyField('Template', _t('WorkflowDefinition.TEMPLATE_NAME', 'Source Template'), $this->Template));
$fields->addFieldToTab('Root.Main', new ReadonlyField('TemplateDesc', _t('WorkflowDefinition.TEMPLATE_INFO', 'Template Info'), $template ? $template->getDescription() : ''));
$fields->addFieldToTab('Root.Main', $tv = new ReadonlyField('TemplateVersion', _t('WorkflowDefinition:TEMPLATE_VERSION', 'Template Version')));
$tv->setRightTitle(sprintf(_t('WorkflowDefinition.LATEST_VERSION', 'Latest version is %s'), $template->getVersion()));
}
$fields->addFieldToTab('Root.Main', new WorkflowField('Workflow', _t('WorkflowDefinition.WORKFLOW', 'Workflow'), $this));
} else {
// add in the 'template' info
$templates = $this->workflowService->getTemplates();
if (is_array($templates)) {
$items = array('' => '');
foreach ($templates as $template) {
$items[$template->getName()] = $template->getName();
}
$templates = array_combine(array_keys($templates), array_keys($templates));
$fields->addFieldToTab('Root.Main', $dd = new DropdownField('Template', _t('WorkflowDefinition.CHOOSE_TEMPLATE', 'Choose template (optional)'), $items));
$dd->setRightTitle('If set, this workflow definition will be automatically updated if the template is changed');
}
$message = _t('WorkflowDefinition.ADDAFTERSAVING', 'You can add workflow steps after you save for the first time.');
$fields->addFieldToTab('Root.Main', new LiteralField('AddAfterSaving', "<p class='message notice'>{$message}</p>"));
}
if ($this->ID && Permission::check('VIEW_ACTIVE_WORKFLOWS')) {
$active = $this->Instances()->filter(array('WorkflowStatus' => array('Active', 'Paused')));
$active = new GridField('Active', 'Active Workflow Instances', $active, new GridFieldConfig_RecordEditor());
$active->getConfig()->removeComponentsByType('GridFieldAddNewButton');
$active->getConfig()->removeComponentsByType('GridFieldDeleteAction');
if (!Permission::check('REASSIGN_ACTIVE_WORKFLOWS')) {
$active->getConfig()->removeComponentsByType('GridFieldEditButton');
$active->getConfig()->addComponent(new GridFieldViewButton());
$active->getConfig()->addComponent(new GridFieldDetailForm());
}
$completed = $this->Instances()->filter(array('WorkflowStatus' => array('Complete', 'Cancelled')));
$config = new GridFieldConfig_Base();
$config->addComponent(new GridFieldEditButton());
$config->addComponent(new GridFieldDetailForm());
$completed = new GridField('Completed', 'Completed Workflow Instances', $completed, $config);
$fields->addFieldToTab('Root.Active', $active);
$fields->addFieldToTab('Root.Completed', $completed);
}
return $fields;
}
示例12: updateCMSFields
function updateCMSFields(FieldList $fields)
{
$fields->addFieldToTab('Root.Copy', $myDD = new DropdownField("AllowCopyingOfRecords", _t("CopyFactory.ALLOW_COPYING_OF_RECORDS", "Allow Copying of Records"), array(0 => _t("CopyFactory.NO_COPYING_AT_ALL", "Do not allow copying of records (default setting)"), 1 => _t("CopyFactory.DRY_RUN_ONLY", "Dry run only (not actual changes will be made)"), 2 => _t("CopyFactory.ALLOW_COPYING", "Allow copying of records (please use with care)"))));
$myDD->setRightTitle(_t("CopyFactory.TURN_IT_OFF", "It is recommended to turn on the ability to copy records only when required and to turn it off between copy sessions."));
return $fields;
}
示例13: getCountryField
/**
* put together a dropdown for the country field
*
* @param String $name - name of the field
* @return DropdownField
**/
protected function getCountryField($name)
{
$countriesForDropdown = EcommerceCountry::list_of_allowed_entries_for_dropdown();
$title = _t("OrderAddress." . strtoupper($name), "Country");
$countryField = new DropdownField($name, $title, $countriesForDropdown, EcommerceCountry::get_country());
$countryField->setRightTitle(_t("OrderAddress." . strtoupper($name) . "_RIGHT", ""));
if (count($countriesForDropdown) < 2) {
$countryField = $countryField->performReadonlyTransformation();
if (count($countriesForDropdown) < 1) {
$countryField = new HiddenField($name, '', "not available");
}
}
$prefix = EcommerceConfig::get("OrderAddress", "field_class_and_id_prefix");
$countryField->addExtraClass($prefix . 'ajaxCountryField');
//important, otherwise loadData will override the default value....
$this->{$name} = EcommerceCountry::get_country();
return $countryField;
}
示例14: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
if ($this->classHasAdvertisements($this->owner->ClassName)) {
$tabName = $this->MyTabName();
//advertisements shown...
$where = '1 = 1';
if ($this->owner->AdvertisementsFolderID) {
$images = Image::get()->filter("ParentID", $this->owner->AdvertisementsFolderID);
if ($images->count()) {
$where = "\"AdvertisementImageID\" IN (" . implode(",", $images->column("ID")) . ")";
} else {
$where = " 1 = 2";
}
}
//$advertisementsCount = DB::query("SELECT COUNT(ID) FROM \"Advertisement\" $whereDB ;")->value();
$advertisements = $this->owner->Advertisements()->where($where);
$txt = sprintf(_t("AdvertisementDecorator.ACTUAL", 'Current %1$s Shown'), Config::inst()->get("Advertisement", "plural_name"));
$fields->addFieldToTab($tabName, $this->MyHeaderField($txt));
$txt = sprintf(_t("AdvertisementDecorator.SELECT", 'Select %1$s to show ... '), Config::inst()->get("Advertisement", "plural_name"));
$advertisementsGridField = new GridField('Advertisements', $txt, $this->owner->Advertisements(), GridFieldConfig_RelationEditor::create());
$fields->addFieldToTab($tabName, $advertisementsGridField);
if (Config::inst()->get("Advertisement", "resize_images") == 'no') {
$totalSize = 0;
foreach ($this->owner->Advertisements() as $advertisement) {
$totalSize += $advertisement->AdvertisementImage()->getAbsoluteSize();
}
$seconds = round(($totalSize + 1) / 524288);
$fields->addFieldToTab($tabName, new LiteralField("TotalSize", '<p><em>Total download size: ' . File::format_size($totalSize) . ', good reception 3G network download time less than ~' . ($seconds + 1) . ' seconds.</em></p>'));
}
if (class_exists("DataObjectSorterController")) {
$shownAdvertisements = $this->owner->getManyManyComponents('Advertisements');
if ($shownAdvertisements) {
$array = $shownAdvertisements->column("ID");
$idString = implode(",", $array);
$link = DataObjectSorterController::popup_link("Advertisement", $filterField = "ID", $filterValue = $idString, $linkText = "sort " . Config::inst()->get("Advertisement", "plural_name"), $titleField = "FullTitle");
$fields->addFieldToTab($tabName, new LiteralField("AdvertisementsSorter", $link));
}
}
if ($advertisements->count()) {
} else {
$txt = sprintf(_t("AdvertisementDecorator.CREATE", '<p>Please <a href="admin/%1$s/">create %2$s</a> on the <a href="admin/%1$s/">%3$s tab</a> first, or see below on how to create %2$s from a folder.</p>'), Config::inst()->get("AdvertisementAdmin", "url_segment"), Config::inst()->get("Advertisement", "plural_name"), Config::inst()->get("AdvertisementAdmin", "menu_title"));
$fields->addFieldToTab($tabName, new LiteralField("AdvertisementsHowToCreate", $txt));
}
if ($parent = $this->advertisementParent()) {
$txt = sprintf(_t("AdvertisementDecorator.ORUSE", 'OR ... use %1$s from <i>%2$s</i>.'), Config::inst()->get("Advertisement", "plural_name"), $parent->Title);
$fields->addFieldToTab($tabName, new CheckboxField("UseParentAdvertisements", $txt));
}
//create new advertisements
$txt = sprintf(_t("AdvertisementDecorator.CREATE", 'Create new %1$s'), Config::inst()->get("Advertisement", "plural_name"));
$fields->addFieldToTab($tabName, $this->MyHeaderField($txt));
$txt = sprintf(_t("AdvertisementDecorator.CREATENEWFROMFOLDER_EXPLANATION", 'Create New %1$s from images in the folder selected - each image in the folder will be used to create a %3$s. %2$s'), Config::inst()->get("Advertisement", "plural_name"), Advertisement::recommended_image_size_statement(), Config::inst()->get("Advertisement", "singular_name"));
if (Folder::get()->count()) {
$fields->addFieldToTab($tabName, $treeDropdownField = new TreeDropdownField('AdvertisementsFolderID', _t("AdvertisementDecorator.CREATENEWFROMFOLDER", "Create from folder"), 'Folder'));
$treeDropdownField->setRightTitle($txt);
}
$styles = AdvertisementStyle::get();
if ($styles->count()) {
$fields->addFieldToTab($tabName, $this->MyHeaderField("Style"));
$list = $styles->map("ID", "Title", $emptyString = _t("AdvertisementDecorator.SELECTSTYLE", "--select style--"), $sortByTitle = true);
$fields->addFieldToTab($tabName, $selectStyleField = new DropdownField("AdvertisementStyleID", _t("AdvertisementDecorator.STYLECREATED", "Select style"), $list));
$selectStyleField->setRightTitle(_t("AdvertisementDecorator.STYLECREATED_EXPLANATION", "Styles are created by your developer"));
}
$txt = sprintf(_t("AdvertisementDecorator.EDIT", 'Edit %1$s'), Config::inst()->get("Advertisement", "plural_name"));
$fields->addFieldToTab($tabName, $this->MyHeaderField($txt));
$txt = sprintf(_t("AdvertisementDecorator.PLEASEMANAGEEXISTING", '<p>Please manage existing %1$s on the <a href="admin/%2$s/">%3$s tab</a>.</p>'), Config::inst()->get("Advertisement", "plural_name"), Config::inst()->get("AdvertisementAdmin", "url_segment"), Config::inst()->get("AdvertisementAdmin", "menu_title"));
$fields->addFieldToTab($tabName, new LiteralField("ManageAdvertisements", $txt));
$txt = sprintf(_t("AdvertisementDecorator.DELETE", 'Delete %1$s'), Config::inst()->get("Advertisement", "plural_name"));
$fields->addFieldToTab($tabName, $this->MyHeaderField($txt));
$page = SiteTree::get()->byID($this->owner->ID);
$txtRemove = sprintf(_t("AdvertisementDecorator.REMOVE", 'Remove all %1$s from this page (%1$s will not be deleted but are not longer associated with this page)'), Config::inst()->get("Advertisement", "plural_name"));
$txtConfirmRemove = sprintf(_t("AdvertisementDecorator.CONFIRMREMOVE", 'Are you sure you want to remove all %1$s from this page?'), Config::inst()->get("Advertisement", "plural_name"));
$removeallLink = 'advertisements/removealladvertisements/' . $this->owner->ID . '/';
$jquery = 'if(confirm(\'' . $txtConfirmRemove . '\')) {jQuery(\'#removealladvertisements\').load(\'' . $removeallLink . '\');} return false;';
$fields->addFieldToTab($tabName, new LiteralField("removealladvertisements", '<p class="message warning"><a href="' . $removeallLink . '" onclick="' . $jquery . '" id="removealladvertisements" class="ss-ui-button">' . $txtRemove . '</a></p>'));
$txtDelete = sprintf(_t("AdvertisementDecorator.DELETE", 'Delete all %1$s from this website (but not the images associated with them)'), Config::inst()->get("Advertisement", "plural_name"));
$txtConfirmDelete = sprintf(_t("AdvertisementDecorator.CONFIRMDELETE", 'Are you sure you want to delete all %1$s - there is no UNDO?'), Config::inst()->get("Advertisement", "plural_name"));
$deleteallLink = 'advertisements/deletealladvertisements/' . $this->owner->ID . '/';
$jquery = 'if(confirm(\'' . $txtConfirmDelete . '\')) {jQuery(\'#deletealladvertisements\').load(\'' . $deleteallLink . '\');} return false;';
$fields->addFieldToTab($tabName, new LiteralField("deletealladvertisements", '<p class="message bad"><a href="' . $deleteallLink . '" onclick="' . $jquery . '" id="deletealladvertisements" class="ss-ui-button">' . $txtDelete . '</a></p>'));
}
return $fields;
}