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


PHP ModelAdmin::getSearchContext方法代码示例

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


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

示例1: getSearchContext

 public function getSearchContext()
 {
     $context = parent::getSearchContext();
     $categories = EmailTemplate::get()->column('Category');
     $context->getFields()->replaceField('q[Category]', new DropdownField('q[Category]', 'Category', ArrayLib::valuekey($categories)));
     return $context;
 }
开发者ID:philbenoit,项目名称:silverstripe-mandrill,代码行数:7,代码来源:EmailTemplatesAdmin.php

示例2: getSearchContext

 public function getSearchContext()
 {
     $context = parent::getSearchContext();
     if ($this->modelClass == 'Contact') {
         $context->getFields()->push(new CheckboxField('q[Flagged]', _t("Contacts.ShowFlaggedOnly", 'Show flagged only')));
     }
     return $context;
 }
开发者ID:i-lateral,项目名称:silverstripe-contacts,代码行数:8,代码来源:ContactAdmin.php

示例3: getSearchContext

 public function getSearchContext()
 {
     $context = parent::getSearchContext();
     if ($this->modelClass == 'Payment') {
         $fields = $context->getFields();
         $fields->removeByName('ID');
         $fields->push(DropdownField::create('PaidByID', 'Paid By:', Member::map_in_groups())->setEmptyString('(Any)'));
     }
     return $context;
 }
开发者ID:brettt89,项目名称:discombobulation,代码行数:10,代码来源:PaymentAdmin.php

示例4: getSearchContext

 public function getSearchContext()
 {
     $context = parent::getSearchContext();
     $fields = $context->getFields();
     $subclasses = $this->blockManager->getBlockClasses();
     if ($fields->dataFieldByName('q[ClassName]') && sizeof($subclasses) > 1) {
         $fields->dataFieldByName('q[ClassName]')->setSource($subclasses);
         $fields->dataFieldByName('q[ClassName]')->setEmptyString('(any)');
     } else {
         $fields->removeByName('q[ClassName]');
     }
     return $context;
 }
开发者ID:anselmdk,项目名称:silverstripe-blocks,代码行数:13,代码来源:BlockAdmin.php

示例5: getSearchContext

 public function getSearchContext()
 {
     if ($this->IsEditingNews()) {
         $context = new NewsSearchContext($this->modelClass, $this);
         foreach ($context->getFields() as $field) {
             $field->setName(sprintf('q[%s]', $field->getName()));
         }
         foreach ($context->getFilters() as $filter) {
             $filter->setFullName(sprintf('q[%s]', $filter->getFullName()));
         }
         $this->extend('updateSearchContext', $context);
         return $context;
     }
     return parent::getSearchContext();
 }
开发者ID:silverstripers,项目名称:silverstripe-news,代码行数:15,代码来源:NewsAdmin.php

示例6: getSearchContext

 /**
  * @return SearchContext
  */
 public function getSearchContext()
 {
     $context = parent::getSearchContext();
     $fields = FieldList::create(TextField::create('Title', 'Title'), TextField::create('MetaTitle', 'MetaTitle'), TextField::create('MetaDescription', 'MetaDescription'), CheckboxField::create('DuplicatesOnly', 'Duplicates Only'), CheckboxField::create('RemoveEmptyMetaTitles', 'Remove Empty MetaTitles'), CheckboxField::create('RemoveEmptyMetaDescriptions', 'Remove Empty MetaDescriptions'));
     $context->setFields($fields);
     $filters = array('Title' => new PartialMatchFilter('Title'), 'MetaTitle' => new PartialMatchFilter('MetaTitle'), 'MetaDescription' => new PartialMatchFilter('MetaDescription'));
     $context->setFilters($filters);
     // Namespace fields, for easier detection if a search is present
     foreach ($context->getFields() as $field) {
         $field->setName(sprintf('q[%s]', $field->getName()));
     }
     foreach ($context->getFilters() as $filter) {
         $filter->setFullName(sprintf('q[%s]', $filter->getFullName()));
     }
     return $context;
 }
开发者ID:helpfulrobot,项目名称:littlegiant-silverstripe-seo-editor,代码行数:19,代码来源:SEOEditorAdmin.php

示例7: getSearchContext

 public function getSearchContext()
 {
     if ($this->modelClass == 'PostmarkMessage') {
         $context = new MessageSearchContext('PostmarkMessage');
         foreach ($context->getFields() as $field) {
             if (isset($_REQUEST['q']) && isset($_REQUEST['q'][$field->getName()])) {
                 $field->setValue($_REQUEST['q'][$field->getName()]);
             }
             $field->setName(sprintf('q[%s]', $field->getName()));
         }
         foreach ($context->getFilters() as $filter) {
             $filter->setFullName(sprintf('q[%s]', $filter->getFullName()));
         }
         return $context;
     }
     return parent::getSearchContext();
 }
开发者ID:bueckl,项目名称:postmarkedapp,代码行数:17,代码来源:PostmarkAdmin.php

示例8: getSearchContext

 public function getSearchContext()
 {
     $customerClass = Config::inst()->get('PostmarkAdmin', 'member_class');
     if ($this->modelClass == $customerClass) {
         $context = new CustomerSearchContext($customerClass);
         foreach ($context->getFields() as $field) {
             if (isset($_REQUEST['q']) && isset($_REQUEST['q'][$field->getName()])) {
                 $field->setValue($_REQUEST['q'][$field->getName()]);
             }
             $field->setName(sprintf('q[%s]', $field->getName()));
         }
         foreach ($context->getFilters() as $filter) {
             $filter->setFullName(sprintf('q[%s]', $filter->getFullName()));
         }
         return $context;
     }
     return parent::getSearchContext();
 }
开发者ID:helpfulrobot,项目名称:silverstripers-silverstripe-postmarked,代码行数:18,代码来源:CRMAdmin.php

示例9: getSearchContext

 /**
  * @return SearchContext
  */
 public function getSearchContext()
 {
     $context = parent::getSearchContext();
     if ($this->modelClass === "Newsletter_Sent") {
         $context = singleton("Newsletter")->getDefaultSearchContext();
         foreach ($context->getFields() as $field) {
             $field->setName(sprintf('q[%s]', $field->getName()));
         }
         foreach ($context->getFilters() as $filter) {
             $filter->setFullName(sprintf('q[%s]', $filter->getFullName()));
         }
     }
     return $context;
 }
开发者ID:Zauberfisch,项目名称:silverstripe-newsletter,代码行数:17,代码来源:NewsletterAdmin.php

示例10: getSearchContext

 /**
  * Set the CMS grid search context
  *
  * @since version 1.0.0
  *
  * @return object
  **/
 public function getSearchContext()
 {
     if (!Controller::curr() instanceof SEO_ModelAdmin) {
         return parent::getSearchContext();
     }
     Config::inst()->update($this->modelClass, 'searchable_fields', SEO_FieldValues::SearchableFields());
     $context = parent::getSearchContext();
     $context->getFields()->fieldByName('q[Robots]')->setEmptyString('- select -')->setSource(SEO_FieldValues::IndexRules());
     $context->getFields()->fieldByName('q[ChangeFrequency]')->setEmptyString('- select -')->setSource(SEO_FieldValues::SitemapChangeFrequency());
     $context->getFields()->fieldByName('q[HideSocial]')->setTitle('Social Meta hidden:')->setEmptyString('- select -')->setSource(SEO_FieldValues::YesNo());
     return $context;
 }
开发者ID:Cyber-Duck,项目名称:Silverstripe-SEO,代码行数:19,代码来源:SEO_ModelAdmin.php


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