本文整理汇总了PHP中SiteTree::prepopuplate_permission_cache方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteTree::prepopuplate_permission_cache方法的具体用法?PHP SiteTree::prepopuplate_permission_cache怎么用?PHP SiteTree::prepopuplate_permission_cache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SiteTree
的用法示例。
在下文中一共展示了SiteTree::prepopuplate_permission_cache方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSiteTreeFor
/**
* Get a site tree HTML listing which displays the nodes under the given criteria.
*
* @param $className The class of the root object
* @param $rootID The ID of the root object. If this is null then a complete tree will be
* shown
* @param $childrenMethod The method to call to get the children of the tree. For example,
* Children, AllChildrenIncludingDeleted, or AllHistoricalChildren
* @return String Nested unordered list with links to each page
*/
function getSiteTreeFor($className, $rootID = null, $childrenMethod = null, $numChildrenMethod = null, $filterFunction = null, $minNodeCount = 30)
{
// Default childrenMethod and numChildrenMethod
if (!$childrenMethod) {
$childrenMethod = 'AllChildrenIncludingDeleted';
}
if (!$numChildrenMethod) {
$numChildrenMethod = 'numChildren';
}
// Get the tree root
$obj = $rootID ? $this->getRecord($rootID) : singleton($className);
// Mark the nodes of the tree to return
if ($filterFunction) {
$obj->setMarkingFilterFunction($filterFunction);
}
$obj->markPartialTree($minNodeCount, $this, $childrenMethod, $numChildrenMethod);
// Ensure current page is exposed
if ($p = $this->currentPage()) {
$obj->markToExpose($p);
}
// NOTE: SiteTree/CMSMain coupling :-(
SiteTree::prepopuplate_permission_cache('CanEditType', $obj->markedNodeIDs(), 'SiteTree::can_edit_multiple');
// getChildrenAsUL is a flexible and complex way of traversing the tree
$titleEval = '
"<li id=\\"record-$child->ID\\" class=\\"" . $child->CMSTreeClasses($extraArg) . "\\">" .
"<a href=\\"" . Controller::join_links(substr($extraArg->Link(),0,-1), "show", $child->ID) . "\\" class=\\"" . $child->CMSTreeClasses($extraArg) . "\\" title=\\"' . _t('LeftAndMain.PAGETYPE', 'Page type: ') . '".$child->class."\\" >" . ($child->TreeTitle) .
"</a>"
';
$html = $obj->getChildrenAsUL("", $titleEval, $this, true, $childrenMethod, $numChildrenMethod, $minNodeCount);
// Wrap the root if needs be.
if (!$rootID) {
$rootLink = $this->Link('show') . '/root';
// This lets us override the tree title with an extension
if ($this->hasMethod('getCMSTreeTitle') && ($customTreeTitle = $this->getCMSTreeTitle())) {
$treeTitle = $customTreeTitle;
} else {
$siteConfig = SiteConfig::current_site_config();
$treeTitle = $siteConfig->Title;
}
$html = "<ul id=\"sitetree\" class=\"tree unformatted\"><li id=\"record-0\" class=\"Root nodelete\"><a href=\"{$rootLink}\"><strong>{$treeTitle}</strong></a>" . $html . "</li></ul>";
}
return $html;
}