本文整理汇总了PHP中DataList::filter方法的典型用法代码示例。如果您正苦于以下问题:PHP DataList::filter方法的具体用法?PHP DataList::filter怎么用?PHP DataList::filter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataList
的用法示例。
在下文中一共展示了DataList::filter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filter
public function filter(DataList $list)
{
$groupids = array(0);
if ($member = $this->getMember()) {
$groupids = $groupids + $member->Groups()->map('ID', 'ID')->toArray();
}
return $list->filter("GroupID", $groupids);
}
示例2: addFilterForFiles
/**
* @param DataList $files
* @return DataList
*/
public function addFilterForFiles(DataList $files)
{
return $files->filter('ClassName', 'CloudinaryFile');
}
示例3: getList
/**
* Returns the pages meet a certain criteria as {@see CMSSiteTreeFilter} or the subpages of a parent page
* defaulting to no filter and show all pages in first level.
* Doubles as search results, if any search parameters are set through {@link SearchForm()}.
*
* @param Array Search filter criteria
* @param Int Optional parent node to filter on (can't be combined with other search criteria)
* @return SS_List
*/
public function getList($params, $parentID = 0) {
$list = new DataList($this->stat('tree_class'));
$filter = null;
$ids = array();
if(isset($params['FilterClass']) && $filterClass = $params['FilterClass']){
if(!is_subclass_of($filterClass, 'CMSSiteTreeFilter')) {
throw new Exception(sprintf('Invalid filter class passed: %s', $filterClass));
}
$filter = new $filterClass($params);
$filterOn = true;
foreach($pages=$filter->pagesIncluded() as $pageMap){
$ids[] = $pageMap['ID'];
}
if(count($ids)) $list->where('"'.$this->stat('tree_class').'"."ID" IN ('.implode(",", $ids).')');
} else {
$list->filter("ParentID", is_numeric($parentID) ? $parentID : 0);
}
return $list;
}