本文整理汇总了PHP中ReadonlyField类的典型用法代码示例。如果您正苦于以下问题:PHP ReadonlyField类的具体用法?PHP ReadonlyField怎么用?PHP ReadonlyField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ReadonlyField类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: Field
public function Field($properties = array())
{
$titleArray = $itemIDs = array();
$titleList = $itemIDsList = "";
if ($items = $this->getItems()) {
foreach ($items as $item) {
$titleArray[] = $item->Title;
}
foreach ($items as $item) {
$itemIDs[] = $item->ID;
}
if ($titleArray) {
$titleList = implode(", ", $titleArray);
}
if ($itemIDs) {
$itemIDsList = implode(",", $itemIDs);
}
}
$field = new ReadonlyField($this->name . '_ReadonlyValue', $this->title);
$field->setValue($titleList);
$field->setForm($this->form);
$valueField = new HiddenField($this->name);
$valueField->setValue($itemIDsList);
$valueField->setForm($this->form);
return $field->Field() . $valueField->Field();
}
开发者ID:SpiritLevel,项目名称:silverstripe-framework,代码行数:26,代码来源:TreeMultiselectField_Readonly.php
示例3: performReadonlyTransformation
/**
* Makes a pretty readonly field with some stars in it
*/
function performReadonlyTransformation()
{
$stars = '*****';
$field = new ReadonlyField($this->name, $this->title ? $this->title : '', $stars);
$field->setForm($this->form);
return $field;
}
开发者ID:ramziammar,项目名称:websites,代码行数:10,代码来源:PasswordField.php
示例4: performReadonlyTransformation
/**
* Returns a readonly version of this field
*/
function performReadonlyTransformation()
{
$field = new ReadonlyField($this->name, $this->title, $this->value);
$field->addExtraClass($this->extraClass());
$field->setForm($this->form);
return $field;
}
开发者ID:helpfulrobot,项目名称:sheadawson-silverstripe-dynamiclists,代码行数:10,代码来源:DependentDynamicListDropdownField.php
示例5: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$fields->removeByName(array('Lat', 'Lng'));
// Adds Lat/Lng fields for viewing in the CMS
$compositeField = CompositeField::create();
$compositeField->push($overrideField = CheckboxField::create('LatLngOverride', 'Override Latitude and Longitude?'));
$overrideField->setDescription('Check this box and save to be able to edit the latitude and longitude manually.');
if ($this->owner->Lng && $this->owner->Lat) {
$googleMapURL = 'http://maps.google.com/?q=' . $this->owner->Lat . ',' . $this->owner->Lng;
$googleMapDiv = '<div class="field"><label class="left" for="Form_EditForm_MapURL_Readonly">Google Map</label><div class="middleColumn"><a href="' . $googleMapURL . '" target="_blank">' . $googleMapURL . '</a></div></div>';
$compositeField->push(LiteralField::create('MapURL_Readonly', $googleMapDiv));
}
if ($this->owner->LatLngOverride) {
$compositeField->push(TextField::create('Lat', 'Lat'));
$compositeField->push(TextField::create('Lng', 'Lng'));
} else {
$compositeField->push(ReadonlyField::create('Lat_Readonly', 'Lat', $this->owner->Lat));
$compositeField->push(ReadonlyField::create('Lng_Readonly', 'Lng', $this->owner->Lng));
}
if ($this->owner->hasExtension('Addressable')) {
// If using addressable, put the fields with it
$fields->addFieldToTab('Root.Address', ToggleCompositeField::create('Coordinates', 'Coordinates', $compositeField));
} else {
if ($this->owner instanceof SiteTree) {
// If SIteTree but not using Addressable, put after 'Metadata' toggle composite field
$fields->insertAfter($compositeField, 'ExtraMeta');
} else {
$fields->addFieldToTab('Root.Main', ToggleCompositeField::create('Coordinates', 'Coordinates', $compositeField));
}
}
}
开发者ID:ajshort,项目名称:silverstripe-addressable,代码行数:31,代码来源:Geocodable.php
示例6: getEditForm
/**
* Gets the form used for viewing a time log
*/
public function getEditForm($id = null, $fields = null)
{
$record = $this->currentPage();
if ($this->action == 'view' && $record) {
$fields = new FieldList(new HeaderField('LogHeader', _t('KapostBridgeLogViewer.VIEWING_ENTRY', '_Viewing Log Entry: {datetime}', array('datetime' => $record->dbObject('Created')->FormatFromSettings())), 3), new ReadonlyField('UserAgent', _t('KapostBridgeLogViewer.USER_AGENT', '_Requestor User Agent')), new ReadonlyField('Method', _t('KapostBridgeLogViewer.METHOD', '_Method')), ToggleCompositeField::create('RequestData', _t('KapostBridgeLogViewer.KAPOST_REQUEST', '_Kapost Request'), new FieldList(ReadonlyField::create('RequestFormatted', '')->setTemplate('KapostBridgeLogField')->addExtraClass('log-contents cms-panel-layout')))->setHeadingLevel(3), ToggleCompositeField::create('ResponseData', _t('KapostBridgeLogViewer.SILVERSTRIPE_RESPONSE', '_SilverStripe Response'), new FieldList(ReadonlyField::create('ResponseFormatted', '')->setTemplate('KapostBridgeLogField')->addExtraClass('log-contents cms-panel-layout')))->setHeadingLevel(3));
$refObj = $record->ReferenceObject;
if (!empty($refObj) && $refObj !== false && $refObj->exists()) {
if (method_exists($refObj, 'CMSEditLink')) {
$fields->insertBefore(new KapostLogLinkField('CMSEditLink', _t('KapostBridgeLogViewer.REFERENCED_OBJECT', '_Referenced Object'), $refObj->CMSEditLink(), _t('KapostBridgeLogViewer.VIEW_REFERENCED_OBJECT', '_View Referenced Object')), 'RequestData');
} else {
if ($refObj instanceof File) {
$refObjLink = Controller::join_links(LeftAndMain::config()->url_base, AssetAdmin::config()->url_segment, 'EditForm/field/File/item', $refObj->ID, 'edit');
$fields->insertBefore(new KapostLogLinkField('CMSEditLink', _t('KapostBridgeLogViewer.REFERENCED_OBJECT', '_Referenced Object'), $refObjLink, _t('KapostBridgeLogViewer.VIEW_REFERENCED_OBJECT', '_View Referenced Object')), 'RequestData');
}
}
}
} else {
$fields = new FieldList();
}
$form = new CMSForm($this, 'EditForm', $fields, new FieldList());
$form->setResponseNegotiator($this->getResponseNegotiator());
$form->addExtraClass('cms-edit-form center');
$form->setAttribute('data-layout-type', 'border');
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
$form->setAttribute('data-pjax-fragment', 'CurrentForm');
$form->setHTMLID('Form_EditForm');
if ($record) {
$form->loadDataFrom($record);
}
return $form;
}
开发者ID:webbuilders-group,项目名称:silverstripe-kapost-bridge-logger,代码行数:34,代码来源:KapostBridgeLogViewer.php
示例7: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$extFields = self::$db;
$fields->removeByName(array_keys($extFields));
if (!$this->owner->WordpressID) {
return;
}
$compositeFields = array();
foreach ($extFields as $name => $type) {
$value = $this->owner->getField($name);
$compositeFields[$name] = ReadonlyField::create($name . '_Readonly', FormField::name_to_label($name), $value);
}
if ($compositeFields) {
$wordpressCompositeField = ToggleCompositeField::create('WordpressCompositeField', 'Wordpress', $compositeFields)->setHeadingLevel(4);
if ($fields->fieldByName('Metadata')) {
$fields->insertBefore($wordpressCompositeField, 'Metadata');
} else {
if ($fields->fieldByName('Root')) {
$fields->addFieldToTab('Root.Main', $wordpressCompositeField);
} else {
$fields->push($wordpressCompositeField);
}
}
}
}
开发者ID:silbinarywolf,项目名称:silverstripe-wordpressmigrationtools,代码行数:25,代码来源:WordpressImportDataExtension.php
示例8: getCMSFields
/**
* Gets a list of form fields for editing the record.
* These records should never be edited, so a readonly list of fields
* is forced.
*
* @return FieldList
*/
public function getCMSFields()
{
preg_match("/<body[^>]*>(.*?)<\\/body>/is", $this->Body, $matches);
$contents = $matches ? $matches[1] : "";
$f = FieldList::create(ReadonlyField::create('To'), ReadonlyField::create('Subject'), ReadonlyField::create('BCC'), ReadonlyField::create('CC'), HeaderField::create('Email contents', 5), LiteralField::create('BodyContents', "<div class='field'>{$contents}</div>"));
return $f;
}
开发者ID:unclecheese,项目名称:silverstripe-permamail,代码行数:14,代码来源:SentEmail.php
示例9: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$createdDate = new Date();
$createdDate->setValue($this->Created);
$reviewer = $this->Member()->Name;
$email = $this->Member()->Email;
$star = "★";
$emptyStar = "☆";
$fields->insertBefore(LiteralField::create('reviewer', '<p>Written by <strong>' . $this->getMemberDetails() . '</strong><br />' . $createdDate->Format('l F jS Y h:i:s A') . '</p>'), 'Title');
$fields->insertBefore(CheckboxField::create('Approved'), 'Title');
$starRatings = $this->StarRatings();
foreach ($starRatings as $starRating) {
$cat = $starRating->StarRatingCategory;
$stars = str_repeat($star, $starRating->Rating);
$ratingStars = $stars;
$maxRating = $starRating->MaxRating - $starRating->Rating;
$emptyStarRepeat = str_repeat($emptyStar, $maxRating);
$emptyStars = $emptyStarRepeat;
/* 4/5 Stars */
$ratingInfo = $ratingStars . $emptyStars . ' (' . $starRating->Rating . ' of ' . $starRating->MaxRating . ' Stars)';
$fields->insertBefore(ReadonlyField::create('rating_' . $cat, $cat, html_entity_decode($ratingInfo, ENT_COMPAT, 'UTF-8')), 'Title');
}
$fields->removeByName('StarRatings');
$fields->removeByName('MemberID');
$fields->removeByName('ProductID');
return $fields;
}
开发者ID:helpfulrobot,项目名称:clintlandrum-silverstripe-productreviews,代码行数:28,代码来源:ProductReview.php
示例10: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
// vars
$config = SiteConfig::current_site_config();
$owner = $this->owner;
// decode data into array
$data = json_decode($owner->OpenGraphData, true);
// @todo Add repair method if data is missing / corrupt ~ for fringe cases
// tab
$tab = new Tab('OpenGraph');
// add disabled/error state if `off`
if ($data['og:type'] === 'off') {
$tab->addExtraClass('error');
}
// add the tab
$fields->addFieldToTab('Root.Metadata', $tab, 'FullOutput');
// new identity
$tab = 'Root.Metadata.OpenGraph';
// add description
// type always visible
$fields->addFieldsToTab($tab, array(LabelField::create('OpenGraphHeader', '@todo Information</a>')->addExtraClass('information'), DropdownField::create('OpenGraphType', '<a href="http://ogp.me/#types">og:type</a>', self::$types, $data['og:type'])));
if ($data['og:type'] !== 'off') {
$fields->addFieldsToTab($tab, array(ReadonlyField::create('OpenGraphURL', 'Canonical URL', $owner->AbsoluteLink()), TextField::create('OpenGraphSiteName', 'Site Name', $data['og:site_name'])->setAttribute('placeholder', $config->Title), TextField::create('OpenGraphTitle', 'Page Title', $data['og:title'])->setAttribute('placeholder', $owner->Title), TextareaField::create('OpenGraphDescription', 'Description', $data['og:description'])->setAttribute('placeholder', $owner->GenerateDescription()), UploadField::create('OpenGraphImage', 'Image<pre>type: png/jpg/gif</pre><pre>size: variable *</pre>', $owner->OpenGraphImage)->setAllowedExtensions(array('png', 'jpg', 'jpeg', 'gif'))->setFolderName(self::$SEOOpenGraphUpload . $owner->Title)->setDescription('* <a href="https://developers.facebook.com/docs/sharing/best-practices#images" target="_blank">Facebook image best practices</a>, or use any preferred Open Graph guide.')));
}
}
开发者ID:graphiques-digitale,项目名称:silverstripe-seo-open-graph,代码行数:25,代码来源:SEO_OpenGraph_SiteTree_DataExtension.php
示例11: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('ConfiguredScheduleID');
$interval = $fields->dataFieldByName('Interval')->setDescription('Number of seconds between each run. e.g 3600 is 1 hour');
$fields->replaceField('Interval', $interval);
$dt = new DateTime();
$fields->replaceField('StartDate', DateField::create('StartDate')->setConfig('dateformat', 'dd/MM/yyyy')->setConfig('showcalendar', true)->setDescription('DD/MM/YYYY e.g. ' . $dt->format('d/m/y')));
$fields->replaceField('EndDate', DateField::create('EndDate')->setConfig('dateformat', 'dd/MM/yyyy')->setConfig('showcalendar', true)->setDescription('DD/MM/YYYY e.g. ' . $dt->format('d/m/y')));
if ($this->ID == null) {
foreach ($fields->dataFields() as $field) {
//delete all included fields
$fields->removeByName($field->Name);
}
$rangeTypes = ClassInfo::subclassesFor('ScheduleRange');
$fields->addFieldToTab('Root.Main', TextField::create('Title', 'Title'));
$fields->addFieldToTab('Root.Main', DropdownField::create('ClassName', 'Range Type', $rangeTypes));
} else {
$fields->addFieldToTab('Root.Main', ReadonlyField::create('ClassName', 'Type'));
}
if ($this->ClassName == __CLASS__) {
$fields->removeByName('ApplicableDays');
}
return $fields;
}
开发者ID:helpfulrobot,项目名称:silverstripe-australia-silverstripe-schedulizer,代码行数:25,代码来源:ScheduleRange.php
示例12: __construct
public function __construct($controller, $name, $show_actions = true)
{
$TempBasketID = Store_BasketController::get_temp_basket_id();
$order_id = DB::Query("SELECT id FROM `order` WHERE (`TempBasketID`='" . $TempBasketID . "')")->value();
/* Basket GridField */
$config = new GridFieldConfig();
$dataColumns = new GridFieldDataColumns();
$dataColumns->setDisplayFields(array('getPhoto' => "Photo", 'Title' => 'Product', 'Price' => 'Item Price', 'Quantity' => 'Quantity', 'productPrice' => 'Total Price', 'getfriendlyTaxCalculation' => 'Tax Inc/Exc', 'TaxClassName' => 'Tax'));
$config->addComponent($dataColumns);
$config->addComponent(new GridFieldTitleHeader());
$basket = GridField::create("BasketItems", "", DataObject::get("Order_Items", "(OrderID='" . $order_id . "')"), $config);
/* Basket Subtotal */
$subtotal = new Order();
$subtotal = $subtotal->calculateSubTotal($order_id);
$subtotal = ReadonlyField::create("SubTotal", "Basket Total (" . Product::getDefaultCurrency() . ")", $subtotal);
/* Fields */
$fields = FieldList::create($basket, $subtotal, ReadonlyField::create("Tax", "Tax", "Calculated on the Order Summary page."));
/* Actions */
$actions = FieldList::create(CompositeField::create(FormAction::create('continueshopping', 'Continue Shopping'), FormAction::create('placeorder', 'Place Order')));
/* Required Fields */
$required = new RequiredFields(array());
/*
* Now we create the actual form with our fields and actions defined
* within this class.
*/
return parent::__construct($controller, $name, $fields, $show_actions ? $actions : FieldList::create(), $required);
}
开发者ID:micschk,项目名称:torindul-silverstripe-shop,代码行数:27,代码来源:BasketForm.php
示例13: SyncButton
public function SyncButton()
{
$fields = FieldList::create(ReadonlyField::create('LastSyncDate', 'Last Sync Date'));
$actions = FieldList::create(FormAction::create("doSyncFromFeed")->setTitle("Sync Feed to Events"));
$form = Form::create($this, 'SyncButton', $fields, $actions);
$form->loadDataFrom($this->data());
return $form;
}
开发者ID:andrewandante,项目名称:blackdorisrovers,代码行数:8,代码来源:Season.php
示例14: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('PlaylistItemID');
$fields->removeByName('SortOrder');
$fields->addFieldsToTab('Root.Main', array(ReadonlyField::create('VideoID'), ReadonlyField::create('ThumbnailURL')), 'Title');
return $fields;
}
开发者ID:helpfulrobot,项目名称:level51-silverstripe-youtubesync,代码行数:8,代码来源:YoutubeVideo.php
示例15: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName("Content");
$fields->addFieldToTab("Root.Main", ReadonlyField::create('UID', 'UID'), 'URLSegment');
$fields->addFieldsToTab("Root.Main", array(TextField::create('Opposition', 'Opposition'), DropdownField::create('Result', 'Game result', singleton('Match')->dbObject('Result')->enumValues())->setEmptyString('(TBD)')), 'Metadata');
return $fields;
}
开发者ID:andrewandante,项目名称:blackdorisrovers,代码行数:8,代码来源:Match.php
示例16: getCMSFields
/**
* Add fields to the CMS for this gateway.
*/
public function getCMSFields()
{
//Fetch the fields from the Courier DataObject
$fields = parent::getCMSFields();
//Add new fields
$fields->addFieldsToTab("Root.Main", array(HeaderField::create("PayPal Transaction Information"), CompositeField::create(ReadonlyField::create("custom", "Order Number"), ReadonlyField::create("payment_date", "Payment Date"), ReadonlyField::create("payment_status", "Payment Status")->setRightTitle("\n\t\t\t\t\tIf this status is pending, see Pending Reason below. \n\t\t\t\t"), ReadonlyField::create("payment_type", "Payment Type")->setRightTitle("\n\t\t\t\t\tFor a explanation of the different payment types please see 'payment_type' at \n\t\t\t\t\t<a href=\"https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/\">paypal.com</a>\n\t\t\t\t"), ReadonlyField::create("pending_reason", "Pending Reason")->setRightTitle("\n\t\t\t\t\tFor a explanation of pending reasons please see 'pending_reason' at \n\t\t\t\t\t<a href=\"https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/\">paypal.com</a>\n\t\t\t\t"), ReadonlyField::create("reason_code", "Reason Code")->setRightTitle("\n\t\t\t\t\tThis is set if Payment Status is Reversed, Refunded, Canceled_Reversal, or Denied. For an explanation of its\n\t\t\t\t\tmeaning see 'reason_code' at \n\t\t\t\t\t<a href=\"https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/\">paypal.com</a>\n\t\t\t\t"), FieldGroup::create("Transaction Identifiers", ReadonlyField::create("txn_id", "<strong>Transaction ID</strong>"), ReadonlyField::create("parent_txn_id", "<strong>Parent Transaction ID</strong>"))->setRightTitle("\n\t\t\t\t\t<strong>Transaction ID</strong><br />\n\t\t\t\t\tThe identifier for this specific transaction entry.\n\t\t\t\t\t\n\t\t\t\t\t<br /><br />\n\t\t\t\t\t\n\t\t\t\t\t<strong>Parent Transaction ID</strong><br />\n\t\t\t\t\tIf provided, this value is the transaction identifier of the\n\t\t\t\t\tparent transaction. i.e. If this transaction is a refund, the\n\t\t\t\t\tvalue will be the transaction ID of the original purchase.\n\t\t\t\t\t<br />\n\t\t\t\t"), FieldGroup::create("Funds", ReadonlyField::create("mc_gross", "<strong>Gross Payment</strong>"), ReadonlyField::create("mc_fee", "<strong>PayPal Fee</strong>"))->setRightTitle("\n\t\t\t\t\t<strong>Gross Payment</strong><br />\n\t\t\t\t\tFull amount of the customer's payment, before transaction fee is subtracted.\n\t\t\t\t\t\n\t\t\t\t\t<br /><br />\n\t\t\t\t\t\n\t\t\t\t\t<strong>PayPal Fee</strong><br />\n\t\t\t\t\tTransaction fee associated with the payment.\n\t\t\t\t"))));
return $fields;
}
开发者ID:micschk,项目名称:torindul-silverstripe-shop,代码行数:11,代码来源:Order_Payment_PayPal.php
示例17: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
if ($this->Code) {
$fields->addFieldToTab("Root.Main", ReadonlyField::create("DiscountURL", _t("CheckoutAdmin.AddDiscountURL", "Add discount URL"), $this->AddLink()), "Code");
}
return $fields;
}
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-checkout,代码行数:8,代码来源:Discount.php
示例18: getCMSFields
public function getCMSFields()
{
$existing_customer = $this->config()->existing_customer_class;
// Manually inject HTML for totals as Silverstripe refuses to
// render Currency.Nice any other way.
$subtotal_html = '<div id="SubTotal" class="field readonly">';
$subtotal_html .= '<label class="left" for="Form_ItemEditForm_SubTotal">';
$subtotal_html .= _t("Orders.SubTotal", "Sub Total");
$subtotal_html .= '</label>';
$subtotal_html .= '<div class="middleColumn"><span id="Form_ItemEditForm_SubTotal" class="readonly">';
$subtotal_html .= $this->SubTotal->Nice();
$subtotal_html .= '</span></div></div>';
$discount_html = '<div id="Discount" class="field readonly">';
$discount_html .= '<label class="left" for="Form_ItemEditForm_Discount">';
$discount_html .= _t("Orders.Discount", "Discount");
$discount_html .= '</label>';
$discount_html .= '<div class="middleColumn"><span id="Form_ItemEditForm_Discount" class="readonly">';
$discount_html .= $this->dbObject("DiscountAmount")->Nice();
$discount_html .= '</span></div></div>';
$postage_html = '<div id="Postage" class="field readonly">';
$postage_html .= '<label class="left" for="Form_ItemEditForm_Postage">';
$postage_html .= _t("Orders.Postage", "Postage");
$postage_html .= '</label>';
$postage_html .= '<div class="middleColumn"><span id="Form_ItemEditForm_Postage" class="readonly">';
$postage_html .= $this->Postage->Nice();
$postage_html .= '</span></div></div>';
$tax_html = '<div id="TaxTotal" class="field readonly">';
$tax_html .= '<label class="left" for="Form_ItemEditForm_TaxTotal">';
$tax_html .= _t("Orders.Tax", "Tax");
$tax_html .= '</label>';
$tax_html .= '<div class="middleColumn"><span id="Form_ItemEditForm_TaxTotal" class="readonly">';
$tax_html .= $this->TaxTotal->Nice();
$tax_html .= '</span></div></div>';
$total_html = '<div id="Total" class="field readonly">';
$total_html .= '<label class="left" for="Form_ItemEditForm_Total">';
$total_html .= _t("Orders.Total", "Total");
$total_html .= '</label>';
$total_html .= '<div class="middleColumn"><span id="Form_ItemEditForm_Total" class="readonly">';
$total_html .= $this->Total->Nice();
$total_html .= '</span></div></div>';
$fields = new FieldList($tab_root = new TabSet("Root", $tab_main = new Tab('Main', new OrderItemGridField("Items", "", $this->Items(), $config = GridFieldConfig::create()->addComponents(new GridFieldButtonRow('before'), new GridFieldTitleHeader(), new GridFieldEditableColumns(), new GridFieldDeleteAction(), new GridFieldAddOrderItem())), new HeaderField("PostageDetailsHeader", _t("Orders.PostageDetails", "Postage Details")), TextField::create("PostageType"), TextField::create("PostageCost"), TextField::create("PostageTax"), new HeaderField("DiscountDetailsHeader", _t("Orders.DiscountDetails", "Discount")), TextField::create("Discount"), TextField::create("DiscountAmount"), OrderSidebar::create(ReadonlyField::create("QuoteNumber", "#")->setValue($this->ID), LiteralField::create("SubTotal", $subtotal_html), LiteralField::create("Discount", $discount_html), LiteralField::create("Postage", $postage_html), LiteralField::create("TaxTotal", $tax_html), LiteralField::create("Total", $total_html))->setTitle("Details")), $tab_customer = new Tab('Customer', TextField::create("Company"), TextField::create("FirstName"), TextField::create("Surname"), TextField::create("Address1"), TextField::create("Address2"), TextField::create("City"), TextField::create("PostCode"), TextField::create("Country"), TextField::create("Email"), TextField::create("PhoneNumber"))));
if ($this->canEdit()) {
// Sidebar
$tab_customer->insertBefore(CustomerSidebar::create(new GridField("ExistingCustomers", "", $existing_customer::get(), $config = GridFieldConfig_Base::create()->addComponents($map_extension = new GridFieldMapExistingAction())))->setTitle("Use Existing Customer"), "Company");
if (is_array($this->config()->existing_customer_fields)) {
$columns = $config->getComponentByType("GridFieldDataColumns");
if ($columns) {
$columns->setDisplayFields($this->config()->existing_customer_fields);
}
}
// Set the record ID
$map_extension->setMapFields($this->config()->existing_customer_map);
}
$tab_main->addExtraClass("order-admin-items");
$tab_customer->addExtraClass("order-admin-customer");
$this->extend("updateCMSFields", $fields);
return $fields;
}
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-orders,代码行数:58,代码来源:Estimate.php
示例19: __construct
public function __construct($controller, $name, $fields = null, $actions = null)
{
$fields = new FieldList(ReadonlyField::create('FirstName')->setTitle(_t('PasswordEditForm.FIRSTNAME', 'PasswordEditForm.FIRSTNAME')), ReadonlyField::create('Surname')->setTitle(_t('PasswordEditForm.SURNAME', 'PasswordEditForm.SURNAME')), ReadonlyField::create('Email')->setTitle(_t('PasswordEditForm.EMAIL', 'PasswordEditForm.EMAIL')), $Password = new BootstrapConfirmedPasswordField('Password', _t('Member.db_Password', 'Member.db_Password')));
$actions = new FieldList($Submit = BootstrapLoadingFormAction::create('doEdit')->setTitle(_t('PasswordEditForm.CHANGEPASSWORD', 'PasswordEditForm.CHANGEPASSWORD')));
parent::__construct($controller, $name, $fields, $actions, new RequiredFields("Password"));
if (Member::currentUser()) {
$this->loadDataFrom(Member::currentUser());
}
}
开发者ID:andrelohmann,项目名称:vagrant-cloud,代码行数:9,代码来源:PasswordEditForm.php
示例20: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
if ($this->ID && $this->RegionCode) {
$readOnlyCode = ReadonlyField::create('RegionCode', 'Region code');
$fields->replaceField('RegionCode', $readOnlyCode);
}
return $fields;
}
开发者ID:helpfulrobot,项目名称:marketo-silverstripe-regional-maxmind-geoip2,代码行数:9,代码来源:GeoRegion.php
注:本文中的ReadonlyField类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论