本文整理汇总了PHP中CollectionType::limit方法的典型用法代码示例。如果您正苦于以下问题:PHP CollectionType::limit方法的具体用法?PHP CollectionType::limit怎么用?PHP CollectionType::limit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CollectionType
的用法示例。
在下文中一共展示了CollectionType::limit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
public static function getList($limiterType = null, $includeInternal = false)
{
$db = Loader::db();
// the purpose for this class? Well, we get an array of collection type objects,
// we don't do a join because on big sites it's actually slower
$mcIDs = $db->GetAll("select p.cID, cv.ctID from Pages p inner join CollectionVersions cv on p.cID = cv.cID where cIsTemplate = 1");
$masterCollectionIDs = array();
foreach ($mcIDs as $mc) {
$masterCollectionIDs[$mc['ctID']] = $mc['cID'];
}
if ($includeInternal) {
$internal = '1=1';
} else {
$internal = 'ctIsInternal = 0';
}
$q = "select ctID, ctHandle, ctIcon, ctName, ctIsInternal, pkgID from PageTypes where {$internal} order by ctName asc";
$r = $db->query($q);
$ctArray = array();
if ($r) {
while ($row = $r->fetchRow()) {
$ct = new CollectionType();
$row['mcID'] = $masterCollectionIDs[$row['ctID']];
$ct->setPropertiesFromArray($row);
if (is_array($limiterType)) {
// an array of collection type handles that we should check against
if (in_array($row['ctHandle'], $limiterType)) {
$ctArray[] = $ct;
}
} else {
if (is_object($limiterType)) {
$ct->limit($limiterType);
$ctArray[] = $ct;
} else {
$ctArray[] = $ct;
}
}
}
$r->free();
}
return $ctArray;
}