本文整理汇总了PHP中UploadField::setAllowedMaxFileNumber方法的典型用法代码示例。如果您正苦于以下问题:PHP UploadField::setAllowedMaxFileNumber方法的具体用法?PHP UploadField::setAllowedMaxFileNumber怎么用?PHP UploadField::setAllowedMaxFileNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UploadField
的用法示例。
在下文中一共展示了UploadField::setAllowedMaxFileNumber方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUploadForm
public static function getUploadForm($file, $parentClass, $parentId, $parentField)
{
if ($file instanceof File && class_exists($parentClass) && is_subclass_of($parentClass, "DataObject")) {
$parent = $parentClass::get()->byId($parentId);
$fields = new FieldList($uploadField = new UploadField($parentField, 'Upload', $parent));
$uploadField->setCanAttachExisting(false);
// Block access to Silverstripe assets library
$uploadField->setCanPreviewFolder(false);
// Don't show target filesystem folder on upload field
$uploadField->relationAutoSetting = false;
// Prevents the form thinking the GalleryPage is the underlying object
$uploadField->setFolderName('Address Book');
$uploadField->setAllowedMaxFileNumber(1);
if ($file instanceof Image) {
$uploadField->setAllowedFileCategories('image');
}
$actions = new FieldList(new FormAction('submit', 'Save'));
$from = new Form(Controller::curr(), 'feFileUploadForm', $fields, $actions, null);
$urlParams = array('feclass' => $parentClass, 'fefield' => $parentField, 'feid' => $parentId, 'filesUpload' => true, 'fefileid' => $file->ID, 'fefileclass' => $file->ClassName);
// feclass: parentClass,
// fefield: parentField,
// feid: parentId,
// feisUpload: true,
// value: "{feclass: " + objClass + ",feid: " + objId + "}"
// echo http_build_query($urlParams) . "\n";
$from->setFormAction('home/feFileUploadForm?' . http_build_query($urlParams));
return $from;
}
}
示例2: getCMSFields
public function getCMSFields()
{
$ScrollDirectionOptions = array("up", "down", "left", "right");
$ScrollEasingOptions = array("Elastic", "Linear");
$ScrollFx = array("none", "scroll", "directscroll", "fade", "crossfade", "cover", "cover-fade", "uncover", "uncover-fade");
$GenAlignment = array("Left", "Center", "Right");
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Photos', $uploadField = new UploadField($name = 'Images', $title = 'Upload one or more images (max 10 at a time)'));
$fields->addFieldToTab('Root.Settings.General', new CheckBoxField('GenAutoStart', 'Auto Start Carousel?'));
$fields->addFieldToTab('Root.Settings.General', new CheckBoxField('GenCarouselCircular', 'Make Carousel Circular?'));
$fields->addFieldToTab('Root.Settings.General', new CheckBoxField('GenCarouselInfinite', 'Make Carousel Infinite?'));
$fields->addFieldToTab('Root.Settings.General', new NumericField('GenItemNumberToStart', 'Which item should start carousel (0 for random)'));
$fields->addFieldToTab('Root.Settings.General', new NumericField('GenDurationBeforeStart', 'Delay before carousel scrolls for first time (millisec)'));
$fields->addFieldToTab('Root.Settings.General', new NumericField('GenItemsMin', 'Items Viewable Minimum'));
$fields->addFieldToTab('Root.Settings.General', new NumericField('GenItemsMax', 'Items Viewable Maximum'));
$fields->addFieldToTab('Root.Settings.General', new NumericField('GenItemWidth', 'Set image width (use 0 for no scaling)'));
$fields->addFieldToTab('Root.Settings.General', new NumericField('GenItemHeight', 'Set image Height (use 0 for no scaling)'));
$fields->addFieldToTab('Root.Settings.General', new DropDownField("GenAlignment", "Slide Alignment?", $GenAlignment));
$fields->addFieldToTab('Root.Settings.Scroll', new DropDownField("ScrollDirection", "What direction to move the carousel?", $ScrollDirectionOptions));
$fields->addFieldToTab('Root.Settings.Scroll', new DropDownField("ScrollFx", "Slide Transition type?", $ScrollFx));
$fields->addFieldToTab('Root.Settings.Scroll', new DropDownField("ScrollEasing", "Slide Easing Option", $ScrollEasingOptions));
$fields->addFieldToTab('Root.Settings.Scroll', new NumericField('ScrollNumItems', 'Scroll number of items (0 will scroll none)'));
$fields->addFieldToTab('Root.Settings.Scroll', new NumericField('ScrollDuration', 'Scroll Duration Time (millisec)'));
$fields->addFieldToTab('Root.Settings.Scroll', new CheckBoxField('ScrollPauseOnHover', 'Pause the scrolling when mouse is hovering?'));
$fields->addFieldToTab('Root.Settings.Swipe', new CheckBoxField('SwipeOnMouse', 'scroll via dragging (on non-touch-devices only)'));
$fields->addFieldToTab('Root.Settings.Swipe', new CheckBoxField('SwipeOnTouch', 'scroll via swiping gestures (on touch-devices only)'));
$uploadField->setFolderName('slides');
$uploadField->setAllowedMaxFileNumber(10);
return $fields;
}
示例3: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main', new HTMLEditorField('VisaInformation', 'Visa Information'));
$fields->addFieldToTab('Root.Main', new HTMLEditorField('TravelSupport', 'Travel Support'));
$fields->addFieldToTab('Root.CityInfo', new HTMLEditorField('CityIntro', 'City Intro'));
$fields->addFieldToTab('Root.CityInfo', new HTMLEditorField('AboutTheCity', 'About The City'));
$fields->addFieldToTab('Root.CityInfo', new HTMLEditorField('Locals', 'In The Words Of The Locals'));
$fields->addFieldToTab('Root.CityInfo', new HTMLEditorField('GettingAround', 'Getting Around'));
$fields->addFieldsToTab('Root.CityInfo', new TextField('HostCityLat', 'City Latitude (Map Center)'));
$fields->addFieldsToTab('Root.CityInfo', new TextField('HostCityLng', 'City Longitude (Map Center)'));
$fields->addFieldToTab('Root.MapLocations', new HTMLEditorField('LocationsTextHeader', 'Intro Text'));
$fields->addFieldToTab('Root.MapLocations', new HTMLEditorField('OtherLocations', 'Other Locations'));
if ($this->ID) {
// Summit Question Categories
$fields->addFieldsToTab('Root.Main', $venue_back = new UploadField('VenueBackgroundImage', 'Venue Background Image'));
$venue_back->setFolderName('summits/locations');
$venue_back->setAllowedMaxFileNumber(1);
$venue_back->setAllowedFileCategories('image');
$fields->addFieldsToTab('Root.Main', new TextField('VenueBackgroundImageHero', 'Venue Background Image Author'));
$fields->addFieldsToTab('Root.Main', new TextField('VenueBackgroundImageHeroSource', 'Venue Background Image Author Url'));
$fields->addFieldsToTab('Root.CityInfo', $about_back = new UploadField('AboutTheCityBackgroundImage', 'About The City Background Image'));
$about_back->setFolderName('summits/location/about');
$about_back->setAllowedMaxFileNumber(1);
$about_back->setAllowedFileCategories('image');
$fields->addFieldsToTab('Root.CityInfo', new TextField('AboutTheCityBackgroundImageHero', 'About The City Background Image Author'));
$fields->addFieldsToTab('Root.CityInfo', new TextField('AboutTheCityBackgroundImageHeroSource', 'About The City Background Image Author Source Url'));
}
$fields->addFieldToTab('Root.Main', new TextField('VenueTitleText', 'Venue Title Text'));
$fields->addFieldToTab('Root.Main', new TextField('AirportsTitle', 'Airports Title'));
$fields->addFieldToTab('Root.Main', new TextField('AirportsSubTitle', 'Airports SubTitle'));
$fields->addFieldToTab('Root.Main', new TextField('CampusGraphic', 'URL of image of campus graphic'));
return $fields;
}
示例4: getCMSFields
public function getCMSFields()
{
$f = parent::getCMSFields();
$f->addFieldToTab('Root.Main', new TextField('Link', 'Slide Link'));
$f->addFieldToTab('Root.Main', $upload = new UploadField('Slide', 'Slide File'));
$upload->setAllowedMaxFileNumber(1);
return $f;
}
示例5: getCMSFields
public function getCMSFields()
{
$fields = new FieldList();
$fields->add($upload_0 = new UploadField('Image', 'Photo'));
$upload_0->setFolderName('summits/overview/networking');
$upload_0->setAllowedMaxFileNumber(1);
$upload_0->setAllowedFileCategories('image');
return $fields;
}
示例6: getCMSFields
/**
* @return FieldList
*/
public function getCMSFields()
{
$f = parent::getCMSFields();
$f->addFieldToTab('Root.Main', new TextField('Link', 'Slide Link'));
$f->addFieldToTab('Root.Main', $upload_field = new UploadField('Slide', 'Slide File'));
$upload_field->setAllowedMaxFileNumber(1);
$upload_field->getValidator()->setAllowedMaxFileSize(array('*' => 5 * 1024 * 1024));
$upload_field->setFolderName(sprintf('summits/%s/presentations/%s/slides/', $_REQUEST['SummitID'], $_REQUEST['SummitEventID']));
return $f;
}
示例7: getCMSFields
public function getCMSFields()
{
$f = new FieldList();
$f->add(new TextField('Title', 'Title'));
$image = new UploadField('Image', 'Pic');
$image->setAllowedMaxFileNumber(1);
$image->setFolderName(sprintf('summits/%s/highlights/pics', $this->SummitHighlightsPage()->SummitID));
$f->add($image);
$f->add(new HiddenField('SummitHighlightsPageID', 'SummitHighlightsPageID'));
return $f;
}
示例8: getCMSFields
public function getCMSFields()
{
$f = parent::getCMSFields();
//current summit
$f->removeByName('Content');
$f->addFieldToTab('Root.CurrentSummit', new HtmlEditorField('ThankYouText', 'ThankYouText'));
$f->addFieldToTab('Root.CurrentSummit', new TextField('CurrentSummitFlickrUrl', 'Flickr Url'));
$image = new UploadField('CurrentSummitBackgroundImage', 'Background Image');
$image->setAllowedMaxFileNumber(1);
$image->setFolderName(sprintf('summits/%s/highlights/', $this->SummitID));
$f->addFieldToTab('Root.CurrentSummit', $image);
// statistics
$f->addFieldToTab('Root.Statistics', new TextField('AttendanceQty', 'Attendance Qty'));
$f->addFieldToTab('Root.Statistics', new TextField('CompaniesRepresentedQty', 'Companies Represented Qty'));
$f->addFieldToTab('Root.Statistics', new TextField('CountriesRepresentedQty', 'Countries Represented Qty'));
$f->addFieldToTab('Root.Statistics', new TextField('StatisticsVideoUrl', 'Video Url'));
$file = new UploadField('StatisticsVideo', 'Video');
$file->setAllowedMaxFileNumber(1);
$file->setAllowedExtensions(array('mp4'));
$file->setFolderName(sprintf('summits/%s/highlights/statistics', $this->SummitID));
$f->addFieldToTab('Root.Statistics', $file);
$image = new UploadField('StatisticsVideoPoster', 'Video Poster');
$image->setAllowedMaxFileNumber(1);
$image->setFolderName(sprintf('summits/%s/highlights/statistics', $this->SummitID));
$f->addFieldToTab('Root.Statistics', $image);
// next summit
$f->addFieldToTab('Root.NextSummit', new HtmlEditorField('NextSummitText', 'Next Summit Text'));
$dropdown = DropdownField::create('NextSummitBackgroundImageID', 'Please choose an image for this page', SummitImage::get()->map("ID", "Title", "Please Select"))->setEmptyString('(None)');
$f->addFieldToTab('Root.NextSummit', $dropdown);
$image = new UploadField('NextSummitTinyBackgroundImage', 'Promo Background Image');
$image->setAllowedMaxFileNumber(1);
$image->setFolderName(sprintf('summits/%s/highlights/next_summit/', $this->SummitID));
$f->addFieldToTab('Root.NextSummit', $image);
// release
$f->addFieldToTab('Root.ReleaseAnnounced', new TextField('ReleaseAnnouncedTitle', 'Title'));
$f->addFieldToTab('Root.ReleaseAnnounced', new HtmlEditorField('ReleaseAnnouncedDescription', 'Description'));
$f->addFieldToTab('Root.ReleaseAnnounced', new TextField('ReleaseAnnouncedButtonTitle', 'Button Text'));
$f->addFieldToTab('Root.ReleaseAnnounced', new TextField('ReleaseAnnouncedButtonLink', 'Button Link'));
$release_image = new UploadField('ReleaseAnnouncedImage', 'Image');
$release_image->setAllowedMaxFileNumber(1);
$release_image->setFolderName(sprintf('summits/%s/highlights/release/', $this->SummitID));
$f->addFieldToTab('Root.ReleaseAnnounced', $release_image);
if ($this->ID > 0) {
$config = GridFieldConfig_RecordEditor::create();
$config->addComponent($sort = new GridFieldSortableRows('Order'));
$gridField = new GridField('KeynotesImages', 'KeynotesImages', $this->KeynotesImages(), $config);
$f->addFieldToTab('Root.KeyNotesImages', $gridField);
$config = GridFieldConfig_RecordEditor::create();
$config->addComponent($sort = new GridFieldSortableRows('Order'));
$gridField = new GridField('Pics', 'Pics', $this->Pics(), $config);
$f->addFieldToTab('Root.Pics', $gridField);
}
return $f;
}
示例9: getCMSFields
public function getCMSFields()
{
$f = parent::getCMSFields();
$f->removeByName('Picture');
$map_field = new UploadField('Picture', 'Map');
$map_field->setAllowedMaxFileNumber(1);
$map_field->setFolderName(sprintf('summits/%s/locations/%s/maps/', $_REQUEST['SummitID'], $_REQUEST['LocationID']));
$map_field->getValidator()->setAllowedMaxFileSize(array('*' => 500 * 1024));
$f->add($map_field);
return $f;
}
示例10: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$tab = 'Root.Main';
$tab = 'Root.Examples';
$field = new UploadField('Image');
$field->setAllowedMaxFileNumber(1);
$field->getValidator()->setAllowedMaxFileSize(4 * 1024 * 1024);
$field->setFolderName('Uploads/10-image-setwidth/');
$fields->addFieldToTab($tab, $field);
return $fields;
}
示例11: getCMSFields
public function getCMSFields()
{
$f = new FieldList();
$f->add(new TextField('Name', 'Name'));
$f->add(new HtmlEditorField('Description', 'Description'));
$map_field = new UploadField('Map', 'Map');
$map_field->setAllowedMaxFileNumber(1);
$map_field->setFolderName(sprintf('summits/%s/locations/maps/', $this->Location()->SummitID));
$f->add($map_field);
$f->add(new HiddenField('LocationID', 'LocationID'));
return $f;
}
示例12: getCMSFields
public function getCMSFields()
{
$f = parent::getCMSFields();
$map_field = new UploadField('Map', 'Map');
$map_field->setAllowedMaxFileNumber(1);
$map_field->setFolderName(sprintf('summits/%s/locations/venues/maps/', $this->SummitID));
$f->addFieldToTab('Root.Main', $map_field);
$config = GridFieldConfig_RecordEditor::create();
$gridField = new GridField('Rooms', 'Rooms', $this->Rooms(), $config);
$f->addFieldToTab('Root.Rooms', $gridField);
return $f;
}
示例13: getCMSFields
public function getCMSFields()
{
$f = new FieldList();
$f->add(new TextField('Name', 'Name'));
$f->add(new HtmlEditorField('Description', 'Description'));
$map_field = new UploadField('Picture', 'Picture');
$map_field->setAllowedMaxFileNumber(1);
$map_field->setFolderName(sprintf('summits/%s/locations/%s/images/', $_REQUEST['SummitID'], $_REQUEST['LocationID']));
$map_field->getValidator()->setAllowedMaxFileSize(array('*' => 500 * 1024));
$f->add($map_field);
$f->add(new HiddenField('LocationID', 'LocationID'));
return $f;
}
示例14: getCMSFields
function getCMSFields()
{
$f = parent::getCMSFields();
$f->removeByName(array('SortOrder', 'Image'));
$f->removeByName('SortOrder');
$f->addFieldsToTab('Root.Main', HtmlEditorField::create("Description")->setRows(15));
$f->addFieldsToTab('Root.Image', $HeroImage = new UploadField('Image', 'Please upload a Hero image <span>(max. 1 files)</span>'));
$HeroImage->setAllowedFileCategories('image');
$HeroImage->setAllowedMaxFileNumber(1);
$HeroImage->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
$HeroImage->setConfig('allowedMaxFileNumber', 1);
$HeroImage->setFolderName('Uploads/Distributors/' . $this->URLSegment);
return $f;
}
示例15: getCMSFields
function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main', new DropdownField('Size', 'Icon size:', singleton('WebAppIcon')->dbObject('Size')->enumValues()));
$fields->addFieldToTab('Root.Main', $uploadField = new UploadField($name = 'Image', $title = 'Upload a App Icon'));
$uploadField->setAllowedMaxFileNumber(1);
$uploadField->setFolderName('appicons');
$uploadField->setAllowedExtensions(array('png'));
$sizeMB = 1;
$size = $sizeMB * 1024 * 1024;
$uploadField->getValidator()->setAllowedMaxFileSize($size);
// hide the settings field
$fields->removeByName('WebAppConfigID');
return $fields;
}