本文整理匯總了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;
}