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


PHP UploadField::setAllowedFileCategories方法代码示例

本文整理汇总了PHP中UploadField::setAllowedFileCategories方法的典型用法代码示例。如果您正苦于以下问题:PHP UploadField::setAllowedFileCategories方法的具体用法?PHP UploadField::setAllowedFileCategories怎么用?PHP UploadField::setAllowedFileCategories使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UploadField的用法示例。


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

示例1: 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;
 }
开发者ID:rbowen,项目名称:openstack-org,代码行数:34,代码来源:SummitLocationPage.php

示例2: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     // Main
     $fields->addFieldToTab('Root.Main', $gaCode = new TextField('GACode', 'Google Analytics account'));
     $gaCode->setRightTitle('Account number to be used all across the site (in the format <strong>UA-XXXXX-X</strong>)');
     $fields->addFieldToTab('Root.Main', $showTitle = new CheckboxField('ShowTitleInHeader', 'Show title in header'), 'Tagline');
     /* @var $logoField UploadField */
     $logoField = new UploadField('Logo', 'Large logo, to appear in the header.');
     $logoField->setAllowedFileCategories('image');
     $logoField->setConfig('allowedMaxFileNumber', 1);
     $mobileLogoField = new UploadField('LogoMobile', 'Mobile logo, to appear in the header.');
     $mobileLogoField->setAllowedFileCategories('image');
     $mobileLogoField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Main', $logoField);
     $fields->addFieldToTab('Root.Main', $this->getLogoOffSetField());
     $fields->addFieldToTab('Root.Main', $mobileLogoField);
     $fields->addFieldToTab('Root.Main', $this->getMobileLogoOffSetField());
     //Footer
     $fields->addFieldToTab('Root.Footer', $footerLogoField = new UploadField('FooterLogo', 'Footer logo, to appear in the bottom right.'));
     $footerLogoField->setAllowedFileCategories('image');
     $footerLogoField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Footer', $footerLink = new TextField('FooterLogoLink', 'Footer Logo link'));
     $footerLink->setRightTitle('Please include the protocol (ie, http:// or https://) unless it is an internal link.');
     $fields->addFieldToTab('Root.Footer', new TextField('FooterLogoDescription', 'Footer Logo description'));
     $fields->addFieldToTab('Root.Footer', new TreeMultiselectField('FooterLinks', 'Footer Links', 'SiteTree'));
     $fields->addFieldToTab('Root.Footer', new TextField('Copyright', 'Copyright'));
 }
开发者ID:guru-digital,项目名称:gdm-ss-express,代码行数:27,代码来源:SSGDMExpressSiteConfig.php

示例3: getCMSFields

 function getCMSFields()
 {
     $_REQUEST["CompanyId"] = $this->ID;
     $large_logo = new UploadField('BigLogo', 'Large Company Logo');
     $large_logo->setFolderName('companies/main_logo');
     $large_logo->setAllowedFileCategories('image');
     $small_logo = new UploadField('Logo', 'Small Company Logo');
     $small_logo->setAllowedFileCategories('image');
     //logo validation rules
     $large_logo_validator = new Upload_Image_Validator();
     $large_logo_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg'));
     $large_logo_validator->setAllowedMaxImageWidth(500);
     $large_logo->setValidator($large_logo_validator);
     $small_logo_validator = new Upload_Image_Validator();
     $small_logo_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg'));
     $small_logo_validator->setAllowedMaxImageWidth(200);
     $small_logo->setValidator($small_logo_validator);
     $fields = new FieldList(new TabSet($name = "Root", new Tab($title = 'Company', new HeaderField("Company Data"), new TextField('Name', 'Company Name'), new TextField('URLSegment', 'Unique page name for this company profile (ie: company-name)'), new TextField('URL', 'Company Web Address (URL)'), $level = new DropDownField('MemberLevel', 'OpenStack Foundation Member Level', $this->dbObject('MemberLevel')->enumValues()), new ColorField("Color", "Company Color"), new CheckboxField('DisplayOnSite', 'List this company on openstack.org'), new CheckboxField('Featured', 'Include this company in featured companies area'), new LiteralField('Break', '<hr/>'), $this->canEditLogo() ? $large_logo : new LiteralField('Space', '<br/>'), $this->canEditLogo() ? $small_logo : new LiteralField('Space', '<br/>'), new TextField('Industry', 'Industry (<4 Words)'), new HtmlEditorField('Description', 'Company Description'), new HtmlEditorField('Contributions', 'How you are contributing to OpenStack (<150 words)'), new HtmlEditorField('Products', 'Products/Services Related to OpenStack (<100 words)'), new HtmlEditorField('Overview', 'Company Overview'), new TextField('CommitmentAuthor', 'Commitment Author (Optional)'), new HtmlEditorField('Commitment', "OpenStack Commitment"), new LiteralField('Break', '<hr/>'), new TextField('ContactEmail', 'Best Contact email address (optional)'))));
     $level->setEmptyString('-- Choose One --');
     if ($this->ID > 0) {
         $admin_list = $this->Administrators()->sort('ID');
         $query = $admin_list->dataQuery();
         $query->groupby('MemberID');
         $admin_list = $admin_list->setDataQuery($query);
         $config = GridFieldConfig_RelationEditor::create();
         $config->removeComponentsByType('GridFieldEditButton');
         $config->removeComponentsByType('GridFieldAddNewButton');
         $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('FirstName' => 'First Name', 'Surname' => 'Last Name', 'Email' => 'Email', 'DDLAdminSecurityGroup' => 'Security Group'));
         $admins = new GridField('Administrators', 'Company Administrators', $admin_list, $config);
         $contracts = new GridField("Contracts", "Contracts", $this->Contracts(), GridFieldConfig_RecordEditor::create(10));
         $fields->addFieldsToTab('Root.Administrators', array(new HeaderField("Companies Administrators"), $admins));
         $fields->addFieldsToTab('Root.Contracts', array(new HeaderField("Companies Contracts"), $contracts));
     }
     return $fields;
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:35,代码来源:Company.php

示例4: scaffoldFormField

 public function scaffoldFormField($title = null, $params = null)
 {
     if (empty($this->object)) {
         return null;
     }
     $relationName = substr($this->name, 0, -2);
     $hasOneClass = $this->object->hasOneComponent($relationName);
     if (empty($hasOneClass)) {
         return null;
     }
     $hasOneSingleton = singleton($hasOneClass);
     if ($hasOneSingleton instanceof File) {
         $field = new UploadField($relationName, $title);
         if ($hasOneSingleton instanceof Image) {
             $field->setAllowedFileCategories('image/supported');
         }
         return $field;
     }
     // Build selector / numeric field
     $titleField = $hasOneSingleton->hasField('Title') ? "Title" : "Name";
     $list = DataList::create($hasOneClass);
     // Don't scaffold a dropdown for large tables, as making the list concrete
     // might exceed the available PHP memory in creating too many DataObject instances
     if ($list->count() < 100) {
         $field = new DropdownField($this->name, $title, $list->map('ID', $titleField));
         $field->setEmptyString(' ');
     } else {
         $field = new NumericField($this->name, $title);
     }
     return $field;
 }
开发者ID:ivoba,项目名称:silverstripe-framework,代码行数:31,代码来源:ForeignKey.php

示例5: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Main', $image = new UploadField('ProductImage', 'Upload an image to use for this product (max 1 in total)'), 'Price');
     $image->setFolderName('products');
     $image->setAllowedFileCategories('image');
     return $fields;
 }
开发者ID:brettt89,项目名称:discombobulation,代码行数:8,代码来源:Product.php

示例6: getCMSFields

 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Image Upload', $uploadHeroField = new UploadField('BackgroundImage', 'Please upload an image to be used as the Background Image for your Text Slice.'));
     $uploadHeroField->setFolderName('TextSlice');
     $uploadHeroField->setAllowedFileCategories('image');
     return $fields;
 }
开发者ID:PsukheDelos,项目名称:pocketwatch,代码行数:8,代码来源:TextSlice.php

示例7: 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;
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:9,代码来源:SummitNetworkingPhoto.php

示例8: getCMSFields

 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName('SortID');
     $fields->removeByName('GalleryAlbum');
     $fields->addFieldToTab('Root.Main', $uploadField = new UploadField('GalleryImage', 'Please upload an image to showcase in your gallery.'));
     //        $uploadField->setFolderName('Gallery/' .  $this->Gallery()->Title());
     //        $album = $this->GalleryAlbum()->Title();
     $uploadField->setFolderName('Gallery');
     $uploadField->setAllowedFileCategories('image');
     return $fields;
 }
开发者ID:PsukheDelos,项目名称:pocketwatch,代码行数:12,代码来源:GalleryItem.php

示例9: getCMSFields

 public function getCMSFields()
 {
     $fields = new FieldList();
     $image_field = new UploadField("Image", "Staff Image");
     $image_field->setAllowedFileCategories('image');
     $fields->push(new TextField('Name', 'Staff Name'));
     $fields->push(new TextField('Title', 'Staff Title'));
     $fields->push($image_field);
     $fields->push(new TextField('Caption', 'Inside Picture Caption'));
     $fields->push(new HTMLEditorField('Bio', 'Staff Bio'));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:iqnection-pages-staffpage,代码行数:13,代码来源:StaffPage.php

示例10: 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;
 }
开发者ID:helpfulrobot,项目名称:chitosystems-silverstripe-distributor-map,代码行数:14,代码来源:Distributor.php

示例11: getCMSFields

 public function getCMSFields()
 {
     $fields = new FieldList();
     $image = new UploadField('Thumbnail', 'Thumbnail');
     $image->setFolderName('marketing');
     $image->setAllowedFileCategories('image');
     $doc = new UploadField('Doc', 'Doc');
     $doc->setFolderName('marketing');
     $doc->getValidator()->setAllowedMaxFileSize(40 * 1024 * 1024);
     $fields->push(new TextField('Label'));
     $fields->push(new TextField('SortOrder'));
     $fields->push($doc);
     $fields->push($image);
     return $fields;
 }
开发者ID:hogepodge,项目名称:openstack-org,代码行数:15,代码来源:MarketingDoc.php

示例12: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $fields->addFieldToTab('Root.Logo Upload', $uploadHeaderField = new UploadField('HeaderImage', 'Please upload the logo you would like to display in your header.'));
     $uploadHeaderField->setFolderName('Header');
     $uploadHeaderField->setAllowedFileCategories('image');
     $fields->addFieldToTab('Root.Logo Upload', $uploadHeroField = new UploadField('FooterLogo', 'Please upload the logo you would like to display in your header.'));
     $uploadHeroField->setFolderName('Footer');
     $uploadHeroField->setAllowedFileCategories('image');
     $fields->addFieldToTab("Root.Contact Details", new TextField("Address", "Physical Address"));
     $fields->addFieldToTab("Root.Contact Details", new TextField("Phone", "Phone Number"));
     $fields->addFieldToTab("Root.Contact Details", new TextField("Email", "Email Address"));
     $fields->addFieldToTab("Root.Social Media", new TextField("Facebook", "Facebook"));
     $fields->addFieldToTab("Root.Social Media", new TextField("Twitter", "Twitter"));
     $fields->addFieldToTab("Root.Social Media", new TextField("Linkedin", "Linkedin"));
     $fields->addFieldToTab("Root.Social Media", new TextField("Instagram", "Instagram"));
 }
开发者ID:PsukheDelos,项目名称:pocketwatch,代码行数:16,代码来源:PocketwatchSiteConfig.php

示例13: getCMSFields

 public function getCMSFields()
 {
     $fields = new FieldList();
     $imageTab = new Tab('Image');
     $seoTab = new Tab('Metadata');
     $tabset = new TabSet("Root", $imageTab, $seoTab);
     $fields->push($tabset);
     $image_field = new UploadField("FullsizeImage", "Image");
     $image_field->setAllowedFileCategories('image');
     $imageTab->push($image_field);
     $imageTab->push(new TextField("Alt", "Image Alt Tag"));
     $imageTab->push(new TextField("Title"));
     $imageTab->push(new HTMLEditorField("Description"));
     $seoTab->push(new TextField("MetaTitle", "Meta Title"));
     $seoTab->push(new TextField("MetaKeywords", "Meta Keywords"));
     $seoTab->push(new TextAreaField("MetaDescription", "Meta Description"));
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:iqnection-pages-photogallerypage,代码行数:18,代码来源:AlbumPage.php

示例14: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->add(new TextField('AddEntityText', 'Add Text'));
     $fields->add(new TextField('DeleteEntityText', 'Delete Text'));
     $fields->add(new TextField('EditEntityText', 'Edit Text'));
     $icon = new UploadField('EntityIcon', 'Upload Entity Icon');
     $icon->setCanAttachExisting(false);
     $icon->setAllowedMaxFileNumber(1);
     $icon->setAllowedFileCategories('image');
     $icon->setFolderName('survey-builder');
     if ($this->ID > 0) {
         $fields->add($icon);
         $id = (int) $this->ID;
         $parent_id = (int) $this->SurveyTemplateID;
         $fields->add($ddl_entity = new DropdownField('EntityID', 'Please choose an entity to hold', EntitySurveyTemplate::get()->where(" (OwnerID = 0 OR OwnerID = {$id} ) AND ParentID = {$parent_id} ")->map("ID", "EntityName")));
         $ddl_entity->setEmptyString('-- Please Select --');
     }
     return $fields;
 }
开发者ID:rbowen,项目名称:openstack-org,代码行数:20,代码来源:SurveyDynamicEntityStepTemplate.php

示例15: 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
         $LocationFields = singleton('SummitLocation')->getCMSFields();
         $config = GridFieldConfig_RelationEditor::create();
         $config->getComponentByType('GridFieldDetailForm')->setFields($LocationFields);
         $config->addComponent(new GridFieldSortableRows('Order'));
         $gridField = new GridField('Locations', 'Locations', $this->Locations(), $config);
         $fields->addFieldToTab('Root.MapLocations', $gridField);
         $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;
 }
开发者ID:balajijegan,项目名称:openstack-org,代码行数:40,代码来源:SummitLocationPage.php


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