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


PHP DataObject::getDefaultSearchContext方法代码示例

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


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

示例1: getDefaultSearchContext

 public function getDefaultSearchContext()
 {
     $context = parent::getDefaultSearchContext();
     $context->getFields()->dataFieldByName('Status')->setHasEmptyDefault(true);
     $context->getFields()->dataFieldByName('Origin')->setHasEmptyDefault(true);
     return $context;
 }
开发者ID:silverstripe,项目名称:deploynaut,代码行数:7,代码来源:DNDataTransfer.php

示例2: getDefaultSearchContext

 public function getDefaultSearchContext()
 {
     $context = parent::getDefaultSearchContext();
     $fields = $context->getFields();
     $fields->push(CheckboxField::create("HasBeenUsed"));
     //add date range filtering
     $fields->push(ToggleCompositeField::create("StartDate", "Start Date", array(DateField::create("q[StartDateFrom]", "From")->setConfig('showcalendar', true), DateField::create("q[StartDateTo]", "To")->setConfig('showcalendar', true))));
     $fields->push(ToggleCompositeField::create("EndDate", "End Date", array(DateField::create("q[EndDateFrom]", "From")->setConfig('showcalendar', true), DateField::create("q[EndDateTo]", "To")->setConfig('showcalendar', true))));
     //must be enabled in config, because some sites may have many products = slow load time, or memory maxes out
     //future solution is using an ajaxified field
     if (self::config()->filter_by_product) {
         $fields->push(ListboxField::create("Products", "Products", Product::get()->map()->toArray())->setMultiple(true));
     }
     if (self::config()->filter_by_category) {
         $fields->push(ListboxField::create("Categories", "Categories", ProductCategory::get()->map()->toArray())->setMultiple(true));
     }
     if ($field = $fields->fieldByName("Code")) {
         $field->setDescription("This can be a partial match.");
     }
     //get the array, to maniplulate name, and fullname seperately
     $filters = $context->getFilters();
     $filters['StartDateFrom'] = GreaterThanOrEqualFilter::create('StartDate');
     $filters['StartDateTo'] = LessThanOrEqualFilter::create('StartDate');
     $filters['EndDateFrom'] = GreaterThanOrEqualFilter::create('EndDate');
     $filters['EndDateTo'] = LessThanOrEqualFilter::create('EndDate');
     $context->setFilters($filters);
     return $context;
 }
开发者ID:helpfulrobot,项目名称:silvershop-discounts,代码行数:28,代码来源:Discount.php

示例3: getDefaultSearchContext

 /**
  * Change search context to use a dropdown for list of gateways.
  */
 public function getDefaultSearchContext()
 {
     $context = parent::getDefaultSearchContext();
     $fields = $context->getSearchFields();
     $fields->removeByName('Gateway');
     $fields->insertBefore(DropdownField::create('Gateway', 'Gateway', GatewayInfo::get_supported_gateways())->setHasEmptyDefault(true), 'Status');
     $fields->fieldByName('Status')->setHasEmptyDefault(true);
     return $context;
 }
开发者ID:ss23,项目名称:silverstripe-omnipay,代码行数:12,代码来源:Payment.php

示例4: getDefaultSearchContext

 public function getDefaultSearchContext()
 {
     $context = parent::getDefaultSearchContext();
     $results = $this->blockManager->getBlockClasses();
     if (sizeof($results) > 1) {
         $classfield = new DropdownField('ClassName', _t('Block.BlockType', 'Block Type'));
         $classfield->setSource($results);
         $classfield->setEmptyString(_t('Block.Any', '(any)'));
         $context->addField($classfield);
     }
     return $context;
 }
开发者ID:sheadawson,项目名称:silverstripe-blocks,代码行数:12,代码来源:Block.php

示例5: getDefaultSearchContext

 /**
  * Change search context to use a dropdown for list of gateways.
  */
 public function getDefaultSearchContext()
 {
     $context = parent::getDefaultSearchContext();
     $fields = $context->getSearchFields();
     $fields->removeByName('Gateway');
     $fields->removeByName('Created');
     $fields->insertAfter(DropdownField::create('Gateway', _t('Payment.GATEWAY', 'Gateway'), GatewayInfo::get_supported_gateways())->setHasEmptyDefault(true), 'Money');
     // create a localized status dropdown for the search-context
     $fields->insertAfter(DropdownField::create('Status', _t('Payment.db_Status', 'Status'), $this->getStatusValues())->setHasEmptyDefault(true), 'Gateway');
     // update "money" to localized title
     $fields->fieldByName('Money')->setTitle(_t('Payment.MONEY', 'Money'));
     $context->addFilter(new PartialMatchFilter('Gateway'));
     return $context;
 }
开发者ID:sunnysideup,项目名称:silverstripe-omnipay,代码行数:17,代码来源:Payment.php

示例6: getDefaultSearchContext

 /**
  * Adjust scafolded search context
  *
  * @return SearchContext the updated search context
  */
 public function getDefaultSearchContext()
 {
     $context = parent::getDefaultSearchContext();
     $fields = $context->getFields();
     $fields->push(ListboxField::create("Status", _t('Order.db_Status', "Status"))->setSource(array_combine(self::config()->placed_status, self::config()->placed_status))->setMultiple(true));
     // add date range filtering
     $fields->insertBefore(DateField::create("DateFrom", _t('Order.DateFrom', "Date from"))->setConfig('showcalendar', true), 'Status');
     $fields->insertBefore(DateField::create("DateTo", _t('Order.DateTo', "Date to"))->setConfig('showcalendar', true), 'Status');
     // get the array, to maniplulate name, and fullname seperately
     $filters = $context->getFilters();
     $filters['DateFrom'] = GreaterThanFilter::create('Placed');
     $filters['DateTo'] = LessThanFilter::create('Placed');
     // filter customer need to use a bunch of different sources
     $filters['FirstName'] = new MultiFieldPartialMatchFilter('FirstName', false, array('SplitWords'), array('Surname', 'Member.FirstName', 'Member.Surname', 'BillingAddress.FirstName', 'BillingAddress.Surname', 'ShippingAddress.FirstName', 'ShippingAddress.Surname'));
     $context->setFilters($filters);
     $this->extend('updateDefaultSearchContext', $context);
     return $context;
 }
开发者ID:burnbright,项目名称:silverstripe-shop,代码行数:23,代码来源:Order.php

示例7: getDefaultSearchContext

 /**
  * Adjust scafolded search context
  * @return SearchContext the updated search context
  */
 public function getDefaultSearchContext()
 {
     $context = parent::getDefaultSearchContext();
     $fields = $context->getFields();
     $fields->push(ListboxField::create("Status", "Status")->setSource(array_combine(self::config()->placed_status, self::config()->placed_status))->setMultiple(true));
     //add date range filtering
     $fields->insertBefore(DateField::create("DateFrom", "Date from")->setConfig('showcalendar', true), 'Status');
     $fields->insertBefore(DateField::create("DateTo", "Date to")->setConfig('showcalendar', true), 'Status');
     //get the array, to maniplulate name, and fullname seperately
     $filters = $context->getFilters();
     $filters['DateFrom'] = GreaterThanFilter::create('Placed');
     $filters['DateTo'] = LessThanFilter::create('Placed');
     $context->setFilters($filters);
     return $context;
 }
开发者ID:8secs,项目名称:cocina,代码行数:19,代码来源:Order.php


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