本文整理汇总了PHP中QQN::NarroRolePermission方法的典型用法代码示例。如果您正苦于以下问题:PHP QQN::NarroRolePermission方法的具体用法?PHP QQN::NarroRolePermission怎么用?PHP QQN::NarroRolePermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQN
的用法示例。
在下文中一共展示了QQN::NarroRolePermission方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: chkPermission_Click
public function chkPermission_Click($strFormId, $strControlId, $strParameter)
{
if (is_numeric($strParameter)) {
$chkPermission = $this->Form->GetControl($strControlId);
if ($chkPermission->Checked) {
$objRolePermission = new NarroRolePermission();
$objRolePermission->RoleId = $this->objRole->RoleId;
$objRolePermission->PermissionId = $strParameter;
try {
$objRolePermission->Save();
} catch (QMySqliDatabaseException $objExc) {
if (strpos($objExc->getMessage(), 'Duplicate entry') === false) {
throw $objExc;
} else {
//
}
}
} else {
$objRolePermission = NarroRolePermission::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::NarroRolePermission()->RoleId, $this->objRole->RoleId), QQ::Equal(QQN::NarroRolePermission()->PermissionId, $strParameter)));
if ($objRolePermission instanceof NarroRolePermission) {
$objRolePermission->Delete();
}
}
} else {
$this->dtgPermission_Bind();
}
}
示例2: Form_Create
protected function Form_Create()
{
parent::Form_Create();
// Instantiate the Meta DataGrid
$this->dtgNarroRolePermissions = new NarroRolePermissionDataGrid($this);
// Style the DataGrid (if desired)
$this->dtgNarroRolePermissions->CssClass = 'datagrid';
$this->dtgNarroRolePermissions->AlternateRowStyle->CssClass = 'alternate';
// Add Pagination (if desired)
$this->dtgNarroRolePermissions->Paginator = new QPaginator($this->dtgNarroRolePermissions);
$this->dtgNarroRolePermissions->ItemsPerPage = __FORM_DRAFTS_FORM_LIST_ITEMS_PER_PAGE__;
// Use the MetaDataGrid functionality to add Columns for this datagrid
// Create an Edit Column
$strEditPageUrl = __VIRTUAL_DIRECTORY__ . __FORM_DRAFTS__ . '/narro_role_permission_edit.php';
$this->dtgNarroRolePermissions->MetaAddEditLinkColumn($strEditPageUrl, 'Edit', 'Edit');
// Create the Other Columns (note that you can use strings for narro_role_permission's properties, or you
// can traverse down QQN::narro_role_permission() to display fields that are down the hierarchy)
$this->dtgNarroRolePermissions->MetaAddColumn('RolePermissionId');
$this->dtgNarroRolePermissions->MetaAddColumn(QQN::NarroRolePermission()->Role);
$this->dtgNarroRolePermissions->MetaAddColumn(QQN::NarroRolePermission()->Permission);
}
示例3: ResolveContentItem
/**
* Used internally by the Meta-based Add Column tools.
*
* Given a QQNode or a Text String, this will return a NarroRolePermission-based QQNode.
* It will also verify that it is a proper NarroRolePermission-based QQNode, and will throw an exception otherwise.
*
* @param mixed $mixContent
* @return QQNode
*/
protected function ResolveContentItem($mixContent)
{
if ($mixContent instanceof QQNode) {
if (!$mixContent->_ParentNode) {
throw new QCallerException('Content QQNode cannot be a Top Level Node');
}
if ($mixContent->_RootTableName == 'narro_role_permission') {
if ($mixContent instanceof QQReverseReferenceNode && !$mixContent->_PropertyName) {
throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
}
$objCurrentNode = $mixContent;
while ($objCurrentNode = $objCurrentNode->_ParentNode) {
if (!$objCurrentNode instanceof QQNode) {
throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
}
if ($objCurrentNode instanceof QQReverseReferenceNode && !$objCurrentNode->_PropertyName) {
throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
}
}
return $mixContent;
} else {
throw new QCallerException('Content QQNode has a root table of "' . $mixContent->_RootTableName . '". Must be a root of "narro_role_permission".');
}
} else {
if (is_string($mixContent)) {
switch ($mixContent) {
case 'RolePermissionId':
return QQN::NarroRolePermission()->RolePermissionId;
case 'RoleId':
return QQN::NarroRolePermission()->RoleId;
case 'Role':
return QQN::NarroRolePermission()->Role;
case 'PermissionId':
return QQN::NarroRolePermission()->PermissionId;
case 'Permission':
return QQN::NarroRolePermission()->Permission;
default:
throw new QCallerException('Simple Property not found in NarroRolePermissionDataGrid content: ' . $mixContent);
}
} else {
if ($mixContent instanceof QQAssociationNode) {
throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
} else {
throw new QCallerException('Invalid Content type');
}
}
}
}
示例4: CountByPermissionId
/**
* Count NarroRolePermissions
* by PermissionId Index(es)
* @param integer $intPermissionId
* @return int
*/
public static function CountByPermissionId($intPermissionId)
{
// Call NarroRolePermission::QueryCount to perform the CountByPermissionId query
return NarroRolePermission::QueryCount(QQ::Equal(QQN::NarroRolePermission()->PermissionId, $intPermissionId));
}
示例5: LoadByUserId
public static function LoadByUserId($intUserId, $objOptionalClauses = null)
{
$objUser = NarroUser::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::NarroUser()->UserId, $intUserId)), QQ::ExpandAsArray(QQN::NarroUser()->NarroUserRoleAsUser));
if (!$objUser instanceof NarroUser) {
return false;
}
foreach ($objUser->_NarroUserRoleAsUserArray as $objRole) {
/* @var $objRole NarroUserRole */
$arrRolePermission = NarroRolePermission::LoadArrayByRoleId($objRole->RoleId, QQ::Expand(QQN::NarroRolePermission()->Permission));
foreach ($arrRolePermission as $objRolePermission) {
$objUser->arrPermissions[$objRolePermission->Permission->PermissionName . '-' . $objRole->LanguageId . '-' . $objRole->ProjectId] = $objRolePermission;
}
}
if (isset($objUser->Preferences['Language'])) {
$objLanguage = NarroLanguage::LoadByLanguageCode($objUser->Preferences['Language']);
if ($objLanguage instanceof NarroLanguage) {
$objUser->Language = $objLanguage;
} elseif (QApplication::$TargetLanguage instanceof NarroLanguage) {
$objUser->Language = QApplication::$TargetLanguage;
}
} elseif (QApplication::$TargetLanguage instanceof NarroLanguage) {
$objUser->Language = QApplication::$TargetLanguage;
}
return $objUser;
}