當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FieldSet類代碼示例

本文整理匯總了PHP中FieldSet的典型用法代碼示例。如果您正苦於以下問題:PHP FieldSet類的具體用法?PHP FieldSet怎麽用?PHP FieldSet使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了FieldSet類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * 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
  */
 function __construct($controller, $name, $fields = null, $actions = null, $checkCurrentUser = true)
 {
     $this->authenticator_class = 'MemberAuthenticator';
     $customCSS = project() . '/css/member_login.css';
     if (Director::fileExists($customCSS)) {
         Requirements::css($customCSS);
     }
     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'), Session::get('SessionForms.MemberLoginForm.Email'), null, $this), new EncryptField("Password", _t('Member.PASSWORD'), null, $this), new CheckboxField("Remember", _t('Member.REMEMBERME', "Remember me next time?"), Session::get('SessionForms.MemberLoginForm.Remember'), $this));
         }
         if (!$actions) {
             $actions = new FieldSet(new FormAction("dologin", _t('Member.BUTTONLOGIN', "Log in")), new FormAction("forgotPassword", _t('Member.BUTTONLOSTPASSWORD', "I've lost my password")));
         }
     }
     if (isset($backURL)) {
         $fields->push(new HiddenField('BackURL', 'BackURL', $backURL));
     }
     parent::__construct($controller, $name, $fields, $actions);
 }
開發者ID:ramziammar,項目名稱:websites,代碼行數:45,代碼來源:MemberLoginForm.php

示例2: getCMSFields_forPopup

 public function getCMSFields_forPopup()
 {
     $oFields = new FieldSet();
     $oFields->push(new TextField('Title'));
     $oFields->push(new TextField('Percentage'));
     return $oFields;
 }
開發者ID:SustainableCoastlines,項目名稱:loveyourwater,代碼行數:7,代碼來源:DataCategory.php

示例3: updateCMSFields

 /**
  * standard SS method
  *
  */
 function updateCMSFields(FieldSet &$fields)
 {
     if ($brands = Dataobject::get("Brand")) {
         $fields->removeFieldFromTab("Root.Content.Main", "Model");
         $fields->addFieldToTab('Root.Content.Main', new DropdownField('BrandID', 'Please choose an brand', $brands->map("ID", "Title", "Please Select")), "FeaturedProduct");
     }
 }
開發者ID:nimeso,項目名稱:shop-brands,代碼行數:11,代碼來源:ProductBrandDecorator.php

示例4: getCMSFields_forPopup

 function getCMSFields_forPopup()
 {
     $fields = new FieldSet();
     $fields->push(new TextField('Title', 'Title'));
     $fields->push(new TextField('Description'));
     return $fields;
 }
開發者ID:gordonbanderson,項目名稱:flickr-editor,代碼行數:7,代碼來源:FlickrExif.php

示例5: __construct

    /**
     * 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
     */
    function __construct($controller, $name, $fields = null, $actions = null, $checkCurrentUser = true)
    {
        $this->authenticator_class = 'OpenIDAuthenticator';
        Requirements::themedCSS('openid_login');
        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')));
        } else {
            if (!$fields) {
                $fields = new FieldSet(new LiteralField("OpenIDDescription", _t('OpenIDLoginForm.DESC', '<div id="OpenIDDescription"><p>OpenID is an Internet-wide identity system
		  					that allows you to sign in to many websites with a single account.
							For more information visit <a href="http://openid.net">openid.net</a>.</p></div>
						')), new HiddenField("AuthenticationMethod", null, $this->authenticator_class, $this), new TextField("OpenIDURL", _t('OpenIDLoginForm.URL', "OpenID URL"), Session::get('SessionForms.OpenIDLoginForm.OpenIDURL'), null, $this), new CheckboxField("Remember", _t('Member.REMEMBERME'), Session::get('SessionForms.OpenIDLoginForm.Remember'), $this));
            }
            if (!$actions) {
                $actions = new FieldSet(new FormAction("dologin", _t('Member.BUTTONLOGIN')));
            }
        }
        if (isset($backURL)) {
            $fields->push(new HiddenField('BackURL', 'BackURL', $backURL));
        }
        parent::__construct($controller, $name, $fields, $actions);
    }
開發者ID:ramziammar,項目名稱:websites,代碼行數:45,代碼來源:OpenIDLoginForm.php

示例6: getFormFields

 /**
  * Form fields for displaying on the Checkout form, a dropdown of {@link FlatFeeShippingRate}s
  * that are filtered depending on the shipping country selected.
  * 
  * @see FlatFeeShippingRate
  * @see Modifier::combined_form_fields()
  * @param Order $order
  * @return FieldSet
  */
 public function getFormFields($order)
 {
     //TODO use SiteConfig object to get the countries back, but at the moment
     //SiteConfig ID not being set correctly on country db rows
     $fields = new FieldSet();
     $flatFeeShippingRates = DataObject::get('FLatFeeShippingRate');
     if ($flatFeeShippingRates) {
         //TODO could probably do this filter in the DataObject::get()
         //Filter based on shipping address
         $shippingCountry = null;
         if ($order && $order->exists()) {
             $shippingAddress = $order->ShippingAddress();
             if ($shippingAddress) {
                 $shippingCountry = $shippingAddress->Country;
             }
         }
         if ($shippingCountry) {
             foreach ($flatFeeShippingRates as $rate) {
                 if ($rate->CountryCode != $shippingCountry) {
                     $flatFeeShippingRates->remove($rate);
                 }
             }
         }
         $fields->push(new FlatFeeShippingField($this, 'Flat Fee Shipping', $flatFeeShippingRates->map('ID', 'Label')));
     }
     return $fields;
 }
開發者ID:helpfulrobot,項目名稱:swipestripe-swipestripe,代碼行數:36,代碼來源:FlatFeeShipping.php

示例7: __construct

	/**
	 * 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);
	}
開發者ID:neopba,項目名稱:silverstripe-book,代碼行數:78,代碼來源:MemberLoginForm.php

示例8: updateCMSFields

 public function updateCMSFields(FieldSet &$fields)
 {
     $tablefield = new DataObjectManager($this->owner, 'Places', 'Place', array('Name' => 'Nombre', 'Lng' => 'Longitud', 'Lat' => 'Latitud'), 'getCMSFields_forPopUp');
     $tablefield->setPageSize(100);
     $contactDetailsTab = _t('HomePage.CONTACTDETAILSTAB', "ContactDetails");
     $fields->addFieldsToTab('Root.' . $contactDetailsTab, $tablefield);
 }
開發者ID:ruffox,項目名稱:geo,代碼行數:7,代碼來源:Branch.php

示例9: updateCMSFields

 /**
  * Add custom form fields into the CMS Main tab
  *
  * @return void
  */
 public function updateCMSFields(FieldSet &$fields)
 {
     $fields->addFieldsToTab('Root.GoogleSEO', array(new HeaderField('Google Codes', 1), new HeaderField('SiteWide', 2), new TextField('GoogleVerificationCode', 'Verification Code (code only)'), new TextField('GoogleAnalyticsCode', 'Analytics Code (code only, starting with UA-)')));
     $fields->addFieldsToTab('Root.DefaultLinks', array(new HeaderField('Links & Messages for site users', 1), new TextField('HelpEmail', 'Help Email, used in footer and cross site'), new TextField('LearnLink', 'Link for Learn Site Section'), new TextField('CreateLink', 'Link for Create Site Section'), new TextField('FindLink', 'Link for Find Site Section'), new TextField('ShareLink', 'Link for Share Site Section'), new TextField('MyEventsLink', 'Link for Account Menu -> Events Site Section'), new TextField('MyEventsTitle', 'Title for Account Menu -> Events Site Section'), new TextField('MyResultsLink', 'Link for Account Menu -> Results Site Section'), new TextField('MyResultsTitle', 'Title for Account Menu -> Results Site Section'), new TextField('MyAccountLink', 'Link for Account Menu -> Account Site Section')));
     $fields->addFieldsToTab('Root.UserMessages', array(new HtmlEditorField('CreateAccountContent', 'Prompt Member to Create an Account', 4, 20), new HtmlEditorField('LoginContent', 'Prompt Member to Login', 4, 20), new HtmlEditorField('MyEventsContent', 'User Account Content', 4, 20), new HtmlEditorField('MemberDefaultMessage', 'Message Shown on Incorrect Login, Admin Login and Permissions Error', 4, 20), new TextField('MemberFormTitle', 'Title Shown on Incorrect Login, Admin Login and Permissions Error')));
     $fields->addFieldsToTab('Root.FooterContent', array(new TextField('FooterFAQLink', 'URL Segement for FAQ link in footer e.g about/'), new TextField('FooterCol1title', 'Title Col1'), new TextareaField('FooterSocialMediaMessage', 'Social Media Message'), new HtmlEditorField('FooterCol1content', 'Footer Column 1 Content', 4, 20), new TextField('FooterCol2title', 'Title Col1'), new HtmlEditorField('FooterCol2content', 'Footer Column 1 Content', 4, 20), new TextField('FooterCol3title', 'Title Col1'), new HtmlEditorField('FooterCol3content', 'Footer Column 1 Content', 4, 20)));
 }
開發者ID:SustainableCoastlines,項目名稱:loveyourwater,代碼行數:12,代碼來源:CustomSiteConfig.php

示例10: getFormFields

 /**
  * Form fields for displaying on the Checkout form, a {@link FlatFeeTaxField} that has
  * a hidden field with an ID for the {@link FlatFeeTaxRate} and a description of 
  * how much the calculated tax amounts to for the current {@link Order}.
  * 
  * @see FlatFeeShippingRate
  * @see Modifier::combined_form_fields()
  * @param Order $order
  * @return FieldSet
  */
 public function getFormFields($order)
 {
     //TODO use SiteConfig object to get the countries back, but at the moment
     //SiteConfig ID not being set correctly on country db rows
     $fields = new FieldSet();
     //Get tax rate based on shipping address
     $shippingCountryID = null;
     if ($order && $order->exists()) {
         $shippingAddress = $order->ShippingAddress();
         if ($shippingAddress) {
             $shippingCountryID = $shippingAddress->CountryID;
         }
     }
     if ($shippingCountryID) {
         $flatFeeTaxRate = DataObject::get_one('FlatFeeTaxRate', "CountryID = '{$shippingCountryID}'");
         if ($flatFeeTaxRate && $flatFeeTaxRate->exists()) {
             $flatFeeTaxField = new FlatFeeTaxField($this, $flatFeeTaxRate->Label(), $flatFeeTaxRate->ID);
             //Set the amount for display on the Order form
             $flatFeeTaxField->setAmount($this->Amount($order, $flatFeeTaxField->Value()));
             $fields->push($flatFeeTaxField);
         }
     }
     //Include the js for tax fields in either case
     if (!$fields->exists()) {
         Requirements::javascript('swipestripe/javascript/FlatFeeTaxField.js');
     }
     return $fields;
 }
開發者ID:helpfulrobot,項目名稱:swipestripe-swipestripe,代碼行數:38,代碼來源:FlatFeeTax.php

示例11: getPaymentFormFields

    function getPaymentFormFields()
    {
        $site_currency = Payment::site_currency();
        $paymentsList = '<div id="SecurePayTechCardsAvailable">';
        $count = 0;
        foreach (self::$credit_cards as $name => $image) {
            $count++;
            $class = '';
            if ($count == 1) {
                $class = "first";
            }
            if ($count % 2) {
                $class .= " even";
            } else {
                $class .= " odd";
            }
            $paymentsList .= '<img src="' . $image . '" alt="' . $name . '" class="SecurePayTechCardImage' . $count . '" />';
        }
        Requirements::customScript('
			function paymark_verify(merchant) {
				window.open ("http://www.paymark.co.nz/dart/darthttp.dll?etsl&tn=verify&merchantid=" + merchant, "verify", "scrollbars=yes, width=400, height=400");
			}
		', 'paymark_verify');
        $paymentsList .= '
			<img height="30" src="payment_securatech/images/paymark_small.png" alt="Paymark Certified" onclick="paymark_verify (' . "'" . self::get_spt_merchant_id() . "'" . ')" class="last" />
			</div>';
        $fieldSet = new FieldSet();
        $fieldSet->push(new LiteralField('SPTInfo', $paymentsList));
        return $fieldSet;
    }
開發者ID:helpfulrobot,項目名稱:sunnysideup-payment-securatech,代碼行數:30,代碼來源:SecurePayTechPaymentHosted.php

示例12: updateCMSFields

 /**
  * Adds group select fields to CMS
  * 
  * @param FieldSet $fields
  * @return void
  */
 public function updateCMSFields(FieldSet &$fields)
 {
     // Only modify folder objects with parent nodes
     if (!$this->owner instanceof Folder || !$this->owner->ID) {
         return;
     }
     // Only allow ADMIN and SECURE_FILE_SETTINGS members to edit these options
     if (!Permission::checkMember(Member::currentUser(), array('ADMIN', 'SECURE_FILE_SETTINGS'))) {
         return;
     }
     // Update Security Tab
     $secureFilesTab = $fields->findOrMakeTab('Root.' . _t('SecureFiles.SECUREFILETABNAME', 'Security'));
     $secureFilesTab->push(new HeaderField(_t('SecureFiles.GROUPACCESSTITLE', 'Group Access')));
     $secureFilesTab->push(new TreeMultiselectField('GroupPermissions', _t('SecureFiles.GROUPACCESSFIELD', 'Group Access Permissions')));
     if ($this->owner->InheritSecured()) {
         $permissionGroups = $this->owner->InheritedGroupPermissions();
         if ($permissionGroups->Count()) {
             $fieldText = implode(", ", $permissionGroups->map());
         } else {
             $fieldText = _t('SecureFiles.NONE', "(None)");
         }
         $InheritedGroupsField = new ReadonlyField("InheritedGroupPermissionsText", _t('SecureFiles.GROUPINHERITEDPERMS', 'Inherited Group Permissions'), $fieldText);
         $InheritedGroupsField->addExtraClass('prependUnlock');
         $secureFilesTab->push($InheritedGroupsField);
     }
 }
開發者ID:hamishcampbell,項目名稱:silverstripe-securefiles,代碼行數:32,代碼來源:SecureFileGroupPermissionDecorator.php

示例13: __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);
 }
開發者ID:helpfulrobot,項目名稱:sunnysideup-social-integration,代碼行數:26,代碼來源:LinkedinLoginForm.php

示例14: augmentEcommerceFields

 /**
  * Adds fields to the Member Ecommerce FieldSet.
  * In this case, we add the name of the organisation as READ-ONLY.
  * @param FieldSet $fields
  * @return FieldSet
  */
 function augmentEcommerceFields(&$fields)
 {
     if ($group = $this->owner->getCorporateAccountGroup()) {
         $fields->push(new ReadonlyField("OrganisationName", _t("EcommerceCorporateAccount.FOR", "For"), $group->CombinedCorporateGroupName()));
     }
     return $fields;
 }
開發者ID:helpfulrobot,項目名稱:sunnysideup-ecommerce-corporate-account,代碼行數:13,代碼來源:EcommerceCorporateGroupMemberDecorator.php

示例15: __construct

 /**
  * Initiate the standard Metadata catalogue search form. The 
  * additional parameter $defaults defines the default values for the form.
  * 
  * @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 $fields All of the fields in the form - a {@link FieldSet} of {@link FormField} objects.
  * @param FieldSet $actions All of the action buttons in the form - a {@link FieldSet} of {@link FormAction} objects
  * @param Validator $validator Override the default validator instance (Default: {@link RequiredFields})
  * @param Array $defaults Override the default values of the form.		 
  */
 function __construct($controller, $name, FieldSet $fields = null, FieldSet $actions = null, $validator = null, $defaults = null)
 {
     $format = $defaults['format'];
     $searchTerm = $defaults['searchTerm'];
     $bboxUpper = $bboxLower = null;
     if (isset($defaults['bboxUpper']) && isset($defaults['bboxLower'])) {
         $bboxUpper = $defaults['bboxUpper'];
         $bboxLower = $defaults['bboxLower'];
     }
     $values = CataloguePage_Controller::get_standard_names();
     $upperField = new HiddenField('bboxUpper', _t('SearchForm.SEARCH', 'bboxUpper'), $bboxUpper);
     $upperField->addExtraClass('upper');
     $lowerField = new HiddenField('bboxLower', _t('SearchForm.SEARCH', 'bboxLower'), $bboxLower);
     $lowerField->addExtraClass('lower');
     if (!$fields) {
         $fields = new FieldSet(new TextField('searchTerm', _t('SearchForm.SEARCH', 'Search'), $searchTerm), $upperField, $lowerField, new OptionsetField('format', _t('SearchForm.MetadataStandard', 'Metadata Standard'), $values, $format));
     }
     if (singleton('SiteTree')->hasExtension('Translatable')) {
         $fields->push(new HiddenField('locale', 'locale', Translatable::get_current_locale()));
     }
     if (!$actions) {
         $actions = new FieldSet(new FormAction("submit", _t('SearchForm.Search', 'Search')));
     }
     parent::__construct($controller, $name, $fields, $actions);
     $this->setFormMethod('get');
 }
開發者ID:helpfulrobot,項目名稱:silverstripe-geocatalogue,代碼行數:37,代碼來源:CatalogueSearchForm.php


注:本文中的FieldSet類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。