本文整理汇总了PHP中UserRole::GetUserRole方法的典型用法代码示例。如果您正苦于以下问题:PHP UserRole::GetUserRole方法的具体用法?PHP UserRole::GetUserRole怎么用?PHP UserRole::GetUserRole使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserRole
的用法示例。
在下文中一共展示了UserRole::GetUserRole方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($FacilityID, $ElementID = 0, $DeputyID = "", $ModuleID = "")
{
$db = parent::getPdoObject(config::$db_servers['master']["host"], config::$db_servers['master']["framework_user"], config::$db_servers['master']["framework_pass"], "framework");
if ($DeputyID != "" && $ModuleID != "") {
$this->DeputyID = $DeputyID;
$this->ModuleID = $ModuleID;
$this->ElementID = $ElementID;
} else {
if (!empty($FacilityID)) {
$query = "select * from SystemFacilities where FacilityID=?";
$dt = parent::runquery($query, array($FacilityID), $db);
if (parent::GetExceptionCount() != 0) {
return;
}
if (count($dt) == 0) {
return;
}
$this->DeputyID = $dt[0]["DeputyID"];
$this->ModuleID = $dt[0]["ModuleID"];
$this->ElementID = $ElementID;
} else {
return;
}
}
$this->UserID = $_SESSION["User"]->UserID;
$this->Roles = UserRole::GetUserRole($this->DeputyID, $this->UserID);
if (parent::GetExceptionCount() != 0) {
return;
}
$rolesStr = "-1";
if (count($this->Roles) != 0) {
for ($i = 0; $i < count($this->Roles); $i++) {
$rolesStr .= "," . $this->Roles[$i]->UserRole;
}
}
$query = "select DeputyID,ModuleID,ElementID,\r\n\t\t\t\t\t\tmax(AcInsert) as AcInsert,\r\n\t\t\t\t\t\tmax(AcFullUpdate) as AcFullUpdate,\r\n\t\t\t\t\t\tmax(AcUpdate) as AcUpdate,\r\n\t\t\t\t\t\tmax(AcFullDelete) as AcFullDelete,\r\n\t\t\t\t\t\tmax(AcDelete) as AcDelete\r\n\t\t\t\tfrom ModuleAccess\r\n\t\t\t\twhere (RoleID in({$rolesStr}) OR UserID=:uid)\r\n\t\t\t\t\tAND DeputyID=:did AND ModuleID=:mid AND ElementID=:eid\r\n\t\t\t\tgroup by DeputyID,ModuleID,ElementID";
$dt = parent::runquery($query, array(":uid" => $this->UserID, ":did" => $this->DeputyID, ":mid" => $this->ModuleID, ":eid" => $this->ElementID), $db);
if (parent::GetExceptionCount() != 0 || count($dt) == 0) {
return;
}
$this->AcInsert = $dt[0]["AcInsert"] == 0 ? false : true;
$this->AcFullUpdate = $dt[0]["AcFullUpdate"] == 0 ? false : true;
$this->AcUpdate = $dt[0]["AcUpdate"] == 0 ? false : true;
$this->AcFullDelete = $dt[0]["AcFullDelete"] == 0 ? false : true;
$this->AcDelete = $dt[0]["AcDelete"] == 0 ? false : true;
}