本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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();
}
示例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();
}
示例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;
}
示例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;
}