本文整理汇总了PHP中PermissionKeyCategory::getByID方法的典型用法代码示例。如果您正苦于以下问题:PHP PermissionKeyCategory::getByID方法的具体用法?PHP PermissionKeyCategory::getByID怎么用?PHP PermissionKeyCategory::getByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PermissionKeyCategory
的用法示例。
在下文中一共展示了PermissionKeyCategory::getByID方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: add
public static function add($pkCategoryHandle, $pkg = false)
{
$db = Loader::db();
if (is_object($pkg)) {
$pkgID = $pkg->getPackageID();
}
$db->Execute('insert into PermissionKeyCategories (pkCategoryHandle, pkgID) values (?, ?)', array($pkCategoryHandle, $pkgID));
$id = $db->Insert_ID();
Cache::delete('permission_key_categories', false);
return PermissionKeyCategory::getByID($id);
}
示例4: 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;
}
}