本文整理汇总了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;
}
示例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;
}
示例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;
}