本文整理汇总了PHP中PermissionKeyCategory类的典型用法代码示例。如果您正苦于以下问题:PHP PermissionKeyCategory类的具体用法?PHP PermissionKeyCategory怎么用?PHP PermissionKeyCategory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PermissionKeyCategory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getResponse
public static function getResponse($object)
{
$r = PermissionCache::getResponse($object);
if (is_object($r)) {
return $r;
}
if (method_exists($object, 'getPermissionObjectPermissionKeyCategoryHandle')) {
$objectClass = Loader::helper('text')->camelcase($object->getPermissionObjectPermissionKeyCategoryHandle());
$handle = $object->getPermissionObjectPermissionKeyCategoryHandle();
} else {
$objectClass = get_class($object);
$handle = Loader::helper('text')->uncamelcase($objectClass);
}
$category = PermissionKeyCategory::getByHandle($handle);
$c1 = $objectClass . 'PermissionResponse';
if (!is_object($category)) {
if ($object instanceof Page) {
$category = PermissionKeyCategory::getByHandle('page');
$c1 = 'PagePermissionResponse';
} else {
if ($object instanceof Area) {
$category = PermissionKeyCategory::getByHandle('area');
$c1 = 'AreaPermissionResponse';
}
}
}
$pr = new $c1();
$pr->setPermissionObject($object);
$pr->setPermissionCategoryObject($category);
PermissionCache::addResponse($object, $pr);
return $pr;
}
示例2: install
public function install()
{
$pkg = parent::install();
$cat = PermissionKeyCategory::getByHandle('page');
$type = PermissionAccessEntityType::add('parent_page_owner', 'Parent Page Owner', $pkg);
$cat->associateAccessEntityType($type);
}
示例3: parseManual
/**
* @see \C5TL\Parser\DynamicItem::parseManual()
*/
public function parseManual(\Gettext\Translations $translations, $concrete5version)
{
if (class_exists('\\PermissionKeyCategory', true) && method_exists('\\PermissionKeyCategory', 'getList')) {
foreach (\PermissionKeyCategory::getList() as $pkc) {
$pkcHandle = $pkc->getPermissionKeyCategoryHandle();
foreach (\PermissionKey::getList($pkcHandle) as $pk) {
$this->addTranslation($translations, $pk->getPermissionKeyName(), 'PermissionKeyName');
$this->addTranslation($translations, $pk->getPermissionKeyDescription(), 'PermissionKeyDescription');
}
}
}
}
示例4: getPermissionKeyToolsURL
public function getPermissionKeyToolsURL($task = false)
{
if (!$task) {
$task = 'save_permission';
}
$uh = Loader::helper('concrete/urls');
$class = substr(get_class($this), 0, strrpos(get_class($this), 'PermissionAssignment'));
$handle = Loader::helper('text')->uncamelcase($class);
if ($handle) {
$akc = PermissionKeyCategory::getByHandle($handle);
} else {
$akc = PermissionKeyCategory::getByID($this->pk->getPermissionKeyCategoryID());
}
$url = $uh->getToolsURL('permissions/categories/' . $akc->getPermissionKeyCategoryHandle(), $akc->getPackageHandle());
$token = Loader::helper('validation/token')->getParameter($task);
$url .= '?' . $token . '&task=' . $task . '&pkID=' . $this->pk->getPermissionKeyID();
return $url;
}
示例5: getResponse
public static function getResponse($object)
{
$r = PermissionCache::getResponse($object);
if (is_object($r)) {
return $r;
}
$category = PermissionKeyCategory::getByHandle(Loader::helper('text')->uncamelcase(get_class($object)));
if (!is_object($category) && $object instanceof Page) {
$category = PermissionKeyCategory::getByHandle('page');
}
$txt = Loader::helper('text');
$c1 = get_class($object) . 'PermissionResponse';
if (!class_exists($c1)) {
$c1 = 'PagePermissionResponse';
}
$pr = new $c1();
$pr->setPermissionObject($object);
$pr->setPermissionCategoryObject($category);
PermissionCache::addResponse($object, $pr);
return $pr;
}
示例6: defined
<?php
defined('C5_EXECUTE') or die("Access Denied.");
?>
<?php
$cat = PermissionKeyCategory::getByHandle('basic_workflow');
?>
<table class="ccm-permission-grid">
<?php
$permissions = PermissionKey::getList('basic_workflow');
foreach ($permissions as $pk) {
$pk->setPermissionObject($workflow);
?>
<tr>
<td class="ccm-permission-grid-name" id="ccm-permission-grid-name-<?php
echo $pk->getPermissionKeyID();
?>
"><strong><?php
if ($enablePermissions) {
?>
<a dialog-title="<?php
echo $pk->getPermissionKeyDisplayName();
?>
" data-pkID="<?php
echo $pk->getPermissionKeyID();
?>
" data-paID="<?php
echo $pk->getPermissionAccessID();
?>
示例7:
<?php
}
?>
</div>
<?php
}
?>
<?php
echo Loader::element('permission/help');
?>
<?php
$cat = PermissionKeyCategory::getByHandle($handle);
?>
<form method="post" id="ccm-permission-list-form" action="<?php
echo $cat->getToolsURL("save_permission_assignments");
?>
&treeNodeID=<?php
echo $node->getTreeNodeID();
?>
">
<table class="ccm-permission-grid table table-striped">
<?php
$permissions = PermissionKey::getList($handle);
foreach ($permissions as $pk) {
$pk->setPermissionObject($node);
示例8: 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);
}
}
}
示例9: defined
<?php
defined('C5_EXECUTE') or die("Access Denied.");
?>
<?php
$cat = PermissionKeyCategory::getByHandle('file_set');
?>
<table class="ccm-permission-grid table table-striped">
<?php
$permissions = PermissionKey::getList('file_set');
foreach ($permissions as $pk) {
$pk->setPermissionObject($fs);
?>
<tr>
<td class="ccm-permission-grid-name" id="ccm-permission-grid-name-<?php
echo $pk->getPermissionKeyID();
?>
"><strong><a dialog-title="<?php
echo $pk->getPermissionKeyDisplayName();
?>
" data-pkID="<?php
echo $pk->getPermissionKeyID();
?>
" data-paID="<?php
echo $pk->getPermissionAccessID();
?>
" onclick="ccm_permissionLaunchDialog(this)" href="javascript:void(0)"><?php
echo $pk->getPermissionKeyDisplayName();
?>
示例10: urlencode
?>
</a>
</div>
<?php
}
}
}
?>
<?php
echo Loader::element('permission/help');
?>
<?php
$cat = PermissionKeyCategory::getByHandle('area');
?>
<form method="post" id="ccm-permission-list-form" action="<?php
echo $cat->getToolsURL("save_permission_assignments");
?>
&cID=<?php
echo $c->getCollectionID();
?>
&arHandle=<?php
echo urlencode($a->getAreaHandle());
?>
">
<table class="ccm-permission-grid table table-striped">
<?php
示例11: t
echo t('Revert to Area Permissions');
?>
</a>
</div>
<?php
}
?>
<?php
echo Loader::element('permission/help');
?>
<?php
$cat = PermissionKeyCategory::getByHandle('block');
?>
<form method="post" id="ccm-permission-list-form" action="<?php
echo $cat->getToolsURL("save_permission_assignments");
?>
&cID=<?php
echo $c->getCollectionID();
?>
&arHandle=<?php
echo urlencode($b->getAreaHandle());
?>
&cvID=<?php
echo $c->getVersionID();
?>
&bID=<?php
echo $b->getBlockID();
示例12: add
/**
* Adds an permission key.
*/
public function add($pkCategoryHandle, $pkHandle, $pkName, $pkDescription, $pkCanTriggerWorkflow, $pkHasCustomClass, $pkg = false) {
$vn = Loader::helper('validation/numbers');
$txt = Loader::helper('text');
$pkgID = 0;
$db = Loader::db();
if (is_object($pkg)) {
$pkgID = $pkg->getPackageID();
}
if ($pkCanTriggerWorkflow) {
$pkCanTriggerWorkflow = 1;
} else {
$pkCanTriggerWorkflow = 0;
}
if ($pkHasCustomClass) {
$pkHasCustomClass = 1;
} else {
$$pkHasCustomClass = 0;
}
$pkCategoryID = $db->GetOne("select pkCategoryID from PermissionKeyCategories where pkCategoryHandle = ?", $pkCategoryHandle);
$a = array($pkHandle, $pkName, $pkDescription, $pkCategoryID, $pkCanTriggerWorkflow, $pkHasCustomClass, $pkgID);
$r = $db->query("insert into PermissionKeys (pkHandle, pkName, pkDescription, pkCategoryID, pkCanTriggerWorkflow, pkHasCustomClass, pkgID) values (?, ?, ?, ?, ?, ?, ?)", $a);
$category = PermissionKeyCategory::getByID($pkCategoryID);
if ($r) {
$pkID = $db->Insert_ID();
$ak = self::load($pkID);
return $ak;
}
}
示例13: getPackageItems
/**
* Returns an array of package items (e.g. blocks, themes)
*/
public function getPackageItems()
{
$items = array();
Loader::model('single_page');
Loader::library('mail/importer');
Loader::model('job');
Loader::model('collection_types');
Loader::model('system/captcha/library');
Loader::model('system/antispam/library');
$items['attribute_categories'] = AttributeKeyCategory::getListByPackage($this);
$items['permission_categories'] = PermissionKeyCategory::getListByPackage($this);
$items['permission_access_entity_types'] = PermissionAccessEntityType::getListByPackage($this);
$items['attribute_keys'] = AttributeKey::getListByPackage($this);
$items['attribute_sets'] = AttributeSet::getListByPackage($this);
$items['group_sets'] = GroupSet::getListByPackage($this);
$items['page_types'] = CollectionType::getListByPackage($this);
$items['mail_importers'] = MailImporter::getListByPackage($this);
$items['configuration_values'] = Config::getListByPackage($this);
$items['block_types'] = BlockTypeList::getByPackage($this);
$items['page_themes'] = PageTheme::getListByPackage($this);
$items['permissions'] = PermissionKey::getListByPackage($this);
$items['single_pages'] = SinglePage::getListByPackage($this);
$items['attribute_types'] = AttributeType::getListByPackage($this);
$items['captcha_libraries'] = SystemCaptchaLibrary::getListByPackage($this);
$items['antispam_libraries'] = SystemAntispamLibrary::getListByPackage($this);
$items['jobs'] = Job::getListByPackage($this);
$items['workflow_types'] = WorkflowType::getListByPackage($this);
ksort($items);
return $items;
}
示例14: t
</div>
<?php
if (!is_object($pae)) {
?>
<div class="btn-group">
<a class="btn btn-default dropdown-toggle" data-toggle="dropdown" href="#">
<i class="icon-plus-sign"></i> <?php
echo t('Select');
?>
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<?php
$category = PermissionKeyCategory::getByHandle($_REQUEST['pkCategoryHandle']);
$entitytypes = PermissionAccessEntityType::getList($category);
foreach ($entitytypes as $type) {
?>
<li><?php
echo $type->getAccessEntityTypeLinkHTML();
?>
</li>
<?php
}
?>
</ul>
</div>
<br/><br/>
<?php
示例15: getListByPackage
/**
* Note, this queries both the pkgID found on the PermissionKeys table AND any permission keys of a special type
* installed by that package, and any in categories by that package.
*/
public static function getListByPackage($pkg)
{
$db = Loader::db();
$kina[] = '-1';
$kinb = $db->GetCol('select pkCategoryID from PermissionKeyCategories where pkgID = ?', $pkg->getPackageID());
if (is_array($kinb)) {
$kina = array_merge($kina, $kinb);
}
$kinstr = implode(',', $kina);
$r = $db->Execute('select pkID, pkCategoryID from PermissionKeys where (pkgID = ? or pkCategoryID in (' . $kinstr . ')) order by pkID asc', array($pkg->getPackageID()));
while ($row = $r->FetchRow()) {
$pkc = PermissionKeyCategory::getByID($row['pkCategoryID']);
$pk = $pkc->getPermissionKeyByID($row['pkID']);
$list[] = $pk;
}
$r->Close();
return $list;
}