本文整理匯總了PHP中FieldSet::push方法的典型用法代碼示例。如果您正苦於以下問題:PHP FieldSet::push方法的具體用法?PHP FieldSet::push怎麽用?PHP FieldSet::push使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FieldSet
的用法示例。
在下文中一共展示了FieldSet::push方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: update_cms_actions
/**
* @param FieldSet $actions
* @parma SiteTree $page
*/
public static function update_cms_actions(&$actions, $page)
{
$openRequest = $page->OpenWorkflowRequest();
// if user doesn't have publish rights
if (!$page->canPublish() || $openRequest) {
// authors shouldn't be able to revert, as this republishes the page.
// they should rather change the page and re-request publication
$actions->removeByName('action_revert');
}
// Remove the one click publish if they are not an admin/workflow admin.
if (self::$force_publishers_to_use_workflow && !Permission::checkMember(Member::currentUser(), 'IS_WORKFLOW_ADMIN')) {
$actions->removeByName('action_publish');
}
// Remove the save & publish button if you don't have edit rights
if (!$page->canEdit()) {
$actions->removeByName('action_publish');
}
$liveVersion = Versioned::get_one_by_stage('SiteTree', 'Live', "\"SiteTree_Live\".\"ID\" = {$page->ID}");
if ($liveVersion && $liveVersion->ExpiryDate != null && $liveVersion->ExpiryDate != '0000-00-00 00:00:00') {
if ($page->canApprove()) {
$actions->push(new FormAction('cms_cancelexpiry', _t('WorkflowPublicationRequest.BUTTONCANCELEXPIRY', 'Cancel expiry')));
}
}
// Optional method
$isPublishable = $page->hasMethod('isPublishable') ? $page->isPublishable() : true;
if (!$openRequest && $page->canEdit() && $isPublishable && $page->stagesDiffer('Stage', 'Live') && ($page->Version > 1 || $page->Title != "New Page") && !$page->IsDeletedFromStage && (!$page->canPublish() || self::$publisher_can_create_wf_requests)) {
$actions->push($requestPublicationAction = new FormAction('cms_requestpublication', _t('SiteTreeCMSWorkflow.BUTTONREQUESTPUBLICATION', 'Request Publication')));
// don't allow creation of a second request by another author
if (!self::can_create(null, $page)) {
$actions->makeFieldReadonly($requestPublicationAction->Name());
}
}
}
示例2: __construct
public function __construct($controller, $method, $fields = null, $actions = null, $checkCurrentUser = true)
{
if (isset($_REQUEST['BackURL'])) {
$backURL = $_REQUEST['BackURL'];
} else {
$backURL = Session::get('BackURL');
}
if ($checkCurrentUser && Member::currentUser() && Member::logged_in_session_exists()) {
$fields = new FieldSet(new HiddenField("AuthenticationMethod", null, $this->authenticator_class, $this));
$actions = new FieldSet(new FormAction("logout", _t('Member.BUTTONLOGINOTHER', "Log in as someone else")));
} else {
if (!$fields) {
$fields = new FieldSet(new HiddenField("AuthenticationMethod", null, $this->authenticator_class, $this));
if (Security::$autologin_enabled) {
$fields->push(new CheckboxField("Remember", _t('Member.REMEMBERME'), Session::get('SessionForms.LinkedinLoginForm.Remember'), $this));
}
}
if (!$actions) {
$actions = new FieldSet(new ImageFormAction('dologin', 'Sign in with LinkedIn', 'linkedin/Images/linkedin.png'));
}
}
if (!empty($backURL)) {
$fields->push(new HiddenField('BackURL', 'BackURL', $backURL));
}
parent::__construct($controller, $method, $fields, $actions);
}
示例3: FieldSet
/**
* Constructor
*
* @param Controller $controller The parent controller, necessary to
* create the appropriate form action tag.
* @param string $name The method on the controller that will return this
* form object.
* @param FieldSet|FormField $fields All of the fields in the form - a
* {@link FieldSet} of {@link FormField}
* objects.
* @param FieldSet|FormAction $actions All of the action buttons in the
* form - a {@link FieldSet} of
*/
function __construct($controller, $name, $fields = null, $actions = null)
{
if (isset($_REQUEST['BackURL'])) {
$backURL = $_REQUEST['BackURL'];
} else {
$backURL = Session::get('BackURL');
}
if (!$fields) {
$fields = new FieldSet();
// Security/changepassword?h=XXX redirects to Security/changepassword
// without GET parameter to avoid potential HTTP referer leakage.
// In this case, a user is not logged in, and no 'old password' should be necessary.
if (Member::currentUser()) {
$fields->push(new PasswordField("OldPassword", _t('Member.YOUROLDPASSWORD', "Your old password")));
}
$fields->push(new PasswordField("NewPassword1", _t('Member.NEWPASSWORD', "New Password")));
$fields->push(new PasswordField("NewPassword2", _t('Member.CONFIRMNEWPASSWORD', "Confirm New Password")));
}
if (!$actions) {
$actions = new FieldSet(new FormAction("doChangePassword", _t('Member.BUTTONCHANGEPASSWORD', "Change Password")));
}
if (isset($backURL)) {
$fields->push(new HiddenField('BackURL', 'BackURL', $backURL));
}
parent::__construct($controller, $name, $fields, $actions);
}
示例4: FieldSet
function getCMSFields_forPopup()
{
$fields = new FieldSet();
$fields->push(new TextField('Title', 'Title'));
$fields->push(new TextField('Description'));
return $fields;
}
示例5: FieldSet
function getCMSFields_forPopup()
{
$fields = new FieldSet();
$fields->push(new TextField('Title'));
$fields->push(new FileIFrameField('KmlFile'));
return $fields;
}
示例6: getCMSFields_forPopup
public function getCMSFields_forPopup()
{
$oFields = new FieldSet();
$oFields->push(new TextField('Title'));
$oFields->push(new TextField('Percentage'));
return $oFields;
}
示例7: project
/**
* Constructor
*
* @param Controller $controller The parent controller, necessary to
* create the appropriate form action tag.
* @param string $name The method on the controller that will return this
* form object.
* @param FieldSet|FormField $fields All of the fields in the form - a
* {@link FieldSet} of {@link FormField}
* objects.
* @param FieldSet|FormAction $actions All of the action buttons in the
* form - a {@link FieldSet} of
* {@link FormAction} objects
* @param bool $checkCurrentUser If set to TRUE, it will be checked if a
* the user is currently logged in, and if
* so, only a logout button will be rendered
* @param string $authenticatorClassName Name of the authenticator class that this form uses.
*/
function __construct($controller, $name, $fields = null, $actions = null,
$checkCurrentUser = true) {
// This is now set on the class directly to make it easier to create subclasses
// $this->authenticator_class = $authenticatorClassName;
$customCSS = project() . '/css/member_login.css';
if(Director::fileExists($customCSS)) {
Requirements::css($customCSS);
}
// Focus on the email input when the page is loaded
Requirements::customScript("
(function($){
$(document).ready(function() {
$('#Email input').focus();
});
})(jQuery);
");
if(isset($_REQUEST['BackURL'])) {
$backURL = $_REQUEST['BackURL'];
} else {
$backURL = Session::get('BackURL');
}
if($checkCurrentUser && Member::currentUserID()) {
$fields = new FieldSet();
$actions = new FieldSet(new FormAction("logout", _t('Member.BUTTONLOGINOTHER', "Log in as someone else")));
} else {
if(!$fields) {
$fields = new FieldSet(
new HiddenField("AuthenticationMethod", null, $this->authenticator_class, $this),
new TextField("Email", _t('Member.EMAIL', 'Email'), Session::get('SessionForms.MemberLoginForm.Email'), null, $this),
new PasswordField("Password", _t('Member.PASSWORD', 'Password'))
);
if(Security::$autologin_enabled) {
$fields->push(new CheckboxField(
"Remember",
_t('Member.REMEMBERME', "Remember me next time?")
));
}
}
if(!$actions) {
$actions = new FieldSet(
new FormAction('dologin', _t('Member.BUTTONLOGIN', "Log in")),
new LiteralField(
'forgotPassword',
'<p id="ForgotPassword"><a href="Security/lostpassword">' . _t('Member.BUTTONLOSTPASSWORD', "I've lost my password") . '</a></p>'
)
);
}
}
if(isset($backURL)) {
$fields->push(new HiddenField('BackURL', 'BackURL', $backURL));
}
parent::__construct($controller, $name, $fields, $actions);
}
示例8: getCMSFields_forPopup
public function getCMSFields_forPopup()
{
$fields = new FieldSet();
$fields->push(new TextareaField('Caption'));
$fields->push(new ImageField('Photo'));
return $fields;
}
示例9: getCMSFields_forPopup
public function getCMSFields_forPopup()
{
$oFields = new FieldSet();
$oFields->push(new TextField('FieldName', 'V.Important: No Spaces, Camel Case and abbreviate where possible'));
$oFields->push(new TextField('Title'));
$oFields->push(new TextField('Description'));
return $oFields;
}
示例10: getCMSFields_forPopup
/**
* Create fields for editing a ProductImage in the CMS.
*
* @return FieldSet
*/
public function getCMSFields_forPopup()
{
$fields = new FieldSet();
$fields->push(new TextareaField('Caption'));
$imageUploadField = class_exists('ImageUploadField') ? new ImageUploadField('Image') : new FileIFrameField('Image');
$fields->push($imageUploadField);
return $fields;
}
示例11: parameterFields
function parameterFields()
{
$params = new FieldSet();
$params->push($startDate = Object::create('DatetimeField', 'StartDate', 'Start date'));
$params->push($endDate = Object::create('DatetimeField', 'EndDate', 'End date'));
$startDate->getTimeField()->setValue('23:59:59');
$endDate->getTimeField()->setValue('23:59:59');
return $params;
}
示例12: HeaderField
function __construct($controller, $name)
{
$member = Member::currentUser();
$requiredFields = null;
if ($member && $member->exists()) {
$fields = $member->getEcommerceFields(true);
$fields->push(new HeaderField('LoginDetails', _t('Account.LOGINDETAILS', 'Login Details'), 3));
$logoutLink = ShoppingCart_Controller::clear_cart_and_logout_link();
$fields->push(new LiteralField('LogoutNote', "<p class=\"message warning\">" . _t("Account.LOGGEDIN", "You are currently logged in as ") . $member->FirstName . ' ' . $member->Surname . '. <a href="' . $logoutLink . '">' . _t('Account.LOGOUT', 'Log out now?') . "</a></p>"));
// PASSWORD KEPT CHANGING - SO I REMOVED IT FOR NOW - Nicolaas
$passwordField = new ConfirmedPasswordField('Password', _t('Account.PASSWORD', 'Password'), "", null, true);
$fields->push($passwordField);
$requiredFields = new ShopAccountForm_Validator($member->getEcommerceRequiredFields());
$actions = new FieldSet(new FormAction('submit', _t('Account.SAVE', 'Save Changes')));
if ($order = ShoppingCart::current_order()) {
if ($order->Items()) {
$actions->push(new FormAction('proceed', _t('Account.SAVEANDPROCEED', 'Save changes and proceed to checkout')));
}
}
} else {
$member = new Member();
$fields = new FieldSet();
$fields->push(new HeaderField('SignUp', _t('ShopAccountForm.CREATEACCOUNT', 'Create Account')));
$fields->push(new LiteralField('MemberInfo', '<p class="message good">' . _t('OrderForm.MEMBERINFO', 'If you are already have an account then please') . " <a href=\"Security/login?BackURL=" . $controller->Link() . "\">" . _t('OrderForm.LOGIN', 'log in') . '</a>.</p>'));
$memberFields = $member->getEcommerceFields(true);
if ($memberFields) {
foreach ($memberFields as $memberField) {
$fields->push($memberField);
}
}
// PASSWORD KEPT CHANGING - SO I REMOVED IT FOR NOW - Nicolaas
$passwordField = new PasswordField('Password', _t('Account.PASSWORD', 'Password'));
$fields->push($passwordField);
$requiredFields = new ShopAccountForm_Validator($member->getEcommerceRequiredFields());
$actions = new FieldSet(new FormAction('creatememberandaddtoorder', _t('Account.SAVE', 'Create Account')));
}
parent::__construct($controller, $name, $fields, $actions, $requiredFields);
//extensions need to be set after __construct
if ($this->extend('updateFields', $fields) !== null) {
$this->setFields($fields);
}
if ($this->extend('updateActions', $actions) !== null) {
$this->setActions($actions);
}
if ($this->extend('updateValidator', $requiredFields) !== null) {
$this->setValidator($requiredFields);
}
if ($member && $member->Password) {
$this->loadDataFrom($member);
if (!isset($_REQUEST["Password"])) {
$this->fields()->fieldByName("Password")->SetValue("");
}
$this->fields()->fieldByName("Password")->setCanBeEmpty(true);
}
$this->extend('updateShopAccountForm', $this);
}
示例13: getCMSFields_forPopup
public function getCMSFields_forPopup()
{
$fields = new FieldSet();
$fields->push(new TextareaField('Caption', _t('ImageGalleryItem.CAPTION', 'Caption')));
if ($this->ImageGalleryPageID) {
$fields->push(new DropdownField('AlbumID', _t('ImageGalleryItem.ALBUM', 'Album'), $this->ImageGalleryPage()->Albums()->toDropdownMap('ID', 'AlbumName')));
}
$fields->push(new ImageField('Image'));
return $fields;
}
示例14: Form
function Form()
{
$fields = new FieldSet(new TextField('MyText'));
if (class_exists('RecaptchaField')) {
$fields->push(new RecaptchaField('MyRecaptcha'));
} else {
$fields->push(new LiteralField('<p class="message error">RecaptchaField class not found</p>'));
}
$form = new Form($this, 'Form', $fields, new FieldSet(new FormAction('submit', 'submit')), new RequiredFields(array('MyText')));
return $form;
}
示例15: getCMSFields_forPopup
/**
* Field for editing a {@link FlatFeeTaxRate}.
*
* @return FieldSet
*/
public function getCMSFields_forPopup()
{
$fields = new FieldSet();
$fields->push(new TextField('Title', _t('FlatFeeTaxRate.LABEL', 'Label')));
$fields->push(new TextField('Description', _t('FlatFeeTaxRate.DESCRIPTION', 'Description')));
$countryField = new DropdownField('CountryID', _t('FlatFeeTaxRate.COUNTRY', 'Country'), Country::shipping_countries());
$fields->push($countryField);
$rateField = new NumericField('Rate', _t('FlatFeeTaxRate.TAX_RATE', 'Tax rate as a percentage'));
$fields->push($rateField);
return $fields;
}