本文整理汇总了PHP中PermissionKeyCategory::add方法的典型用法代码示例。如果您正苦于以下问题:PHP PermissionKeyCategory::add方法的具体用法?PHP PermissionKeyCategory::add怎么用?PHP PermissionKeyCategory::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PermissionKeyCategory
的用法示例。
在下文中一共展示了PermissionKeyCategory::add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: installPermissionsAndWorkflow
protected function installPermissionsAndWorkflow()
{
$sx = simplexml_load_file(DIR_BASE_CORE . '/config/install/base/permissions.xml');
foreach ($sx->permissioncategories->category as $pkc) {
$handle = (string) $pkc['handle'];
$pkca = PermissionKeyCategory::getByHandle($handle);
if (!is_object($pkca)) {
$pkx = PermissionKeyCategory::add((string) $pkc['handle']);
}
}
foreach ($sx->workflowprogresscategories->category as $pkc) {
$handle = (string) $pkc['handle'];
$pkca = WorkflowProgressCategory::getByHandle($handle);
if (!is_object($pkca)) {
$pkx = WorkflowProgressCategory::add((string) $pkc['handle']);
}
}
foreach ($sx->workflowtypes->workflowtype as $wt) {
$handle = (string) $wt['handle'];
$name = (string) $wt['name'];
$wtt = WorkflowType::getByHandle($handle);
if (!is_object($wtt)) {
$pkx = WorkflowType::add($handle, $name);
}
}
if (isset($sx->permissionaccessentitytypes)) {
foreach ($sx->permissionaccessentitytypes->permissionaccessentitytype as $pt) {
$name = $pt['name'];
if (!$name) {
$name = Loader::helper('text')->unhandle($pt['handle']);
}
$handle = (string) $pt['handle'];
$patt = PermissionAccessEntityType::getByHandle($handle);
if (!is_object($patt)) {
$type = PermissionAccessEntityType::add((string) $pt['handle'], $name);
if (isset($pt->categories)) {
foreach ($pt->categories->children() as $cat) {
$catobj = PermissionKeyCategory::getByHandle((string) $cat['handle']);
$catobj->associateAccessEntityType($type);
}
}
}
}
}
$txt = Loader::helper('text');
foreach ($sx->permissionkeys->permissionkey as $pk) {
$pkc = PermissionKeyCategory::getByHandle((string) $pk['category']);
$className = $txt->camelcase($pkc->getPermissionKeyCategoryHandle());
$c1 = $className . 'PermissionKey';
$handle = (string) $pk['handle'];
$pka = PermissionKey::getByHandle($handle);
if (!is_object($pka)) {
$pkx = call_user_func(array($c1, 'import'), $pk);
}
}
}
示例2: importPermissionCategories
protected function importPermissionCategories(SimpleXMLElement $sx) {
if (isset($sx->permissioncategories)) {
foreach($sx->permissioncategories->category as $pkc) {
$pkg = ContentImporter::getPackageObject($akc['package']);
$pkx = PermissionKeyCategory::add((string) $pkc['handle'], $pkg);
}
}
}