예제 #1
0
 public function getDefaultSearchContext()
 {
     $context = parent::getDefaultSearchContext();
     $context->getFields()->dataFieldByName('Status')->setHasEmptyDefault(true);
     $context->getFields()->dataFieldByName('Origin')->setHasEmptyDefault(true);
     return $context;
 }
 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;
 }
예제 #3
0
 /**
  * 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;
 }
예제 #4
0
 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;
 }
예제 #5
0
 /**
  * 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;
 }
예제 #6
0
 /**
  * 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;
 }
예제 #7
0
파일: Order.php 프로젝트: 8secs/cocina
 /**
  * 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;
 }