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


PHP FileField::setFolderName方法代码示例

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


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

示例1: getFormField

 public function getFormField()
 {
     $field = new FileField($this->Name, $this->Title);
     if ($this->getSetting('Folder')) {
         $folder = Folder::get()->byId($this->getSetting('Folder'));
         if ($folder) {
             $field->setFolderName(preg_replace("/^assets\\//", "", $folder->Filename));
         }
     }
     return $field;
 }
开发者ID:prostart,项目名称:erics-homes,代码行数:11,代码来源:EditableFileField.php

示例2: Form

 function Form()
 {
     if ($this->request->requestVar('_REDIRECT_BACK_URL')) {
         $url = $this->request->requestVar('_REDIRECT_BACK_URL');
     } else {
         if ($this->request->getHeader('Referer')) {
             $url = $this->request->getHeader('Referer');
         } else {
             $url = Director::baseURL();
         }
     }
     $folder = Folder::find_or_make("ErrorScreenshots");
     $whatDidYouTryDoField = new TextareaField('WhatDidYouTryToDo', 'What did you try to do');
     $whatDidYouTryDoField->setRows(3);
     $whatWentWrongField = new TextareaField('WhatWentWrong', 'What went wrong');
     $whatWentWrongField->setRows(3);
     $screenshotField = new FileField('Screenshot', 'To take a screenshot press the PRT SCR button on your keyboard, then open MS Word or MS Paint and paste the screenshot. Save the file and then attach (upload) the file here.');
     $screenshotField->setFolderName($folder->Name);
     $form = new Form($this, 'Form', new FieldList(new TextField('Name'), new TextField('Email'), new TextField('URL', 'What is the URL of the page the error occured (this is the address shown in the address bar (e.g. http://www.mysite.com/mypage/with/errors/)', $url), $whatDidYouTryDoField, $whatWentWrongField, $screenshotField), new FieldList(new FormAction('senderror', 'Submit Error')), new RequiredFields(array("Email", "Name")));
     return $form;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-templateoverview,代码行数:21,代码来源:ErrorNotifierController.php

示例3: getForumFields

 /**
  * Get the fields needed by the forum module
  *
  * @param bool $showIdentityURL Should a field for an OpenID or an i-name
  *                              be shown (always read-only)?
  * @return FieldList Returns a FieldList containing all needed fields for
  *                  the registration of new users
  */
 function getForumFields($showIdentityURL = false, $addmode = false)
 {
     $gravatarText = DataObject::get_one("ForumHolder", "\"AllowGravatars\" = 1") ? '<small>' . _t('ForumRole.CANGRAVATAR', 'If you use Gravatars then leave this blank') . '</small>' : "";
     //Sets the upload folder to the Configurable one set via the ForumHolder or overridden via Config::inst()->update().
     $avatarField = new FileField('Avatar', _t('ForumRole.AVATAR', 'Avatar Image') . ' ' . $gravatarText);
     $avatarField->setFolderName(Config::inst()->get('ForumHolder', 'avatars_folder'));
     $avatarField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
     $personalDetailsFields = new CompositeField(new HeaderField("PersonalDetails", _t('ForumRole.PERSONAL', 'Personal Details')), new LiteralField("Blurb", "<p id=\"helpful\">" . _t('ForumRole.TICK', 'Tick the fields to show in public profile') . "</p>"), new TextField("Nickname", _t('ForumRole.NICKNAME', 'Nickname')), new CheckableOption("FirstNamePublic", new TextField("FirstName", _t('ForumRole.FIRSTNAME', 'First name'))), new CheckableOption("SurnamePublic", new TextField("Surname", _t('ForumRole.SURNAME', 'Surname'))), new CheckableOption("OccupationPublic", new TextField("Occupation", _t('ForumRole.OCCUPATION', 'Occupation')), true), new CheckableOption('CompanyPublic', new TextField('Company', _t('ForumRole.COMPANY', 'Company')), true), new CheckableOption('CityPublic', new TextField('City', _t('ForumRole.CITY', 'City')), true), new CheckableOption("CountryPublic", new ForumCountryDropdownField("Country", _t('ForumRole.COUNTRY', 'Country')), true), new CheckableOption("EmailPublic", new EmailField("Email", _t('ForumRole.EMAIL', 'Email'))), new ConfirmedPasswordField("Password", _t('ForumRole.PASSWORD', 'Password')), $avatarField);
     // Don't show 'forum rank' at registration
     if (!$addmode) {
         $personalDetailsFields->push(new ReadonlyField("ForumRank", _t('ForumRole.RATING', 'User rating')));
     }
     $personalDetailsFields->setID('PersonalDetailsFields');
     $fieldset = new FieldList($personalDetailsFields);
     if ($showIdentityURL) {
         $fieldset->insertBefore(new ReadonlyField('IdentityURL', _t('ForumRole.OPENIDINAME', 'OpenID/i-name')), 'Password');
         $fieldset->insertAfter(new LiteralField('PasswordOptionalMessage', '<p>' . _t('ForumRole.PASSOPTMESSAGE', 'Since you provided an OpenID respectively an i-name the password is optional. If you enter one, you will be able to log in also with your e-mail address.') . '</p>'), 'IdentityURL');
     }
     if ($this->owner->IsSuspended()) {
         $fieldset->insertAfter(new LiteralField('SuspensionNote', '<p class="message warning suspensionWarning">' . $this->ForumSuspensionMessage() . '</p>'), 'Blurb');
     }
     $this->owner->extend('updateForumFields', $fieldset);
     return $fieldset;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-forum,代码行数:32,代码来源:ForumRole.php


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