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


PHP ReadonlyField::setValue方法代码示例

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


在下文中一共展示了ReadonlyField::setValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: setValue

 public function setValue($value)
 {
     if ($this->fixed) {
         return $this;
     }
     if ($value) {
         $this->fixed = true;
     }
     return parent::setValue($value);
 }
开发者ID:lekoala,项目名称:silverstripe-form-extras,代码行数:10,代码来源:FixedReadonlyField.php

示例3: HiddenField

 function __construct($controller, $name, $article = null, bool $is_manager, $use_actions = true)
 {
     $IDField = new HiddenField('newsID');
     //madatory fields
     $HeadlineField = new TextField('headline', 'Headline (150 character max)', '', $maxLength = 150);
     $HeadlineField->addExtraClass('headline');
     $SummaryField = new HtmlEditorField('summary', 'Summary (300 character max)');
     $SummaryField->addExtraClass('summary');
     $SummaryField->setAttribute('max_chars', 300);
     $CityField = new TextField('city', 'City');
     $StateField = new TextField('state', 'State');
     $CountryField = new CountryDropdownField('country', 'Country');
     $TagsField = new TextField('tags', 'Tags');
     $DateEmbargoField = new TextField('date_embargo', 'Desired release date/time: Time zone is Central Time. Please ensure your release date is in Central Time
         (<a target="_blank" href="http://www.timeanddate.com/worldclock/converter.html">time converter</a>)');
     $DateEmbargoField->addExtraClass('datefield');
     if ($is_manager) {
         $DateExpireField = new TextField('date_expire', 'Expire Date');
         $DateExpireField->addExtraClass('datefield');
     }
     $UpdatedField = new DatetimeField_Readonly('date_updated', 'Last Updated');
     //$UpdatedField->addExtraClass('inline');
     //optional fields
     $BodyField = new HtmlEditorField('body', 'Body');
     $LinkField = new TextField('link', 'Link');
     $DocumentField = new CustomUploadField('Document', 'Document');
     $DocumentField->addExtraClass('hidden');
     $DocumentField->setCanAttachExisting(false);
     $DocumentField->setAllowedMaxFileNumber(1);
     $DocumentField->setAllowedFileCategories('doc');
     $DocumentField->setTemplateFileButtons('CustomUploadField_FrontEndFIleButtons');
     $DocumentField->setFolderName('news-documents');
     $sizeMB = 1;
     // 1 MB
     $size = $sizeMB * 1024 * 1024;
     // 1 MB in bytes
     $DocumentField->getValidator()->setAllowedMaxFileSize($size);
     $DocumentField->setCanPreviewFolder(false);
     // Don't show target filesystem folder on upload field
     $DocumentField->setRecordClass('File');
     $ImageField = new CustomUploadField('Image', 'Image (Max size 2Mb - Suggested size 300x250px)');
     $ImageField->setCanAttachExisting(false);
     $ImageField->setAllowedMaxFileNumber(1);
     $ImageField->setAllowedFileCategories('image');
     $ImageField->setTemplateFileButtons('CustomUploadField_FrontEndFIleButtons');
     $ImageField->setFolderName('news-images');
     $ImageField->setRecordClass('BetterImage');
     $ImageField->getUpload()->setReplaceFile(false);
     $ImageField->setOverwriteWarning(false);
     $sizeMB = 2;
     // 2 MB
     $size = $sizeMB * 1024 * 1024;
     // 2 MB in bytes
     $ImageField->getValidator()->setAllowedMaxFileSize($size);
     $ImageField->setCanPreviewFolder(false);
     // Don't show target filesystem folder on upload field
     if ($is_manager) {
         $IsLandscapeField = new CheckboxField('is_landscape', 'Is Banner? (landscape image)');
         $IsLandscapeField->addExtraClass('is_landscape');
     }
     if ($article) {
         $IDField->setValue($article->ID);
         $HeadlineField->setValue($article->Headline);
         $SummaryField->setValue($article->Summary);
         $CityField->setValue($article->City);
         $StateField->setValue($article->State);
         $CountryField->setValue($article->Country);
         $TagsField->setValue($article->getTagsCSV());
         if ($article->DateEmbargo) {
             $DateEmbargoField->setValue(date('m/d/Y g:i a', strtotime($article->DateEmbargo)));
         } else {
             $DateEmbargoField->setValue(gmdate('m/d/Y g:i a'));
         }
         $UpdatedField->setValue($article->LastEdited);
         $BodyField->setValue($article->Body);
         $LinkField->setValue($article->Link);
         if ($article->DateExpire) {
             $DateExpireField->setValue(date('m/d/Y g:i a', strtotime($article->DateExpire)));
         }
         $IsLandscapeField->setValue($article->IsLandscape);
         //submitter read only
         $SubmitterFirstNameField = new ReadonlyField('submitter_first_name', 'First Name');
         $SubmitterLastNameField = new ReadonlyField('submitter_last_name', 'Last Name');
         $SubmitterEmailField = new ReadonlyField('submitter_email', 'Email');
         $SubmitterCompanyField = new ReadonlyField('submitter_company', 'Company');
         $SubmitterPhoneField = new ReadonlyField('submitter_phone', 'Phone');
         $SubmitterFirstNameField->setValue($article->getSubmitter()->FirstName);
         $SubmitterLastNameField->setValue($article->getSubmitter()->LastName);
         $SubmitterEmailField->setValue($article->getSubmitter()->Email);
         $SubmitterCompanyField->setValue($article->getSubmitter()->Company);
         $SubmitterPhoneField->setValue($article->getSubmitter()->Phone);
     } else {
         // submitter fields
         $SubmitterFirstNameField = new TextField('submitter_first_name', 'First Name');
         $SubmitterLastNameField = new TextField('submitter_last_name', 'Last Name');
         $SubmitterEmailField = new TextField('submitter_email', 'Email');
         $SubmitterCompanyField = new TextField('submitter_company', 'Company');
         $SubmitterPhoneField = new TextField('submitter_phone', 'Phone');
         $LinkField->setValue('http://');
     }
//.........这里部分代码省略.........
开发者ID:Thingee,项目名称:openstack-org,代码行数:101,代码来源:NewsRequestForm.php

示例4: Field

 function Field()
 {
     $titleArray = array();
     $titleList = array();
     if ($items = $this->getItems()) {
         foreach ($items as $item) {
             $titleArray[] = $item->Title;
         }
         if ($titleArray) {
             $titleList = implode(", ", $titleArray);
         }
     }
     $field = new ReadonlyField($this->name, $this->title);
     $field->setValue($titleList);
     $field->setForm($this->form);
     return $field->Field();
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:17,代码来源:TreeMultiselectField.php


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