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


PHP ReadonlyField类代码示例

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


在下文中一共展示了ReadonlyField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 = "&#9733;";
     $emptyStar = "&#9734;";
     $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


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