本文整理汇总了PHP中SinglePage::obtainPermissionsXML方法的典型用法代码示例。如果您正苦于以下问题:PHP SinglePage::obtainPermissionsXML方法的具体用法?PHP SinglePage::obtainPermissionsXML怎么用?PHP SinglePage::obtainPermissionsXML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SinglePage
的用法示例。
在下文中一共展示了SinglePage::obtainPermissionsXML方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
public function add($cPath, $pkg = null) {
// if we get to this point, we create a special collection
// without a specific type. This collection has a special cFilename that
// points to the passed node
$db = Loader::db();
$txt = Loader::helper('text');
// trim off a leading / if there is one
$cPath = trim($cPath, '/');
// now we grab the parent collection, if there is a static one.
$pages = explode('/', $cPath);
// instantiate the home collection so we have someplace to add these to
$parent = Page::getByID(1);
// now we iterate through the pages to ensure that they exist in the system before adding the new guy
$pathPrefix = '';
for ($i = 0; $i < count($pages); $i++) {
$currentPath = $pathPrefix . $pages[$i];
$pathToFile = SinglePage::getPathToNode($currentPath, $pkg);
// check to see if a page at this point in the tree exists
$c = Page::getByPath("/" . $currentPath);
if ($c->isError() && $c->getError() == COLLECTION_NOT_FOUND) {
// create the page at that point in the tree
$data = array();
$data['handle'] = $pages[$i];
$data['name'] = $txt->unhandle($data['handle']);
$data['filename'] = $pathToFile;
$data['uID'] = USER_SUPER_ID;
if ($pkg != null) {
$data['pkgID'] = $pkg->getPackageID();
}
$newC = $parent->addStatic($data);
$parent = $newC;
$pxml = SinglePage::obtainPermissionsXML($currentPath, $pkg);
if ($pxml) {
$newC->assignPermissionSet($pxml); // pass it an array
}
} else {
$parent = $c;
}
$pathPrefix = $currentPath . '/';
}
return $newC;
}