當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DataList::filter方法代碼示例

本文整理匯總了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);
 }
開發者ID:helpfulrobot,項目名稱:silvershop-discounts,代碼行數:8,代碼來源:GroupDiscountConstraint.php

示例2: addFilterForFiles

 /**
  * @param DataList $files
  * @return DataList
  */
 public function addFilterForFiles(DataList $files)
 {
     return $files->filter('ClassName', 'CloudinaryFile');
 }
開發者ID:helpfulrobot,項目名稱:mademedia-silverstripe-cloudinary,代碼行數:8,代碼來源:CloudinaryFileField.php

示例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;
	}
開發者ID:redema,項目名稱:silverstripe-cms,代碼行數:29,代碼來源:CMSMain.php


注:本文中的DataList::filter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。